Improves comments for Stargate events, and adds a new event for teleporting entities

Adds information about what events can be used for
Tries to clarify event comments where possible
Renames The StargatePortalEvent to StargatePlayerPortalEvent
Adds StargateEntityPortalEvent
Makes the StargateEntityPortalEvent trigger whenever a vehicle is teleported
Removes the unused event name for all events
This commit is contained in:
2021-10-13 15:45:15 +02:00
parent 0ab6cb52c0
commit bf7a10636e
14 changed files with 223 additions and 104 deletions

View File

@ -9,7 +9,9 @@ import java.util.List;
/**
* 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>
*
* <p>Activation of a stargate happens when a player right-clicks the sign of a stargate.
* This event can be used to overwrite the selected destination, and all destinations the player can see.</p>
*/
@SuppressWarnings("unused")
public class StargateActivateEvent extends StargatePlayerEvent {
@ -24,24 +26,15 @@ public class StargateActivateEvent extends StargatePlayerEvent {
* @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>
* @param destination <p>The currently selected destination</p>
*/
public StargateActivateEvent(Portal portal, Player player, List<String> destinations, String destination) {
super("StargateActivateEvent", portal, player);
super(portal, player);
this.destinations = destinations;
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;
}
/**
* Gets the destinations available for the portal
*
@ -61,23 +54,32 @@ public class StargateActivateEvent extends StargatePlayerEvent {
}
/**
* Gets the chosen destination to activate
* Gets the selected destination
*
* @return <p>The chosen destination to activate</p>
* @return <p>The selected destination</p>
*/
public String getDestination() {
return destination;
}
/**
* Sets (changes) the chosen destination to activate
* Sets (changes) the selected destination
*
* @param destination <p>The new destination to activate</p>
* @param destination <p>The new selected destination</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() {