Class PlatformManager

java.lang.Object
com.sk89q.worldedit.extension.platform.PlatformManager

public class PlatformManager extends Object
Manages registered Platforms for WorldEdit. Platforms are implementations of WorldEdit.

This class is thread-safe.

  • Constructor Details

    • PlatformManager

      public PlatformManager(WorldEdit worldEdit)
      Create a new platform manager.
      Parameters:
      worldEdit - the WorldEdit instance
  • Method Details

    • register

      public void register(Platform platform)
      Register a platform with WorldEdit.
      Parameters:
      platform - the platform
    • unregister

      public boolean unregister(Platform platform)
      Unregister a platform from WorldEdit.

      If the platform has been chosen for any capabilities, then a new platform will be found.

      Parameters:
      platform - the platform
    • queryCapability

      public Platform queryCapability(Capability capability) throws NoCapablePlatformException
      Get the preferred platform for handling a certain capability. Throws if none are available.
      Parameters:
      capability - the capability
      Returns:
      the platform
      Throws:
      NoCapablePlatformException - thrown if no platform is capable
    • getPlatforms

      public List<Platform> getPlatforms()
      Get a list of loaded platforms.

      The returned list is a copy of the original and is mutable.

      Returns:
      a list of platforms
    • getWorldForEditing

      public World getWorldForEditing(World base)
      Given a world, possibly return the same world but using a different platform preferred for world editing operations.
      Parameters:
      base - the world to match
      Returns:
      the preferred world, if one was found, otherwise the given world
    • createProxyActor

      public <T extends Actor> T createProxyActor(T base)
      Given an actor, return a new one that may use a different platform for permissions and world editing.
      Parameters:
      base - the base actor to match
      Returns:
      a new delegate actor
    • getPlatformCommandManager

      public PlatformCommandManager getPlatformCommandManager()
      Get the command manager.
      Returns:
      the command manager
    • getConfiguration

      public LocalConfiguration getConfiguration()
      Get the current configuration.

      If no platform has been registered yet, then a default configuration will be returned.

      Returns:
      the configuration
    • getSupportedSideEffects

      public Collection<SideEffect> getSupportedSideEffects()
      Get the current supported SideEffects.
      Returns:
      the supported side effects
      Throws:
      NoCapablePlatformException - thrown if no platform is capable
    • isInitialized

      public boolean isInitialized()
      Get the initialized state of the Platform. Returns if the platform manager is initialized.
    • handlePlatformReady

      @Deprecated public void handlePlatformReady(PlatformReadyEvent event)
      Deprecated.
      You shouldn't have been calling this anyways, but this is now deprecated. Either don't fire this event at all, or fire the new event via the event bus if you're a platform.
    • handlePlatformsRegistered

      public void handlePlatformsRegistered(PlatformsRegisteredEvent event)
      Internal, do not call.
    • handleNewPlatformReady

      public void handleNewPlatformReady(PlatformReadyEvent event)
      Internal, do not call.
    • handleNewPlatformUnready

      public void handleNewPlatformUnready(PlatformUnreadyEvent event)
      Internal, do not call.
    • handleBlockInteract

      public void handleBlockInteract(BlockInteractEvent event)
    • handlePlayerInput

      public void handlePlayerInput(PlayerInputEvent event)