Fix resetting existing home throws homes limit reached error

This commit is contained in:
Alessandro Proto 2024-11-01 10:30:23 +01:00
parent 9805179093
commit afb7341262
2 changed files with 4 additions and 3 deletions

View file

@ -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

View file

@ -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;
}