Class PortalPosition

java.lang.Object
org.sgrewritten.stargate.api.network.portal.PortalPosition
All Implemented Interfaces:
MetadataHolder

public class PortalPosition extends Object implements MetadataHolder
A position of a portal's control block
  • Constructor Details

    • PortalPosition

      public PortalPosition(@NotNull @NotNull PositionType positionType, @NotNull @NotNull org.bukkit.util.BlockVector relativePositionLocation, @NotNull @NotNull String pluginName)
      Instantiates a new active portal position
      Parameters:
      positionType -

      The type of this portal position

      relativePositionLocation -

      The relative location of this portal to that of the gate

      pluginName -

      The name of the plugin this position relates to

    • PortalPosition

      public PortalPosition(@NotNull @NotNull PositionType positionType, @NotNull @NotNull org.bukkit.util.BlockVector relativePositionLocation, @NotNull @NotNull String pluginName, boolean active)
      Instantiates a new active portal position
      Parameters:
      positionType -

      The type of this portal position

      relativePositionLocation -

      The relative location of this portal to that of the gate

      pluginName -

      The name of the plugin this position relates to

      active -

      If the position is active

  • Method Details

    • getPositionType

      @NotNull public @NotNull PositionType getPositionType()
      Gets this portal position's type
      Returns:

      This portal position's type

    • getRelativePositionLocation

      @NotNull public @NotNull org.bukkit.util.BlockVector getRelativePositionLocation()
      Gets this portal position's relative location to that of the gate
      Returns:

      This portal position's relative location

    • assignPortal

      @Internal public void assignPortal(RealPortal portal)
      Parameters:
      portal -

      The portal to assign to this portal position

    • getPluginName

      @NotNull public @NotNull String getPluginName()
      Returns:

      The name of the plugin that owns this portal position

    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • isActive

      public boolean isActive()
      Returns:

      Whether the portal position is currently active

    • setActive

      public void setActive(boolean active)
      Activate/deactive this portal position
      Parameters:
      active -

      Whether to activate or deactivate the portal position

    • setMetadata

      public void setMetadata(@Nullable @Nullable String data)
      Description copied from interface: MetadataHolder
      Set metadata for this portal. This sets all metadata for this entity, it's advised to use MetadataHolder.setMetadata(JsonElement, String)
      Specified by:
      setMetadata in interface MetadataHolder
      Parameters:
      data -

      The meta data to set

    • getMetadata

      public String getMetadata()
      Description copied from interface: MetadataHolder
      Get metadata for this portal. This gets all metadata for this entity, it's advised to use the MetadataHolder.getMetadata(String) method
      Specified by:
      getMetadata in interface MetadataHolder
      Returns:

      The meta data of this portal

    • getPortal

      public RealPortal getPortal()
      Returns:

      The portal owning this portal position

    • getAttachment

      @Internal @Nullable public @Nullable PortalPositionAttachment getAttachment()
    • setAttachment

      @Internal public void setAttachment(@NotNull @NotNull PortalPositionAttachment attachment)