Class BungeeHelper

java.lang.Object
org.sgrewritten.stargate.util.BungeeHelper

public final class BungeeHelper extends Object
A helper class for dealing with BungeeCord
  • Method Details

    • getServerId

      public static void getServerId(String dataFolder, String internalFolder)
      Gets the server's unique ID

      If the server this plugin runs on is missing an id, a new unique id will be generated.

      Parameters:
      dataFolder -

      The folder containing plugin data

      internalFolder -

      The folder containing internal hidden files

    • getLegacyBungeeNetwork

      @Nullable public static @Nullable Network getLegacyBungeeNetwork(RegistryAPI registry, NetworkManager networkManager, String bungeeNetwork) throws UnimplementedFlagException
      Gets the legacy bungee network

      If the network doesn't already exist, it will be created

      Parameters:
      registry -

      The registry to use

      bungeeNetwork -

      The name of the legacy bungee network

      Returns:

      The legacy bungee network, or null if unobtainable

      Throws:
      UnimplementedFlagException -

      If an unimplemented network type was used in creation (should not trigger)

    • generateJsonMessage

      public static String generateJsonMessage(Portal portal, StargateProtocolRequestType requestType)
      Parameters:
      portal -

      The portal which was created or destroyed

      requestType -

      Whether the portal was created or destroyed

      Returns:

      A json string message

    • generateRenameNetworkMessage

      public static String generateRenameNetworkMessage(String newId, String oldId)
      Get json message for changing the id of a network
      Parameters:
      newId -

      The id to change to

      oldId -

      Previous id of the network

      Returns:

      A json string with a rename network message

    • generateRenamePortalMessage

      public static String generateRenamePortalMessage(String newName, String oldName, Network network)
      Parameters:
      newName -

      The new portal name to change to

      oldName -

      The previous portal name

      network -

      The network of the portal

      Returns:

      A json string with a rename portal message

    • generateTeleportJsonMessage

      public static String generateTeleportJsonMessage(String player, Portal portal)
      Parameters:
      player -

      The player to teleport

      portal -

      The portal to teleport to (in the other server)

      Returns:

      A json string with a teleport player message

    • generateLegacyTeleportMessage

      public static String generateLegacyTeleportMessage(String player, Portal portal)
      Parameters:
      player -

      The player to teleport

      portal -

      The portal to teleport

      Returns:

      A legacy format (csv-ish) with teleport message

    • canSendBungeeMessages

      public static boolean canSendBungeeMessages()
      To send bungee messages, it is required that a player is online and that stargate knows the server name as defined In the velocity / bungee config.
      Returns:

      True if the server can send bungee messages