Class VirtualPortal

java.lang.Object
org.sgrewritten.stargate.network.portal.VirtualPortal
All Implemented Interfaces:
Portal
Direct Known Subclasses:
LegacyVirtualPortal

public class VirtualPortal extends Object implements Portal
A virtual representation of a portal on a different server

A virtual portal, which does not exist. Symbolises a portal that is outside this server and acts as an interface to send relevant inter-server packets.

Author:
Thorin
  • Field Details

    • server

      protected final String server
  • Constructor Details

    • VirtualPortal

      public VirtualPortal(String server, String name, Network network, Set<PortalFlag> flags, UUID ownerUUID)
      Instantiates a new virtual portal
      Parameters:
      server -

      The name of the server this portal belongs to

      name -

      The name of this portal

      network -

      The network this virtual portal belongs to

      flags -

      The portal flags enabled for this virtual portal

      ownerUUID -

      The UUID of this virtual portal's owner

  • Method Details

    • teleportHere

      public void teleportHere(org.bukkit.entity.Entity target, RealPortal origin)
      Description copied from interface: Portal
      Teleports an entity to this portal
      Specified by:
      teleportHere in interface Portal
      Parameters:
      target -

      The target entity to teleport

      origin -

      The origin portal the entity is teleporting from

    • close

      public void close(boolean force)
      Description copied from interface: Portal
      Closes this portal
      Specified by:
      close in interface Portal
      Parameters:
      force -

      Whether to force this portal to close, even if set to always on or similar

    • getName

      public String getName()
      Description copied from interface: Portal
      Gets the name of this portal
      Specified by:
      getName in interface Portal
      Returns:

      The name of this portal

    • setNetwork

      public void setNetwork(Network targetNetwork)
      Description copied from interface: Portal
      Changes the network this portal belongs to
      Specified by:
      setNetwork in interface Portal
      Parameters:
      targetNetwork -

      The new network this portal should belong to

    • overrideDestination

      public void overrideDestination(Portal destination)
      Description copied from interface: Portal
      Forces this portal to temporarily go to the given destination regardless of the normal destination(s)
      Specified by:
      overrideDestination in interface Portal
      Parameters:
      destination -

      The destination this portal should temporarily connect ot

    • getNetwork

      public Network getNetwork()
      Description copied from interface: Portal
      Gets the network this portal belongs to
      Specified by:
      getNetwork in interface Portal
      Returns:

      The network this portal belongs to

    • open

      public void open(org.bukkit.entity.Player player)
      Description copied from interface: Portal
      Opens this portal for the given player
      Specified by:
      open in interface Portal
      Parameters:
      player -

      The player to open this portal for

    • destroy

      public void destroy()
      Description copied from interface: Portal
      The method used when destroying a portal

      Mainly clears the sign, see NetworkManager.destroyPortal(RealPortal) to really destroy a portal

      Specified by:
      destroy in interface Portal
    • isOpen

      public boolean isOpen()
      Description copied from interface: Portal
      Checks whether this portal is currently open
      Specified by:
      isOpen in interface Portal
      Returns:

      True if this portal is currently open

    • isOpenFor

      public boolean isOpenFor(org.bukkit.entity.Entity player)
      Description copied from interface: Portal
      Checks whether this portal is currently open and the given target is the one the portal opened for
      Specified by:
      isOpenFor in interface Portal
      Parameters:
      player -

      The target to check

      Returns:

      True if the portal has been opened for the given target

    • getAllFlagsString

      public String getAllFlagsString()
      Description copied from interface: Portal
      Gets all of this portal's portal flags in the form of a string

      This returns the concatenation of all character representations for the flags used by this portal.

      Specified by:
      getAllFlagsString in interface Portal
      Returns:

      All of this portal's portal flags in the form of a string

    • getOwnerUUID

      public UUID getOwnerUUID()
      Description copied from interface: Portal
      Gets the UUID of this portal's owner

      A portal's owner is the player that created the portal.

      Specified by:
      getOwnerUUID in interface Portal
      Returns:

      The UUID of this portal's owner

    • updateState

      public void updateState()
      Description copied from interface: Portal
      Looks into available portals to connect to, and updates appearance and behaviour accordingly
      Specified by:
      updateState in interface Portal
    • setOwner

      public void setOwner(UUID targetPlayer)
      Description copied from interface: Portal
      Changes the player this portal belongs to

      DOES NOT SAVE TO DATABASE

      Specified by:
      setOwner in interface Portal
      Parameters:
      targetPlayer -

      The new player this portal should belong to

    • hasFlag

      public boolean hasFlag(PortalFlag flag)
      Description copied from interface: Portal
      Checks whether this portal has the given portal flag enabled
      Specified by:
      hasFlag in interface Portal
      Parameters:
      flag -

      The portal flag to check for

      Returns:

      True if this portal has the given portal flag enabled

    • removeFlag

      public void removeFlag(PortalFlag flag)
      Description copied from interface: Portal
      Remove a flag from this portal (does not do so from storage)
      Specified by:
      removeFlag in interface Portal
      Parameters:
      flag -

      Flag to remove

    • addFlag

      public void addFlag(PortalFlag flag)
      Description copied from interface: Portal
      Add a flag from this portal (does not do so to storage)
      Specified by:
      addFlag in interface Portal
      Parameters:
      flag -

      Flag to add

    • getId

      public String getId()
      Description copied from interface: Portal
      Gets the unique identifier for this portal
      Specified by:
      getId in interface Portal
      Returns:

      The unique identifier for this portal

    • getGlobalId

      public GlobalPortalId getGlobalId()
      Description copied from interface: Portal
      Gets the globally unique identifier for this portal
      Specified by:
      getGlobalId in interface Portal
      Returns:

      The globally unique identifier for this portal

    • getServer

      public String getServer()
      Returns:

      The server this portal is contained within

    • getStorageType

      public StorageType getStorageType()
      Description copied from interface: Portal
      Gets how the portal is stored
      Specified by:
      getStorageType in interface Portal
      Returns:

      The storage type of the portal

    • setName

      public void setName(String newName)
      Description copied from interface: Portal
      Changes the name of the portal. Use NetworkManager.rename(Portal, String) instead, as this does not save to database, nor update its name to the portal network.
      Specified by:
      setName in interface Portal
      Parameters:
      newName -

      The new name of the portal

    • isDestroyed

      public boolean isDestroyed()
      Specified by:
      isDestroyed in interface Portal
      Returns:

      True if this portal has been destroyed