Performance tweaks

This commit is contained in:
isokissa3 2020-04-27 03:46:51 +03:00
parent d02d9d49e1
commit 02b47224da
1 changed files with 8 additions and 0 deletions

View File

@ -56,6 +56,14 @@ public abstract class HandlerWrapper extends Handler
@Override
public boolean onCrossBoundary(LocalPlayer localPlayer, com.sk89q.worldedit.util.Location from, com.sk89q.worldedit.util.Location to, ApplicableRegionSet toSet, Set<ProtectedRegion> entered, Set<ProtectedRegion> exited, MoveType moveType)
{
//It turns out that this is fired every time player moves
//The plugin flags assume already that nothing changes unless region is crossed, so ignore when there isn't a region change
//This optimization is already in place in the FVCH
if (entered.isEmpty() && exited.isEmpty() && from.getExtent().equals(to.getExtent()))
{
return true;
}
return this.onCrossBoundary(((BukkitPlayer)localPlayer).getPlayer(), BukkitAdapter.adapt(from), BukkitAdapter.adapt(to), toSet, entered, exited, moveType);
}