Class SpongeServerProvider

java.lang.Object
net.tnemc.plugincore.sponge.impl.SpongeServerProvider
All Implemented Interfaces:
ServerConnector

public class SpongeServerProvider extends Object implements ServerConnector
SpongeServerProvider
Since:
0.1.2.0
Author:
creatorfromhell
  • Constructor Details Link icon

  • Method Details Link icon

    • name Link icon

      public String name()
      Description copied from interface: ServerConnector
      The name of this implementation.
      Specified by:
      name in interface ServerConnector
      Returns:
      The name of the implementation.
    • replacePlaceholder Link icon

      public String replacePlaceholder(UUID player, String message)
      Used to replace placeholders from a string.
      Specified by:
      replacePlaceholder in interface ServerConnector
      Parameters:
      player - The player to use for the placeholder replacement.
      message - The message to replace placeholders in.
      Returns:
      The string after placeholders have been replaced.
    • proxy Link icon

      public ProxyProvider proxy()
      The proxy provider to use for this implementation.
      Specified by:
      proxy in interface ServerConnector
      Returns:
      The proxy provider to use for this implementation.
    • source Link icon

      public CmdSource<?> source(@NotNull @NotNull revxrsal.commands.command.CommandActor actor)
      Used to convert an CommandActor to a CmdSource.
      Specified by:
      source in interface ServerConnector
      Parameters:
      actor - The command actor.
      Returns:
      The CmdSource for this actor.
    • onlinePlayers Link icon

      public int onlinePlayers()
      Used to get the amount of online players.
      Specified by:
      onlinePlayers in interface ServerConnector
      Returns:
      The amount of online players.
    • findPlayer Link icon

      public Optional<PlayerProvider> findPlayer(@NotNull @NotNull UUID identifier)
      Attempts to find a player based on an identifier.
      Specified by:
      findPlayer in interface ServerConnector
      Parameters:
      identifier - The identifier
      Returns:
      An Optional containing the located player, or an empty Optional if no player is located.
    • initializePlayer Link icon

      public PlayerProvider initializePlayer(@NotNull @NotNull Object player)
      This is used to return an instance of an player based on the provided instance's player object.
      Specified by:
      initializePlayer in interface ServerConnector
      Parameters:
      player - The instance of the player.
      Returns:
      The initialized player object.
    • playedBefore Link icon

      public boolean playedBefore(UUID identifier)
      Used to determine if this player has played on this server before.
      Specified by:
      playedBefore in interface ServerConnector
      Parameters:
      identifier - The UUID that is associated with the player.
      Returns:
      True if the player has played on the server before, otherwise false.
    • playedBefore Link icon

      public boolean playedBefore(String name)
      Used to determine if a player with the specified username has played before.
      Specified by:
      playedBefore in interface ServerConnector
      Parameters:
      name - The username to search for.
      Returns:
      True if someone with the specified username has played before, otherwise false.
    • online Link icon

      public boolean online(String name)
      Used to determine if a player with the specified username is online.
      Specified by:
      online in interface ServerConnector
      Parameters:
      name - The username to search for.
      Returns:
      True if someone with the specified username is online.
    • fromName Link icon

      public Optional<UUID> fromName(String name)
      Description copied from interface: ServerConnector
      Used to locate a UUID for a specific name. This could be called from either a primary or secondary thread, and should not call back to the Mojang API ever.
      Specified by:
      fromName in interface ServerConnector
      Parameters:
      name - The name to use for the search.
      Returns:
      An optional containing the UUId if exists, otherwise false.
    • fromID Link icon

      public Optional<String> fromID(UUID id)
      Used to locate a username for a specific name. This could be called from either a primary or secondary thread, and should not call back to the Mojang API ever.
      Specified by:
      fromID in interface ServerConnector
      Parameters:
      id - The UUID to use for the search.
      Returns:
      An optional containing the name if exists, otherwise false.
    • defaultWorld Link icon

      public String defaultWorld()
      Returns the name of the default world.
      Specified by:
      defaultWorld in interface ServerConnector
      Returns:
      The name of the default world.
    • replaceColours Link icon

      public String replaceColours(String string, boolean strip)
      Used to replace colour codes in a string.
      Specified by:
      replaceColours in interface ServerConnector
      Parameters:
      string - The string to format.
      strip - If true, the color codes are striped from the string.
      Returns:
      The formatted string.
    • stackBuilder Link icon

      public net.tnemc.item.AbstractItemStack<?> stackBuilder()
      Description copied from interface: ServerConnector
      Provides direct access to the implementation's instance of TNIL's AbstractItemStack, which acts as a builder.
      Specified by:
      stackBuilder in interface ServerConnector
      Returns:
      The software's implementation of AbstractItemStack.
    • saveResource Link icon

      public void saveResource(String resourcePath, boolean replace)
      Description copied from interface: ServerConnector
      Used to save a resource from the plugin's jar file to the local system's storage.
      Specified by:
      saveResource in interface ServerConnector
      Parameters:
      resourcePath - The path to the resource inside the jar.
      replace - If the file exists in the local system's storage, should it be replaced?
    • scheduler Link icon

      Provides this implementation's scheduler.
      Specified by:
      scheduler in interface ServerConnector
      Returns:
      The scheduler for this implementation.
    • registerCrafting Link icon

      public void registerCrafting(@NotNull @NotNull String key, @NotNull @NotNull CraftingRecipe recipe)
      Used to register a crafting recipe to the server.
      Specified by:
      registerCrafting in interface ServerConnector
      Parameters:
      key - The key for the crafting recipe to be registered.
      recipe - The crafting recipe to register.
      See Also:
    • calculations Link icon

      public net.tnemc.sponge.SpongeItemCalculationsProvider calculations()
      Specified by:
      calculations in interface ServerConnector
    • getResource Link icon

      @Nullable public @Nullable InputStream getResource(@NotNull @NotNull String filename)
      Description copied from interface: ServerConnector
      Retrieves an input stream for the specified filename from the resources.
      Specified by:
      getResource in interface ServerConnector
      Parameters:
      filename - The name of the file to retrieve from the resources. Cannot be null.
      Returns:
      An input stream for the specified file, or null if the file is not found in the resources.