mirror of
				https://github.com/IntellectualSites/PlotSquared.git
				synced 2025-11-04 11:13:45 +01:00 
			
		
		
		
	Bugfixes for deny-teleport
This commit is contained in:
		@@ -679,37 +679,34 @@ import java.util.regex.Pattern;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
 | 
					    @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
 | 
				
			||||||
    public void onTeleport(PlayerTeleportEvent event) {
 | 
					    public void onTeleport(PlayerTeleportEvent event) {
 | 
				
			||||||
        if (event.getTo() == null || event.getFrom() == null || !event.getFrom().getWorld()
 | 
					        final Object lastLoc =
 | 
				
			||||||
            .equals(event.getTo().getWorld())) {
 | 
					            BukkitUtil.getPlayer(event.getPlayer()).deleteMeta(PlotPlayer.META_LOCATION);
 | 
				
			||||||
            final Object lastLoc =
 | 
					        final Object lastPlot =
 | 
				
			||||||
                BukkitUtil.getPlayer(event.getPlayer()).deleteMeta(PlotPlayer.META_LOCATION);
 | 
					            BukkitUtil.getPlayer(event.getPlayer()).deleteMeta(PlotPlayer.META_LAST_PLOT);
 | 
				
			||||||
            final Object lastPlot =
 | 
					        org.bukkit.Location to = event.getTo();
 | 
				
			||||||
                BukkitUtil.getPlayer(event.getPlayer()).deleteMeta(PlotPlayer.META_LAST_PLOT);
 | 
					        if (to != null) {
 | 
				
			||||||
            org.bukkit.Location to = event.getTo();
 | 
					            Player player = event.getPlayer();
 | 
				
			||||||
            if (to != null) {
 | 
					            PlotPlayer plotPlayer = PlotPlayer.wrap(player);
 | 
				
			||||||
                Player player = event.getPlayer();
 | 
					            Location location = BukkitUtil.getLocation(to);
 | 
				
			||||||
                PlotPlayer plotPlayer = PlotPlayer.wrap(player);
 | 
					            PlotArea area = location.getPlotArea();
 | 
				
			||||||
                Location location = BukkitUtil.getLocation(to);
 | 
					            if (area == null) {
 | 
				
			||||||
                PlotArea area = location.getPlotArea();
 | 
					                return;
 | 
				
			||||||
                if (area == null) {
 | 
					            }
 | 
				
			||||||
                    return;
 | 
					            Plot plot = area.getPlot(location);
 | 
				
			||||||
                }
 | 
					            if (plot != null) {
 | 
				
			||||||
                Plot plot = area.getPlot(location);
 | 
					                final boolean result = Flags.DENY_TELEPORT.allowsTeleport(plotPlayer, plot);
 | 
				
			||||||
                if (plot != null) {
 | 
					                if (!result) {
 | 
				
			||||||
                    final boolean result = Flags.DENY_TELEPORT.allowsTeleport(plotPlayer, plot);
 | 
					                    MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT,
 | 
				
			||||||
                    if (!result) {
 | 
					                        Captions.PERMISSION_ADMIN_ENTRY_DENIED);
 | 
				
			||||||
                        MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT,
 | 
					                    event.setCancelled(true);
 | 
				
			||||||
                            Captions.PERMISSION_ADMIN_ENTRY_DENIED);
 | 
					                    if (lastLoc != null) {
 | 
				
			||||||
                        event.setCancelled(true);
 | 
					                        plotPlayer.setMeta(PlotPlayer.META_LOCATION, lastLoc);
 | 
				
			||||||
                        if (lastLoc != null) {
 | 
					 | 
				
			||||||
                            plotPlayer.setMeta(PlotPlayer.META_LOCATION, lastLoc);
 | 
					 | 
				
			||||||
                        }
 | 
					 | 
				
			||||||
                        if (lastPlot != null) {
 | 
					 | 
				
			||||||
                            plotPlayer.setMeta(PlotPlayer.META_LAST_PLOT, lastPlot);
 | 
					 | 
				
			||||||
                        }
 | 
					 | 
				
			||||||
                    } else {
 | 
					 | 
				
			||||||
                        plotEntry(plotPlayer, plot);
 | 
					 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
 | 
					                    if (lastPlot != null) {
 | 
				
			||||||
 | 
					                        plotPlayer.setMeta(PlotPlayer.META_LAST_PLOT, lastPlot);
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                } else {
 | 
				
			||||||
 | 
					                    plotEntry(plotPlayer, plot);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -22,14 +22,14 @@ public class TeleportDenyFlag extends EnumFlag {
 | 
				
			|||||||
                result = !plot.getMembers().contains(player.getUUID());
 | 
					                result = !plot.getMembers().contains(player.getUUID());
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
            case "nonmembers":
 | 
					            case "nonmembers":
 | 
				
			||||||
                result = !plot.isAdded(player.getUUID());
 | 
					                result = plot.isAdded(player.getUUID());
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
            case "nontrusted":
 | 
					            case "nontrusted":
 | 
				
			||||||
                result = !plot.getTrusted().contains(player.getUUID()) && !plot
 | 
					                result = plot.getTrusted().contains(player.getUUID()) || plot
 | 
				
			||||||
                    .isOwner(player.getUUID());
 | 
					                    .isOwner(player.getUUID());
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
            case "nonowners":
 | 
					            case "nonowners":
 | 
				
			||||||
                result = !plot.isOwner(player.getUUID());
 | 
					                result = plot.isOwner(player.getUUID());
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
            default:
 | 
					            default:
 | 
				
			||||||
                return true;
 | 
					                return true;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user