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.
This commit is contained in:
wizjany 2019-03-23 12:27:55 -04:00
parent 6144ca82ac
commit c53ed56b3a
2 changed files with 7 additions and 1 deletions

View File

@ -47,7 +47,8 @@ public final void initialize(LocalPlayer player, Location current, ApplicableReg
@Override @Override
public boolean onCrossBoundary(LocalPlayer player, Location from, Location to, ApplicableRegionSet toSet, Set<ProtectedRegion> entered, Set<ProtectedRegion> exited, MoveType moveType) { public boolean onCrossBoundary(LocalPlayer player, Location from, Location to, ApplicableRegionSet toSet, Set<ProtectedRegion> entered, Set<ProtectedRegion> 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 return true; // no changes to flags if regions didn't change
} }

View File

@ -23,6 +23,7 @@
import com.sk89q.minecraft.util.commands.CommandException; import com.sk89q.minecraft.util.commands.CommandException;
import com.sk89q.worldedit.WorldEditException; 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.ExceptionConverterHelper;
import com.sk89q.worldedit.util.command.parametric.ExceptionMatch; import com.sk89q.worldedit.util.command.parametric.ExceptionMatch;
import com.sk89q.worldguard.WorldGuard; import com.sk89q.worldguard.WorldGuard;
@ -88,4 +89,8 @@ public void convert(UnresolvedNamesException e) throws CommandException {
throw new CommandException(e.getMessage(), e); 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);
}
} }