mirror of
				https://github.com/IntellectualSites/PlotSquared.git
				synced 2025-11-04 03:03:43 +01:00 
			
		
		
		
	Merge remote-tracking branch 'origin/master'
# Conflicts: # src/main/java/com/intellectualcrafters/plot/commands/Condense.java # src/main/java/com/intellectualcrafters/plot/commands/Deny.java # src/main/java/com/intellectualcrafters/plot/commands/Save.java # src/main/java/com/intellectualcrafters/plot/commands/list.java # src/main/java/com/intellectualcrafters/plot/database/SQLManager.java
This commit is contained in:
		@@ -1,5 +1,7 @@
 | 
			
		||||
package com.intellectualcrafters.configuration.serialization;
 | 
			
		||||
 | 
			
		||||
import com.intellectualcrafters.configuration.Configuration;
 | 
			
		||||
 | 
			
		||||
import java.lang.reflect.Constructor;
 | 
			
		||||
import java.lang.reflect.InvocationTargetException;
 | 
			
		||||
import java.lang.reflect.Method;
 | 
			
		||||
@@ -9,8 +11,6 @@ import java.util.Map;
 | 
			
		||||
import java.util.logging.Level;
 | 
			
		||||
import java.util.logging.Logger;
 | 
			
		||||
 | 
			
		||||
import com.intellectualcrafters.configuration.Configuration;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Utility class for storing and retrieving classes for {@link Configuration}.
 | 
			
		||||
 */
 | 
			
		||||
