From 052e9c31a2717904cd6074607a8857c0fc16ea50 Mon Sep 17 00:00:00 2001 From: William Date: Wed, 19 Jun 2024 00:13:27 +0100 Subject: [PATCH] fix: town flag updating not working --- .../java/net/william278/husktowns/claim/Rules.java | 10 ++-------- .../net/william278/husktowns/manager/TownsManager.java | 5 +++-- paper/build.gradle | 2 +- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/common/src/main/java/net/william278/husktowns/claim/Rules.java b/common/src/main/java/net/william278/husktowns/claim/Rules.java index 9950194f..31a1abf9 100644 --- a/common/src/main/java/net/william278/husktowns/claim/Rules.java +++ b/common/src/main/java/net/william278/husktowns/claim/Rules.java @@ -104,14 +104,8 @@ public boolean hasFlagSet(@NotNull Flag flag) { * @param value the value to set the flag to */ public void setFlag(@NotNull Flag flag, boolean value) { - if (flags.containsKey(flag.getName())) { - flags.replace(flag.getName(), value); - } else { - flags.put(flag.getName(), value); - } - if (calculatedFlags != null) { - calculatedFlags.put(flag, value); - } + flags.put(flag.getName(), value); + calculatedFlags = null; } /** diff --git a/common/src/main/java/net/william278/husktowns/manager/TownsManager.java b/common/src/main/java/net/william278/husktowns/manager/TownsManager.java index 227d1a17..486b2992 100644 --- a/common/src/main/java/net/william278/husktowns/manager/TownsManager.java +++ b/common/src/main/java/net/william278/husktowns/manager/TownsManager.java @@ -922,10 +922,11 @@ public void setFlagRule(@NotNull OnlineUser user, @NotNull Flag flag, @NotNull C final Town town = member.town(); town.getRules().get(type).setFlag(flag, value); town.getLog().log(Action.of(user, Action.Type.SET_FLAG_RULE, flag.getName().toLowerCase() + ": " + value)); + plugin.getLocales().getLocale("town_flag_set", flag.getName().toLowerCase(), Boolean.toString(value), - type.name().toLowerCase()).ifPresent(user::sendMessage); + type.name().toLowerCase()).ifPresent(user::sendMessage); if (showMenu) { - showRulesConfig(user); + RulesConfig.of(plugin, town, user).show(); } return true; })); diff --git a/paper/build.gradle b/paper/build.gradle index bf09678b..55eaeac5 100644 --- a/paper/build.gradle +++ b/paper/build.gradle @@ -42,6 +42,6 @@ shadowJar { tasks { runServer { - minecraftVersion('1.20.6') + minecraftVersion('1.21') } } \ No newline at end of file