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
ConstructorDescriptionCreate a new instance.ParserContext
(ParserContext other) Creates a copy of another instance. -
Method Summary
Modifier and TypeMethodDescriptiongetActor()
Get theActor
set on this context.Get theExtent
set on this context.org.enginehub.piston.inject.InjectedValueAccess
int
getMaxY()
Attempts to resolve the maximum Y value associated with this context or returns 255.int
getMinY()
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 theWorld
set on this context.boolean
Get whether wildcards are preferred.boolean
Returns whether there should be restrictions (as a result of limits or permissions) considered when parsing the input.boolean
Get whether legacy IDs should be tried.Get theActor
set on this context.Get theExtent
set on this context.Get thePlayer
set on this context.Get theLocalSession
.Get theWorld
set on this context.void
Set the actor.void
Set the extent.void
setInjected
(org.enginehub.piston.inject.InjectedValueAccess injected) void
setPreferringWildcard
(boolean preferringWildcard) Set whether wildcards are preferred.void
setRestricted
(boolean restricted) Set whether there should be restrictions (as a result of limits or permissions) considered when parsing the input.void
setSession
(LocalSession session) Set the session.void
setTryLegacy
(boolean tryLegacy) Set whether legacy IDs should be attempted.void
Set 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 theExtent
set 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 theWorld
set on this context.- Returns:
- a world
-
setWorld
Set the world.- Parameters:
world
- a world, or null if none is available
-
getActor
Get theActor
set on this context.- Returns:
- an actor, or null
-
setActor
Set the actor.- Parameters:
actor
- an actor, or null if none is available
-
requireExtent
Get theExtent
set on this context.- Returns:
- an extent
- Throws:
InputParseException
- thrown if noExtent
is set
-
requireSession
Get theLocalSession
.- Returns:
- a session
- Throws:
InputParseException
- thrown if noLocalSession
is set
-
requireWorld
Get theWorld
set on this context.- Returns:
- a world
- Throws:
InputParseException
- thrown if noWorld
is set
-
requireActor
Get theActor
set on this context.- Returns:
- an actor
- Throws:
InputParseException
- thrown if noActor
is set
-
requirePlayer
Get thePlayer
set on this context.- Returns:
- a player
- Throws:
InputParseException
- thrown if noActor
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
-
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 anActor
orLocalSession
be supplied.- Returns:
- Region representing the selection for this context or null if it cannot be retrieved.
- Since:
- 2.2.0
-