From afb73412626a3345922d6b1ad168602bd841fdf1 Mon Sep 17 00:00:00 2001 From: Alessandro Proto Date: Fri, 1 Nov 2024 10:30:23 +0100 Subject: [PATCH] Fix resetting existing home throws homes limit reached error --- gradle.properties | 2 +- .../cc/reconnected/server/commands/home/SetHomeCommand.java | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/gradle.properties b/gradle.properties index 80c0c07..3883efa 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ yarn_mappings=1.20.1+build.10 loader_version=0.16.7 # Mod Properties -mod_version=1.16.3 +mod_version=1.16.4 maven_group=cc.reconnected archives_base_name=rcc-server diff --git a/src/main/java/cc/reconnected/server/commands/home/SetHomeCommand.java b/src/main/java/cc/reconnected/server/commands/home/SetHomeCommand.java index 9c34aba..09791dc 100644 --- a/src/main/java/cc/reconnected/server/commands/home/SetHomeCommand.java +++ b/src/main/java/cc/reconnected/server/commands/home/SetHomeCommand.java @@ -47,7 +47,8 @@ public class SetHomeCommand { var homes = playerState.homes; - if (homes.containsKey(name) && !forced) { + var exists = homes.containsKey(name); + if (exists && !forced) { var text = Component.text("You already have set this home.") .appendNewline().appendSpace() .append(Components.makeButton( @@ -62,7 +63,7 @@ public class SetHomeCommand { } var maxHomes = RccServer.CONFIG.homes.maxHomes(); - if(homes.size() >= maxHomes) { + if(homes.size() >= maxHomes && !exists) { context.getSource().sendFeedback(() -> Text.literal("You have reached the maximum amount of homes!").formatted(Formatting.RED), false); return 1; }