Skip to content

Commit

Permalink
Merge pull request #35 from jaapieaapie1/master
Browse files Browse the repository at this point in the history
Performance improvements
  • Loading branch information
Sidpatchy committed Jul 6, 2022
2 parents 9e03423 + 51a0c63 commit 01832d6
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 01832d6

Please sign in to comment.