Java Code Examples for com.mojang.brigadier.context.CommandContext#getArgument()
The following examples show how to use
com.mojang.brigadier.context.CommandContext#getArgument() .
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: Commands.java From BlueMap with MIT License | 6 votes |
public int cancelRenderTaskCommand(CommandContext<S> context) { CommandSource source = commandSourceInterface.apply(context.getSource()); String uuidString = context.getArgument("uuid", String.class); Optional<UUID> taskUUID = parseUUID(uuidString); if (!taskUUID.isPresent()) { source.sendMessage(Text.of(TextColor.RED, "Not a valid UUID: " + uuidString)); return 0; } for (RenderTask task : plugin.getRenderManager().getRenderTasks()) { if (task.getUuid().equals(taskUUID.get())) { plugin.getRenderManager().removeRenderTask(task); source.sendMessages(helper.createStatusMessage()); return 1; } } source.sendMessage(Text.of(TextColor.RED, "There is no render-task with this UUID: " + uuidString)); return 0; }
Example 2
Source File: Commands.java From BlueMap with MIT License | 6 votes |
public int prioritizeRenderTaskCommand(CommandContext<S> context) { CommandSource source = commandSourceInterface.apply(context.getSource()); String uuidString = context.getArgument("uuid", String.class); Optional<UUID> taskUUID = parseUUID(uuidString); if (!taskUUID.isPresent()) { source.sendMessage(Text.of(TextColor.RED, "Not a valid UUID: " + uuidString)); return 0; } for (RenderTask task : plugin.getRenderManager().getRenderTasks()) { if (task.getUuid().equals(taskUUID.get())) { plugin.getRenderManager().prioritizeRenderTask(task); source.sendMessages(helper.createStatusMessage()); return 1; } } source.sendMessage(Text.of(TextColor.RED, "There is no render-task with this UUID: " + uuidString)); return 0; }
Example 3
Source File: ServerCommandConfig.java From Better-Sprinting with Mozilla Public License 2.0 | 6 votes |
private static int execSetting(CommandContext<CommandSource> ctx){ String setting = ctx.getArgument(ARG_SETTINGS, String.class); boolean value = ctx.getArgument(ARG_BOOLEAN, Boolean.class); CommandSource source = ctx.getSource(); if (setting.equalsIgnoreCase(SETTING_SURVIVAL_FLY_BOOST)){ BetterSprintingMod.config.set(ServerSettings.enableSurvivalFlyBoost, value); BetterSprintingMod.config.save(); sendMessageTranslated(source, ServerSettings.enableSurvivalFlyBoost.get() ? "bs.command.enableFlyBoost" : "bs.command.disableFlyBoost", true); ServerNetwork.sendToAll(source.getServer().getPlayerList().getPlayers(), ServerNetwork.writeSettings(ServerSettings.enableSurvivalFlyBoost.get(), ServerSettings.enableAllDirs.get())); } else if (setting.equalsIgnoreCase(SETTING_RUN_IN_ALL_DIRS)){ BetterSprintingMod.config.set(ServerSettings.enableAllDirs, value); BetterSprintingMod.config.save(); sendMessageTranslated(source, ServerSettings.enableAllDirs.get() ? "bs.command.enableAllDirs" : "bs.command.disableAllDirs", true); ServerNetwork.sendToAll(source.getServer().getPlayerList().getPlayers(), ServerNetwork.writeSettings(ServerSettings.enableSurvivalFlyBoost.get(), ServerSettings.enableAllDirs.get())); } else{ execHelp(ctx); } return 0; }
Example 4
Source File: NMS_1_16_R1.java From 1.13-Command-API with Apache License 2.0 | 5 votes |
@Override public FloatRange getFloatRange(CommandContext cmdCtx, String key) { net.minecraft.server.v1_16_R1.CriterionConditionValue.FloatRange.FloatRange range = (net.minecraft.server.v1_16_R1.CriterionConditionValue.FloatRange.FloatRange) cmdCtx .getArgument(key, FloatRange.class); float low = range.a() == null ? -Float.MAX_VALUE : range.a(); float high = range.b() == null ? Float.MAX_VALUE : range.b(); return new FloatRange(low, high); }
Example 5
Source File: NMS_1_13_1.java From 1.13-Command-API with Apache License 2.0 | 5 votes |
@Override public FloatRange getFloatRange(CommandContext<?> cmdCtx, String key) { CriterionConditionValue.c range = cmdCtx.getArgument(key, CriterionConditionValue.c.class); float low = range.a() == null ? -Float.MAX_VALUE : range.a(); float high = range.b() == null ? Float.MAX_VALUE : range.b(); return new dev.jorel.commandapi.wrappers.FloatRange(low, high); }
Example 6
Source File: NMS_1_13.java From 1.13-Command-API with Apache License 2.0 | 5 votes |
@Override public FloatRange getFloatRange(CommandContext<?> cmdCtx, String key) { CriterionConditionValue.c range = cmdCtx.getArgument(key, CriterionConditionValue.c.class); float low = range.a() == null ? -Float.MAX_VALUE : range.a(); float high = range.b() == null ? Float.MAX_VALUE : range.b(); return new FloatRange(low, high); }
Example 7
Source File: NMS_1_15.java From 1.13-Command-API with Apache License 2.0 | 5 votes |
@Override public FloatRange getFloatRange(CommandContext cmdCtx, String key) { net.minecraft.server.v1_15_R1.CriterionConditionValue.FloatRange.FloatRange range = (net.minecraft.server.v1_15_R1.CriterionConditionValue.FloatRange.FloatRange) cmdCtx .getArgument(key, FloatRange.class); float low = range.a() == null ? -Float.MAX_VALUE : range.a(); float high = range.b() == null ? Float.MAX_VALUE : range.b(); return new FloatRange(low, high); }
Example 8
Source File: NMS_1_14_3.java From 1.13-Command-API with Apache License 2.0 | 5 votes |
@Override public dev.jorel.commandapi.wrappers.FloatRange getFloatRange(CommandContext<?> cmdCtx, String key) { FloatRange range = cmdCtx.getArgument(key, FloatRange.class); float low = range.a() == null ? -Float.MAX_VALUE : range.a(); float high = range.b() == null ? Float.MAX_VALUE : range.b(); return new dev.jorel.commandapi.wrappers.FloatRange(low, high); }
Example 9
Source File: NMS_1_13_2.java From 1.13-Command-API with Apache License 2.0 | 5 votes |
@Override public FloatRange getFloatRange(CommandContext<?> cmdCtx, String key) { CriterionConditionValue.FloatRange range = cmdCtx.getArgument(key, CriterionConditionValue.FloatRange.class); float low = range.a() == null ? -Float.MAX_VALUE : range.a(); float high = range.b() == null ? Float.MAX_VALUE : range.b(); return new FloatRange(low, high); }
Example 10
Source File: NMS_1_14_4.java From 1.13-Command-API with Apache License 2.0 | 5 votes |
@Override public dev.jorel.commandapi.wrappers.FloatRange getFloatRange(CommandContext<?> cmdCtx, String key) { FloatRange range = cmdCtx.getArgument(key, FloatRange.class); float low = range.a() == null ? -Float.MAX_VALUE : range.a(); float high = range.b() == null ? Float.MAX_VALUE : range.b(); return new dev.jorel.commandapi.wrappers.FloatRange(low, high); }
Example 11
Source File: BoolArgumentType.java From brigadier with MIT License | 4 votes |
public static boolean getBool(final CommandContext<?> context, final String name) { return context.getArgument(name, Boolean.class); }
Example 12
Source File: IntegerArgumentType.java From brigadier with MIT License | 4 votes |
public static int getInteger(final CommandContext<?> context, final String name) { return context.getArgument(name, int.class); }
Example 13
Source File: NMS_1_14_3.java From 1.13-Command-API with Apache License 2.0 | 4 votes |
@Override public int getTime(CommandContext<?> cmdCtx, String key) { return cmdCtx.getArgument(key, Integer.class); }
Example 14
Source File: FloatArgumentType.java From brigadier with MIT License | 4 votes |
public static float getFloat(final CommandContext<?> context, final String name) { return context.getArgument(name, Float.class); }
Example 15
Source File: NMS_1_15.java From 1.13-Command-API with Apache License 2.0 | 4 votes |
@Override public int getTime(CommandContext cmdCtx, String key) { return (Integer) cmdCtx.getArgument(key, Integer.class); }
Example 16
Source File: StringArgumentType.java From brigadier with MIT License | 4 votes |
public static String getString(final CommandContext<?> context, final String name) { return context.getArgument(name, String.class); }
Example 17
Source File: DoubleArgumentType.java From brigadier with MIT License | 4 votes |
public static double getDouble(final CommandContext<?> context, final String name) { return context.getArgument(name, Double.class); }
Example 18
Source File: NMS_1_16_R1.java From 1.13-Command-API with Apache License 2.0 | 4 votes |
@Override public Biome getBiome(CommandContext cmdCtx, String key) { MinecraftKey minecraftKey = (MinecraftKey) cmdCtx.getArgument(key, MinecraftKey.class); return Biome.valueOf(minecraftKey.getKey().toUpperCase()); }
Example 19
Source File: NMS_1_16_R1.java From 1.13-Command-API with Apache License 2.0 | 4 votes |
@Override public int getTime(CommandContext cmdCtx, String key) { return (Integer) cmdCtx.getArgument(key, Integer.class); }
Example 20
Source File: LongArgumentType.java From brigadier with MIT License | 4 votes |
public static long getLong(final CommandContext<?> context, final String name) { return context.getArgument(name, long.class); }