pub(crate) struct CommandContext<S, R = BrigadierRuntime>where
R: CommandRuntime<S>,{
source: Arc<S>,
input: Arc<str>,
root: NodeId,
arguments: Arc<ParsedArguments<R::ArgumentValue>>,
executor: Option<Arc<R::Executor>>,
nodes: Arc<[ParsedCommandNode]>,
range: StringRange,
child: Option<Arc<Self>>,
modifier: Option<Arc<R::Modifier>>,
forks: bool,
}Expand description
Immutable parsed input supplied to commands and redirect modifiers.
Fields§
§source: Arc<S>§input: Arc<str>§root: NodeId§arguments: Arc<ParsedArguments<R::ArgumentValue>>§executor: Option<Arc<R::Executor>>§nodes: Arc<[ParsedCommandNode]>§range: StringRange§child: Option<Arc<Self>>§modifier: Option<Arc<R::Modifier>>§forks: boolImplementations§
Source§impl<S, R> CommandContext<S, R>where
R: CommandRuntime<S>,
impl<S, R> CommandContext<S, R>where
R: CommandRuntime<S>,
Sourcepub(crate) const fn root(&self) -> NodeId
pub(crate) const fn root(&self) -> NodeId
Returns the root at which this context segment began parsing.
Sourcepub(crate) fn nodes(&self) -> &[ParsedCommandNode]
pub(crate) fn nodes(&self) -> &[ParsedCommandNode]
Returns all nodes consumed by this context segment.
Sourcepub(crate) const fn range(&self) -> StringRange
pub(crate) const fn range(&self) -> StringRange
Returns the range covered by this context segment.
Sourcepub(crate) fn argument(&self, name: &str) -> Option<&R::ArgumentValue>
pub(crate) fn argument(&self, name: &str) -> Option<&R::ArgumentValue>
Returns a parsed runtime argument by name.
pub(super) const fn child_arc(&self) -> Option<&Arc<Self>>
pub(crate) fn executor(&self) -> Option<&R::Executor>
pub(crate) fn modifier(&self) -> Option<&R::Modifier>
pub(crate) const fn is_forked(&self) -> bool
pub(crate) fn copy_for(&self, source: Arc<S>) -> Self
Source§impl<S, R> CommandContext<S, R>
impl<S, R> CommandContext<S, R>
Source§impl<S> CommandContext<S, SteelCommandRuntime>where
S: ExecutionCommandSource,
impl<S> CommandContext<S, SteelCommandRuntime>where
S: ExecutionCommandSource,
fn typed_argument<T: DowncastType>(&self, name: &str) -> Option<&T>
Sourcepub(crate) fn time(&self, name: &str) -> Option<i32>
pub(crate) fn time(&self, name: &str) -> Option<i32>
Returns a parsed Minecraft time argument in ticks.
Sourcepub(crate) fn coordinates(&self, name: &str) -> Option<Coordinates>
pub(crate) fn coordinates(&self, name: &str) -> Option<Coordinates>
Returns a parsed coordinate expression without resolving it early.
Sourcepub(crate) fn entity_anchor(&self, name: &str) -> Option<EntityAnchor>
pub(crate) fn entity_anchor(&self, name: &str) -> Option<EntityAnchor>
Returns a parsed entity position anchor.
pub(crate) fn swizzle(&self, name: &str) -> Option<CoordinateAxes>
pub(crate) fn heightmap(&self, name: &str) -> Option<HeightmapType>
pub(crate) fn score_holder_argument( &self, name: &str, ) -> Option<&ScoreHolderArgument>
pub(crate) fn objective_name(&self, name: &str) -> Option<&str>
pub(crate) fn int_range(&self, name: &str) -> Option<IntRange>
pub(crate) fn biome_or_tag(&self, name: &str) -> Option<&BiomeOrTag>
pub(crate) fn structure_or_tag_key( &self, name: &str, ) -> Option<&StructureOrTagKey>
pub(crate) fn block_predicate(&self, name: &str) -> Option<&BlockPredicate>
Sourcepub(crate) fn domain(&self, name: &str) -> Option<&str>
pub(crate) fn domain(&self, name: &str) -> Option<&str>
Returns a configured Steel domain name.
pub(crate) fn world_argument(&self, name: &str) -> Option<&WorldArgument>
Sourcepub(crate) fn game_mode(&self, name: &str) -> Option<GameType>
pub(crate) fn game_mode(&self, name: &str) -> Option<GameType>
Returns a parsed vanilla game mode.
pub(crate) fn entity_type(&self, name: &str) -> Option<EntityTypeRef>
pub(crate) fn enchantment(&self, name: &str) -> Option<EnchantmentRef>
pub(crate) fn damage_type(&self, name: &str) -> Option<DamageTypeRef>
pub(crate) fn item_stack(&self, name: &str) -> Option<&ItemStack>
pub(crate) fn item_predicate(&self, name: &str) -> Option<&ItemPredicate>
pub(crate) fn text_component(&self, name: &str) -> Option<&TextComponent>
pub(crate) fn nbt_path(&self, name: &str) -> Option<&NbtPath>
pub(crate) fn identifier(&self, name: &str) -> Option<&Identifier>
pub(crate) fn world_clock(&self, name: &str) -> Option<WorldClockRef>
pub(crate) fn timeline(&self, name: &str) -> Option<TimelineRef>
pub(crate) fn entity_selector(&self, name: &str) -> Option<&EntitySelector>
pub(crate) fn game_profile_argument( &self, name: &str, ) -> Option<&GameProfileArgument>
pub(crate) fn permission_rule_expression( &self, name: &str, ) -> Option<&PermissionRuleExpression>
pub(crate) fn permission_metadata_expression( &self, name: &str, ) -> Option<&PermissionMetadataExpression>
pub(crate) fn permission_group( &self, name: &str, ) -> Option<&PermissionGroupName>
Source§impl CommandContext<CommandSource, SteelCommandRuntime>
impl CommandContext<CommandSource, SteelCommandRuntime>
pub(crate) fn score_holders( &self, name: &str, wildcard: ScoreHolderWildcard, ) -> Result<Vec<ScoreHolder>, CommandSyntaxError>
pub(crate) fn score_holder( &self, name: &str, ) -> Result<ScoreHolder, CommandSyntaxError>
pub(crate) fn optional_entities( &self, name: &str, ) -> Result<Vec<SharedEntity>, CommandSyntaxError>
pub(crate) fn entities( &self, name: &str, ) -> Result<Vec<SharedEntity>, CommandSyntaxError>
pub(crate) fn entity( &self, name: &str, ) -> Result<SharedEntity, CommandSyntaxError>
pub(crate) fn optional_players( &self, name: &str, ) -> Result<Vec<Arc<Player>>, CommandSyntaxError>
pub(crate) fn players( &self, name: &str, ) -> Result<Vec<Arc<Player>>, CommandSyntaxError>
pub(crate) fn player( &self, name: &str, ) -> Result<Arc<Player>, CommandSyntaxError>
Auto Trait Implementations§
impl<S, R> Freeze for CommandContext<S, R>
impl<S, R> RefUnwindSafe for CommandContext<S, R>where
S: RefUnwindSafe,
<R as CommandRuntime<S>>::Executor: RefUnwindSafe,
<R as CommandRuntime<S>>::Modifier: RefUnwindSafe,
<R as CommandRuntime<S>>::ArgumentValue: RefUnwindSafe,
impl<S, R> Send for CommandContext<S, R>
impl<S, R> Sync for CommandContext<S, R>
impl<S, R> Unpin for CommandContext<S, R>
impl<S, R> UnsafeUnpin for CommandContext<S, R>
impl<S, R> UnwindSafe for CommandContext<S, R>where
S: RefUnwindSafe,
<R as CommandRuntime<S>>::Executor: RefUnwindSafe,
<R as CommandRuntime<S>>::Modifier: RefUnwindSafe,
<R as CommandRuntime<S>>::ArgumentValue: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreWraps this value in an
Arc<SyncMutex<>>