Class Host

java.lang.Object
net.ME1312.SubServers.Bungee.Host.Host
All Implemented Interfaces:
ExtraDataHandler<String>
Direct Known Subclasses:
ExternalHost, InternalHost

public abstract class Host extends Object implements ExtraDataHandler<String>
Host Layout Class
  • Constructor Details

    • Host

      public Host(SubProxy plugin, String name, boolean enabled, com.google.common.collect.Range<Integer> ports, boolean log, InetAddress address, String directory, String gitBash)
      This constructor is required to launch your host from the drivers list. Do not add or remove any arguments.
      Parameters:
      plugin - SubServers Internals
      name - The Name of your Host
      ports - The range of ports to auto-select from
      log - Whether apps like SubCreator should log to console (does not apply to servers)
      enabled - If your host is Enabled
      address - The address of your Host
      directory - The runtime directory of your Host
      gitBash - The Git Bash directory
  • Method Details

    • isAvailable

      public boolean isAvailable()
      Is this Host Available?
      Returns:
      Availability Status
    • isEnabled

      public abstract boolean isEnabled()
      Is this Host Enabled?
      Returns:
      Enabled Status
    • setEnabled

      public abstract void setEnabled(boolean value)
      Set if this Host is Enabled
      Parameters:
      value - Value
    • getAddress

      public abstract InetAddress getAddress()
      Get the Address of this Host
      Returns:
      Host Address
    • getPath

      public abstract String getPath()
      Get the host Directory Path
      Returns:
      Host Directory Path
    • getName

      public abstract String getName()
      Get the Name of this Host
      Returns:
      Host Name
    • getDisplayName

      public String getDisplayName()
      Get the Display Name of this Host
      Returns:
      Display Name
    • setDisplayName

      public void setDisplayName(String value)
      Sets the Display Name for this Host
      Parameters:
      value - Value (or null to reset)
    • getPlayers

      public Collection<ProxiedPlayer> getPlayers()
      Get players on servers provided by this host
      Returns:
      Local Player Collection
    • getRemotePlayers

      public Collection<RemotePlayer> getRemotePlayers()
      Get players on servers provided by this host across all known proxies
      Returns:
      Remote Player Collection
    • start

      public int start(String... servers)
      Starts the Servers Specified
      Parameters:
      servers - Servers
      Returns:
      Success Status
    • start

      public int start(UUID player, String... servers)
      Starts the Servers Specified
      Parameters:
      player - Player who started
      servers - Servers
      Returns:
      Success Status
    • stop

      public int stop(String... servers)
      Stops the Servers Specified
      Parameters:
      servers - Servers
      Returns:
      Success Status
    • stop

      public int stop(UUID player, String... servers)
      Stops the Servers Specified
      Parameters:
      player - Player who started
      servers - Servers
      Returns:
      Success Status
    • terminate

      public int terminate(String... servers)
      Terminates the Servers Specified
      Parameters:
      servers - Servers
      Returns:
      Success Status
    • terminate

      public int terminate(UUID player, String... servers)
      Terminates the Servers Specified
      Parameters:
      player - Player who started
      servers - Servers
      Returns:
      Success Status
    • command

      public int command(String command, String... servers)
      Commands the Servers Specified
      Parameters:
      command - Command to send
      servers - Servers
      Returns:
      Success Status
    • command

      public int command(UUID player, String command, String... servers)
      Commands the Servers Specified
      Parameters:
      player - Player who started
      command - Command to send
      servers - Servers
      Returns:
      Success Status
    • getCreator

      public abstract SubCreator getCreator()
      Gets the SubCreator Instance for this Host
      Returns:
      SubCreator
    • getSubServers

      public abstract Map<String,? extends SubServer> getSubServers()
      Gets the SubServers on this Host
      Returns:
      SubServer Map
    • getSubServer

      public abstract SubServer getSubServer(String name)
      Gets a SubServer
      Parameters:
      name - SubServer Name
      Returns:
      a SubServer
    • constructSubServer

      public abstract SubServer constructSubServer(String name, boolean enabled, int port, String motd, boolean log, String directory, String executable, String stopcmd, boolean hidden, boolean restricted) throws InvalidServerException
      Constructs a SubServer (but doesn't add it to the server manager)
      Parameters:
      name - Name of Server
      enabled - Enabled Status
      port - Port Number
      motd - Motd of the Server
      log - Logging Status
      directory - Directory
      executable - Executable String
      stopcmd - Command to Stop the Server
      hidden - if the server should be hidden from players
      restricted - Players will need a permission to join if true
      Returns:
      The SubServer
      Throws:
      InvalidServerException
    • addSubServer

      public SubServer addSubServer(String name, boolean enabled, int port, String motd, boolean log, String directory, String executable, String stopcmd, boolean hidden, boolean restricted) throws InvalidServerException
      Adds a SubServer
      Parameters:
      name - Name of Server
      enabled - Enabled Status
      port - Port Number
      motd - Motd of the Server
      log - Logging Status
      directory - Directory
      executable - Executable String
      stopcmd - Command to Stop the Server
      hidden - if the server should be hidden from players
      restricted - Players will need a permission to join if true
      Returns:
      The SubServer
      Throws:
      InvalidServerException
    • addSubServer

      public SubServer addSubServer(UUID player, String name, boolean enabled, int port, String motd, boolean log, String directory, String executable, String stopcmd, boolean hidden, boolean restricted) throws InvalidServerException
      Adds a SubServer
      Parameters:
      player - Player who Added
      name - Name of Server
      enabled - Enabled Status
      port - Port Number
      motd - Motd of the Server
      log - Logging Status
      directory - Directory
      executable - Executable String
      stopcmd - Command to Stop the Server
      hidden - if the server should be hidden from players
      restricted - Players will need a permission to join if true
      Returns:
      The SubServer
      Throws:
      InvalidServerException
    • addSubServer

      public boolean addSubServer(SubServer server) throws InvalidServerException
      Adds a SubServer
      Parameters:
      server - SubServer to add
      Returns:
      Success status
      Throws:
      InvalidServerException
    • addSubServer

      public abstract boolean addSubServer(UUID player, SubServer server) throws InvalidServerException
      Adds a SubServer
      Parameters:
      player - Player who added
      server - SubServer to add
      Returns:
      Success status
      Throws:
      InvalidServerException
    • removeSubServer

      public boolean removeSubServer(String name) throws InterruptedException
      Removes a SubServer
      Parameters:
      name - SubServer Name
      Returns:
      Success Status
      Throws:
      InterruptedException
    • removeSubServer

      public boolean removeSubServer(UUID player, String name) throws InterruptedException
      Removes a SubServer
      Parameters:
      player - Player Removing
      name - SubServer Name
      Returns:
      Success Status
      Throws:
      InterruptedException
    • removeSubServer

      protected abstract boolean removeSubServer(UUID player, String name, boolean forced) throws InterruptedException
      Removes a SubServer
      Parameters:
      player - Player Removing
      name - SubServer Name
      forced - Forces the Removal
      Returns:
      Success Status
      Throws:
      InterruptedException
    • forceRemoveSubServer

      public boolean forceRemoveSubServer(String name) throws InterruptedException
      Forces the Removal of a SubServer
      Parameters:
      name - SubServer Name
      Returns:
      Success Status
      Throws:
      InterruptedException
    • forceRemoveSubServer

      public boolean forceRemoveSubServer(UUID player, String name) throws InterruptedException
      Forces the Removal of a SubServer
      Parameters:
      player - Player Removing
      name - SubServer Name
      Returns:
      Success Status
      Throws:
      InterruptedException
    • recycleSubServer

      public boolean recycleSubServer(String name) throws InterruptedException
      Deletes a SubServer (will move to 'Recently Deleted')
      Parameters:
      name - SubServer Name
      Returns:
      Success Status
      Throws:
      InterruptedException
    • recycleSubServer

      public boolean recycleSubServer(UUID player, String name) throws InterruptedException
      Deletes a SubServer (will move to 'Recently Deleted')
      Parameters:
      player - Player Deleting
      name - SubServer Name
      Returns:
      Success Status
      Throws:
      InterruptedException
    • recycleSubServer

      protected abstract boolean recycleSubServer(UUID player, String name, boolean forced) throws InterruptedException
      Deletes a SubServer (will move to 'Recently Deleted')
      Parameters:
      player - Player Deleting
      name - SubServer Name
      forced - Forces the Deletion
      Returns:
      Success Status
      Throws:
      InterruptedException
    • forceRecycleSubServer

      public boolean forceRecycleSubServer(String name) throws InterruptedException
      Forces the Deletion of a SubServer (will move to 'Recently Deleted')
      Parameters:
      name - SubServer Name
      Returns:
      Success Status
      Throws:
      InterruptedException
    • forceRecycleSubServer

      public boolean forceRecycleSubServer(UUID player, String name) throws InterruptedException
      Forces the Deletion of a SubServer (will move to 'Recently Deleted')
      Parameters:
      player - Player Deleting
      name - SubServer Name
      Returns:
      Success Status
      Throws:
      InterruptedException
    • deleteSubServer

      public boolean deleteSubServer(String name) throws InterruptedException
      Deletes a SubServer
      Parameters:
      name - SubServer Name
      Returns:
      Success Status
      Throws:
      InterruptedException
    • deleteSubServer

      public boolean deleteSubServer(UUID player, String name) throws InterruptedException
      Deletes a SubServer
      Parameters:
      player - Player Deleting
      name - SubServer Name
      Returns:
      Success Status
      Throws:
      InterruptedException
    • deleteSubServer

      protected abstract boolean deleteSubServer(UUID player, String name, boolean forced) throws InterruptedException
      Deletes a SubServer
      Parameters:
      player - Player Deleting
      name - SubServer Name
      forced - Forces the Deletion
      Returns:
      Success Status
      Throws:
      InterruptedException
    • forceDeleteSubServer

      public boolean forceDeleteSubServer(String name) throws InterruptedException
      Forces the Deletion of a SubServer
      Parameters:
      name - SubServer Name
      Returns:
      Success Status
      Throws:
      InterruptedException
    • forceDeleteSubServer

      public boolean forceDeleteSubServer(UUID player, String name) throws InterruptedException
      Forces the Deletion of a SubServer
      Parameters:
      player - Player Deleting
      name - SubServer Name
      Returns:
      Success Status
      Throws:
      InterruptedException
    • destroy

      public boolean destroy()
      Resets this Host object
      Returns:
      Success Status
    • getSignature

      public final String getSignature()
      Get the Signature of this Object
      Returns:
      Object Signature
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • addExtra

      public void addExtra(String handle, Object value)
      Specified by:
      addExtra in interface ExtraDataHandler<String>
    • hasExtra

      public boolean hasExtra(String handle)
      Specified by:
      hasExtra in interface ExtraDataHandler<String>
    • getExtra

      public ObjectMapValue getExtra(String handle)
      Specified by:
      getExtra in interface ExtraDataHandler<String>
    • getExtra

      public ObjectMap<String> getExtra()
      Specified by:
      getExtra in interface ExtraDataHandler<String>
    • removeExtra

      public void removeExtra(String handle)
      Specified by:
      removeExtra in interface ExtraDataHandler<String>
    • forSubData

      public ObjectMap<String> forSubData()