Class SubAPI

java.lang.Object
net.ME1312.SubServers.Bungee.SubAPI
All Implemented Interfaces:
BungeeAPI

public final class SubAPI extends Object implements BungeeAPI
SubAPI Class
  • Method Details

    • getInstance

      public static SubAPI getInstance()
      Gets the SubAPI Methods
      Returns:
      SubAPI
    • getInternals

      @Deprecated public SubProxy getInternals()
      Deprecated.
      Use SubAPI Methods when available
      Gets the SubServers Internals
      Specified by:
      getInternals in interface BungeeAPI
      Returns:
      SubPlugin Internals
    • addListener

      public void addListener(Runnable reload)
      Adds a SubAPI Reload Listener
      Parameters:
      reload - An Event that will be called after SubAPI is soft-reloaded
    • getSubDataNetwork

      public DataServer getSubDataNetwork()
      Gets the SubData Network
      Returns:
      SubData Network
    • getSubDataProtocol

      public DataProtocol getSubDataProtocol()
      Gets the SubData Network Protocol
      Returns:
      SubData Network Protocol
    • addHostDriver

      public void addHostDriver(Class<? extends Host> driver, String handle)
      Adds a Driver for Hosts
      Parameters:
      driver - Driver to add
      handle - Handle to Bind
    • getHostDrivers

      public List<String> getHostDrivers()
      Get a list of all available Host Drivers
      Returns:
      Host Driver handle list
    • getHosts

      public Map<String,Host> getHosts()
      Gets the Hosts
      Returns:
      Host Map
    • getHost

      public Host getHost(String name)
      Gets a Host
      Parameters:
      name - Host name
      Returns:
      a Host
    • addHost

      public Host addHost(String driver, String name, boolean enabled, com.google.common.collect.Range<Integer> ports, boolean log, InetAddress address, String directory, String gitBash) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException
      Add a Host to the Network
      Parameters:
      driver - Driver to initiate
      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
      Returns:
      The Host
      Throws:
      NoSuchMethodException
      IllegalAccessException
      InvocationTargetException
      InstantiationException
    • addHost

      public Host addHost(UUID player, String driver, String name, boolean enabled, com.google.common.collect.Range<Integer> ports, boolean log, InetAddress address, String directory, String gitBash) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException
      Add a Host to the Network
      Parameters:
      player - Player who added
      driver - Driver to initiate
      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
      Returns:
      The Host
      Throws:
      NoSuchMethodException
      IllegalAccessException
      InvocationTargetException
      InstantiationException
    • addHost

      public Host addHost(Class<? extends Host> driver, String name, boolean enabled, com.google.common.collect.Range<Integer> ports, boolean log, InetAddress address, String directory, String gitBash) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException
      Add a Host with a potentially unregistered driver to the Network
      Parameters:
      driver - Driver to initiate
      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
      Returns:
      The Host
      Throws:
      NoSuchMethodException
      IllegalAccessException
      InvocationTargetException
      InstantiationException
    • addHost

      public Host addHost(UUID player, Class<? extends Host> driver, String name, boolean enabled, com.google.common.collect.Range<Integer> ports, boolean log, InetAddress address, String directory, String gitBash) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException
      Add a Host with a potentially unregistered driver to the Network
      Parameters:
      player - Player who added
      driver - Driver to initiate
      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
      Returns:
      The Host
      Throws:
      NoSuchMethodException
      IllegalAccessException
      InvocationTargetException
      InstantiationException
    • addHost

      public boolean addHost(Host host)
      Add a Host with a potentially invalid/unregistered driver to the Network
      Parameters:
      host - Host to add
      Returns:
      Success status
    • addHost

      public boolean addHost(UUID player, Host host)
      Add a Host with a potentially invalid/unregistered driver to the Network
      Parameters:
      player - Player who added
      host - Host to add
      Returns:
      Success status
    • removeHost

      public boolean removeHost(String name)
      Remove a Host from the Network
      Parameters:
      name - Name of the Host
      Returns:
      Success Status
    • removeHost

      public boolean removeHost(UUID player, String name)
      Remove a Host from the Network
      Parameters:
      player - Player Removing
      name - Name of the Host
      Returns:
      Success Status
    • forceRemoveHost

      public boolean forceRemoveHost(String name)
      Force Remove a Host from the Network
      Parameters:
      name - Name of the Host
      Returns:
      Success Status
    • forceRemoveHost

      public boolean forceRemoveHost(UUID player, String name)
      Force Remove a Host from the Network
      Parameters:
      player - Player Removing
      name - Name of the Host
      Returns:
      Success Status
    • getGroups

      public Map<String,List<Server>> getGroups()
      Gets the Server Groups (Group names are case sensitive here)
      Returns:
      Group Map
    • getLowercaseGroups

      public Map<String,List<Server>> getLowercaseGroups()
      Gets the Server Groups (Group names are all lowercase here)
      Returns:
      Group Map
    • getGroup

      public Pair<String,List<Server>> getGroup(String name)
      Gets a Server Group (Group names are case insensitive here)
      Parameters:
      name - Group name
      Returns:
      a Server Group
    • getServers

      public Map<String,Server> getServers()
      Gets the Servers (including SubServers)
      Returns:
      Server Map
    • getServer

      public Server getServer(String name)
      Gets a Server
      Parameters:
      name - Server name
      Returns:
      a Server
    • addServer

      public Server addServer(String name, InetAddress ip, int port, String motd, boolean hidden, boolean restricted)
      Adds a Server to the Network
      Parameters:
      name - Name of the Server
      ip - IP of the Server
      port - Port of the Server
      motd - MOTD of the Server
      hidden - if the server should be hidden from players
      restricted - Players will need a permission to join if true
      Returns:
      The Server
    • addServer

      public Server addServer(UUID player, String name, InetAddress ip, int port, String motd, boolean hidden, boolean restricted)
      Adds a Server to the Network
      Parameters:
      player - Player who added
      name - Name of the Server
      ip - IP of the Server
      port - Port of the Server
      motd - MOTD of the Server
      hidden - If the server should be hidden from players
      restricted - Players will need a permission to join if true
      Returns:
      The Server
    • addServer

      public boolean addServer(Server server)
      Adds a Server to the Network
      Parameters:
      server - Server to add
      Returns:
      Success status
    • addServer

      public boolean addServer(UUID player, Server server)
      Adds a Server to the Network
      Parameters:
      player - Player who added
      server - Server to add
      Returns:
      Success status
    • removeServer

      public boolean removeServer(String name)
      Remove a Server from the Network
      Parameters:
      name - Name of the Server
      Returns:
      Success Status
    • removeServer

      public boolean removeServer(UUID player, String name)
      Remove a Server from the Network
      Parameters:
      player - Player Removing
      name - Name of the Server
      Returns:
      Success Status
    • forceRemoveServer

      public boolean forceRemoveServer(String name)
      Force Remove a Server from the Network
      Parameters:
      name - Name of the Server
      Returns:
      Success Status
    • forceRemoveServer

      public boolean forceRemoveServer(UUID player, String name)
      Force Remove a Server from the Network
      Parameters:
      player - Player Removing
      name - Name of the Server
      Returns:
      Success Status
    • getSubServers

      public Map<String,SubServer> getSubServers()
      Gets the SubServers
      Returns:
      SubServer Map
    • getSubServer

      public SubServer getSubServer(String name)
      Gets a SubServer
      Parameters:
      name - SubServer name
      Returns:
      a SubServer
    • getProxies

      public Map<String,Proxy> getProxies()
      Gets the known Proxies
      Returns:
      Proxy Map
    • getProxy

      public Proxy getProxy(String name)
      Gets a Proxy
      Parameters:
      name - Proxy name
      Returns:
      a Proxy
    • getMasterProxy

      public Proxy getMasterProxy()
      Get the Master Proxy Value
      Returns:
      Master Proxy
    • getRemotePlayerCount

      public int getRemotePlayerCount()
      Get the number of players on this network across all known proxies
      Specified by:
      getRemotePlayerCount in interface BungeeAPI
      Returns:
      Remote Player Count
    • getRemotePlayers

      public Map<UUID,RemotePlayer> getRemotePlayers(ServerInfo server)
      Get players on this server across all known proxies
      Specified by:
      getRemotePlayers in interface BungeeAPI
      Parameters:
      server - Server to search
      Returns:
      Remote Player Map
    • getRemotePlayers

      public Map<UUID,RemotePlayer> getRemotePlayers()
      Get players on this network across all known proxies
      Specified by:
      getRemotePlayers in interface BungeeAPI
      Returns:
      Remote Player Map
    • getRemotePlayer

      public RemotePlayer getRemotePlayer(String name)
      Get a player on this network by searching across all known proxies
      Specified by:
      getRemotePlayer in interface BungeeAPI
      Parameters:
      name - Player name
      Returns:
      Remote Player
    • getRemotePlayer

      public RemotePlayer getRemotePlayer(UUID id)
      Get a player on this network by searching across all known proxies
      Specified by:
      getRemotePlayer in interface BungeeAPI
      Parameters:
      id - Player UUID
      Returns:
      Remote Player
    • setLang

      public void setLang(String channel, String key, String value)
      Adds to the SubServers Lang
      Parameters:
      channel - Lang Channel
      key - Key
      value - Lang Value
    • getLangChannels

      public Collection<String> getLangChannels()
      Gets the current SubServers Lang Channels
      Specified by:
      getLangChannels in interface BungeeAPI
      Returns:
      SubServers Lang Channel list
    • getLang

      public Map<String,String> getLang(String channel)
      Gets values from the SubServers Lang
      Specified by:
      getLang in interface BungeeAPI
      Parameters:
      channel - Lang Channel
      Returns:
      Lang Value
    • signAnonymousObject

      public String signAnonymousObject()
      Get an Object Signature without linking the Signature to any object
      Returns:
      Anonymous Object Signature
    • signObject

      public String signObject(Object object)
      Signs an Object
      Parameters:
      object - Object to Sign
      Returns:
      Object's Signature (or an empty string if the object was null)
    • getObjectBySignature

      public <R> R getObjectBySignature(String signature)
      Get an Object by it's Signature
      Type Parameters:
      R - Expected Object Type
      Parameters:
      signature - Object's Signature
      Returns:
      Object that is tied to this Signature (or null if the signature is unknown)
    • invalidateObjectSignature

      public void invalidateObjectSignature(String signature)
      Invalidate an Object Signature. This will remove the link between the Signature and the Object
      Parameters:
      signature - Object's Signature
    • getRuntimeDirectory

      public File getRuntimeDirectory()
      Gets the Runtime Directory
      Specified by:
      getRuntimeDirectory in interface BungeeAPI
      Returns:
      Directory
    • getWrapperVersion

      public Version getWrapperVersion()
      Gets the SubServers Version
      Specified by:
      getWrapperVersion in interface BungeeAPI
      Returns:
      SubServers Version
    • getWrapperBuild

      public Version getWrapperBuild()
      Gets the SubServers Build Signature
      Specified by:
      getWrapperBuild in interface BungeeAPI
      Returns:
      SubServers Build Signature (or null if unsigned)
    • getProxyVersion

      public Version getProxyVersion()
      Gets the BungeeCord Version
      Specified by:
      getProxyVersion in interface BungeeAPI
      Returns:
      BungeeCord Version
    • getGameVersion

      public Version[] getGameVersion()
      Get an array of compatible Minecraft Versions
      Specified by:
      getGameVersion in interface BungeeAPI
      Returns:
      Minecraft Versions