Skip to content

Commit f8415ed

Browse files
committed
Skip handling notify flags on false values
1 parent c4c17a2 commit f8415ed

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

worldguard-core/src/main/java/com/sk89q/worldguard/session/handler/NotifyEntryFlag.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,15 @@ protected void onInitialValue(LocalPlayer player, ApplicableRegionSet set, Boole
5050

5151
@Override
5252
protected boolean onSetValue(LocalPlayer player, Location from, Location to, ApplicableRegionSet toSet, Boolean currentValue, Boolean lastValue, MoveType moveType) {
53+
if (!currentValue) {
54+
// If the current value is false, we do not notify
55+
return false;
56+
}
57+
5358
StringBuilder regionList = new StringBuilder();
5459

5560
for (ProtectedRegion region : toSet) {
56-
if (regionList.length() != 0) {
61+
if (!regionList.isEmpty()) {
5762
regionList.append(", ");
5863
}
5964

worldguard-core/src/main/java/com/sk89q/worldguard/session/handler/NotifyExitFlag.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ protected boolean onSetValue(LocalPlayer player, Location from, Location to, App
5656

5757
@Override
5858
protected boolean onAbsentValue(LocalPlayer player, Location from, Location to, ApplicableRegionSet toSet, Boolean lastValue, MoveType moveType) {
59+
if (!lastValue) {
60+
// If the lastValue was false, we don't notify
61+
return false;
62+
}
5963
WorldGuard.getInstance().getPlatform().broadcastNotification(new Notify(player.getName(), " left NOTIFY region").create());
6064
return true;
6165
}

0 commit comments

Comments
 (0)