mirror of
				https://github.com/IntellectualSites/PlotSquared.git
				synced 2025-11-04 03:03:43 +01:00 
			
		
		
		
	Potential fixes
This commit is contained in:
		@@ -291,8 +291,8 @@ public class PS {
 | 
			
		||||
                            }
 | 
			
		||||
                            if (!BlockManager.manager.isWorld(world) || (BlockManager.manager.isWorld(world) && !isPlotWorld(world))) {
 | 
			
		||||
                                PS.debug("&c`" + world + "` was not properly loaded - PlotSquared will now try to load it properly: ");
 | 
			
		||||
                                PS.debug("&8 - &7Are you trying to delete this world? Remember to remove it from the settings.yml as well");
 | 
			
		||||
                                PS.debug("&8 - &7Your world management plugin may be faulty. Consider using an up to date plugin.");
 | 
			
		||||
                                PS.debug("&8 - &7Are you trying to delete this world? Remember to remove it from the settings.yml, bukkit.yml and multiverse worlds.yml");
 | 
			
		||||
                                PS.debug("&8 - &7Your world management plugin may be faulty (or non existant)");
 | 
			
		||||
                                IMP.setGenerator(world);
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
 
 | 
			
		||||
@@ -427,18 +427,19 @@ public class DebugExec extends SubCommand {
 | 
			
		||||
                        @Override
 | 
			
		||||
                        public void run() {
 | 
			
		||||
                            final long start = System.currentTimeMillis();
 | 
			
		||||
                            Object result = null;
 | 
			
		||||
                            try {
 | 
			
		||||
                                engine.eval(toExec, scope);
 | 
			
		||||
                                result = engine.eval(toExec, scope);
 | 
			
		||||
                            } catch (final ScriptException e) {
 | 
			
		||||
                                e.printStackTrace();
 | 
			
		||||
                            }
 | 
			
		||||
                            PS.log("> " + (System.currentTimeMillis() - start) + "ms");
 | 
			
		||||
                            PS.log("> " + (System.currentTimeMillis() - start) + "ms -> " + result);
 | 
			
		||||
                        }
 | 
			
		||||
                    });
 | 
			
		||||
                } else {
 | 
			
		||||
                    final long start = System.currentTimeMillis();
 | 
			
		||||
                    engine.eval(script, scope);
 | 
			
		||||
                    PS.log("> " + (System.currentTimeMillis() - start) + "ms");
 | 
			
		||||
                    Object result = engine.eval(script, scope);
 | 
			
		||||
                    PS.log("> " + (System.currentTimeMillis() - start) + "ms -> " + result);
 | 
			
		||||
                }
 | 
			
		||||
                return true;
 | 
			
		||||
            } catch (final ScriptException e) {
 | 
			
		||||
 
 | 
			
		||||
@@ -101,7 +101,7 @@ public abstract class ChunkManager {
 | 
			
		||||
    
 | 
			
		||||
    public abstract boolean loadChunk(final String world, final ChunkLoc loc, final boolean force);
 | 
			
		||||
    
 | 
			
		||||
    public abstract boolean unloadChunk(final String world, final ChunkLoc loc, final boolean save, final boolean safe);
 | 
			
		||||
    public abstract void unloadChunk(final String world, final ChunkLoc loc, final boolean save, final boolean safe);
 | 
			
		||||
    
 | 
			
		||||
    public abstract Set<ChunkLoc> getChunkChunks(final String world);
 | 
			
		||||
    
 | 
			
		||||
 
 | 
			
		||||
@@ -1172,10 +1172,8 @@ public class MainUtil {
 | 
			
		||||
        }
 | 
			
		||||
        if (plot.owner == null) {
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
        if (!plot.owner.equals(uuid)) {
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
        HashSet<Plot> visited = new HashSet<>();
 | 
			
		||||
        HashSet<PlotId> merged = new HashSet<>();
 | 
			
		||||
        ArrayDeque<Plot> frontier = new ArrayDeque<>(getConnectedPlots(plot));
 | 
			
		||||
        Plot current;
 | 
			
		||||
@@ -1189,6 +1187,8 @@ public class MainUtil {
 | 
			
		||||
                Plot other = getPlotAbs(current.world, getPlotIdRelative(current.id, 0));
 | 
			
		||||
                if (other.isOwner(uuid)) {
 | 
			
		||||
                    frontier.addAll(other.getConnectedPlots());
 | 
			
		||||
                    mergePlot(current.world, current, other, removeRoads);
 | 
			
		||||
                    merged.add(current.id);
 | 
			
		||||
                    merged.add(other.id);
 | 
			
		||||
                    toReturn = true;
 | 
			
		||||
                    max--;
 | 
			
		||||
@@ -1198,6 +1198,8 @@ public class MainUtil {
 | 
			
		||||
                Plot other = getPlotAbs(current.world, getPlotIdRelative(current.id, 1));
 | 
			
		||||
                if (other.isOwner(uuid)) {
 | 
			
		||||
                    frontier.addAll(other.getConnectedPlots());
 | 
			
		||||
                    mergePlot(current.world, current, other, removeRoads);
 | 
			
		||||
                    merged.add(current.id);
 | 
			
		||||
                    merged.add(other.id);
 | 
			
		||||
                    toReturn = true;
 | 
			
		||||
                    max--;
 | 
			
		||||
@@ -1207,6 +1209,8 @@ public class MainUtil {
 | 
			
		||||
                Plot other = getPlotAbs(current.world, getPlotIdRelative(current.id, 2));
 | 
			
		||||
                if (other.isOwner(uuid)) {
 | 
			
		||||
                    frontier.addAll(other.getConnectedPlots());
 | 
			
		||||
                    mergePlot(current.world, current, other, removeRoads);
 | 
			
		||||
                    merged.add(current.id);
 | 
			
		||||
                    merged.add(other.id);
 | 
			
		||||
                    toReturn = true;
 | 
			
		||||
                    max--;
 | 
			
		||||
@@ -1216,40 +1220,21 @@ public class MainUtil {
 | 
			
		||||
                Plot other = getPlotAbs(current.world, getPlotIdRelative(current.id, 3));
 | 
			
		||||
                if (other.isOwner(uuid)) {
 | 
			
		||||
                    frontier.addAll(other.getConnectedPlots());
 | 
			
		||||
                    mergePlot(current.world, current, other, removeRoads);
 | 
			
		||||
                    merged.add(current.id);
 | 
			
		||||
                    merged.add(other.id);
 | 
			
		||||
                    toReturn = true;
 | 
			
		||||
                    max--;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            PlotManager manager = PS.get().getPlotManager(plot.world);
 | 
			
		||||
            ArrayList<PlotId> ids = new ArrayList<>(visited.size());
 | 
			
		||||
            for (Plot visit : visited) {
 | 
			
		||||
                ids.add(visit.id);
 | 
			
		||||
            }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        PlotManager manager = PS.get().getPlotManager(plot.world);
 | 
			
		||||
        ArrayList<PlotId> ids = new ArrayList<>(merged);
 | 
			
		||||
        if (removeRoads) {
 | 
			
		||||
            manager.finishPlotMerge(plot.getWorld(), ids);
 | 
			
		||||
        }
 | 
			
		||||
        return toReturn;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
//    private static boolean ownsPlots(final String world, final ArrayList<PlotId> plots, final UUID uuid, final int dir) {
 | 
			
		||||
//        final PlotId id_min = plots.get(0);
 | 
			
		||||
//        final PlotId id_max = plots.get(plots.size() - 1);
 | 
			
		||||
//        for (final PlotId myid : plots) {
 | 
			
		||||
//            final Plot myplot = PS.get().getPlot(world, myid);
 | 
			
		||||
//            if ((myplot == null) || (myplot.owner == null) || !(myplot.owner.equals(uuid))) {
 | 
			
		||||
//                return false;
 | 
			
		||||
//            }
 | 
			
		||||
//            final PlotId top = getTopPlot(myplot).id;
 | 
			
		||||
//            if (((top.x > id_max.x) && (dir != 1)) || ((top.y > id_max.y) && (dir != 2))) {
 | 
			
		||||
//                return false;
 | 
			
		||||
//            }
 | 
			
		||||
//            final PlotId bot = getBottomPlot(myplot).id;
 | 
			
		||||
//            if (((bot.x < id_min.x) && (dir != 3)) || ((bot.y < id_min.y) && (dir != 0))) {
 | 
			
		||||
//                return false;
 | 
			
		||||
//            }
 | 
			
		||||
//        }
 | 
			
		||||
//        return true;
 | 
			
		||||
//    }
 | 
			
		||||
    
 | 
			
		||||
    public static void updateWorldBorder(final Plot plot) {
 | 
			
		||||
        if (!worldBorder.containsKey(plot.world)) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user