Don't call boundary crossing handlers unless a boundary was crossed.

This commit is contained in:
sk89q 2015-01-17 19:17:17 -08:00
parent 7ecf73165b
commit a3d2a1b127

View File

@ -206,9 +206,11 @@ public Location testMoveTo(Player player, Location to, MoveType moveType, boolea
Set<ProtectedRegion> entered = Sets.difference(toSet.getRegions(), lastRegionSet);
Set<ProtectedRegion> exited = Sets.difference(lastRegionSet, toSet.getRegions());
for (Handler handler : handlers.values()) {
if (!handler.onCrossBoundary(player, lastValid, to, toSet, entered, exited, moveType) && moveType.isCancellable()) {
return lastValid;
if (!entered.isEmpty() || !exited.isEmpty()) {
for (Handler handler : handlers.values()) {
if (!handler.onCrossBoundary(player, lastValid, to, toSet, entered, exited, moveType) && moveType.isCancellable()) {
return lastValid;
}
}
}