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:
bermudalocket 2021-08-06 20:40:21 -04:00 committed by GitHub
parent 39cd888440
commit da718de252
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 158 additions and 38 deletions

View file

@ -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;
}
}