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

@ -5,44 +5,55 @@ import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
public class StargateOpenEvent extends StargateEvent {
/**
* This event should be called whenever a player opens a stargate
*/
public class StargateOpenEvent extends StargatePlayerEvent {
private final Player player;
private boolean force;
private static final HandlerList handlers = new HandlerList();
/**
* Instantiates a new stargate open event
* @param player <p>The player opening the stargate</p>
* @param portal <p>The portal opened</p>
* @param force <p>Whether to force the portal open</p>
*/
public StargateOpenEvent(Player player, Portal portal, boolean force) {
super("StargateOpenEvent", portal, player);
this.force = force;
}
/**
* Gets whether the portal should be forced open
* @return <p>Whether the portal should be forced open</p>
*/
public boolean getForce() {
return force;
}
/**
* Sets whether the portal should be forced open
* @param force <p>Whether the portal should be forced open</p>
*/
public void setForce(boolean force) {
this.force = force;
}
/**
* Gets a handler-list containing all event handlers
* @return <p>A handler-list with all event handlers</p>
*/
public static HandlerList getHandlerList() {
return handlers;
}
@Override
@NotNull
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
public StargateOpenEvent(Player player, Portal portal, boolean force) {
super("StargateOpenEvent", portal);
this.player = player;
this.force = force;
}
/**
* Return the player than opened the gate.
*
* @return player than opened the gate
*/
public Player getPlayer() {
return player;
}
public boolean getForce() {
return force;
}
public void setForce(boolean force) {
this.force = force;
}
}