From 7650ea387494126b2b193436842669a4b5fef64c Mon Sep 17 00:00:00 2001 From: 17146 <1714673995@qq.com> Date: Mon, 14 Apr 2025 20:22:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=BD=BD=E5=85=B7=E7=A2=B0?= =?UTF-8?q?=E6=92=9E=E6=8C=87=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../superbwarfare/command/ConfigCommand.java | 47 +++++++++++++++++-- .../assets/superbwarfare/lang/en_us.json | 4 ++ .../assets/superbwarfare/lang/zh_cn.json | 4 ++ 3 files changed, 52 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/atsuishio/superbwarfare/command/ConfigCommand.java b/src/main/java/com/atsuishio/superbwarfare/command/ConfigCommand.java index 0d5f0e1d0..f002eacd9 100644 --- a/src/main/java/com/atsuishio/superbwarfare/command/ConfigCommand.java +++ b/src/main/java/com/atsuishio/superbwarfare/command/ConfigCommand.java @@ -1,7 +1,7 @@ - package com.atsuishio.superbwarfare.command; import com.atsuishio.superbwarfare.config.server.ExplosionConfig; +import com.atsuishio.superbwarfare.config.server.VehicleConfig; import com.mojang.brigadier.arguments.BoolArgumentType; import com.mojang.brigadier.builder.LiteralArgumentBuilder; import net.minecraft.commands.CommandSourceStack; @@ -11,7 +11,6 @@ import net.minecraft.network.chat.Component; public class ConfigCommand { public static LiteralArgumentBuilder get() { - 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 -> { 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); 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; + })) + ); } } diff --git a/src/main/resources/assets/superbwarfare/lang/en_us.json b/src/main/resources/assets/superbwarfare/lang/en_us.json index 2702f8338..0391e16b7 100644 --- a/src/main/resources/assets/superbwarfare/lang/en_us.json +++ b/src/main/resources/assets/superbwarfare/lang/en_us.json @@ -488,6 +488,10 @@ "commands.ammo.no_permission": "Permission denied", "commands.config.explosion_destroy.enabled": "Enabled 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.monitor.linked": "Connect!", diff --git a/src/main/resources/assets/superbwarfare/lang/zh_cn.json b/src/main/resources/assets/superbwarfare/lang/zh_cn.json index cfa2441ba..f6ab02966 100644 --- a/src/main/resources/assets/superbwarfare/lang/zh_cn.json +++ b/src/main/resources/assets/superbwarfare/lang/zh_cn.json @@ -486,6 +486,10 @@ "commands.ammo.no_permission": "权限不足", "commands.config.explosion_destroy.enabled": "已开启爆炸破坏方块", "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.monitor.linked": "连接成功!",