Improve compatibility with the new onClearValue

This commit is contained in:
aromaa 2022-09-20 12:35:33 +03:00 committed by wizjany
parent bd1d772faa
commit cb100bb797
2 changed files with 8 additions and 2 deletions

View File

@ -81,7 +81,9 @@ public abstract class FlagValueChangeHandler<T> extends Handler {
protected abstract boolean onAbsentValue(LocalPlayer player, Location from, Location to, ApplicableRegionSet toSet, T lastValue, MoveType moveType);
protected void onClearValue(LocalPlayer player, ApplicableRegionSet set) {
Location current = player.getLocation();
onAbsentValue(player, current, current, set, lastValue, MoveType.OTHER_NON_CANCELLABLE);
if (lastValue != null) {
Location current = player.getLocation();
onAbsentValue(player, current, current, set, lastValue, MoveType.OTHER_NON_CANCELLABLE);
}
}
}

View File

@ -59,4 +59,8 @@ public class NotifyExitFlag extends FlagValueChangeHandler<Boolean> {
WorldGuard.getInstance().getPlatform().broadcastNotification(new Notify(player.getName(), " left NOTIFY region").create());
return true;
}
@Override
protected void onClearValue(LocalPlayer player, ApplicableRegionSet set) {
}
}