@@ -86,16 +86,12 @@ public class ConfigurationSerialization {
 | 
			
		||||
            throw new NullPointerException("Args must not be null");
 | 
			
		||||
        }
 | 
			
		||||
        ConfigurationSerializable result = null;
 | 
			
		||||
        Method method = null;
 | 
			
		||||
        
 | 
			
		||||
        if (result == null) {
 | 
			
		||||
            method = getMethod("deserialize", true);
 | 
			
		||||
            
 | 
			
		||||
            if (method != null) {
 | 
			
		||||
                result = deserializeViaMethod(method, args);
 | 
			
		||||
            }
 | 
			
		||||
        Method method = getMethod("deserialize", true);
 | 
			
		||||
 | 
			
		||||
        if (method != null) {
 | 
			
		||||
            result = deserializeViaMethod(method, args);
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
        if (result == null) {
 | 
			
		||||
            method = getMethod("valueOf", true);
 | 
			
		||||
            
 | 
			
		||||
@@ -247,15 +243,13 @@ public class ConfigurationSerialization {
 | 
			
		||||
                return getAlias(delegate.value());
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        if (delegate == null) {
 | 
			
		||||
            final SerializableAs alias = clazz.getAnnotation(SerializableAs.class);
 | 
			
		||||
            
 | 
			
		||||
            if ((alias != null) && (alias.value() != null)) {
 | 
			
		||||
                return alias.value();
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
        final SerializableAs alias = clazz.getAnnotation(SerializableAs.class);
 | 
			
		||||
 | 
			
		||||
        if ((alias != null) && (alias.value() != null)) {
 | 
			
		||||
            return alias.value();
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
        return clazz.getName();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,33 +1,5 @@
 | 
			
		||||
package com.intellectualcrafters.plot;
 | 
			
		||||
 | 
			
		||||
import java.io.BufferedReader;
 | 
			
		||||
import java.io.File;
 | 
			
		||||
import java.io.FileInputStream;
 | 
			
		||||
import java.io.FileOutputStream;
 | 
			
		||||
import java.io.IOException;
 | 
			
		||||
import java.io.InputStream;
 | 
			
		||||
import java.io.InputStreamReader;
 | 
			
		||||
import java.net.URL;
 | 
			
		||||
import java.net.URLConnection;
 | 
			
		||||
import java.nio.file.Files;
 | 
			
		||||
import java.sql.Connection;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.Arrays;
 | 
			
		||||
import java.util.Collection;
 | 
			
		||||
import java.util.Collections;
 | 
			
		||||
import java.util.Comparator;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.HashSet;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
import java.util.Map.Entry;
 | 
			
		||||
import java.util.Objects;
 | 
			
		||||
import java.util.Set;
 | 
			
		||||
import java.util.UUID;
 | 
			
		||||
import java.util.regex.Pattern;
 | 
			
		||||
import java.util.zip.ZipEntry;
 | 
			
		||||
import java.util.zip.ZipInputStream;
 | 
			
		||||
 | 
			
		||||
import com.intellectualcrafters.configuration.ConfigurationSection;
 | 
			
		||||
import com.intellectualcrafters.configuration.MemorySection;
 | 
			
		||||
import com.intellectualcrafters.configuration.file.YamlConfiguration;
 | 
			
		||||
@@ -84,6 +56,34 @@ import com.intellectualcrafters.plot.util.area.QuadMap;
 | 
			
		||||
import com.plotsquared.listener.WESubscriber;
 | 
			
		||||
import com.sk89q.worldedit.WorldEdit;
 | 
			
		||||
 | 
			
		||||
import java.io.BufferedReader;
 | 
			
		||||
import java.io.File;
 | 
			
		||||
import java.io.FileInputStream;
 | 
			
		||||
import java.io.FileOutputStream;
 | 
			
		||||
import java.io.IOException;
 | 
			
		||||
import java.io.InputStream;
 | 
			
		||||
import java.io.InputStreamReader;
 | 
			
		||||
import java.net.URL;
 | 
			
		||||
import java.net.URLConnection;
 | 
			
		||||
import java.nio.file.Files;
 | 
			
		||||
import java.sql.Connection;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.Arrays;
 | 
			
		||||
import java.util.Collection;
 | 
			
		||||
import java.util.Collections;
 | 
			
		||||
import java.util.Comparator;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.HashSet;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
import java.util.Map.Entry;
 | 
			
		||||
import java.util.Objects;
 | 
			
		||||
import java.util.Set;
 | 
			
		||||
import java.util.UUID;
 | 
			
		||||
import java.util.regex.Pattern;
 | 
			
		||||
import java.util.zip.ZipEntry;
 | 
			
		||||
import java.util.zip.ZipInputStream;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * An implementation of the core,
 | 
			
		||||
 * with a static getter for easy access
 | 
			
		||||
@@ -407,7 +407,7 @@ public class PS {
 | 
			
		||||
     * @param plot Plot Object to update
 | 
			
		||||
     */
 | 
			
		||||
    public boolean updatePlot(final Plot plot) {
 | 
			
		||||
        return plot.area.addPlot(plot);
 | 
			
		||||
        return plot.getArea().addPlot(plot);
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
@@ -595,7 +595,7 @@ public class PS {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public PlotManager getPlotManager(Plot plot) {
 | 
			
		||||
        return plot.area.manager;
 | 
			
		||||
        return plot.getArea().manager;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    public PlotManager getPlotManager(Location loc) {
 | 
			
		||||
@@ -1159,10 +1159,10 @@ public class PS {
 | 
			
		||||
            Collection<Plot> lastList = null;
 | 
			
		||||
            PlotArea lastWorld = null;
 | 
			
		||||
            for (final Plot plot : myplots) {
 | 
			
		||||
                if (lastWorld == plot.area) {
 | 
			
		||||
                if (lastWorld == plot.getArea()) {
 | 
			
		||||
                    lastList.add(plot);
 | 
			
		||||
                } else {
 | 
			
		||||
                    lastWorld = plot.area;
 | 
			
		||||
                    lastWorld = plot.getArea();
 | 
			
		||||
                    lastList = map.get(lastWorld);
 | 
			
		||||
                    lastList.add(plot);
 | 
			
		||||
                }
 | 
			
		||||
@@ -1418,12 +1418,12 @@ public class PS {
 | 
			
		||||
        if (callEvent) {
 | 
			
		||||
            EventUtil.manager.callDelete(plot);
 | 
			
		||||
        }
 | 
			
		||||
        if (plot.area.removePlot(plot.id)) {
 | 
			
		||||
            PlotId last = (PlotId) plot.area.getMeta("lastPlot");
 | 
			
		||||
        if (plot.getArea().removePlot(plot.getId())) {
 | 
			
		||||
            PlotId last = (PlotId) plot.getArea().getMeta("lastPlot");
 | 
			
		||||
            final int last_max = Math.max(Math.abs(last.x), Math.abs(last.y));
 | 
			
		||||
            final int this_max = Math.max(Math.abs(plot.id.x), Math.abs(plot.id.y));
 | 
			
		||||
            final int this_max = Math.max(Math.abs(plot.getId().x), Math.abs(plot.getId().y));
 | 
			
		||||
            if (this_max < last_max) {
 | 
			
		||||
                plot.area.setMeta("lastPlot", plot.id);
 | 
			
		||||
                plot.getArea().setMeta("lastPlot", plot.getId());
 | 
			
		||||
            }
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -54,7 +54,7 @@ public class Alias extends SetCommand {
 | 
			
		||||
            C.NOT_VALID_VALUE.send(plr);
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
        for (final Plot p : PS.get().getPlots(plot.area)) {
 | 
			
		||||
        for (final Plot p : PS.get().getPlots(plot.getArea())) {
 | 
			
		||||
            if (p.getAlias().equalsIgnoreCase(alias)) {
 | 
			
		||||
                MainUtil.sendMessage(plr, C.ALIAS_IS_TAKEN);
 | 
			
		||||
                return false;
 | 
			
		||||
 
 | 
			
		||||
@@ -190,7 +190,7 @@ public class Auto extends SubCommand {
 | 
			
		||||
                    Claim.claimPlot(plr, plot, true, true);
 | 
			
		||||
                    br = true;
 | 
			
		||||
                }
 | 
			
		||||
                plotarea.setMeta("lastPlot", getNextPlotId(plot.id, 1));
 | 
			
		||||
                plotarea.setMeta("lastPlot", getNextPlotId(plot.getId(), 1));
 | 
			
		||||
            }
 | 
			
		||||
        } else {
 | 
			
		||||
            while (!br) {
 | 
			
		||||
 
 | 
			
		||||
@@ -146,7 +146,7 @@ public class Condense extends SubCommand {
 | 
			
		||||
                        final Plot origin = allPlots.remove(0);
 | 
			
		||||
                        int i = 0;
 | 
			
		||||
                        while (free.size() > i) {
 | 
			
		||||
                            final Plot possible = origin.area.getPlotAbs(free.get(i));
 | 
			
		||||
                            final Plot possible = origin.getArea().getPlotAbs(free.get(i));
 | 
			
		||||
                            if (possible.owner != null) {
 | 
			
		||||
                                free.remove(i);
 | 
			
		||||
                                continue;
 | 
			
		||||
 
 | 
			
		||||
@@ -20,26 +20,6 @@
 | 
			
		||||
////////////////////////////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
package com.intellectualcrafters.plot.commands;
 | 
			
		||||
 | 
			
		||||
import java.io.File;
 | 
			
		||||
import java.io.FileNotFoundException;
 | 
			
		||||
import java.io.IOException;
 | 
			
		||||
import java.io.PrintWriter;
 | 
			
		||||
import java.nio.charset.StandardCharsets;
 | 
			
		||||
import java.sql.Timestamp;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.Arrays;
 | 
			
		||||
import java.util.Date;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.UUID;
 | 
			
		||||
 | 
			
		||||
import javax.script.Bindings;
 | 
			
		||||
import javax.script.ScriptContext;
 | 
			
		||||
import javax.script.ScriptEngine;
 | 
			
		||||
import javax.script.ScriptEngineManager;
 | 
			
		||||
import javax.script.ScriptException;
 | 
			
		||||
import javax.script.SimpleScriptContext;
 | 
			
		||||
 | 
			
		||||
import com.google.common.io.Files;
 | 
			
		||||
import com.intellectualcrafters.plot.PS;
 | 
			
		||||
import com.intellectualcrafters.plot.config.C;
 | 
			
		||||
@@ -74,6 +54,26 @@ import com.intellectualcrafters.plot.util.WorldUtil;
 | 
			
		||||
import com.plotsquared.general.commands.Command;
 | 
			
		||||
import com.plotsquared.general.commands.CommandDeclaration;
 | 
			
		||||
 | 
			
		||||
import java.io.File;
 | 
			
		||||
import java.io.FileNotFoundException;
 | 
			
		||||
import java.io.IOException;
 | 
			
		||||
import java.io.PrintWriter;
 | 
			
		||||
import java.nio.charset.StandardCharsets;
 | 
			
		||||
import java.sql.Timestamp;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.Arrays;
 | 
			
		||||
import java.util.Date;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.UUID;
 | 
			
		||||
 | 
			
		||||
import javax.script.Bindings;
 | 
			
		||||
import javax.script.ScriptContext;
 | 
			
		||||
import javax.script.ScriptEngine;
 | 
			
		||||
import javax.script.ScriptEngineManager;
 | 
			
		||||
import javax.script.ScriptException;
 | 
			
		||||
import javax.script.SimpleScriptContext;
 | 
			
		||||
 | 
			
		||||
@CommandDeclaration(command = "debugexec", permission = "plots.admin", description = "Mutli-purpose debug command", aliases = { "exec" }, category = CommandCategory.DEBUG)
 | 
			
		||||
public class DebugExec extends SubCommand {
 | 
			
		||||
    
 | 
			
		||||
@@ -289,7 +289,7 @@ public class DebugExec extends SubCommand {
 | 
			
		||||
                        MainUtil.sendMessage(player, "Expired plots (" + ExpireManager.expiredPlots.get(args[1]).size() + "):");
 | 
			
		||||
                        for (final Plot plot : ExpireManager.expiredPlots.get(args[1])) {
 | 
			
		||||
                            MainUtil.sendMessage(player,
 | 
			
		||||
                            " - " + plot.area + ";" + plot.getId().x + ";" + plot.getId().y + ";" + UUIDHandler.getName(plot.owner) + " : " + ExpireManager.dates.get(plot.owner));
 | 
			
		||||
                            " - " + plot.getArea() + ";" + plot.getId().x + ";" + plot.getId().y + ";" + UUIDHandler.getName(plot.owner) + " : " + ExpireManager.dates.get(plot.owner));
 | 
			
		||||
                        }
 | 
			
		||||
                        return true;
 | 
			
		||||
                    }
 | 
			
		||||
 
 | 
			
		||||
@@ -50,7 +50,7 @@ public class Deny extends SubCommand {
 | 
			
		||||
        if (plot == null) {
 | 
			
		||||
            return !sendMessage(plr, C.NOT_IN_PLOT);
 | 
			
		||||
        }
 | 
			
		||||
        if ((plot == null) || !plot.hasOwner()) {
 | 
			
		||||
        if (!plot.hasOwner()) {
 | 
			
		||||
            MainUtil.sendMessage(plr, C.PLOT_UNOWNED);
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -20,13 +20,6 @@
 | 
			
		||||
////////////////////////////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
package com.intellectualcrafters.plot.commands;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.Arrays;
 | 
			
		||||
import java.util.Collections;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.HashSet;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
import com.intellectualcrafters.plot.config.C;
 | 
			
		||||
import com.intellectualcrafters.plot.config.Settings;
 | 
			
		||||
import com.intellectualcrafters.plot.object.ConsolePlayer;
 | 
			
		||||
@@ -45,6 +38,13 @@ import com.plotsquared.general.commands.Command;
 | 
			
		||||
import com.plotsquared.general.commands.CommandHandlingOutput;
 | 
			
		||||
import com.plotsquared.general.commands.CommandManager;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.Arrays;
 | 
			
		||||
import java.util.Collections;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.HashSet;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * PlotSquared command class
 | 
			
		||||
 *
 | 
			
		||||
@@ -278,7 +278,7 @@ public class MainCommand extends CommandManager<PlotPlayer> {
 | 
			
		||||
                            if (newPlot == null) {
 | 
			
		||||
                                break;
 | 
			
		||||
                            }
 | 
			
		||||
                            if (!ConsolePlayer.isConsole(player) && (!newPlot.area.equals(area) || newPlot.isDenied(player.getUUID())) && !Permissions.hasPermission(player, C.PERMISSION_ADMIN)) {
 | 
			
		||||
                            if (!ConsolePlayer.isConsole(player) && (!newPlot.getArea().equals(area) || newPlot.isDenied(player.getUUID())) && !Permissions.hasPermission(player, C.PERMISSION_ADMIN)) {
 | 
			
		||||
                                break;
 | 
			
		||||
                            }
 | 
			
		||||
                            // Save meta
 | 
			
		||||
 
 | 
			
		||||
@@ -62,7 +62,7 @@ public class Move extends SubCommand {
 | 
			
		||||
            MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot copy <X;Z>");
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
        if (!plot1.area.isCompatible(plot2.area)) {
 | 
			
		||||
        if (!plot1.getArea().isCompatible(plot2.getArea())) {
 | 
			
		||||
            C.PLOTWORLD_INCOMPATIBLE.send(plr);
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -20,9 +20,6 @@
 | 
			
		||||
////////////////////////////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
package com.intellectualcrafters.plot.commands;
 | 
			
		||||
 | 
			
		||||
import java.util.HashSet;
 | 
			
		||||
import java.util.UUID;
 | 
			
		||||
 | 
			
		||||
import com.intellectualcrafters.plot.config.C;
 | 
			
		||||
import com.intellectualcrafters.plot.config.Settings;
 | 
			
		||||
import com.intellectualcrafters.plot.object.Plot;
 | 
			
		||||
@@ -32,6 +29,9 @@ import com.intellectualcrafters.plot.util.Permissions;
 | 
			
		||||
import com.intellectualcrafters.plot.util.UUIDHandler;
 | 
			
		||||
import com.plotsquared.general.commands.CommandDeclaration;
 | 
			
		||||
 | 
			
		||||
import java.util.HashSet;
 | 
			
		||||
import java.util.UUID;
 | 
			
		||||
 | 
			
		||||
@CommandDeclaration(
 | 
			
		||||
command = "setowner",
 | 
			
		||||
permission = "plots.set.owner",
 | 
			
		||||
@@ -82,7 +82,7 @@ public class Owner extends SetCommand {
 | 
			
		||||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
            final int size = plots.size();
 | 
			
		||||
            final int currentPlots = (Settings.GLOBAL_LIMIT ? other.getPlotCount() : other.getPlotCount(plot.area.worldname)) + size;
 | 
			
		||||
            final int currentPlots = (Settings.GLOBAL_LIMIT ? other.getPlotCount() : other.getPlotCount(plot.getArea().worldname)) + size;
 | 
			
		||||
            if (currentPlots > other.getAllowedPlots()) {
 | 
			
		||||
                sendMessage(plr, C.CANT_TRANSFER_MORE_PLOTS);
 | 
			
		||||
                return false;
 | 
			
		||||
@@ -93,7 +93,7 @@ public class Owner extends SetCommand {
 | 
			
		||||
        plot.setSign(name);
 | 
			
		||||
        MainUtil.sendMessage(plr, C.SET_OWNER);
 | 
			
		||||
        if (other != null) {
 | 
			
		||||
            MainUtil.sendMessage(other, C.NOW_OWNER, plot.area + ";" + plot.getId());
 | 
			
		||||
            MainUtil.sendMessage(other, C.NOW_OWNER, plot.getArea() + ";" + plot.getId());
 | 
			
		||||
        }
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -20,12 +20,6 @@
 | 
			
		||||
////////////////////////////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
package com.intellectualcrafters.plot.commands;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.HashSet;
 | 
			
		||||
import java.util.Map.Entry;
 | 
			
		||||
import java.util.Set;
 | 
			
		||||
import java.util.UUID;
 | 
			
		||||
 | 
			
		||||
import com.intellectualcrafters.plot.PS;
 | 
			
		||||
import com.intellectualcrafters.plot.config.C;
 | 
			
		||||
import com.intellectualcrafters.plot.database.DBFunc;
 | 
			
		||||
@@ -38,6 +32,12 @@ import com.intellectualcrafters.plot.util.StringMan;
 | 
			
		||||
import com.intellectualcrafters.plot.util.UUIDHandler;
 | 
			
		||||
import com.plotsquared.general.commands.CommandDeclaration;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.HashSet;
 | 
			
		||||
import java.util.Map.Entry;
 | 
			
		||||
import java.util.Set;
 | 
			
		||||
import java.util.UUID;
 | 
			
		||||
 | 
			
		||||
@CommandDeclaration(
 | 
			
		||||
usage = "/plot purge world:<world> area:<area> id:<id> owner:<owner> shared:<shared> unknown:[true|false]",
 | 
			
		||||
command = "purge",
 | 
			
		||||
@@ -117,13 +117,13 @@ public class Purge extends SubCommand {
 | 
			
		||||
        final HashSet<Integer> toDelete = new HashSet<>();
 | 
			
		||||
        Set<Plot> basePlots = PS.get().getBasePlots();
 | 
			
		||||
        for (Plot plot : PS.get().getBasePlots()) {
 | 
			
		||||
            if (world != null && !plot.area.worldname.equalsIgnoreCase(world)) {
 | 
			
		||||
            if (world != null && !plot.getArea().worldname.equalsIgnoreCase(world)) {
 | 
			
		||||
                continue;
 | 
			
		||||
            }
 | 
			
		||||
            if (area != null && !plot.area.equals(area)) {
 | 
			
		||||
            if (area != null && !plot.getArea().equals(area)) {
 | 
			
		||||
                continue;
 | 
			
		||||
            }
 | 
			
		||||
            if (id != null && !plot.id.equals(id)) {
 | 
			
		||||
            if (id != null && !plot.getId().equals(id)) {
 | 
			
		||||
                continue;
 | 
			
		||||
            }
 | 
			
		||||
            if (owner != null && !plot.isOwner(owner)) {
 | 
			
		||||
@@ -150,7 +150,7 @@ public class Purge extends SubCommand {
 | 
			
		||||
                }
 | 
			
		||||
                for (Entry<PlotId, Plot> entry2 : entry.getValue().entrySet()) {
 | 
			
		||||
                    Plot plot = entry2.getValue();
 | 
			
		||||
                    if (id != null && !plot.id.equals(id)) {
 | 
			
		||||
                    if (id != null && !plot.getId().equals(id)) {
 | 
			
		||||
                        continue;
 | 
			
		||||
                    }
 | 
			
		||||
                    if (owner != null && !plot.isOwner(owner)) {
 | 
			
		||||
 
 | 
			
		||||
@@ -61,7 +61,7 @@ public class Save extends SubCommand {
 | 
			
		||||
                        Location[] corners = plot.getCorners();
 | 
			
		||||
                        final int size = (corners[1].getX() - corners[0].getX()) + 1;
 | 
			
		||||
                        final PlotId id = plot.getId();
 | 
			
		||||
                        final String world = plot.area.toString().replaceAll(";", "-").replaceAll("[^A-Za-z0-9]", "");
 | 
			
		||||
                        final String world = plot.getArea().toString().replaceAll(";", "-").replaceAll("[^A-Za-z0-9]", "");
 | 
			
		||||
                        final String file = time + "_" + world + "_" + id.x + "_" + id.y + "_" + size + "_" + name;
 | 
			
		||||
                        final UUID uuid = plr.getUUID();
 | 
			
		||||
                        
 | 
			
		||||
 
 | 
			
		||||
@@ -55,7 +55,7 @@ public class Swap extends SubCommand {
 | 
			
		||||
            MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot copy <X;Z>");
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
        if (!plot1.area.isCompatible(plot2.area)) {
 | 
			
		||||
        if (!plot1.getArea().isCompatible(plot2.getArea())) {
 | 
			
		||||
            C.PLOTWORLD_INCOMPATIBLE.send(plr);
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -100,7 +100,7 @@ public class list extends SubCommand {
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    public void noArgs(final PlotPlayer plr) {
 | 
			
		||||
        MainUtil.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + getArgumentList(getArgumentList(plr)));
 | 
			
		||||
        MainUtil.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + getArgumentList(plr));
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    @Override
 | 
			
		||||
@@ -388,8 +388,9 @@ public class list extends SubCommand {
 | 
			
		||||
                    strFlags = C.NONE.s();
 | 
			
		||||
                }
 | 
			
		||||
                final PlotMessage flags = new PlotMessage().text(C.color(C.PLOT_INFO_FLAGS.s().replaceAll("%flags%", strFlags))).color("$1");
 | 
			
		||||
                message.text("[").color("$3").text(i + "").command("/plot visit " + plot.area + ";" + plot.getId()).tooltip("/plot visit " + plot.area + ";" + plot.getId()).color("$1").text("]")
 | 
			
		||||
                .color("$3").text(" " + plot.toString()).tooltip(trusted, members, flags).command("/plot info " + plot.area + ";" + plot.getId()).color(color).text(" - ").color("$2");
 | 
			
		||||
                message.text("[").color("$3").text(i + "").command("/plot visit " + plot.getArea() + ";" + plot.getId()).tooltip("/plot visit " + plot.getArea() + ";" + plot.getId()).color("$1")
 | 
			
		||||
                .text("]")
 | 
			
		||||
                .color("$3").text(" " + plot.toString()).tooltip(trusted, members, flags).command("/plot info " + plot.getArea() + ";" + plot.getId()).color(color).text(" - ").color("$2");
 | 
			
		||||
                String prefix = "";
 | 
			
		||||
                for (final UUID uuid : plot.getOwners()) {
 | 
			
		||||
                    final String name = UUIDHandler.getName(uuid);
 | 
			
		||||
 
 | 
			
		||||
@@ -471,7 +471,7 @@ public class SQLManager implements AbstractDB {
 | 
			
		||||
                statement.setString(1, uuid.toString());
 | 
			
		||||
                statement.setInt(2, plot.getId().x);
 | 
			
		||||
                statement.setInt(3, plot.getId().y);
 | 
			
		||||
                statement.setString(4, plot.area.toString());
 | 
			
		||||
                statement.setString(4, plot.getArea().toString());
 | 
			
		||||
            }
 | 
			
		||||
            
 | 
			
		||||
            @Override
 | 
			
		||||
@@ -657,7 +657,7 @@ public class SQLManager implements AbstractDB {
 | 
			
		||||
                } catch (final Exception e) {
 | 
			
		||||
                    stmt.setString((i * 5) + 3, everyone.toString());
 | 
			
		||||
                }
 | 
			
		||||
                stmt.setString((i * 5) + 4, plot.area.toString());
 | 
			
		||||
                stmt.setString((i * 5) + 4, plot.getArea().toString());
 | 
			
		||||
                stmt.setTimestamp((i * 5) + 5, new Timestamp(plot.getTimestamp()));
 | 
			
		||||
            }
 | 
			
		||||
            
 | 
			
		||||
@@ -671,7 +671,7 @@ public class SQLManager implements AbstractDB {
 | 
			
		||||
                } catch (final Exception e1) {
 | 
			
		||||
                    stmt.setString((i * 6) + 4, everyone.toString());
 | 
			
		||||
                }
 | 
			
		||||
                stmt.setString((i * 6) + 5, plot.area.toString());
 | 
			
		||||
                stmt.setString((i * 6) + 5, plot.getArea().toString());
 | 
			
		||||
                stmt.setTimestamp((i * 6) + 6, new Timestamp(plot.getTimestamp()));
 | 
			
		||||
            }
 | 
			
		||||
            
 | 
			
		||||
@@ -680,7 +680,7 @@ public class SQLManager implements AbstractDB {
 | 
			
		||||
                stmt.setInt(1, plot.getId().x);
 | 
			
		||||
                stmt.setInt(2, plot.getId().y);
 | 
			
		||||
                stmt.setString(3, plot.owner.toString());
 | 
			
		||||
                stmt.setString(4, plot.area.toString());
 | 
			
		||||
                stmt.setString(4, plot.getArea().toString());
 | 
			
		||||
                stmt.setTimestamp(5, new Timestamp(plot.getTimestamp()));
 | 
			
		||||
                
 | 
			
		||||
            }
 | 
			
		||||
@@ -994,7 +994,7 @@ public class SQLManager implements AbstractDB {
 | 
			
		||||
                stmt.setInt(1, plot.getId().x);
 | 
			
		||||
                stmt.setInt(2, plot.getId().y);
 | 
			
		||||
                stmt.setString(3, plot.owner.toString());
 | 
			
		||||
                stmt.setString(4, plot.area.toString());
 | 
			
		||||
                stmt.setString(4, plot.getArea().toString());
 | 
			
		||||
                stmt.setTimestamp(5, new Timestamp(plot.getTimestamp()));
 | 
			
		||||
            }
 | 
			
		||||
            
 | 
			
		||||
@@ -1027,7 +1027,7 @@ public class SQLManager implements AbstractDB {
 | 
			
		||||
                stmt.setInt(1, plot.getId().x);
 | 
			
		||||
                stmt.setInt(2, plot.getId().y);
 | 
			
		||||
                stmt.setString(3, plot.owner.toString());
 | 
			
		||||
                stmt.setString(4, plot.area.toString());
 | 
			
		||||
                stmt.setString(4, plot.getArea().toString());
 | 
			
		||||
                stmt.setTimestamp(5, new Timestamp(plot.getTimestamp()));
 | 
			
		||||
            }
 | 
			
		||||
            
 | 
			
		||||
@@ -1363,7 +1363,7 @@ public class SQLManager implements AbstractDB {
 | 
			
		||||
        addPlotTask(plot, new UniqueStatement("delete_plot_comments") {
 | 
			
		||||
            @Override
 | 
			
		||||
            public void set(final PreparedStatement stmt) throws SQLException {
 | 
			
		||||
                stmt.setString(1, plot.area.toString());
 | 
			
		||||
                stmt.setString(1, plot.getArea().toString());
 | 
			
		||||
                stmt.setInt(2, plot.hashCode());
 | 
			
		||||
            }
 | 
			
		||||
            
 | 
			
		||||
@@ -1493,7 +1493,7 @@ public class SQLManager implements AbstractDB {
 | 
			
		||||
            stmt = connection.prepareStatement("SELECT `id` FROM `" + prefix + "plot` WHERE `plot_id_x` = ? AND `plot_id_z` = ? AND world = ? ORDER BY `timestamp` ASC");
 | 
			
		||||
            stmt.setInt(1, plot.getId().x);
 | 
			
		||||
            stmt.setInt(2, plot.getId().y);
 | 
			
		||||
            stmt.setString(3, plot.area.toString());
 | 
			
		||||
            stmt.setString(3, plot.getArea().toString());
 | 
			
		||||
            final ResultSet r = stmt.executeQuery();
 | 
			
		||||
            int id = Integer.MAX_VALUE;
 | 
			
		||||
            while (r.next()) {
 | 
			
		||||
@@ -1711,9 +1711,9 @@ public class SQLManager implements AbstractDB {
 | 
			
		||||
                    p = new Plot(plot_id, user, new HashSet<UUID>(), new HashSet<UUID>(), new HashSet<UUID>(), "", null, null, null, new boolean[] { false, false, false, false }, time, id);
 | 
			
		||||
                    HashMap<PlotId, Plot> map = newplots.get(areaid);
 | 
			
		||||
                    if (map != null) {
 | 
			
		||||
                        Plot last = map.put(p.id, p);
 | 
			
		||||
                        Plot last = map.put(p.getId(), p);
 | 
			
		||||
                        if (last != null) {
 | 
			
		||||
                            map.put(last.id, last);
 | 
			
		||||
                            map.put(last.getId(), last);
 | 
			
		||||
                            if (Settings.AUTO_PURGE) {
 | 
			
		||||
                                toDelete.add(id);
 | 
			
		||||
                            } else {
 | 
			
		||||
@@ -1724,7 +1724,7 @@ public class SQLManager implements AbstractDB {
 | 
			
		||||
                    } else {
 | 
			
		||||
                        map = new HashMap<PlotId, Plot>();
 | 
			
		||||
                        newplots.put(areaid, map);
 | 
			
		||||
                        map.put(p.id, p);
 | 
			
		||||
                        map.put(p.getId(), p);
 | 
			
		||||
                    }
 | 
			
		||||
                    plots.put(id, p);
 | 
			
		||||
                }
 | 
			
		||||
@@ -1991,7 +1991,7 @@ public class SQLManager implements AbstractDB {
 | 
			
		||||
            public void set(final PreparedStatement stmt) throws SQLException {
 | 
			
		||||
                stmt.setInt(1, newPlot.getId().x);
 | 
			
		||||
                stmt.setInt(2, newPlot.getId().y);
 | 
			
		||||
                stmt.setString(3, newPlot.area.toString());
 | 
			
		||||
                stmt.setString(3, newPlot.getArea().toString());
 | 
			
		||||
                stmt.setInt(4, getId(original));
 | 
			
		||||
            }
 | 
			
		||||
            
 | 
			
		||||
@@ -2149,7 +2149,7 @@ public class SQLManager implements AbstractDB {
 | 
			
		||||
            @Override
 | 
			
		||||
            public void set(final PreparedStatement statement) throws SQLException {
 | 
			
		||||
                if (plot != null) {
 | 
			
		||||
                    statement.setString(1, plot.area.toString());
 | 
			
		||||
                    statement.setString(1, plot.getArea().toString());
 | 
			
		||||
                    statement.setInt(2, plot.getId().hashCode());
 | 
			
		||||
                    statement.setString(3, comment.comment);
 | 
			
		||||
                    statement.setString(4, comment.inbox);
 | 
			
		||||
@@ -2177,7 +2177,7 @@ public class SQLManager implements AbstractDB {
 | 
			
		||||
            @Override
 | 
			
		||||
            public void set(final PreparedStatement statement) throws SQLException {
 | 
			
		||||
                if (plot != null) {
 | 
			
		||||
                    statement.setString(1, plot.area.toString());
 | 
			
		||||
                    statement.setString(1, plot.getArea().toString());
 | 
			
		||||
                    statement.setInt(2, plot.getId().hashCode());
 | 
			
		||||
                    statement.setString(3, inbox);
 | 
			
		||||
                } else {
 | 
			
		||||
@@ -2201,7 +2201,7 @@ public class SQLManager implements AbstractDB {
 | 
			
		||||
            @Override
 | 
			
		||||
            public void set(final PreparedStatement statement) throws SQLException {
 | 
			
		||||
                if (plot != null) {
 | 
			
		||||
                    statement.setString(1, plot.area.toString());
 | 
			
		||||
                    statement.setString(1, plot.getArea().toString());
 | 
			
		||||
                    statement.setInt(2, plot.getId().hashCode());
 | 
			
		||||
                    statement.setString(3, inbox);
 | 
			
		||||
                } else {
 | 
			
		||||
@@ -2251,7 +2251,7 @@ public class SQLManager implements AbstractDB {
 | 
			
		||||
        addPlotTask(plot, new UniqueStatement("setComment") {
 | 
			
		||||
            @Override
 | 
			
		||||
            public void set(final PreparedStatement statement) throws SQLException {
 | 
			
		||||
                statement.setString(1, plot.area.toString());
 | 
			
		||||
                statement.setString(1, plot.getArea().toString());
 | 
			
		||||
                statement.setInt(2, plot.getId().hashCode());
 | 
			
		||||
                statement.setString(3, comment.comment);
 | 
			
		||||
                statement.setString(4, comment.inbox);
 | 
			
		||||
@@ -2989,7 +2989,7 @@ public class SQLManager implements AbstractDB {
 | 
			
		||||
            if (plot.temp == -1) {
 | 
			
		||||
                continue;
 | 
			
		||||
            }
 | 
			
		||||
            final HashMap<PlotId, Plot> worldplots = database.get(plot.area.toString());
 | 
			
		||||
            final HashMap<PlotId, Plot> worldplots = database.get(plot.getArea().toString());
 | 
			
		||||
            if (worldplots == null) {
 | 
			
		||||
                PS.debug("&8 - &7Creating plot (1): " + plot);
 | 
			
		||||
                toCreate.add(plot);
 | 
			
		||||
 
 | 
			
		||||
@@ -20,13 +20,6 @@
 | 
			
		||||
////////////////////////////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
package com.intellectualcrafters.plot.flag;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.HashSet;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
import java.util.Set;
 | 
			
		||||
 | 
			
		||||
import com.intellectualcrafters.plot.PS;
 | 
			
		||||
import com.intellectualcrafters.plot.config.C;
 | 
			
		||||
import com.intellectualcrafters.plot.database.DBFunc;
 | 
			
		||||
@@ -39,6 +32,13 @@ import com.intellectualcrafters.plot.object.RunnableVal;
 | 
			
		||||
import com.intellectualcrafters.plot.util.EventUtil;
 | 
			
		||||
import com.intellectualcrafters.plot.util.Permissions;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.HashSet;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
import java.util.Set;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Flag Manager Utility
 | 
			
		||||
 *
 | 
			
		||||
@@ -173,7 +173,7 @@ public class FlagManager {
 | 
			
		||||
        if (plot.owner == null) {
 | 
			
		||||
            return null;
 | 
			
		||||
        }
 | 
			
		||||
        return getSettingFlag(plot.area, plot.getSettings(), flag);
 | 
			
		||||
        return getSettingFlag(plot.getArea(), plot.getSettings(), flag);
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    public static boolean isPlotFlagTrue(final Plot plot, final String strFlag) {
 | 
			
		||||
@@ -255,7 +255,7 @@ public class FlagManager {
 | 
			
		||||
        if (!plot.hasOwner()) {
 | 
			
		||||
            return null;
 | 
			
		||||
        }
 | 
			
		||||
        return getSettingFlags(plot.area, plot.getSettings());
 | 
			
		||||
        return getSettingFlags(plot.getArea(), plot.getSettings());
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    public static HashMap<String, Flag> getPlotFlags(PlotArea area, final PlotSettings settings, final boolean ignorePluginflags) {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,17 +1,5 @@
 | 
			
		||||
package com.intellectualcrafters.plot.generator;
 | 
			
		||||
 | 
			
		||||
import java.io.File;
 | 
			
		||||
import java.util.ArrayDeque;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.Collections;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.HashSet;
 | 
			
		||||
import java.util.Iterator;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map.Entry;
 | 
			
		||||
import java.util.Set;
 | 
			
		||||
import java.util.concurrent.atomic.AtomicInteger;
 | 
			
		||||
 | 
			
		||||
import com.intellectualcrafters.jnbt.CompoundTag;
 | 
			
		||||
import com.intellectualcrafters.plot.PS;
 | 
			
		||||
import com.intellectualcrafters.plot.config.C;
 | 
			
		||||
@@ -33,6 +21,18 @@ import com.intellectualcrafters.plot.util.SchematicHandler;
 | 
			
		||||
import com.intellectualcrafters.plot.util.SetQueue;
 | 
			
		||||
import com.intellectualcrafters.plot.util.TaskManager;
 | 
			
		||||
 | 
			
		||||
import java.io.File;
 | 
			
		||||
import java.util.ArrayDeque;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.Collections;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.HashSet;
 | 
			
		||||
import java.util.Iterator;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map.Entry;
 | 
			
		||||
import java.util.Set;
 | 
			
		||||
import java.util.concurrent.atomic.AtomicInteger;
 | 
			
		||||
 | 
			
		||||
public abstract class HybridUtils {
 | 
			
		||||
    
 | 
			
		||||
    public static HybridUtils manager;
 | 
			
		||||
@@ -93,7 +93,7 @@ public abstract class HybridUtils {
 | 
			
		||||
                }
 | 
			
		||||
                RegionWrapper region = zones.poll();
 | 
			
		||||
                final Runnable task = this;
 | 
			
		||||
                analyzeRegion(origin.area.worldname, region, new RunnableVal<PlotAnalysis>() {
 | 
			
		||||
                analyzeRegion(origin.getArea().worldname, region, new RunnableVal<PlotAnalysis>() {
 | 
			
		||||
                    @Override
 | 
			
		||||
                    public void run(PlotAnalysis value) {
 | 
			
		||||
                        analysis.add(value);
 | 
			
		||||
@@ -151,20 +151,21 @@ public abstract class HybridUtils {
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                RegionWrapper region = zones.poll();
 | 
			
		||||
                Location pos1 = new Location(plot.area.worldname, region.minX, region.minY, region.minZ);
 | 
			
		||||
                Location pos2 = new Location(plot.area.worldname, region.maxX, region.maxY, region.maxZ);
 | 
			
		||||
                Location pos1 = new Location(plot.getArea().worldname, region.minX, region.minY, region.minZ);
 | 
			
		||||
                Location pos2 = new Location(plot.getArea().worldname, region.maxX, region.maxY, region.maxZ);
 | 
			
		||||
                ChunkManager.chunkTask(pos1, pos2, new RunnableVal<int[]>() {
 | 
			
		||||
                    @Override
 | 
			
		||||
                    public void run(int[] value) {
 | 
			
		||||
                        final ChunkLoc loc = new ChunkLoc(value[0], value[1]);
 | 
			
		||||
                        ChunkManager.manager.loadChunk(plot.area.worldname, loc, false);
 | 
			
		||||
                        ChunkManager.manager.loadChunk(plot.getArea().worldname, loc, false);
 | 
			
		||||
                        final int bx = value[2];
 | 
			
		||||
                        final int bz = value[3];
 | 
			
		||||
                        final int ex = value[4];
 | 
			
		||||
                        final int ez = value[5];
 | 
			
		||||
                        whenDone.value += checkModified(plot.area.worldname, bx, ex, 1, cpw.PLOT_HEIGHT - 1, bz, ez, cpw.MAIN_BLOCK);
 | 
			
		||||
                        whenDone.value += checkModified(plot.area.worldname, bx, ex, cpw.PLOT_HEIGHT, cpw.PLOT_HEIGHT, bz, ez, cpw.TOP_BLOCK);
 | 
			
		||||
                        whenDone.value += checkModified(plot.area.worldname, bx, ex, cpw.PLOT_HEIGHT + 1, 255, bz, ez, new PlotBlock[] { new PlotBlock((short) 0, (byte) 0) });
 | 
			
		||||
                        whenDone.value += checkModified(plot.getArea().worldname, bx, ex, 1, cpw.PLOT_HEIGHT - 1, bz, ez, cpw.MAIN_BLOCK);
 | 
			
		||||
                        whenDone.value += checkModified(plot.getArea().worldname, bx, ex, cpw.PLOT_HEIGHT, cpw.PLOT_HEIGHT, bz, ez, cpw.TOP_BLOCK);
 | 
			
		||||
                        whenDone.value += checkModified(
 | 
			
		||||
                                plot.getArea().worldname, bx, ex, cpw.PLOT_HEIGHT + 1, 255, bz, ez, new PlotBlock[] { new PlotBlock((short) 0, (byte) 0) });
 | 
			
		||||
                    }
 | 
			
		||||
                }, this, 5);
 | 
			
		||||
                
 | 
			
		||||
@@ -296,10 +297,10 @@ public abstract class HybridUtils {
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    public boolean setupRoadSchematic(final Plot plot) {
 | 
			
		||||
        final String world = plot.area.worldname;
 | 
			
		||||
        final String world = plot.getArea().worldname;
 | 
			
		||||
        final Location bot = plot.getBottomAbs().subtract(1, 0, 1);
 | 
			
		||||
        final Location top = plot.getTopAbs();
 | 
			
		||||
        final HybridPlotWorld plotworld = (HybridPlotWorld) plot.area;
 | 
			
		||||
        final HybridPlotWorld plotworld = (HybridPlotWorld) plot.getArea();
 | 
			
		||||
        final int sx = (bot.getX() - plotworld.ROAD_WIDTH) + 1;
 | 
			
		||||
        final int sz = bot.getZ() + 1;
 | 
			
		||||
        final int sy = plotworld.ROAD_HEIGHT;
 | 
			
		||||
@@ -313,7 +314,8 @@ public abstract class HybridUtils {
 | 
			
		||||
        final Set<RegionWrapper> sideroad = new HashSet<>(Collections.singletonList(new RegionWrapper(sx, ex, sy, ey, sz, ez)));
 | 
			
		||||
        final Set<RegionWrapper> intersection = new HashSet<>(Collections.singletonList(new RegionWrapper(sx, ex, sy, ty, bz, tz)));
 | 
			
		||||
 | 
			
		||||
        final String dir = PS.get().IMP.getDirectory() + File.separator + "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + plot.area.toString() + File.separator;
 | 
			
		||||
        final String dir = PS.get().IMP.getDirectory() + File.separator + "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + plot
 | 
			
		||||
                .getArea().toString() + File.separator;
 | 
			
		||||
        SchematicHandler.manager.getCompoundTag(world, sideroad, new RunnableVal<CompoundTag>() {
 | 
			
		||||
            @Override
 | 
			
		||||
            public void run(CompoundTag value) {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,9 +1,5 @@
 | 
			
		||||
package com.intellectualcrafters.plot.generator;
 | 
			
		||||
 | 
			
		||||
import java.util.Arrays;
 | 
			
		||||
import java.util.HashSet;
 | 
			
		||||
import java.util.Iterator;
 | 
			
		||||
 | 
			
		||||
import com.intellectualcrafters.plot.PS;
 | 
			
		||||
import com.intellectualcrafters.plot.object.Location;
 | 
			
		||||
import com.intellectualcrafters.plot.object.Plot;
 | 
			
		||||
@@ -13,6 +9,10 @@ import com.intellectualcrafters.plot.object.RegionWrapper;
 | 
			
		||||
import com.intellectualcrafters.plot.util.ChunkManager;
 | 
			
		||||
import com.intellectualcrafters.plot.util.MainUtil;
 | 
			
		||||
 | 
			
		||||
import java.util.Arrays;
 | 
			
		||||
import java.util.HashSet;
 | 
			
		||||
import java.util.Iterator;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * A plot manager with a square grid layout, with square shaped plots
 | 
			
		||||
 */
 | 
			
		||||
@@ -30,8 +30,8 @@ public abstract class SquarePlotManager extends GridPlotManager {
 | 
			
		||||
                Iterator<RegionWrapper> iter = regions.iterator();
 | 
			
		||||
                RegionWrapper region = iter.next();
 | 
			
		||||
                iter.remove();
 | 
			
		||||
                Location pos1 = new Location(plot.area.worldname, region.minX, region.minY, region.minZ);
 | 
			
		||||
                Location pos2 = new Location(plot.area.worldname, region.maxX, region.maxY, region.maxZ);
 | 
			
		||||
                Location pos1 = new Location(plot.getArea().worldname, region.minX, region.minY, region.minZ);
 | 
			
		||||
                Location pos2 = new Location(plot.getArea().worldname, region.maxX, region.maxY, region.maxZ);
 | 
			
		||||
                ChunkManager.manager.regenerateRegion(pos1, pos2, false, this);
 | 
			
		||||
            }
 | 
			
		||||
        };
 | 
			
		||||
 
 | 
			
		||||
@@ -20,22 +20,6 @@
 | 
			
		||||
////////////////////////////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
package com.intellectualcrafters.plot.object;
 | 
			
		||||
 | 
			
		||||
import java.io.File;
 | 
			
		||||
import java.net.URL;
 | 
			
		||||
import java.nio.charset.StandardCharsets;
 | 
			
		||||
import java.util.ArrayDeque;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.Collection;
 | 
			
		||||
import java.util.Collections;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.HashSet;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map.Entry;
 | 
			
		||||
import java.util.Set;
 | 
			
		||||
import java.util.UUID;
 | 
			
		||||
import java.util.concurrent.ConcurrentHashMap;
 | 
			
		||||
import java.util.concurrent.atomic.AtomicInteger;
 | 
			
		||||
 | 
			
		||||
import com.google.common.collect.BiMap;
 | 
			
		||||
import com.intellectualcrafters.jnbt.CompoundTag;
 | 
			
		||||
import com.intellectualcrafters.plot.PS;
 | 
			
		||||
@@ -57,6 +41,22 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
 | 
			
		||||
import com.intellectualcrafters.plot.util.WorldUtil;
 | 
			
		||||
import com.plotsquared.listener.PlotListener;
 | 
			
		||||
 | 
			
		||||
import java.io.File;
 | 
			
		||||
import java.net.URL;
 | 
			
		||||
import java.nio.charset.StandardCharsets;
 | 
			
		||||
import java.util.ArrayDeque;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.Collection;
 | 
			
		||||
import java.util.Collections;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.HashSet;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map.Entry;
 | 
			
		||||
import java.util.Set;
 | 
			
		||||
import java.util.UUID;
 | 
			
		||||
import java.util.concurrent.ConcurrentHashMap;
 | 
			
		||||
import java.util.concurrent.atomic.AtomicInteger;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * The plot class
 | 
			
		||||
 */
 | 
			
		||||
@@ -72,8 +72,7 @@ public class Plot {
 | 
			
		||||
     * plot world
 | 
			
		||||
     * Direct access is Deprecated: use getWorld()
 | 
			
		||||
     */
 | 
			
		||||
    @Deprecated
 | 
			
		||||
    public PlotArea area;
 | 
			
		||||
    private PlotArea area;
 | 
			
		||||
    /**
 | 
			
		||||
     * plot owner
 | 
			
		||||
     * (Merged plots can have multiple owners)
 | 
			
		||||
@@ -304,7 +303,7 @@ public class Plot {
 | 
			
		||||
     * @return the PlotCluster object, or null
 | 
			
		||||
     */
 | 
			
		||||
    public PlotCluster getCluster() {
 | 
			
		||||
        return area.getCluster(id);
 | 
			
		||||
        return getArea().getCluster(id);
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
@@ -389,7 +388,7 @@ public class Plot {
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    public void setArea(PlotArea area) {
 | 
			
		||||
        if (this.area != null) {
 | 
			
		||||
        if (this.getArea() != null) {
 | 
			
		||||
            this.area.removePlot(id);
 | 
			
		||||
        }
 | 
			
		||||
        this.area = area;
 | 
			
		||||
 
 | 
			
		||||
@@ -20,18 +20,6 @@
 | 
			
		||||
////////////////////////////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
package com.intellectualcrafters.plot.object;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.Collection;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.HashSet;
 | 
			
		||||
import java.util.Iterator;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
import java.util.Map.Entry;
 | 
			
		||||
import java.util.Set;
 | 
			
		||||
import java.util.UUID;
 | 
			
		||||
import java.util.concurrent.ConcurrentHashMap;
 | 
			
		||||
 | 
			
		||||
import com.intellectualcrafters.configuration.ConfigurationSection;
 | 
			
		||||
import com.intellectualcrafters.plot.PS;
 | 
			
		||||
import com.intellectualcrafters.plot.config.C;
 | 
			
		||||
@@ -50,6 +38,18 @@ import com.intellectualcrafters.plot.util.StringMan;
 | 
			
		||||
import com.intellectualcrafters.plot.util.WorldUtil;
 | 
			
		||||
import com.intellectualcrafters.plot.util.area.QuadMap;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.Collection;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.HashSet;
 | 
			
		||||
import java.util.Iterator;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
import java.util.Map.Entry;
 | 
			
		||||
import java.util.Set;
 | 
			
		||||
import java.util.UUID;
 | 
			
		||||
import java.util.concurrent.ConcurrentHashMap;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @author Jesse Boyd
 | 
			
		||||
 */
 | 
			
		||||
@@ -517,7 +517,7 @@ public abstract class PlotArea {
 | 
			
		||||
        if (plot == null) {
 | 
			
		||||
            return null;
 | 
			
		||||
        }
 | 
			
		||||
        return clusters != null ? clusters.get(plot.id.x, plot.id.y) : null;
 | 
			
		||||
        return clusters != null ? clusters.get(plot.getId().x, plot.getId().y) : null;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    public PlotCluster getFirstIntersectingCluster(PlotId pos1, PlotId pos2) {
 | 
			
		||||
@@ -607,11 +607,11 @@ public abstract class PlotArea {
 | 
			
		||||
        for (PlotPlayer pp : plot.getPlayersInPlot()) {
 | 
			
		||||
            pp.setMeta("lastplot", plot);
 | 
			
		||||
        }
 | 
			
		||||
        return plots.put(plot.id, plot) == null;
 | 
			
		||||
        return plots.put(plot.getId(), plot) == null;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    public boolean addPlotIfAbsent(Plot plot) {
 | 
			
		||||
        if (plots.putIfAbsent(plot.id, plot) == null) {
 | 
			
		||||
        if (plots.putIfAbsent(plot.getId(), plot) == null) {
 | 
			
		||||
            for (PlotPlayer pp : plot.getPlayersInPlot()) {
 | 
			
		||||
                pp.setMeta("lastplot", plot);
 | 
			
		||||
            }
 | 
			
		||||
@@ -621,12 +621,11 @@ public abstract class PlotArea {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public boolean addPlotAbs(Plot plot) {
 | 
			
		||||
        return plots.put(plot.id, plot) == null;
 | 
			
		||||
        return plots.put(plot.getId(), plot) == null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Check if the plots in a selection are unowned
 | 
			
		||||
     * @param world
 | 
			
		||||
     * @param pos1
 | 
			
		||||
     * @param pos2
 | 
			
		||||
     * @return
 | 
			
		||||
@@ -635,7 +634,7 @@ public abstract class PlotArea {
 | 
			
		||||
        int area = (pos2.x - pos1.x + 1) * (pos2.y - pos1.y + 1);
 | 
			
		||||
        if (area > getPlotCount()) {
 | 
			
		||||
            for (Plot plot : getPlots()) {
 | 
			
		||||
                if (plot.id.x >= pos1.x && plot.id.x <= pos2.x && plot.id.y >= pos1.y && plot.id.y <= pos2.y) {
 | 
			
		||||
                if (plot.getId().x >= pos1.x && plot.getId().x <= pos2.x && plot.getId().y >= pos1.y && plot.getId().y <= pos2.y) {
 | 
			
		||||
                    return false;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
@@ -654,7 +653,6 @@ public abstract class PlotArea {
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * Get the plot border distance for a world<br>
 | 
			
		||||
     * @param worldname
 | 
			
		||||
     * @return The border distance or Integer.MAX_VALUE if no border is set
 | 
			
		||||
     */
 | 
			
		||||
    public int getBorder() {
 | 
			
		||||
@@ -672,7 +670,6 @@ public abstract class PlotArea {
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * Setup the plot border for a world (usually done when the world is created)
 | 
			
		||||
     * @param world
 | 
			
		||||
     */
 | 
			
		||||
    public void setupBorder() {
 | 
			
		||||
        if (!WORLD_BORDER) {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,14 +1,14 @@
 | 
			
		||||
package com.intellectualcrafters.plot.object;
 | 
			
		||||
 | 
			
		||||
import com.intellectualcrafters.plot.database.DBFunc;
 | 
			
		||||
import com.intellectualcrafters.plot.util.UUIDHandler;
 | 
			
		||||
 | 
			
		||||
import java.util.Collections;
 | 
			
		||||
import java.util.HashSet;
 | 
			
		||||
import java.util.Iterator;
 | 
			
		||||
import java.util.Set;
 | 
			
		||||
import java.util.UUID;
 | 
			
		||||
 | 
			
		||||
import com.intellectualcrafters.plot.database.DBFunc;
 | 
			
		||||
import com.intellectualcrafters.plot.util.UUIDHandler;
 | 
			
		||||
 | 
			
		||||
public class PlotHandler {
 | 
			
		||||
    public static HashSet<UUID> getOwners(final Plot plot) {
 | 
			
		||||
        if (plot.owner == null) {
 | 
			
		||||
@@ -238,7 +238,7 @@ public class PlotHandler {
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
        for (Plot current : plot.getConnectedPlots()) {
 | 
			
		||||
            plot.area.removePlot(plot.id);
 | 
			
		||||
            plot.getArea().removePlot(plot.getId());
 | 
			
		||||
            DBFunc.delete(current);
 | 
			
		||||
            current.settings = null;
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -1,15 +1,5 @@
 | 
			
		||||
package com.intellectualcrafters.plot.util;
 | 
			
		||||
 | 
			
		||||
import java.io.File;
 | 
			
		||||
import java.nio.charset.StandardCharsets;
 | 
			
		||||
import java.nio.file.Files;
 | 
			
		||||
import java.nio.file.StandardOpenOption;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.HashSet;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map.Entry;
 | 
			
		||||
 | 
			
		||||
import com.intellectualcrafters.plot.PS;
 | 
			
		||||
import com.intellectualcrafters.plot.config.Settings;
 | 
			
		||||
import com.intellectualcrafters.plot.flag.FlagManager;
 | 
			
		||||
@@ -23,6 +13,16 @@ import com.intellectualcrafters.plot.object.PlotBlock;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
import com.intellectualcrafters.plot.object.RegionWrapper;
 | 
			
		||||
 | 
			
		||||
import java.io.File;
 | 
			
		||||
import java.nio.charset.StandardCharsets;
 | 
			
		||||
import java.nio.file.Files;
 | 
			
		||||
import java.nio.file.StandardOpenOption;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.HashSet;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map.Entry;
 | 
			
		||||
 | 
			
		||||
public class BO3Handler {
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
@@ -51,7 +51,7 @@ public class BO3Handler {
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    public static boolean saveBO3(final PlotPlayer plr, final Plot plot) {
 | 
			
		||||
        final PlotArea plotworld = plot.area;
 | 
			
		||||
        final PlotArea plotworld = plot.getArea();
 | 
			
		||||
        if (!(plotworld instanceof ClassicPlotWorld) || (plotworld.TYPE != 0)) {
 | 
			
		||||
            MainUtil.sendMessage(plr, "BO3 exporting only supports type 0 classic generation.");
 | 
			
		||||
            return false;
 | 
			
		||||
@@ -78,13 +78,13 @@ public class BO3Handler {
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        for (ChunkLoc loc : chunks) {
 | 
			
		||||
            ChunkManager.manager.loadChunk(plot.area.worldname, loc, false);
 | 
			
		||||
            ChunkManager.manager.loadChunk(plot.getArea().worldname, loc, false);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        boolean content = false;
 | 
			
		||||
        for (RegionWrapper region : regions) {
 | 
			
		||||
            Location pos1 = new Location(plot.area.worldname, region.minX, region.minY, region.minZ);
 | 
			
		||||
            Location pos2 = new Location(plot.area.worldname, region.maxX, region.maxY, region.maxZ);
 | 
			
		||||
            Location pos1 = new Location(plot.getArea().worldname, region.minX, region.minY, region.minZ);
 | 
			
		||||
            Location pos2 = new Location(plot.getArea().worldname, region.maxX, region.maxY, region.maxZ);
 | 
			
		||||
            for (int x = pos1.getX(); x <= pos2.getX(); x++) {
 | 
			
		||||
                final int X = ((x + 7) - cx) >> 4;
 | 
			
		||||
                final int xx = (x - cx) % 16;
 | 
			
		||||
@@ -94,7 +94,7 @@ public class BO3Handler {
 | 
			
		||||
                    final ChunkLoc loc = new ChunkLoc(X, Z);
 | 
			
		||||
                    BO3 bo3 = map.get(loc);
 | 
			
		||||
                    for (int y = 1; y < height; y++) {
 | 
			
		||||
                        final PlotBlock block = WorldUtil.IMP.getBlock(new Location(plot.area.worldname, x, y, z));
 | 
			
		||||
                        final PlotBlock block = WorldUtil.IMP.getBlock(new Location(plot.getArea().worldname, x, y, z));
 | 
			
		||||
                        if ((block != null) && !contains(cpw.MAIN_BLOCK, block)) {
 | 
			
		||||
                            if (bo3 == null) {
 | 
			
		||||
                                bo3 = new BO3(alias, loc);
 | 
			
		||||
@@ -104,7 +104,7 @@ public class BO3Handler {
 | 
			
		||||
                            bo3.addBlock(xx, y - height - 1, zz, block);
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    final PlotBlock floor = WorldUtil.IMP.getBlock(new Location(plot.area.worldname, x, height, z));
 | 
			
		||||
                    final PlotBlock floor = WorldUtil.IMP.getBlock(new Location(plot.getArea().worldname, x, height, z));
 | 
			
		||||
                    if ((floor != null) && !contains(cpw.TOP_BLOCK, floor)) {
 | 
			
		||||
                        if (bo3 == null) {
 | 
			
		||||
                            bo3 = new BO3(alias, loc);
 | 
			
		||||
@@ -114,7 +114,7 @@ public class BO3Handler {
 | 
			
		||||
                        bo3.addBlock(xx, -1, zz, floor);
 | 
			
		||||
                    }
 | 
			
		||||
                    for (int y = height + 1; y < 256; y++) {
 | 
			
		||||
                        final PlotBlock block = WorldUtil.IMP.getBlock(new Location(plot.area.worldname, x, y, z));
 | 
			
		||||
                        final PlotBlock block = WorldUtil.IMP.getBlock(new Location(plot.getArea().worldname, x, y, z));
 | 
			
		||||
                        if ((block != null) && (block.id != 0)) {
 | 
			
		||||
                            if (bo3 == null) {
 | 
			
		||||
                                bo3 = new BO3(alias, loc);
 | 
			
		||||
@@ -172,7 +172,7 @@ public class BO3Handler {
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    public static boolean save(final Plot plot, final BO3 bo3) {
 | 
			
		||||
        final File base = getBaseFile(plot.area.worldname);
 | 
			
		||||
        final File base = getBaseFile(plot.getArea().worldname);
 | 
			
		||||
        try {
 | 
			
		||||
            final List<String> lines = Files.readAllLines(base.toPath(), StandardCharsets.UTF_8);
 | 
			
		||||
            for (int i = 0; i < lines.size(); i++) {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,10 +1,5 @@
 | 
			
		||||
package com.intellectualcrafters.plot.util;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.Collection;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.concurrent.atomic.AtomicInteger;
 | 
			
		||||
 | 
			
		||||
import com.intellectualcrafters.plot.config.C;
 | 
			
		||||
import com.intellectualcrafters.plot.config.Settings;
 | 
			
		||||
import com.intellectualcrafters.plot.object.Plot;
 | 
			
		||||
@@ -16,6 +11,11 @@ import com.intellectualcrafters.plot.object.comment.InboxPublic;
 | 
			
		||||
import com.intellectualcrafters.plot.object.comment.InboxReport;
 | 
			
		||||
import com.intellectualcrafters.plot.object.comment.PlotComment;
 | 
			
		||||
 | 
			
		||||
import java.util.Collection;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.concurrent.atomic.AtomicInteger;
 | 
			
		||||
 | 
			
		||||
public class CommentManager {
 | 
			
		||||
    public static HashMap<String, CommentInbox> inboxes = new HashMap<>();
 | 
			
		||||
    
 | 
			
		||||
@@ -33,13 +33,13 @@ public class CommentManager {
 | 
			
		||||
                final AtomicInteger count = new AtomicInteger(0);
 | 
			
		||||
                final AtomicInteger size = new AtomicInteger(boxes.size());
 | 
			
		||||
                for (final CommentInbox inbox : inboxes.values()) {
 | 
			
		||||
                    inbox.getComments(plot, new RunnableVal() {
 | 
			
		||||
                    inbox.getComments(plot, new RunnableVal<List<PlotComment>>() {
 | 
			
		||||
                        @Override
 | 
			
		||||
                        public void run(Object value) {
 | 
			
		||||
                        public void run(List<PlotComment> value) {
 | 
			
		||||
                            int total;
 | 
			
		||||
                            if (value != null) {
 | 
			
		||||
                                int num = 0;
 | 
			
		||||
                                for (final PlotComment comment : (ArrayList<PlotComment>) value) {
 | 
			
		||||
                                for (final PlotComment comment : value) {
 | 
			
		||||
                                    if (comment.timestamp > getTimestamp(player, inbox.toString())) {
 | 
			
		||||
                                        num++;
 | 
			
		||||
                                    }
 | 
			
		||||
 
 | 
			
		||||
@@ -1,11 +1,5 @@
 | 
			
		||||
package com.intellectualcrafters.plot.util;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.Iterator;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.UUID;
 | 
			
		||||
import java.util.concurrent.ConcurrentHashMap;
 | 
			
		||||
 | 
			
		||||
import com.intellectualcrafters.plot.PS;
 | 
			
		||||
import com.intellectualcrafters.plot.config.C;
 | 
			
		||||
import com.intellectualcrafters.plot.config.Settings;
 | 
			
		||||
@@ -20,6 +14,12 @@ import com.intellectualcrafters.plot.object.PlotHandler;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
import com.intellectualcrafters.plot.object.RunnableVal;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.Iterator;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.UUID;
 | 
			
		||||
import java.util.concurrent.ConcurrentHashMap;
 | 
			
		||||
 | 
			
		||||
public class ExpireManager {
 | 
			
		||||
    public static ConcurrentHashMap<String, List<Plot>> expiredPlots = new ConcurrentHashMap<>();
 | 
			
		||||
    public static ConcurrentHashMap<String, Boolean> updatingPlots = new ConcurrentHashMap<>();
 | 
			
		||||
@@ -123,7 +123,7 @@ public class ExpireManager {
 | 
			
		||||
                                final int complexity = changed == null ? 0 : changed.getComplexity();
 | 
			
		||||
                                final int modified = changed == null ? 0 : changed.changes;
 | 
			
		||||
                                PS.debug("$2[&5Expire&dManager$2] &cDeleted expired plot: " + plot + " : " + complexity + " - " + modified);
 | 
			
		||||
                                PS.debug("$4 - Area: " + plot.area);
 | 
			
		||||
                                PS.debug("$4 - Area: " + plot.getArea());
 | 
			
		||||
                                if (plot.hasOwner()) {
 | 
			
		||||
                                    PS.debug("$4 - Owner: " + UUIDHandler.getName(plot.owner));
 | 
			
		||||
                                } else {
 | 
			
		||||
 
 | 
			
		||||
@@ -20,15 +20,6 @@
 | 
			
		||||
////////////////////////////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
package com.intellectualcrafters.plot.util;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.Collection;
 | 
			
		||||
import java.util.Collections;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map.Entry;
 | 
			
		||||
import java.util.UUID;
 | 
			
		||||
import java.util.regex.Matcher;
 | 
			
		||||
 | 
			
		||||
import com.intellectualcrafters.plot.PS;
 | 
			
		||||
import com.intellectualcrafters.plot.config.C;
 | 
			
		||||
import com.intellectualcrafters.plot.config.Settings;
 | 
			
		||||
@@ -47,6 +38,15 @@ import com.intellectualcrafters.plot.object.PseudoRandom;
 | 
			
		||||
import com.intellectualcrafters.plot.object.RegionWrapper;
 | 
			
		||||
import com.intellectualcrafters.plot.object.RunnableVal;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.Collection;
 | 
			
		||||
import java.util.Collections;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map.Entry;
 | 
			
		||||
import java.util.UUID;
 | 
			
		||||
import java.util.regex.Matcher;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * plot functions
 | 
			
		||||
 *
 | 
			
		||||
@@ -216,10 +216,7 @@ public class MainUtil {
 | 
			
		||||
                if (uuid == null) {
 | 
			
		||||
                    uuid = UUID.fromString(term);
 | 
			
		||||
                }
 | 
			
		||||
                if (uuid != null) {
 | 
			
		||||
                    uuids.add(uuid);
 | 
			
		||||
                    continue;
 | 
			
		||||
                }
 | 
			
		||||
                uuids.add(uuid);
 | 
			
		||||
            } catch (final Exception e) {
 | 
			
		||||
                id = PlotId.fromString(term);
 | 
			
		||||
                if (id != null) {
 | 
			
		||||
@@ -253,7 +250,7 @@ public class MainUtil {
 | 
			
		||||
                    count++;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            if ((area != null) && plot.area.equals(area)) {
 | 
			
		||||
            if ((area != null) && plot.getArea().equals(area)) {
 | 
			
		||||
                count++;
 | 
			
		||||
            }
 | 
			
		||||
            if ((alias != null) && alias.equals(plot.getAlias())) {
 | 
			
		||||
@@ -633,7 +630,7 @@ public class MainUtil {
 | 
			
		||||
        final int num = plot.getConnectedPlots().size();
 | 
			
		||||
        final String alias = plot.getAlias().length() > 0 ? plot.getAlias() : C.NONE.s();
 | 
			
		||||
        final Location bot = plot.getCorners()[0];
 | 
			
		||||
        final String biome = WorldUtil.IMP.getBiome(plot.area.worldname, bot.getX(), bot.getZ());
 | 
			
		||||
        final String biome = WorldUtil.IMP.getBiome(plot.getArea().worldname, bot.getX(), bot.getZ());
 | 
			
		||||
        final String trusted = getPlayerList(plot.getTrusted());
 | 
			
		||||
        final String members = getPlayerList(plot.getMembers());
 | 
			
		||||
        final String denied = getPlayerList(plot.getDenied());
 | 
			
		||||
@@ -643,7 +640,9 @@ public class MainUtil {
 | 
			
		||||
        
 | 
			
		||||
        final String flags = StringMan.replaceFromMap(
 | 
			
		||||
        "$2"
 | 
			
		||||
        + (StringMan.join(FlagManager.getPlotFlags(plot.area, plot.getSettings(), true).values(), "").length() > 0 ? StringMan.join(FlagManager.getPlotFlags(plot.area, plot.getSettings(), true)
 | 
			
		||||
        + (StringMan.join(FlagManager.getPlotFlags(plot.getArea(), plot.getSettings(), true).values(), "").length() > 0 ? StringMan.join(FlagManager.getPlotFlags(
 | 
			
		||||
 | 
			
		||||
                plot.getArea(), plot.getSettings(), true)
 | 
			
		||||
        .values(), "$1, $2") : C.NONE.s()), C.replacements);
 | 
			
		||||
        final boolean build = plot.isAdded(player.getUUID());
 | 
			
		||||
        
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,28 @@
 | 
			
		||||
package com.intellectualcrafters.plot.util;
 | 
			
		||||
 | 
			
		||||
import com.google.common.collect.Lists;
 | 
			
		||||
import com.intellectualcrafters.jnbt.ByteArrayTag;
 | 
			
		||||
import com.intellectualcrafters.jnbt.CompoundTag;
 | 
			
		||||
import com.intellectualcrafters.jnbt.IntTag;
 | 
			
		||||
import com.intellectualcrafters.jnbt.ListTag;
 | 
			
		||||
import com.intellectualcrafters.jnbt.NBTInputStream;
 | 
			
		||||
import com.intellectualcrafters.jnbt.NBTOutputStream;
 | 
			
		||||
import com.intellectualcrafters.jnbt.ShortTag;
 | 
			
		||||
import com.intellectualcrafters.jnbt.StringTag;
 | 
			
		||||
import com.intellectualcrafters.jnbt.Tag;
 | 
			
		||||
import com.intellectualcrafters.json.JSONArray;
 | 
			
		||||
import com.intellectualcrafters.plot.PS;
 | 
			
		||||
import com.intellectualcrafters.plot.config.Settings;
 | 
			
		||||
import com.intellectualcrafters.plot.generator.ClassicPlotWorld;
 | 
			
		||||
import com.intellectualcrafters.plot.object.ChunkLoc;
 | 
			
		||||
import com.intellectualcrafters.plot.object.Location;
 | 
			
		||||
import com.intellectualcrafters.plot.object.Plot;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotArea;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotBlock;
 | 
			
		||||
import com.intellectualcrafters.plot.object.RegionWrapper;
 | 
			
		||||
import com.intellectualcrafters.plot.object.RunnableVal;
 | 
			
		||||
import com.intellectualcrafters.plot.object.schematic.PlotItem;
 | 
			
		||||
 | 
			
		||||
import java.io.BufferedReader;
 | 
			
		||||
import java.io.File;
 | 
			
		||||
import java.io.FileInputStream;
 | 
			
		||||
@@ -29,29 +52,6 @@ import java.util.UUID;
 | 
			
		||||
import java.util.zip.GZIPInputStream;
 | 
			
		||||
import java.util.zip.GZIPOutputStream;
 | 
			
		||||
 | 
			
		||||
import com.google.common.collect.Lists;
 | 
			
		||||
import com.intellectualcrafters.jnbt.ByteArrayTag;
 | 
			
		||||
import com.intellectualcrafters.jnbt.CompoundTag;
 | 
			
		||||
import com.intellectualcrafters.jnbt.IntTag;
 | 
			
		||||
import com.intellectualcrafters.jnbt.ListTag;
 | 
			
		||||
import com.intellectualcrafters.jnbt.NBTInputStream;
 | 
			
		||||
import com.intellectualcrafters.jnbt.NBTOutputStream;
 | 
			
		||||
import com.intellectualcrafters.jnbt.ShortTag;
 | 
			
		||||
import com.intellectualcrafters.jnbt.StringTag;
 | 
			
		||||
import com.intellectualcrafters.jnbt.Tag;
 | 
			
		||||
import com.intellectualcrafters.json.JSONArray;
 | 
			
		||||
import com.intellectualcrafters.plot.PS;
 | 
			
		||||
import com.intellectualcrafters.plot.config.Settings;
 | 
			
		||||
import com.intellectualcrafters.plot.generator.ClassicPlotWorld;
 | 
			
		||||
import com.intellectualcrafters.plot.object.ChunkLoc;
 | 
			
		||||
import com.intellectualcrafters.plot.object.Location;
 | 
			
		||||
import com.intellectualcrafters.plot.object.Plot;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotArea;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotBlock;
 | 
			
		||||
import com.intellectualcrafters.plot.object.RegionWrapper;
 | 
			
		||||
import com.intellectualcrafters.plot.object.RunnableVal;
 | 
			
		||||
import com.intellectualcrafters.plot.object.schematic.PlotItem;
 | 
			
		||||
 | 
			
		||||
public abstract class SchematicHandler {
 | 
			
		||||
    public static SchematicHandler manager;
 | 
			
		||||
    
 | 
			
		||||
@@ -83,10 +83,10 @@ public abstract class SchematicHandler {
 | 
			
		||||
                }
 | 
			
		||||
                final String name;
 | 
			
		||||
                if (namingScheme == null) {
 | 
			
		||||
                    name = plot.getId().x + ";" + plot.getId().y + "," + plot.area + "," + o;
 | 
			
		||||
                    name = plot.getId().x + ";" + plot.getId().y + "," + plot.getArea() + "," + o;
 | 
			
		||||
                } else {
 | 
			
		||||
                    name = namingScheme.replaceAll("%owner%", o).replaceAll("%id%", plot.getId().toString()).replaceAll("%idx%", plot.getId().x + "").replaceAll("%idy%", plot.getId().y + "")
 | 
			
		||||
                    .replaceAll("%world%", plot.area.toString());
 | 
			
		||||
                            .replaceAll("%world%", plot.getArea().toString());
 | 
			
		||||
                }
 | 
			
		||||
                final String directory;
 | 
			
		||||
                if (outputDir == null) {
 | 
			
		||||
@@ -170,14 +170,14 @@ public abstract class SchematicHandler {
 | 
			
		||||
                    if (HEIGHT >= 256) {
 | 
			
		||||
                        y_offset = 0;
 | 
			
		||||
                    } else {
 | 
			
		||||
                        PlotArea pw = plot.area;
 | 
			
		||||
                        PlotArea pw = plot.getArea();
 | 
			
		||||
                        if (pw instanceof ClassicPlotWorld) {
 | 
			
		||||
                            y_offset = ((ClassicPlotWorld) pw).PLOT_HEIGHT;
 | 
			
		||||
                        } else {
 | 
			
		||||
                            y_offset = MainUtil.getHeighestBlock(plot.area.worldname, region.minX + 1, region.minZ + 1);
 | 
			
		||||
                            y_offset = MainUtil.getHeighestBlock(plot.getArea().worldname, region.minX + 1, region.minZ + 1);
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    final Location pos1 = new Location(plot.area.worldname, region.minX + x_offset, y_offset, region.minZ + z_offset);
 | 
			
		||||
                    final Location pos1 = new Location(plot.getArea().worldname, region.minX + x_offset, y_offset, region.minZ + z_offset);
 | 
			
		||||
                    final Location pos2 = pos1.clone().add(WIDTH - 1, HEIGHT - 1, LENGTH - 1);
 | 
			
		||||
                    // TODO switch to ChunkManager.chunkTask(pos1, pos2, task, whenDone, allocate);
 | 
			
		||||
                    final int p1x = pos1.getX();
 | 
			
		||||
@@ -306,11 +306,11 @@ public abstract class SchematicHandler {
 | 
			
		||||
                                                case 190:
 | 
			
		||||
                                                case 191:
 | 
			
		||||
                                                case 192: {
 | 
			
		||||
                                                    SetQueue.IMP.setBlock(plot.area.worldname, xx, yy, zz, id);
 | 
			
		||||
                                                    SetQueue.IMP.setBlock(plot.getArea().worldname, xx, yy, zz, id);
 | 
			
		||||
                                                    break;
 | 
			
		||||
                                                }
 | 
			
		||||
                                                default: {
 | 
			
		||||
                                                    SetQueue.IMP.setBlock(plot.area.worldname, xx, yy, zz, new PlotBlock((short) id, datas[i]));
 | 
			
		||||
                                                    SetQueue.IMP.setBlock(plot.getArea().worldname, xx, yy, zz, new PlotBlock((short) id, datas[i]));
 | 
			
		||||
                                                    break;
 | 
			
		||||
                                                }
 | 
			
		||||
                                            }
 | 
			
		||||
@@ -362,9 +362,9 @@ public abstract class SchematicHandler {
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
        RegionWrapper region = plot.getLargestRegion();
 | 
			
		||||
        Location l1 = new Location(plot.area.worldname, region.minX + x_offset, 1, region.minZ + z_offset);
 | 
			
		||||
        Location l1 = new Location(plot.getArea().worldname, region.minX + x_offset, 1, region.minZ + z_offset);
 | 
			
		||||
//        Location l1 = MainUtil.getPlotBottomLoc(plot.world, plot.getId());
 | 
			
		||||
        final int sy = MainUtil.getHeighestBlock(plot.area.worldname, l1.getX() + 1, l1.getZ() + 1);
 | 
			
		||||
        final int sy = MainUtil.getHeighestBlock(plot.getArea().worldname, l1.getX() + 1, l1.getZ() + 1);
 | 
			
		||||
        final Dimension demensions = schematic.getSchematicDimension();
 | 
			
		||||
        final int HEIGHT = demensions.getY();
 | 
			
		||||
        if ((HEIGHT < 255)) {
 | 
			
		||||
@@ -377,7 +377,7 @@ public abstract class SchematicHandler {
 | 
			
		||||
            item.x += X;
 | 
			
		||||
            item.y += Y;
 | 
			
		||||
            item.z += Z;
 | 
			
		||||
            WorldUtil.IMP.addItems(plot.area.worldname, item);
 | 
			
		||||
            WorldUtil.IMP.addItems(plot.getArea().worldname, item);
 | 
			
		||||
        }
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
@@ -672,7 +672,7 @@ public abstract class SchematicHandler {
 | 
			
		||||
    public abstract void getCompoundTag(final String world, Set<RegionWrapper> regions, final RunnableVal<CompoundTag> whenDone);
 | 
			
		||||
    
 | 
			
		||||
    public void getCompoundTag(Plot plot, final RunnableVal<CompoundTag> whenDone) {
 | 
			
		||||
        getCompoundTag(plot.area.worldname, plot.getRegions(), whenDone);
 | 
			
		||||
        getCompoundTag(plot.getArea().worldname, plot.getRegions(), whenDone);
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
@@ -684,33 +684,10 @@ public abstract class SchematicHandler {
 | 
			
		||||
        // Lossy but fast
 | 
			
		||||
        private final short[] ids;
 | 
			
		||||
        private final byte[] datas;
 | 
			
		||||
        
 | 
			
		||||
        @Deprecated
 | 
			
		||||
        private DataCollection[] collection;
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
        private final Dimension schematicDimension;
 | 
			
		||||
        private HashSet<PlotItem> items;
 | 
			
		||||
        
 | 
			
		||||
        /**
 | 
			
		||||
         * This is deprecated as having a wrapper for each block is slow.<br>
 | 
			
		||||
         *  - There's also a performance hit by having to cast the DataCollection short / byte
 | 
			
		||||
         *  -
 | 
			
		||||
         * @param blockCollection
 | 
			
		||||
         * @param schematicDimension
 | 
			
		||||
         */
 | 
			
		||||
        @Deprecated
 | 
			
		||||
        public Schematic(final DataCollection[] blockCollection, final Dimension schematicDimension) {
 | 
			
		||||
            ids = new short[blockCollection.length];
 | 
			
		||||
            datas = new byte[blockCollection.length];
 | 
			
		||||
            for (int i = 0; i < blockCollection.length; i++) {
 | 
			
		||||
                final DataCollection block = blockCollection[i];
 | 
			
		||||
                ids[i] = (byte) block.block;
 | 
			
		||||
                datas[i] = block.data;
 | 
			
		||||
            }
 | 
			
		||||
            collection = blockCollection;
 | 
			
		||||
            this.schematicDimension = schematicDimension;
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
        public Schematic(final short[] i, final byte[] b, final Dimension d) {
 | 
			
		||||
            ids = i;
 | 
			
		||||
            datas = b;
 | 
			
		||||
@@ -759,22 +736,7 @@ public abstract class SchematicHandler {
 | 
			
		||||
        public byte[] getDatas() {
 | 
			
		||||
            return datas;
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        /**
 | 
			
		||||
         * @deprecated as it is slow to wrap each block
 | 
			
		||||
         * @return DataCollection of schematic blocks
 | 
			
		||||
         */
 | 
			
		||||
        @Deprecated
 | 
			
		||||
        public DataCollection[] getBlockCollection() {
 | 
			
		||||
            if (collection == null) {
 | 
			
		||||
                collection = new DataCollection[ids.length];
 | 
			
		||||
                for (int i = 0; i < ids.length; i++) {
 | 
			
		||||
                    collection[i] = new DataCollection(ids[i], datas[i]);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            return collection;
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
        public Schematic copySection(RegionWrapper region) {
 | 
			
		||||
 | 
			
		||||
            int x1 = region.minX;
 | 
			
		||||
@@ -855,29 +817,5 @@ public abstract class SchematicHandler {
 | 
			
		||||
            return z;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * Schematic Data Collection
 | 
			
		||||
     * @deprecated as it is slow to wrap each block
 | 
			
		||||
 | 
			
		||||
     */
 | 
			
		||||
    @Deprecated
 | 
			
		||||
    public class DataCollection {
 | 
			
		||||
        private final short block;
 | 
			
		||||
        private final byte data;
 | 
			
		||||
        
 | 
			
		||||
        // public CompoundTag tag;
 | 
			
		||||
        public DataCollection(final short block, final byte data) {
 | 
			
		||||
            this.block = block;
 | 
			
		||||
            this.data = data;
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        public short getBlock() {
 | 
			
		||||
            return block;
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        public byte getData() {
 | 
			
		||||
            return data;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user