Skip to content

Commit

Permalink
fix: town flag updating not working
Browse files Browse the repository at this point in the history
  • Loading branch information
WiIIiam278 committed Jun 18, 2024
1 parent 0f5e07b commit 052e9c3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
10 changes: 2 additions & 8 deletions common/src/main/java/net/william278/husktowns/claim/Rules.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}));
Expand Down
2 changes: 1 addition & 1 deletion paper/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ shadowJar {

tasks {
runServer {
minecraftVersion('1.20.6')
minecraftVersion('1.21')
}
}

0 comments on commit 052e9c3

Please sign in to comment.