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,51 +5,84 @@ import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
public class StargateActivateEvent extends StargateEvent {
/**
* This event should be called whenever a player activates a stargate
* <p>Activation of a stargate happens when a player right-clicks the sign of a stargate.</p>
*/
@SuppressWarnings("unused")
public class StargateActivateEvent extends StargatePlayerEvent {
private final Player player;
private ArrayList<String> destinations;
private List<String> destinations;
private String destination;
private static final HandlerList handlers = new HandlerList();
/**
* Instantiates a new stargate activate event
*
* @param portal <p>The activated portal</p>
* @param player <p>The player activating the portal</p>
* @param destinations <p>The destinations available to the player using the portal</p>
* @param destination <p>The chosen destination to activate</p>
*/
public StargateActivateEvent(Portal portal, Player player, List<String> destinations, String destination) {
super("StargatActivateEvent", portal, player);
this.destinations = destinations;
this.destination = destination;
}
/**
* Gets the destinations available for the portal
*
* @return <p>The destinations available for the portal</p>
*/
public List<String> getDestinations() {
return destinations;
}
/**
* Sets the destinations available to the player using the portal
*
* @param destinations <p>The new list of available destinations</p>
*/
public void setDestinations(List<String> destinations) {
this.destinations = destinations;
}
/**
* Gets the chosen destination to activate
*
* @return <p>The chosen destination to activate</p>
*/
public String getDestination() {
return destination;
}
/**
* Sets (changes) the chosen destination to activate
*
* @param destination <p>The new destination to activate</p>
*/
public void setDestination(String destination) {
this.destination = destination;
}
/**
* 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 StargateActivateEvent(Portal portal, Player player, ArrayList<String> destinations, String destination) {
super("StargatActivateEvent", portal);
this.player = player;
this.destinations = destinations;
this.destination = destination;
}
public Player getPlayer() {
return player;
}
public ArrayList<String> getDestinations() {
return destinations;
}
public void setDestinations(ArrayList<String> destinations) {
this.destinations = destinations;
}
public String getDestination() {
return destination;
}
public void setDestination(String destination) {
this.destination = destination;
}
}