Make user mutable via CoreProtectPreLogEvent (#66)
* Make user mutable via CoreProtectPreLogEvent * Cleanup & added missing toLowerCase in getId * Docs: add Event category; add CoreProtectPreLogEvent * Merged event documentation into API documentation * Removed event.getUser() equality check * Added IllegalArgumentException check within PreLogEvent * Reverted docs/index.md Co-authored-by: Intelli <contact@intelli.software>
This commit is contained in:
parent
39cd888440
commit
da718de252
13 changed files with 158 additions and 38 deletions
|
|
@ -0,0 +1,37 @@
|
|||
package net.coreprotect.event;
|
||||
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
public class CoreProtectPreLogEvent extends Event {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private String user;
|
||||
|
||||
public CoreProtectPreLogEvent(String user) {
|
||||
super(true); // async
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
public String getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public void setUser(String newUser) {
|
||||
if (newUser == null || newUser.isEmpty()) {
|
||||
throw new IllegalArgumentException("Invalid user");
|
||||
}
|
||||
|
||||
this.user = newUser;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue