Class ParserContext
java.lang.Object
com.sk89q.worldedit.extension.input.ParserContext
Contains contextual information that may be useful when constructing
objects from a registry (such as
MaskFactory).
By default, isRestricted() will return true.
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a new instance.ParserContext(ParserContext other) Creates a copy of another instance. -
Method Summary
Modifier and TypeMethodDescriptiongetActor()Get theActorset on this context.Get theExtentset on this context.org.enginehub.piston.inject.InjectedValueAccessintgetMaxY()Attempts to resolve the maximum Y value associated with this context or returns 255.intgetMinY()Attempts to resolve the minimum Y value associated with this context or returns 0.Attempts to retrieve the selection associated with this context.Get theLocalSession.getWorld()Get theWorldset on this context.booleanGet whether wildcards are preferred.booleanReturns whether there should be restrictions (as a result of limits or permissions) considered when parsing the input.booleanGet whether legacy IDs should be tried.Get theActorset on this context.Get theExtentset on this context.Get thePlayerset on this context.Get theLocalSession.Get theWorldset on this context.voidSet the actor.voidSet the extent.voidsetInjected(org.enginehub.piston.inject.InjectedValueAccess injected) voidsetPreferringWildcard(boolean preferringWildcard) Set whether wildcards are preferred.voidsetRestricted(boolean restricted) Set whether there should be restrictions (as a result of limits or permissions) considered when parsing the input.voidsetSession(LocalSession session) Set the session.voidsetTryLegacy(boolean tryLegacy) Set whether legacy IDs should be attempted.voidSet the world.
-
Constructor Details
-
ParserContext
public ParserContext()Create a new instance. -
ParserContext
Creates a copy of another instance.- Parameters:
other- the other instance
-
-
Method Details
-
getExtent
Get theExtentset on this context.- Returns:
- an extent
-
setExtent
Set the extent.- Parameters:
extent- an extent, or null if none is available
-
getSession
Get theLocalSession.- Returns:
- a session
-
setSession
Set the session.- Parameters:
session- a session, or null if none is available
-
getWorld
Get theWorldset on this context.- Returns:
- a world
-
setWorld
Set the world.- Parameters:
world- a world, or null if none is available
-
getActor
Get theActorset on this context.- Returns:
- an actor, or null
-
setActor
Set the actor.- Parameters:
actor- an actor, or null if none is available
-
requireExtent
Get theExtentset on this context.- Returns:
- an extent
- Throws:
InputParseException- thrown if noExtentis set
-
requireSession
Get theLocalSession.- Returns:
- a session
- Throws:
InputParseException- thrown if noLocalSessionis set
-
requireWorld
Get theWorldset on this context.- Returns:
- a world
- Throws:
InputParseException- thrown if noWorldis set
-
requireActor
Get theActorset on this context.- Returns:
- an actor
- Throws:
InputParseException- thrown if noActoris set
-
requirePlayer
Get thePlayerset on this context.- Returns:
- a player
- Throws:
InputParseException- thrown if noActoris 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
-
setInjected
public void setInjected(org.enginehub.piston.inject.InjectedValueAccess injected) -
getInjected
public org.enginehub.piston.inject.InjectedValueAccess getInjected() -
getMinY
public int getMinY()Attempts to resolve the minimum Y value associated with this context or returns 0. Caches both min and max y values.- Returns:
- Minimum y value (inclusive) or 0
-
getMaxY
public int getMaxY()Attempts to resolve the maximum Y value associated with this context or returns 255. Caches both min and max y values.- Returns:
- Maximum y value (inclusive) or 255
-
getSelection
Attempts to retrieve the selection associated with this context. Requires anActororLocalSessionbe supplied.- Returns:
- Region representing the selection for this context or null if it cannot be retrieved.
- Since:
- 2.2.0
-