Made PreLogEvent cancellable (implements #325)

This commit is contained in:
Intelli 2023-07-13 17:55:00 -06:00
parent e7a6f21d88
commit 1a06e6a6bf
11 changed files with 84 additions and 11 deletions

View file

@ -6,6 +6,7 @@ import org.bukkit.event.HandlerList;
public class CoreProtectPreLogEvent extends Event {
private static final HandlerList handlers = new HandlerList();
private boolean cancelled = false;
private String user;
public CoreProtectPreLogEvent(String user) {
@ -17,6 +18,14 @@ public class CoreProtectPreLogEvent extends Event {
return user;
}
public boolean isCancelled() {
return cancelled;
}
public void setCancelled(boolean cancel) {
this.cancelled = cancel;
}
public void setUser(String newUser) {
if (newUser == null || newUser.isEmpty()) {
throw new IllegalArgumentException("Invalid user");