com.mojang.brigadier.arguments.BoolArgumentType Java Examples
The following examples show how to use
com.mojang.brigadier.arguments.BoolArgumentType.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SpigotMapperTest.java From Chimera with MIT License | 5 votes |
@Test void type() { var bool = BoolArgumentType.bool(); assertEquals(bool, mapper.type(Argument.of("test", bool).build())); assertEquals(PlayerType.WORD, mapper.type(Argument.of("test", new PlayerType()).build())); }
Example #2
Source File: SpawnCommand.java From fabric-carpet with MIT License | 4 votes |
public static void register(CommandDispatcher<ServerCommandSource> dispatcher) { LiteralArgumentBuilder<ServerCommandSource> literalargumentbuilder = literal("spawn"). requires((player) -> SettingsManager.canUseCommand(player, CarpetSettings.commandSpawn)); literalargumentbuilder. then(literal("list"). then(argument("pos", BlockPosArgumentType.blockPos()). executes( (c) -> listSpawns(c.getSource(), BlockPosArgumentType.getBlockPos(c, "pos"))))). then(literal("tracking"). executes( (c) -> printTrackingReport(c.getSource())). then(literal("start"). executes( (c) -> startTracking(c.getSource(), null, null)). then(argument("from", BlockPosArgumentType.blockPos()). then(argument("to", BlockPosArgumentType.blockPos()). executes( (c) -> startTracking( c.getSource(), BlockPosArgumentType.getBlockPos(c, "from"), BlockPosArgumentType.getBlockPos(c, "to")))))). then(literal("stop"). executes( (c) -> stopTracking(c.getSource()))). then(argument("type", word()). suggests( (c, b) -> suggestMatching(Arrays.stream(EntityCategory.values()).map(EntityCategory::getName),b)). executes( (c) -> recentSpawnsForType(c.getSource(), getString(c, "type"))))). then(literal("test"). executes( (c)-> runTest(c.getSource(), 72000, null)). then(argument("ticks", integer(10,720000)). executes( (c)-> runTest( c.getSource(), getInteger(c, "ticks"), null)). then(argument("counter", word()). suggests( (c, b) -> suggestMatching(Arrays.stream(DyeColor.values()).map(DyeColor::toString),b)). executes((c)-> runTest( c.getSource(), getInteger(c, "ticks"), getString(c, "counter")))))). then(literal("mocking"). then(argument("to do or not to do?", BoolArgumentType.bool()). executes( (c) -> toggleMocking(c.getSource(), BoolArgumentType.getBool(c, "to do or not to do?"))))). then(literal("rates"). executes( (c) -> generalMobcaps(c.getSource())). then(literal("reset"). executes( (c) -> resetSpawnRates(c.getSource()))). then(argument("type", word()). suggests( (c, b) -> suggestMatching(Arrays.stream(EntityCategory.values()).map(EntityCategory::getName),b)). then(argument("rounds", integer(0)). suggests( (c, b) -> suggestMatching(new String[]{"1"},b)). executes( (c) -> setSpawnRates( c.getSource(), getString(c, "type"), getInteger(c, "rounds")))))). then(literal("mobcaps"). executes( (c) -> generalMobcaps(c.getSource())). then(literal("set"). then(argument("cap (hostile)", integer(1,1400)). executes( (c) -> setMobcaps(c.getSource(), getInteger(c, "cap (hostile)"))))). then(argument("dimension", DimensionArgumentType.dimension()). executes( (c)-> mobcapsForDimension(c.getSource(), DimensionArgumentType.getDimensionArgument(c, "dimension"))))). then(literal("entities"). executes( (c) -> generalMobcaps(c.getSource()) ). then(argument("type", string()). suggests( (c, b)->suggestMatching(Arrays.stream(EntityCategory.values()).map(EntityCategory::getName), b)). executes( (c) -> listEntitiesOfType(c.getSource(), getString(c, "type"), false)). then(literal("all").executes( (c) -> listEntitiesOfType(c.getSource(), getString(c, "type"), true))))); dispatcher.register(literalargumentbuilder); }
Example #3
Source File: BooleanArgument.java From 1.13-Command-API with Apache License 2.0 | 4 votes |
/** * An Boolean argument */ public BooleanArgument() { super(BoolArgumentType.bool()); }