Adds comments and simplifies some of the code
Adds a PortalOption enum to simplify portal options Adds a BungeeHelper class to collect the bungee-related code
This commit is contained in:
@ -11,46 +11,49 @@ import org.jetbrains.annotations.NotNull;
|
||||
@SuppressWarnings("unused")
|
||||
public class StargateAccessEvent extends StargatePlayerEvent {
|
||||
|
||||
private boolean deny;
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean deny;
|
||||
|
||||
/**
|
||||
* Instantiates a new stargate access event
|
||||
*
|
||||
* @param player <p>The player involved in the vent</p>
|
||||
* @param portal <p>The portal involved in the event</p>
|
||||
* @param deny <p>Whether the event should be denied</p>
|
||||
* @param deny <p>Whether the event should be denied</p>
|
||||
*/
|
||||
public StargateAccessEvent(Player player, Portal portal, boolean deny) {
|
||||
super("StargateAccessEvent", portal, player);
|
||||
public StargateAccessEvent(Player player, Portal portal, boolean deny) {
|
||||
super("StargateAccessEvent", portal, player);
|
||||
|
||||
this.deny = deny;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets whether the player should be denied access
|
||||
* @return <p>Whether the player should be denied access</p>
|
||||
*/
|
||||
public boolean getDeny() {
|
||||
return this.deny;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether to deny the player
|
||||
* @param deny <p>Whether to deny the player</p>
|
||||
*/
|
||||
public void setDeny(boolean deny) {
|
||||
this.deny = deny;
|
||||
}
|
||||
this.deny = deny;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 whether the player should be denied access
|
||||
*
|
||||
* @return <p>Whether the player should be denied access</p>
|
||||
*/
|
||||
public boolean getDeny() {
|
||||
return this.deny;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether to deny the player
|
||||
*
|
||||
* @param deny <p>Whether to deny the player</p>
|
||||
*/
|
||||
public void setDeny(boolean deny) {
|
||||
this.deny = deny;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public HandlerList getHandlers() {
|
||||
|
@ -14,11 +14,10 @@ import java.util.List;
|
||||
@SuppressWarnings("unused")
|
||||
public class StargateActivateEvent extends StargatePlayerEvent {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private List<String> destinations;
|
||||
private String destination;
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
/**
|
||||
* Instantiates a new stargate activate event
|
||||
*
|
||||
@ -34,6 +33,15 @@ public class StargateActivateEvent extends StargatePlayerEvent {
|
||||
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
|
||||
*
|
||||
@ -70,15 +78,6 @@ public class StargateActivateEvent extends StargatePlayerEvent {
|
||||
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() {
|
||||
|
@ -10,9 +10,8 @@ import org.jetbrains.annotations.NotNull;
|
||||
@SuppressWarnings("unused")
|
||||
public class StargateCloseEvent extends StargateEvent {
|
||||
|
||||
private boolean force;
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean force;
|
||||
|
||||
/**
|
||||
* Instantiates a new stargate closing event
|
||||
@ -26,6 +25,15 @@ public class StargateCloseEvent extends StargateEvent {
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets whether to force the stargate to close
|
||||
*
|
||||
@ -44,15 +52,6 @@ public class StargateCloseEvent extends StargateEvent {
|
||||
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;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
|
@ -11,13 +11,12 @@ import org.jetbrains.annotations.NotNull;
|
||||
@SuppressWarnings("unused")
|
||||
public class StargateCreateEvent extends StargatePlayerEvent {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private final String[] lines;
|
||||
private boolean deny;
|
||||
private String denyReason;
|
||||
private final String[] lines;
|
||||
private int cost;
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
/**
|
||||
* Instantiates a new stargate creation event
|
||||
*
|
||||
@ -36,6 +35,15 @@ public class StargateCreateEvent extends StargatePlayerEvent {
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a given line from the sign creating the star gate
|
||||
*
|
||||
@ -101,15 +109,6 @@ public class StargateCreateEvent extends StargatePlayerEvent {
|
||||
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() {
|
||||
|
@ -11,19 +11,19 @@ import org.jetbrains.annotations.NotNull;
|
||||
@SuppressWarnings("unused")
|
||||
public class StargateDestroyEvent extends StargatePlayerEvent {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean deny;
|
||||
private String denyReason;
|
||||
private int cost;
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
/**
|
||||
* Instantiates a new Stargate Destroy Event
|
||||
* @param portal <p>The portal destroyed</p>
|
||||
* @param player <p>The player destroying the portal</p>
|
||||
* @param deny <p>Whether the event should be denied (cancelled)</p>
|
||||
*
|
||||
* @param portal <p>The portal destroyed</p>
|
||||
* @param player <p>The player destroying the portal</p>
|
||||
* @param deny <p>Whether the event should be denied (cancelled)</p>
|
||||
* @param denyMsg <p>The message to display if the event is denied</p>
|
||||
* @param cost <p>The cost of destroying the portal</p>
|
||||
* @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, player);
|
||||
@ -32,54 +32,6 @@ public class StargateDestroyEvent extends StargatePlayerEvent {
|
||||
this.cost = cost;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets whether this event should be denied
|
||||
* @return <p>Whether this event should be denied</p>
|
||||
*/
|
||||
public boolean getDeny() {
|
||||
return deny;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether this event should be denied
|
||||
* @param deny <p>Whether this event should be denied</p>
|
||||
*/
|
||||
public void setDeny(boolean deny) {
|
||||
this.deny = deny;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the reason the event was denied
|
||||
* @return <p>The reason the event was denied</p>
|
||||
*/
|
||||
public String getDenyReason() {
|
||||
return denyReason;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the reason the event was denied
|
||||
* @param denyReason <p>The reason the event was denied</p>
|
||||
*/
|
||||
public void setDenyReason(String denyReason) {
|
||||
this.denyReason = denyReason;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the cost of destroying the portal
|
||||
* @return <p>The cost of destroying the portal</p>
|
||||
*/
|
||||
public int getCost() {
|
||||
return cost;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the cost of destroying the portal
|
||||
* @param cost <p>The cost of destroying the portal</p>
|
||||
*/
|
||||
public void setCost(int cost) {
|
||||
this.cost = cost;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a handler-list containing all event handlers
|
||||
*
|
||||
@ -89,6 +41,60 @@ public class StargateDestroyEvent extends StargatePlayerEvent {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets whether this event should be denied
|
||||
*
|
||||
* @return <p>Whether this event should be denied</p>
|
||||
*/
|
||||
public boolean getDeny() {
|
||||
return deny;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether this event should be denied
|
||||
*
|
||||
* @param deny <p>Whether this event should be denied</p>
|
||||
*/
|
||||
public void setDeny(boolean deny) {
|
||||
this.deny = deny;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the reason the event was denied
|
||||
*
|
||||
* @return <p>The reason the event was denied</p>
|
||||
*/
|
||||
public String getDenyReason() {
|
||||
return denyReason;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the reason the event was denied
|
||||
*
|
||||
* @param denyReason <p>The reason the event was denied</p>
|
||||
*/
|
||||
public void setDenyReason(String denyReason) {
|
||||
this.denyReason = denyReason;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the cost of destroying the portal
|
||||
*
|
||||
* @return <p>The cost of destroying the portal</p>
|
||||
*/
|
||||
public int getCost() {
|
||||
return cost;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the cost of destroying the portal
|
||||
*
|
||||
* @param cost <p>The cost of destroying the portal</p>
|
||||
*/
|
||||
public void setCost(int cost) {
|
||||
this.cost = cost;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
|
@ -15,7 +15,8 @@ public abstract class StargateEvent extends Event implements Cancellable {
|
||||
|
||||
/**
|
||||
* Instantiates a new stargate event
|
||||
* @param event <p>UNUSED</p>
|
||||
*
|
||||
* @param event <p>UNUSED</p>
|
||||
* @param portal <p>The portal involved in this stargate event</p>
|
||||
*/
|
||||
StargateEvent(String event, Portal portal) {
|
||||
@ -25,6 +26,7 @@ public abstract class StargateEvent extends Event implements Cancellable {
|
||||
|
||||
/**
|
||||
* Gets the portal involved in this stargate event
|
||||
*
|
||||
* @return <p>The portal involved in this stargate event</p>
|
||||
*/
|
||||
public Portal getPortal() {
|
||||
|
@ -10,15 +10,15 @@ import org.jetbrains.annotations.NotNull;
|
||||
*/
|
||||
public class StargateOpenEvent extends StargatePlayerEvent {
|
||||
|
||||
private boolean force;
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean force;
|
||||
|
||||
/**
|
||||
* 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>
|
||||
* @param force <p>Whether to force the portal open</p>
|
||||
*/
|
||||
public StargateOpenEvent(Player player, Portal portal, boolean force) {
|
||||
super("StargateOpenEvent", portal, player);
|
||||
@ -26,8 +26,18 @@ public class StargateOpenEvent extends StargatePlayerEvent {
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets whether the portal should be forced open
|
||||
*
|
||||
* @return <p>Whether the portal should be forced open</p>
|
||||
*/
|
||||
public boolean getForce() {
|
||||
@ -36,20 +46,13 @@ public class StargateOpenEvent extends StargatePlayerEvent {
|
||||
|
||||
/**
|
||||
* 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() {
|
||||
|
@ -12,17 +12,17 @@ import org.jetbrains.annotations.NotNull;
|
||||
@SuppressWarnings("unused")
|
||||
public class StargatePortalEvent extends StargatePlayerEvent {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private final Portal destination;
|
||||
private Location exit;
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
/**
|
||||
* Instantiates a new stargate portal event
|
||||
* @param player <p>The player teleporting</p>
|
||||
* @param portal <p>The portal the player entered from</p>
|
||||
*
|
||||
* @param player <p>The player teleporting</p>
|
||||
* @param portal <p>The portal the player entered from</p>
|
||||
* @param destination <p>The destination the player should exit from</p>
|
||||
* @param exit <p>The exit location of the destination portal the user will be teleported to</p>
|
||||
* @param exit <p>The exit location of the destination portal the user will be teleported to</p>
|
||||
*/
|
||||
public StargatePortalEvent(Player player, Portal portal, Portal destination, Location exit) {
|
||||
super("StargatePortalEvent", portal, player);
|
||||
@ -31,6 +31,15 @@ public class StargatePortalEvent extends StargatePlayerEvent {
|
||||
this.exit = exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a handler-list containing all event handlers
|
||||
*
|
||||
* @return <p>A handler-list with all event handlers</p>
|
||||
*/
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the destination gate
|
||||
*
|
||||
@ -56,14 +65,6 @@ public class StargatePortalEvent extends StargatePlayerEvent {
|
||||
this.exit = loc;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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() {
|
||||
|
Reference in New Issue
Block a user