mirror of
				https://github.com/IntellectualSites/PlotSquared.git
				synced 2025-11-04 03:03:43 +01:00 
			
		
		
		
	Optimize move event
This commit is contained in:
		@@ -197,26 +197,23 @@ public class WorldEditListener implements Listener {
 | 
				
			|||||||
    @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
 | 
					    @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
 | 
				
			||||||
    public void onPlayerMove(final PlayerMoveEvent e) {
 | 
					    public void onPlayerMove(final PlayerMoveEvent e) {
 | 
				
			||||||
        final Location t = e.getTo();
 | 
					        final Location t = e.getTo();
 | 
				
			||||||
        if (!isPlotWorld(t)) {
 | 
					 | 
				
			||||||
            return;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        final Location f = e.getFrom();
 | 
					        final Location f = e.getFrom();
 | 
				
			||||||
        if ((f.getX() == t.getX()) && (f.getZ() == t.getZ())) {
 | 
					 | 
				
			||||||
            return;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        final Player p = e.getPlayer();
 | 
					 | 
				
			||||||
        final PlotPlayer pp = BukkitUtil.getPlayer(p);
 | 
					 | 
				
			||||||
        if (Permissions.hasPermission(pp, "plots.worldedit.bypass")) {
 | 
					 | 
				
			||||||
            if (!PWE.hasMask(pp)) {
 | 
					 | 
				
			||||||
                return;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        final com.intellectualcrafters.plot.object.Location locf = BukkitUtil.getLocation(f);
 | 
					        final com.intellectualcrafters.plot.object.Location locf = BukkitUtil.getLocation(f);
 | 
				
			||||||
        final com.intellectualcrafters.plot.object.Location loct = BukkitUtil.getLocation(t);
 | 
					        final com.intellectualcrafters.plot.object.Location loct = BukkitUtil.getLocation(t);
 | 
				
			||||||
        if ((locf.getX() != loct.getX()) || (locf.getZ() != loct.getZ())) {
 | 
					        if ((locf.getX() != loct.getX()) || (locf.getZ() != loct.getZ())) {
 | 
				
			||||||
 | 
					            final Player p = e.getPlayer();
 | 
				
			||||||
 | 
					            final PlotPlayer pp = BukkitUtil.getPlayer(p);
 | 
				
			||||||
 | 
					            if (!isPlotWorld(t)) {
 | 
				
			||||||
 | 
					                return;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
            final PlotId idF = MainUtil.getPlotId(locf);
 | 
					            final PlotId idF = MainUtil.getPlotId(locf);
 | 
				
			||||||
            final PlotId idT = MainUtil.getPlotId(loct);
 | 
					            final PlotId idT = MainUtil.getPlotId(loct);
 | 
				
			||||||
            if ((idT != null) && !(idF == idT)) {
 | 
					            if ((idT != null) && !(idF == idT)) {
 | 
				
			||||||
 | 
					                if (Permissions.hasPermission(pp, "plots.worldedit.bypass")) {
 | 
				
			||||||
 | 
					                    if (!PWE.hasMask(pp)) {
 | 
				
			||||||
 | 
					                        return;
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
                PWE.setMask(pp, loct, false);
 | 
					                PWE.setMask(pp, loct, false);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user