Fix resetting existing home throws homes limit reached error
This commit is contained in:
parent
9805179093
commit
afb7341262
2 changed files with 4 additions and 3 deletions
|
@ -9,7 +9,7 @@ yarn_mappings=1.20.1+build.10
|
||||||
loader_version=0.16.7
|
loader_version=0.16.7
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version=1.16.3
|
mod_version=1.16.4
|
||||||
maven_group=cc.reconnected
|
maven_group=cc.reconnected
|
||||||
archives_base_name=rcc-server
|
archives_base_name=rcc-server
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,8 @@ public class SetHomeCommand {
|
||||||
|
|
||||||
var homes = playerState.homes;
|
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.")
|
var text = Component.text("You already have set this home.")
|
||||||
.appendNewline().appendSpace()
|
.appendNewline().appendSpace()
|
||||||
.append(Components.makeButton(
|
.append(Components.makeButton(
|
||||||
|
@ -62,7 +63,7 @@ public class SetHomeCommand {
|
||||||
}
|
}
|
||||||
|
|
||||||
var maxHomes = RccServer.CONFIG.homes.maxHomes();
|
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);
|
context.getSource().sendFeedback(() -> Text.literal("You have reached the maximum amount of homes!").formatted(Formatting.RED), false);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue