From c53ed56b3a6698047ead51b1a7b89fa2749cc5e3 Mon Sep 17 00:00:00 2001 From: wizjany Date: Sat, 23 Mar 2019 12:27:55 -0400 Subject: [PATCH] Check flag change handlers when world changes. Global regions aren't actually part of the ApplicableRegionSet, so the set difference will be empty even if the global region has changed. --- .../worldguard/session/handler/FlagValueChangeHandler.java | 3 ++- .../sk89q/worldguard/util/WorldGuardExceptionConverter.java | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/worldguard-core/src/main/java/com/sk89q/worldguard/session/handler/FlagValueChangeHandler.java b/worldguard-core/src/main/java/com/sk89q/worldguard/session/handler/FlagValueChangeHandler.java index 37c1ab68..acc87bbc 100644 --- a/worldguard-core/src/main/java/com/sk89q/worldguard/session/handler/FlagValueChangeHandler.java +++ b/worldguard-core/src/main/java/com/sk89q/worldguard/session/handler/FlagValueChangeHandler.java @@ -47,7 +47,8 @@ public final void initialize(LocalPlayer player, Location current, ApplicableReg @Override public boolean onCrossBoundary(LocalPlayer player, Location from, Location to, ApplicableRegionSet toSet, Set entered, Set exited, MoveType moveType) { - if (entered.isEmpty() && exited.isEmpty()) { + if (entered.isEmpty() && exited.isEmpty() + && from.getExtent().equals(to.getExtent())) { // sets don't include global regions - check if those changed return true; // no changes to flags if regions didn't change } diff --git a/worldguard-core/src/main/java/com/sk89q/worldguard/util/WorldGuardExceptionConverter.java b/worldguard-core/src/main/java/com/sk89q/worldguard/util/WorldGuardExceptionConverter.java index a010c78c..c1721526 100644 --- a/worldguard-core/src/main/java/com/sk89q/worldguard/util/WorldGuardExceptionConverter.java +++ b/worldguard-core/src/main/java/com/sk89q/worldguard/util/WorldGuardExceptionConverter.java @@ -23,6 +23,7 @@ import com.sk89q.minecraft.util.commands.CommandException; import com.sk89q.worldedit.WorldEditException; +import com.sk89q.worldedit.util.auth.AuthorizationException; import com.sk89q.worldedit.util.command.parametric.ExceptionConverterHelper; import com.sk89q.worldedit.util.command.parametric.ExceptionMatch; import com.sk89q.worldguard.WorldGuard; @@ -88,4 +89,8 @@ public void convert(UnresolvedNamesException e) throws CommandException { throw new CommandException(e.getMessage(), e); } + @ExceptionMatch + public void convert(AuthorizationException e) throws CommandException { + throw new CommandException("You don't have permission to do that.", e); + } }