2021-02-07 03:37:25 +01:00
|
|
|
package net.knarcraft.stargate.event;
|
|
|
|
|
|
|
|
import net.knarcraft.stargate.Portal;
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
import org.bukkit.event.HandlerList;
|
2021-02-12 00:26:47 +01:00
|
|
|
import org.jetbrains.annotations.NotNull;
|
2021-02-07 03:37:25 +01:00
|
|
|
|
2021-02-19 12:06:23 +01:00
|
|
|
import java.util.List;
|
2021-02-07 03:37:25 +01:00
|
|
|
|
2021-02-19 12:06:23 +01:00
|
|
|
/**
|
|
|
|
* 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 {
|
2021-02-07 03:37:25 +01:00
|
|
|
|
2021-02-20 13:57:04 +01:00
|
|
|
private static final HandlerList handlers = new HandlerList();
|
2021-02-19 12:06:23 +01:00
|
|
|
private List<String> destinations;
|
2021-02-07 03:37:25 +01:00
|
|
|
private String destination;
|
|
|
|
|
2021-02-19 12:06:23 +01:00
|
|
|
/**
|
|
|
|
* 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);
|
2021-02-07 03:37:25 +01:00
|
|
|
|
|
|
|
this.destinations = destinations;
|
|
|
|
this.destination = destination;
|
|
|
|
}
|
|
|
|
|
2021-02-20 13:57:04 +01:00
|
|
|
/**
|
|
|
|
* Gets a handler-list containing all event handlers
|
|
|
|
*
|
|
|
|
* @return <p>A handler-list with all event handlers</p>
|
|
|
|
*/
|
|
|
|
public static HandlerList getHandlerList() {
|
|
|
|
return handlers;
|
|
|
|
}
|
|
|
|
|
2021-02-19 12:06:23 +01:00
|
|
|
/**
|
|
|
|
* Gets the destinations available for the portal
|
|
|
|
*
|
|
|
|
* @return <p>The destinations available for the portal</p>
|
|
|
|
*/
|
|
|
|
public List<String> getDestinations() {
|
2021-02-07 03:37:25 +01:00
|
|
|
return destinations;
|
|
|
|
}
|
|
|
|
|
2021-02-19 12:06:23 +01:00
|
|
|
/**
|
|
|
|
* 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) {
|
2021-02-07 03:37:25 +01:00
|
|
|
this.destinations = destinations;
|
|
|
|
}
|
|
|
|
|
2021-02-19 12:06:23 +01:00
|
|
|
/**
|
|
|
|
* Gets the chosen destination to activate
|
|
|
|
*
|
|
|
|
* @return <p>The chosen destination to activate</p>
|
|
|
|
*/
|
2021-02-07 03:37:25 +01:00
|
|
|
public String getDestination() {
|
|
|
|
return destination;
|
|
|
|
}
|
|
|
|
|
2021-02-19 12:06:23 +01:00
|
|
|
/**
|
|
|
|
* Sets (changes) the chosen destination to activate
|
|
|
|
*
|
|
|
|
* @param destination <p>The new destination to activate</p>
|
|
|
|
*/
|
2021-02-07 03:37:25 +01:00
|
|
|
public void setDestination(String destination) {
|
|
|
|
this.destination = destination;
|
|
|
|
}
|
|
|
|
|
2021-02-19 12:06:23 +01:00
|
|
|
@Override
|
|
|
|
@NotNull
|
|
|
|
public HandlerList getHandlers() {
|
|
|
|
return handlers;
|
|
|
|
}
|
|
|
|
|
2021-02-07 03:37:25 +01:00
|
|
|
}
|