Class StargateCreatePortalEvent
This event can be used to deny or change the cost of a stargate creation.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
org.bukkit.event.Event.Result
-
Constructor Summary
ConstructorDescriptionStargateCreatePortalEvent
(@NotNull org.bukkit.OfflinePlayer player, @NotNull Portal portal, @NotNull String[] lines, boolean deny, String denyReason, double cost) Instantiates a new stargate creation event -
Method Summary
Modifier and TypeMethodDescriptionvoid
addFlag
(PortalFlag flag) Add flag to related portal and save to storagedouble
getCost()
Gets the cost of creating the stargateboolean
getDeny()
Gets whether the entity should be denied accessGets the reason the stargate access was deniedstatic org.bukkit.event.HandlerList
Gets a handler-list containing all event handlers@NotNull org.bukkit.event.HandlerList
getLine
(int index) Gets a given line from the sign creating the star gateorg.bukkit.OfflinePlayer
Get the player that is creating the portalvoid
removeFlag
(PortalFlag flag) Remove flag to related portal and save to storagevoid
setCost
(int cost) Sets the cost of creating the stargatevoid
setDeny
(boolean deny) Sets whether to deny access to the entityvoid
setDenyReason
(String denyReason) Sets the reason the stargate access was deniedMethods inherited from class org.sgrewritten.stargate.api.event.portal.StargatePortalEvent
getPortal
Methods inherited from class org.bukkit.event.Event
callEvent, getEventName, isAsynchronous
-
Constructor Details
-
StargateCreatePortalEvent
public StargateCreatePortalEvent(@NotNull @NotNull org.bukkit.OfflinePlayer player, @NotNull @NotNull Portal portal, @NotNull @NotNull String[] lines, boolean deny, String denyReason, double cost) Instantiates a new stargate creation eventThis is called asynchronously!
- Parameters:
player
-The player creating the stargate
portal
-The created portal
lines
-The lines of the sign creating the star gate
deny
-Whether to deny the creation of the new gate
denyReason
-The reason stargate creation was denied
cost
-The cost of creating the new star gate
-
-
Method Details
-
getLine
Gets a given line from the sign creating the star gate- Parameters:
index
-The line number to get
- Returns:
The text on the given line
- Throws:
IndexOutOfBoundsException
-If given a line index less than zero or above three
-
addFlag
Add flag to related portal and save to storage- Parameters:
flag
-The flag to add
- Throws:
UnsupportedOperationException
-
removeFlag
Remove flag to related portal and save to storage- Parameters:
flag
-The flag to remove
- Throws:
UnsupportedOperationException
-
getCost
public double getCost()Gets the cost of creating the stargate- Returns:
The cost of creating the stargate
-
setCost
public void setCost(int cost) Sets the cost of creating the stargate- Parameters:
cost
-The new cost of creating the stargate
-
getHandlerList
public static org.bukkit.event.HandlerList getHandlerList()Gets a handler-list containing all event handlers- Returns:
A handler-list with all event handlers
-
getHandlers
@NotNull public @NotNull org.bukkit.event.HandlerList getHandlers()- Specified by:
getHandlers
in classorg.bukkit.event.Event
-
getDeny
public boolean getDeny()Gets whether the entity should be denied access- Returns:
Whether the entity should be denied access
-
setDeny
public void setDeny(boolean deny) Sets whether to deny access to the entity- Parameters:
deny
-Whether to deny access to the entity
-
getDenyReason
Gets the reason the stargate access was denied- Returns:
The reason the stargate access was denied
-
setDenyReason
Sets the reason the stargate access was deniedSet to null for a generic message. Set to empty for no message.
- Parameters:
denyReason
-The new reason why the stargate access was denied
-
getPlayer
public org.bukkit.OfflinePlayer getPlayer()Get the player that is creating the portal- Returns:
The player that is creating the portal
-