Adds comments to all custom events

Adds full comments to every class implementing StarGateEvent
Adds another abstract event StargatePlayerEvent which reduces code duplication
This commit is contained in:
2021-02-19 12:06:23 +01:00
parent 5b7f5649b1
commit c912624df1
10 changed files with 344 additions and 173 deletions

View File

@ -8,28 +8,15 @@ import org.jetbrains.annotations.NotNull;
/**
* This event represents an event where a star gate is destroyed or attempted to be destroyed
*/
public class StargateDestroyEvent extends StargateEvent {
@SuppressWarnings("unused")
public class StargateDestroyEvent extends StargatePlayerEvent {
private final Player player;
private boolean deny;
private String denyReason;
private int cost;
private static final HandlerList handlers = new HandlerList();
@NotNull
public HandlerList getHandlers() {
return handlers;
}
/**
* Gets a handler-list containing all event handlers
* @return <p>A handler-list with all event handlers</p>
*/
public static HandlerList getHandlerList() {
return handlers;
}
/**
* Instantiates a new Stargate Destroy Event
* @param portal <p>The portal destroyed</p>
@ -39,21 +26,12 @@ public class StargateDestroyEvent extends StargateEvent {
* @param cost <p>The cost of destroying the portal</p>
*/
public StargateDestroyEvent(Portal portal, Player player, boolean deny, String denyMsg, int cost) {
super("StargateDestroyEvent", portal);
this.player = player;
super("StargateDestroyEvent", portal, player);
this.deny = deny;
this.denyReason = denyMsg;
this.cost = cost;
}
/**
* Gets the player causing the destroy event
* @return <p>The player causing the destroy event</p>
*/
public Player getPlayer() {
return player;
}
/**
* Gets whether this event should be denied
* @return <p>Whether this event should be denied</p>
@ -102,4 +80,19 @@ public class StargateDestroyEvent extends StargateEvent {
this.cost = cost;
}
/**
* Gets a handler-list containing all event handlers
*
* @return <p>A handler-list with all event handlers</p>
*/
public static HandlerList getHandlerList() {
return handlers;
}
@NotNull
@Override
public HandlerList getHandlers() {
return handlers;
}
}