mirror of
				https://github.com/IntellectualSites/PlotSquared.git
				synced 2025-11-04 03:03:43 +01:00 
			
		
		
		
	@@ -126,6 +126,7 @@ public class DebugExec extends SubCommand {
 | 
				
			|||||||
        scope.put("Settings", new Settings());
 | 
					        scope.put("Settings", new Settings());
 | 
				
			||||||
        scope.put("StringMan", new StringMan());
 | 
					        scope.put("StringMan", new StringMan());
 | 
				
			||||||
        scope.put("MathMan", new MathMan());
 | 
					        scope.put("MathMan", new MathMan());
 | 
				
			||||||
 | 
					        scope.put("FlagManager", new FlagManager());
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        // Classes
 | 
					        // Classes
 | 
				
			||||||
        scope.put("Location", Location.class);
 | 
					        scope.put("Location", Location.class);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -87,14 +87,13 @@ public abstract class EventUtil {
 | 
				
			|||||||
                if (!plot.hasOwner()) {
 | 
					                if (!plot.hasOwner()) {
 | 
				
			||||||
                    return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms);
 | 
					                    return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                Flag use = FlagManager.getPlotFlag(plot, "break");
 | 
					                Flag use = FlagManager.getPlotFlag(plot, "use");
 | 
				
			||||||
                if (use != null) {
 | 
					                if (use != null) {
 | 
				
			||||||
                    HashSet<PlotBlock> value = (HashSet<PlotBlock>) use.getValue();
 | 
					                    HashSet<PlotBlock> value = (HashSet<PlotBlock>) use.getValue();
 | 
				
			||||||
                    if (value.contains(PlotBlock.EVERYTHING) || value.contains(block.getPlotBlock())) {
 | 
					                    if (value.contains(PlotBlock.EVERYTHING) || value.contains(block.getPlotBlock())) {
 | 
				
			||||||
                        return true;
 | 
					                        return true;
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                
 | 
					 | 
				
			||||||
                Flag destroy = FlagManager.getPlotFlag(plot, "break");
 | 
					                Flag destroy = FlagManager.getPlotFlag(plot, "break");
 | 
				
			||||||
                if (destroy != null) {
 | 
					                if (destroy != null) {
 | 
				
			||||||
                    HashSet<PlotBlock> value = (HashSet<PlotBlock>) destroy.getValue();
 | 
					                    HashSet<PlotBlock> value = (HashSet<PlotBlock>) destroy.getValue();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -492,7 +492,6 @@ public class MainUtil {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    public static boolean teleportPlayer(final PlotPlayer player, final Location from, final Plot plot) {
 | 
					    public static boolean teleportPlayer(final PlotPlayer player, final Location from, final Plot plot) {
 | 
				
			||||||
        final Plot bot = MainUtil.getBottomPlot(plot);
 | 
					        final Plot bot = MainUtil.getBottomPlot(plot);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        boolean result = EventUtil.manager.callTeleport(player, from, plot);
 | 
					        boolean result = EventUtil.manager.callTeleport(player, from, plot);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (result) {
 | 
					        if (result) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -242,11 +242,11 @@ public class StringMan {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    public static boolean isEqual(String a, String b) {
 | 
					    public static boolean isEqual(String a, String b) {
 | 
				
			||||||
        return (a == b || (a.length() == b.length() && a.hashCode() == b.hashCode() && a.equals(b)));
 | 
					        return (a == b || (a != null && b != null && a.length() == b.length() && a.hashCode() == b.hashCode() && a.equals(b)));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    public static boolean isEqualIgnoreCase(String a, String b) {
 | 
					    public static boolean isEqualIgnoreCase(String a, String b) {
 | 
				
			||||||
        return (a == b || (a.length() == b.length() && a.equalsIgnoreCase(b)));
 | 
					        return (a == b || (a != null && b != null && a.length() == b.length() && a.equalsIgnoreCase(b)));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static String repeat(String s, int n) {
 | 
					    public static String repeat(String s, int n) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1096,6 +1096,7 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
 | 
				
			|||||||
                    case BEACON:
 | 
					                    case BEACON:
 | 
				
			||||||
                    case BED_BLOCK:
 | 
					                    case BED_BLOCK:
 | 
				
			||||||
                    case SIGN:
 | 
					                    case SIGN:
 | 
				
			||||||
 | 
					                    case WALL_SIGN:
 | 
				
			||||||
                    case SIGN_POST:
 | 
					                    case SIGN_POST:
 | 
				
			||||||
                    case ENCHANTMENT_TABLE:
 | 
					                    case ENCHANTMENT_TABLE:
 | 
				
			||||||
                    case BREWING_STAND:
 | 
					                    case BREWING_STAND:
 | 
				
			||||||
@@ -1125,7 +1126,7 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
 | 
				
			|||||||
                if (eventType != null && !player.isSneaking()) {
 | 
					                if (eventType != null && !player.isSneaking()) {
 | 
				
			||||||
                    break;
 | 
					                    break;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                if (hand == null) {
 | 
					                if (hand == null || hand.getType() == Material.AIR || hand.getType().isBlock()) {
 | 
				
			||||||
                    eventType = PlayerBlockEventType.INTERACT_BLOCK;
 | 
					                    eventType = PlayerBlockEventType.INTERACT_BLOCK;
 | 
				
			||||||
                    lb = new BukkitLazyBlock(block);
 | 
					                    lb = new BukkitLazyBlock(block);
 | 
				
			||||||
                    break;
 | 
					                    break;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,6 +8,7 @@ import org.bukkit.Effect;
 | 
				
			|||||||
import org.bukkit.GameMode;
 | 
					import org.bukkit.GameMode;
 | 
				
			||||||
import org.bukkit.WeatherType;
 | 
					import org.bukkit.WeatherType;
 | 
				
			||||||
import org.bukkit.entity.Player;
 | 
					import org.bukkit.entity.Player;
 | 
				
			||||||
 | 
					import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
 | 
				
			||||||
import org.bukkit.permissions.Permission;
 | 
					import org.bukkit.permissions.Permission;
 | 
				
			||||||
import org.bukkit.permissions.PermissionDefault;
 | 
					import org.bukkit.permissions.PermissionDefault;
 | 
				
			||||||
import org.bukkit.plugin.PluginManager;
 | 
					import org.bukkit.plugin.PluginManager;
 | 
				
			||||||
@@ -130,7 +131,7 @@ public class BukkitPlayer extends PlotPlayer {
 | 
				
			|||||||
        if (Math.abs(loc.getX()) >= 30000000 || Math.abs(loc.getZ()) >= 30000000) {
 | 
					        if (Math.abs(loc.getX()) >= 30000000 || Math.abs(loc.getZ()) >= 30000000) {
 | 
				
			||||||
            return;
 | 
					            return;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        this.player.teleport(new org.bukkit.Location(BukkitUtil.getWorld(loc.getWorld()), loc.getX() + 0.5, loc.getY(), loc.getZ() + 0.5, loc.getYaw(), loc.getPitch()));
 | 
					            this.player.teleport(new org.bukkit.Location(BukkitUtil.getWorld(loc.getWorld()), loc.getX() + 0.5, loc.getY(), loc.getZ() + 0.5, loc.getYaw(), loc.getPitch()), TeleportCause.COMMAND);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -31,11 +31,11 @@ import com.intellectualcrafters.plot.object.schematic.PlotItem;
 | 
				
			|||||||
import com.intellectualcrafters.plot.util.BlockManager;
 | 
					import com.intellectualcrafters.plot.util.BlockManager;
 | 
				
			||||||
import com.intellectualcrafters.plot.util.MathMan;
 | 
					import com.intellectualcrafters.plot.util.MathMan;
 | 
				
			||||||
import com.intellectualcrafters.plot.util.StringComparison;
 | 
					import com.intellectualcrafters.plot.util.StringComparison;
 | 
				
			||||||
 | 
					import com.intellectualcrafters.plot.util.StringMan;
 | 
				
			||||||
import com.intellectualcrafters.plot.util.UUIDHandler;
 | 
					import com.intellectualcrafters.plot.util.UUIDHandler;
 | 
				
			||||||
import com.plotsquared.bukkit.object.BukkitPlayer;
 | 
					import com.plotsquared.bukkit.object.BukkitPlayer;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class BukkitUtil extends BlockManager {
 | 
					public class BukkitUtil extends BlockManager {
 | 
				
			||||||
    private static HashMap<String, World> worlds = new HashMap<>();
 | 
					 | 
				
			||||||
    private static String lastString = null;
 | 
					    private static String lastString = null;
 | 
				
			||||||
    private static World lastWorld = null;
 | 
					    private static World lastWorld = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -145,14 +145,12 @@ public class BukkitUtil extends BlockManager {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static World getWorld(final String string) {
 | 
					    public static World getWorld(final String string) {
 | 
				
			||||||
        if (string == lastString) {
 | 
					        if (StringMan.isEqual(string,lastString)) {
 | 
				
			||||||
            return lastWorld;
 | 
					            return lastWorld;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        World world = worlds.get(string);
 | 
					        World world = Bukkit.getWorld(string);
 | 
				
			||||||
        if (world == null) {
 | 
					        lastString = string;
 | 
				
			||||||
            world = Bukkit.getWorld(string);
 | 
					        lastWorld = world;
 | 
				
			||||||
            worlds.put(string, world);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        return world;
 | 
					        return world;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
		Reference in New Issue
	
	Block a user