Class ParserContext

java.lang.Object
com.sk89q.worldedit.extension.input.ParserContext

public class ParserContext extends Object
Contains contextual information that may be useful when constructing objects from a registry (such as MaskFactory).

By default, isRestricted() will return true.

  • Constructor Details

    • ParserContext

      public ParserContext()
      Create a new instance.
    • ParserContext

      public ParserContext(ParserContext other)
      Creates a copy of another instance.
      Parameters:
      other - the other instance
  • Method Details

    • getExtent

      @Nullable public Extent getExtent()
      Get the Extent set on this context.
      Returns:
      an extent
    • setExtent

      public void setExtent(@Nullable Extent extent)
      Set the extent.
      Parameters:
      extent - an extent, or null if none is available
    • getSession

      @Nullable public LocalSession getSession()
      Get the LocalSession.
      Returns:
      a session
    • setSession

      public void setSession(@Nullable LocalSession session)
      Set the session.
      Parameters:
      session - a session, or null if none is available
    • getWorld

      @Nullable public World getWorld()
      Get the World set on this context.
      Returns:
      a world
    • setWorld

      public void setWorld(@Nullable World world)
      Set the world.
      Parameters:
      world - a world, or null if none is available
    • getActor

      @Nullable public Actor getActor()
      Get the Actor set on this context.
      Returns:
      an actor, or null
    • setActor

      public void setActor(@Nullable Actor actor)
      Set the actor.
      Parameters:
      actor - an actor, or null if none is available
    • requireExtent

      public Extent requireExtent() throws InputParseException
      Get the Extent set on this context.
      Returns:
      an extent
      Throws:
      InputParseException - thrown if no Extent is set
    • requireSession

      public LocalSession requireSession() throws InputParseException
      Get the LocalSession.
      Returns:
      a session
      Throws:
      InputParseException - thrown if no LocalSession is set
    • requireWorld

      public World requireWorld() throws InputParseException
      Get the World set on this context.
      Returns:
      a world
      Throws:
      InputParseException - thrown if no World is set
    • requireActor

      public Actor requireActor() throws InputParseException
      Get the Actor set on this context.
      Returns:
      an actor
      Throws:
      InputParseException - thrown if no Actor is set
    • isRestricted

      public boolean isRestricted()
      Returns whether there should be restrictions (as a result of limits or permissions) considered when parsing the input.
      Returns:
      true if restricted
    • setRestricted

      public void setRestricted(boolean restricted)
      Set whether there should be restrictions (as a result of limits or permissions) considered when parsing the input.
      Parameters:
      restricted - true if restricted
    • isPreferringWildcard

      public boolean isPreferringWildcard()
      Get whether wildcards are preferred.
      Returns:
      true if wildcards are preferred
    • setPreferringWildcard

      public void setPreferringWildcard(boolean preferringWildcard)
      Set whether wildcards are preferred.
      Parameters:
      preferringWildcard - true if wildcards are preferred
    • setTryLegacy

      public void setTryLegacy(boolean tryLegacy)
      Set whether legacy IDs should be attempted.
      Parameters:
      tryLegacy - true if legacy IDs should be attempted
    • isTryingLegacy

      public boolean isTryingLegacy()
      Get whether legacy IDs should be tried.
      Returns:
      true if legacy should be tried