CommandAPI 9.3.0
An API for the command UI introduced in Minecraft 1.13
com.mojang.brigadier.arguments.BoolArgumentType Class Reference

An ArgumentType that parses booleans. More...

+ Inheritance diagram for com.mojang.brigadier.arguments.BoolArgumentType:

Public Member Functions

Boolean parse (final StringReader reader) throws CommandSyntaxException
 
Collection< String > getExamples ()
 

Static Public Member Functions

static BoolArgumentType bool ()
 A factory method as a simple way to get an instance. More...
 
static boolean getBool (final CommandContext<?> context, final String name)
 Retrieves the argument with the given name from the context and casts it to a boolean. More...
 

Detailed Description

An ArgumentType that parses booleans.

Member Function Documentation

◆ bool()

static BoolArgumentType com.mojang.brigadier.arguments.BoolArgumentType.bool ( )
static

A factory method as a simple way to get an instance.

It is recommended to statically import this method to provide an interface similar to:
argument("name", bool())

Returns
an instance of this class

◆ getBool()

static boolean com.mojang.brigadier.arguments.BoolArgumentType.getBool ( final CommandContext<?>  context,
final String  name 
)
static

Retrieves the argument with the given name from the context and casts it to a boolean.

Parameters
contextthe context to get the argument from, calls CommandContext#getArgument
namethe name of the argument to retrieve
Returns
the argument as a boolean
See also
CommandContext::getArgument