Interface Platform

All Superinterfaces:
Keyed
All Known Subinterfaces:
MultiUserPlatform
All Known Implementing Classes:
AbstractPlatform

public interface Platform extends Keyed
Represents a platform that WorldEdit has been implemented for.

It is strongly recommended that implementations extend from AbstractPlatform.

  • Method Details

    • getResourceLoader

      ResourceLoader getResourceLoader()
      Return the resource loader.
      Returns:
      The resource loader
    • getTranslationManager

      TranslationManager getTranslationManager()
    • getRegistries

      Registries getRegistries()
      Gets the registry holder.
      Returns:
      The registry holder
    • getDataVersion

      int getDataVersion()
      Gets the Minecraft data version being used by the platform.
      Returns:
      the data version
    • getDataFixer

      DataFixer getDataFixer()
      Get a DataFixer capable of upgrading old data.
      Returns:
      a data fixer, or null if not supported by this platform
    • isValidMobType

      boolean isValidMobType(String type)
      Checks if a mob type is valid.
      Parameters:
      type - The mob type name to check
      Returns:
      Whether the name is a valid mod type
    • reload

      void reload()
      Reload WorldEdit configuration.
    • schedule

      int schedule(long delay, long period, Runnable task)
      Schedules the given task to be invoked once every period ticks after an initial delay of delay ticks.
      Parameters:
      delay - Delay in server ticks before executing first repeat
      period - Period in server ticks of the task
      task - Task to be executed
      Returns:
      Task id number (-1 if scheduling failed)
    • getWatchdog

      @Nullable default Watchdog getWatchdog()
      Get the watchdog service.
      Returns:
      the watchdog service, or null if none
    • getWorlds

      List<? extends World> getWorlds()
      Get a list of available or loaded worlds.
      Returns:
      a list of worlds
    • matchPlayer

      @Nullable Player matchPlayer(Player player)
      Create a duplicate of the given player.

      The given player may have been provided by a different platform.

      Parameters:
      player - the player to match
      Returns:
      a matched player, otherwise null
    • matchWorld

      @Nullable World matchWorld(World world)
      Create a duplicate of the given world.

      The given world may have been provided by a different platform.

      Parameters:
      world - the world to match
      Returns:
      a matched world, otherwise null
    • registerCommands

      void registerCommands(org.enginehub.piston.CommandManager commandManager)
      Register the commands contained within the given command manager.

      This method should be ignored if the platform offers a command registration event.

      Parameters:
      commandManager - the command manager
    • registerGameHooks

      @Deprecated default void registerGameHooks()
      Deprecated.
      Call setGameHooksEnabled(boolean) with true instead
      Register game hooks.
    • setGameHooksEnabled

      void setGameHooksEnabled(boolean enabled)
      Set if the game hooks are enabled for this platform.
    • getConfiguration

      LocalConfiguration getConfiguration()
      Get the configuration from this platform.
      Returns:
      the configuration
    • getVersion

      String getVersion()
      Get the version of WorldEdit that this platform provides.

      This version should match WorldEdit releases because it may be checked to match.

      Returns:
      the version
    • getPlatformName

      String getPlatformName()
      Get a friendly name of the platform.

      The name can be anything (reasonable). An example name may be "Bukkit" or "Forge".

      Returns:
      the platform name
    • getPlatformVersion

      String getPlatformVersion()
      Get the version of the platform, which can be anything.
      Returns:
      the platform version
    • getId

      @NonAbstractForCompatibility(delegateName="getPlatformName", delegateParams={}) default String getId()
      The id of this object in the registry. Must be unique, and lowercase. Certain registries (e.g Namespaced ones) may have additional restrictions.
      Specified by:
      getId in interface Keyed
      Returns:
      an id
      API Note:
      This must be overridden by new subclasses. See NonAbstractForCompatibility for details
    • getCapabilities

      Map<Capability,Preference> getCapabilities()
      Get a map of advertised capabilities of this platform, where each key in the given map is a supported capability and the respective value indicates the preference for this platform for that given capability.
      Returns:
      a map of capabilities
    • getSupportedSideEffects

      Set<SideEffect> getSupportedSideEffects()
      Get a set of SideEffects supported by this platform.
      Returns:
      A set of supported side effects
    • getTickCount

      long getTickCount()
      Get the number of ticks since the server started. On some platforms this value may be an approximation based on the JVM run time.
      Returns:
      The number of ticks since the server started.