添加载具碰撞指令
This commit is contained in:
parent
280a25ad3f
commit
7650ea3874
3 changed files with 52 additions and 3 deletions
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
package com.atsuishio.superbwarfare.command;
|
package com.atsuishio.superbwarfare.command;
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
||||||
|
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
|
||||||
import com.mojang.brigadier.arguments.BoolArgumentType;
|
import com.mojang.brigadier.arguments.BoolArgumentType;
|
||||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
|
@ -11,7 +11,6 @@ import net.minecraft.network.chat.Component;
|
||||||
public class ConfigCommand {
|
public class ConfigCommand {
|
||||||
|
|
||||||
public static LiteralArgumentBuilder<CommandSourceStack> get() {
|
public static LiteralArgumentBuilder<CommandSourceStack> get() {
|
||||||
|
|
||||||
return Commands.literal("config").requires(s -> s.hasPermission(0))
|
return Commands.literal("config").requires(s -> s.hasPermission(0))
|
||||||
.then(Commands.literal("explosionDestroy").requires(s -> s.hasPermission(2)).then(Commands.argument("value", BoolArgumentType.bool()).executes(context -> {
|
.then(Commands.literal("explosionDestroy").requires(s -> s.hasPermission(2)).then(Commands.argument("value", BoolArgumentType.bool()).executes(context -> {
|
||||||
var value = BoolArgumentType.getBool(context, "value");
|
var value = BoolArgumentType.getBool(context, "value");
|
||||||
|
@ -20,6 +19,48 @@ public class ConfigCommand {
|
||||||
|
|
||||||
context.getSource().sendSuccess(() -> Component.translatable(value ? "commands.config.explosion_destroy.enabled" : "commands.config.explosion_destroy.disabled"), true);
|
context.getSource().sendSuccess(() -> Component.translatable(value ? "commands.config.explosion_destroy.enabled" : "commands.config.explosion_destroy.disabled"), true);
|
||||||
return 0;
|
return 0;
|
||||||
})));
|
})))
|
||||||
|
.then(Commands.literal("collisionDestroy").requires(s -> s.hasPermission(2))
|
||||||
|
.then(Commands.literal("none").executes(context -> {
|
||||||
|
VehicleConfig.COLLISION_DESTROY_BLOCKS.set(false);
|
||||||
|
VehicleConfig.COLLISION_DESTROY_HARD_BLOCKS.set(false);
|
||||||
|
VehicleConfig.COLLISION_DESTROY_BLOCKS_BEASTLY.set(false);
|
||||||
|
|
||||||
|
VehicleConfig.COLLISION_DESTROY_BLOCKS.save();
|
||||||
|
|
||||||
|
context.getSource().sendSuccess(() -> Component.translatable("commands.config.collision_destroy.none"), true);
|
||||||
|
return 0;
|
||||||
|
}))
|
||||||
|
.then(Commands.literal("soft").executes(context -> {
|
||||||
|
VehicleConfig.COLLISION_DESTROY_BLOCKS.set(true);
|
||||||
|
VehicleConfig.COLLISION_DESTROY_HARD_BLOCKS.set(false);
|
||||||
|
VehicleConfig.COLLISION_DESTROY_BLOCKS_BEASTLY.set(false);
|
||||||
|
|
||||||
|
VehicleConfig.COLLISION_DESTROY_BLOCKS.save();
|
||||||
|
|
||||||
|
context.getSource().sendSuccess(() -> Component.translatable("commands.config.collision_destroy.soft"), true);
|
||||||
|
return 0;
|
||||||
|
}))
|
||||||
|
.then(Commands.literal("hard").executes(context -> {
|
||||||
|
VehicleConfig.COLLISION_DESTROY_BLOCKS.set(true);
|
||||||
|
VehicleConfig.COLLISION_DESTROY_HARD_BLOCKS.set(true);
|
||||||
|
VehicleConfig.COLLISION_DESTROY_BLOCKS_BEASTLY.set(false);
|
||||||
|
|
||||||
|
VehicleConfig.COLLISION_DESTROY_BLOCKS.save();
|
||||||
|
|
||||||
|
context.getSource().sendSuccess(() -> Component.translatable("commands.config.collision_destroy.hard"), true);
|
||||||
|
return 0;
|
||||||
|
}))
|
||||||
|
.then(Commands.literal("beastly").executes(context -> {
|
||||||
|
VehicleConfig.COLLISION_DESTROY_BLOCKS.set(true);
|
||||||
|
VehicleConfig.COLLISION_DESTROY_HARD_BLOCKS.set(true);
|
||||||
|
VehicleConfig.COLLISION_DESTROY_BLOCKS_BEASTLY.set(true);
|
||||||
|
|
||||||
|
VehicleConfig.COLLISION_DESTROY_BLOCKS.save();
|
||||||
|
|
||||||
|
context.getSource().sendSuccess(() -> Component.translatable("commands.config.collision_destroy.beastly"), true);
|
||||||
|
return 0;
|
||||||
|
}))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -488,6 +488,10 @@
|
||||||
"commands.ammo.no_permission": "Permission denied",
|
"commands.ammo.no_permission": "Permission denied",
|
||||||
"commands.config.explosion_destroy.enabled": "Enabled explosion destroy blocks",
|
"commands.config.explosion_destroy.enabled": "Enabled explosion destroy blocks",
|
||||||
"commands.config.explosion_destroy.disabled": "Disabled explosion destroy blocks",
|
"commands.config.explosion_destroy.disabled": "Disabled explosion destroy blocks",
|
||||||
|
"commands.config.collision_destroy.none": "Disabled vehicle collision destroy blocks",
|
||||||
|
"commands.config.collision_destroy.soft": "Enabled vehicle collision destroy blocks (Soft Mode)",
|
||||||
|
"commands.config.collision_destroy.hard": "Enabled vehicle collision destroy blocks (Hard Mode)",
|
||||||
|
"commands.config.collision_destroy.beastly": "Enabled vehicle collision destroy blocks (Beastly Mode)",
|
||||||
|
|
||||||
"tips.superbwarfare.sensitivity": "Current Sensitivity of This Gun: %1$s",
|
"tips.superbwarfare.sensitivity": "Current Sensitivity of This Gun: %1$s",
|
||||||
"tips.superbwarfare.monitor.linked": "Connect!",
|
"tips.superbwarfare.monitor.linked": "Connect!",
|
||||||
|
|
|
@ -486,6 +486,10 @@
|
||||||
"commands.ammo.no_permission": "权限不足",
|
"commands.ammo.no_permission": "权限不足",
|
||||||
"commands.config.explosion_destroy.enabled": "已开启爆炸破坏方块",
|
"commands.config.explosion_destroy.enabled": "已开启爆炸破坏方块",
|
||||||
"commands.config.explosion_destroy.disabled": "已关闭爆炸破坏方块",
|
"commands.config.explosion_destroy.disabled": "已关闭爆炸破坏方块",
|
||||||
|
"commands.config.collision_destroy.none": "已关闭载具碰撞破坏方块",
|
||||||
|
"commands.config.collision_destroy.soft": "已开启载具碰撞破坏方块(柔软模式)",
|
||||||
|
"commands.config.collision_destroy.hard": "已开启载具碰撞破坏方块(坚固模式)",
|
||||||
|
"commands.config.collision_destroy.beastly": "已开启载具碰撞破坏方块(野兽模式)",
|
||||||
|
|
||||||
"tips.superbwarfare.sensitivity": "当前枪械的灵敏度为:%1$s",
|
"tips.superbwarfare.sensitivity": "当前枪械的灵敏度为:%1$s",
|
||||||
"tips.superbwarfare.monitor.linked": "连接成功!",
|
"tips.superbwarfare.monitor.linked": "连接成功!",
|
||||||
|
|
Loading…
Add table
Reference in a new issue