Class StargateCreatePortalEvent

java.lang.Object
org.bukkit.event.Event
org.sgrewritten.stargate.api.event.portal.StargatePortalEvent
org.sgrewritten.stargate.api.event.portal.StargateCreatePortalEvent

public class StargateCreatePortalEvent extends StargatePortalEvent
This event should be called whenever a stargate is created

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

    Constructors
    Constructor
    Description
    StargateCreatePortalEvent(@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 Type
    Method
    Description
    void
    Add flag to related portal and save to storage
    double
    Gets the cost of creating the stargate
    boolean
    Gets whether the entity should be denied access
    Gets the reason the stargate access was denied
    static 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 gate
    org.bukkit.OfflinePlayer
    Get the player that is creating the portal
    void
    Remove flag to related portal and save to storage
    void
    setCost(int cost)
    Sets the cost of creating the stargate
    void
    setDeny(boolean deny)
    Sets whether to deny access to the entity
    void
    setDenyReason(String denyReason)
    Sets the reason the stargate access was denied

    Methods inherited from class org.sgrewritten.stargate.api.event.portal.StargatePortalEvent

    getPortal

    Methods inherited from class org.bukkit.event.Event

    callEvent, getEventName, isAsynchronous

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 event

      This 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

      public String getLine(int index) throws IndexOutOfBoundsException
      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

      public void addFlag(PortalFlag flag) throws UnsupportedOperationException
      Add flag to related portal and save to storage
      Parameters:
      flag -

      The flag to add

      Throws:
      UnsupportedOperationException
    • removeFlag

      public void removeFlag(PortalFlag flag) throws UnsupportedOperationException
      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 class org.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

      public String getDenyReason()
      Gets the reason the stargate access was denied
      Returns:

      The reason the stargate access was denied

    • setDenyReason

      public void setDenyReason(String denyReason)
      Sets the reason the stargate access was denied

      Set 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