diff --git a/gradle.properties b/gradle.properties index 7856743..5df0e94 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,7 +10,7 @@ loader_version=0.14.21 fabric_version=0.84.0+1.20.1 # Mod Properties -mod_version = 1.3.0 +mod_version = 1.3.1 maven_group = cn.noryea archives_base_name = manhunt-fabric diff --git a/src/main/java/cn/noryea/manhunt/ManhuntCommand.java b/src/main/java/cn/noryea/manhunt/ManhuntCommand.java index 57ee5e8..9f10080 100644 --- a/src/main/java/cn/noryea/manhunt/ManhuntCommand.java +++ b/src/main/java/cn/noryea/manhunt/ManhuntCommand.java @@ -40,6 +40,8 @@ public static void registerCommands(CommandDispatcher dis, C .executes((ctx) -> executeTeamLimit(ctx.getSource(), TeamArgument.getTeam(ctx, "team"), IntegerArgumentType.getInteger(ctx, "limit")))))) .then(Commands.literal("clearTeams").requires((src) -> src.hasPermission(2)) .executes((ctx) -> executeClearTeams(ctx.getSource()))) + .then(Commands.literal("leave") + .executes((ctx) -> executeLeave(ctx.getSource()))) .then(Commands.literal("cure").requires((src) -> src.hasPermission(2)) .then(Commands.argument("targets", EntityArgument.players()) .executes((ctx) -> executeCure(ctx.getSource(), EntityArgument.getPlayers(ctx, "targets"))))) @@ -139,6 +141,13 @@ private static int executeClearTeams(CommandSourceStack source) { return 1; } + private static int executeLeave(CommandSourceStack source) { + Scoreboard scoreboard = source.getServer().getScoreboard(); + scoreboard.removePlayerFromTeam(source.getPlayer().getScoreboardName()); + source.sendSuccess(() -> Component.translatable("commands.team.leave.success.single", source.getPlayer().getDisplayName()), true); + return 1; + } + private static int executeCompassDelay(CommandSourceStack source, Integer delay) { config.setDelay(delay); source.sendSuccess(() -> Component.translatable("manhunt.commands.delay", delay), true);