Skip to content

Commit

Permalink
Performance improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
jaapieaapie1 committed Jul 4, 2022
1 parent 9e03423 commit 51a0c63
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.sk89q.worldguard.protection.flags.StateFlag;
import com.sk89q.worldguard.protection.regions.RegionQuery;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
Expand Down Expand Up @@ -41,6 +42,14 @@ public PlayerMove(AntiWorldFly awf) {
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onPlayerCommandPreprocessEvent(PlayerMoveEvent event) {

if (event.getTo() != null) {
Location fromBlock = event.getFrom().getBlock().getLocation();
Location toBlock = event.getTo().getBlock().getLocation();

if (fromBlock.equals(toBlock))
return;
}

Player player = event.getPlayer();

if (plugin.isDisabled() || player.hasPermission("antiworldfly.fly." + player.getWorld().getName()) || !player.getPlayer().isFlying()) {
Expand Down

0 comments on commit 51a0c63

Please sign in to comment.