mirror of
				https://github.com/IntellectualSites/PlotSquared.git
				synced 2025-11-04 03:03:43 +01:00 
			
		
		
		
	@@ -44,15 +44,12 @@ import com.intellectualcrafters.plot.database.SQLite;
 | 
			
		||||
import com.intellectualcrafters.plot.flag.AbstractFlag;
 | 
			
		||||
import com.intellectualcrafters.plot.flag.FlagManager;
 | 
			
		||||
import com.intellectualcrafters.plot.flag.FlagValue;
 | 
			
		||||
import com.intellectualcrafters.plot.generator.ClassicPlotWorld;
 | 
			
		||||
import com.intellectualcrafters.plot.generator.HybridPlotWorld;
 | 
			
		||||
import com.intellectualcrafters.plot.generator.HybridUtils;
 | 
			
		||||
import com.intellectualcrafters.plot.generator.PlotGenerator;
 | 
			
		||||
import com.intellectualcrafters.plot.generator.SquarePlotManager;
 | 
			
		||||
import com.intellectualcrafters.plot.generator.SquarePlotWorld;
 | 
			
		||||
import com.intellectualcrafters.plot.object.Plot;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotAnalysis;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotBlock;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotCluster;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotFilter;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotHandler;
 | 
			
		||||
@@ -1314,13 +1311,6 @@ public class PS {
 | 
			
		||||
            // save configuration
 | 
			
		||||
            final String[] split = args.split(",");
 | 
			
		||||
            final HybridPlotWorld plotworld = new HybridPlotWorld(world);
 | 
			
		||||
            final int width = SquarePlotWorld.PLOT_WIDTH_DEFAULT;
 | 
			
		||||
            final int gap = SquarePlotWorld.ROAD_WIDTH_DEFAULT;
 | 
			
		||||
            final int height = ClassicPlotWorld.PLOT_HEIGHT_DEFAULT;
 | 
			
		||||
            final PlotBlock[] floor = ClassicPlotWorld.TOP_BLOCK_DEFAULT;
 | 
			
		||||
            final PlotBlock[] main = ClassicPlotWorld.MAIN_BLOCK_DEFAULT;
 | 
			
		||||
            final PlotBlock wall = ClassicPlotWorld.WALL_FILLING_DEFAULT;
 | 
			
		||||
            final PlotBlock border = ClassicPlotWorld.WALL_BLOCK_DEFAULT;
 | 
			
		||||
            for (final String element : split) {
 | 
			
		||||
                final String[] pair = element.split("=");
 | 
			
		||||
                if (pair.length != 2) {
 | 
			
		||||
@@ -1329,43 +1319,44 @@ public class PS {
 | 
			
		||||
                }
 | 
			
		||||
                final String key = pair[0].toLowerCase();
 | 
			
		||||
                final String value = pair[1];
 | 
			
		||||
                final String base = "worlds." + world + ".";
 | 
			
		||||
                try {
 | 
			
		||||
                    switch (key) {
 | 
			
		||||
                        case "s":
 | 
			
		||||
                        case "size": {
 | 
			
		||||
                            SquarePlotWorld.PLOT_WIDTH_DEFAULT = Configuration.INTEGER.parseString(value).shortValue();
 | 
			
		||||
                            config.set(base + "plot.size", Configuration.INTEGER.parseString(value).shortValue());
 | 
			
		||||
                            break;
 | 
			
		||||
                        }
 | 
			
		||||
                        case "g":
 | 
			
		||||
                        case "gap": {
 | 
			
		||||
                            SquarePlotWorld.ROAD_WIDTH_DEFAULT = Configuration.INTEGER.parseString(value).shortValue();
 | 
			
		||||
                            config.set(base + "road.width", Configuration.INTEGER.parseString(value).shortValue());
 | 
			
		||||
                            break;
 | 
			
		||||
                        }
 | 
			
		||||
                        case "h":
 | 
			
		||||
                        case "height": {
 | 
			
		||||
                            ClassicPlotWorld.PLOT_HEIGHT_DEFAULT = Configuration.INTEGER.parseString(value);
 | 
			
		||||
                            ClassicPlotWorld.ROAD_HEIGHT_DEFAULT = Configuration.INTEGER.parseString(value);
 | 
			
		||||
                            ClassicPlotWorld.WALL_HEIGHT_DEFAULT = Configuration.INTEGER.parseString(value);
 | 
			
		||||
                            config.set(base + "road.height", Configuration.INTEGER.parseString(value).shortValue());
 | 
			
		||||
                            config.set(base + "plot.height", Configuration.INTEGER.parseString(value).shortValue());
 | 
			
		||||
                            config.set(base + "wall.height", Configuration.INTEGER.parseString(value).shortValue());
 | 
			
		||||
                            break;
 | 
			
		||||
                        }
 | 
			
		||||
                        case "f":
 | 
			
		||||
                        case "floor": {
 | 
			
		||||
                            ClassicPlotWorld.TOP_BLOCK_DEFAULT = Configuration.BLOCKLIST.parseString(value);
 | 
			
		||||
                            config.set(base + "plot.floor", Arrays.asList(StringMan.join(Configuration.BLOCKLIST.parseString(value), ",").split(",")));
 | 
			
		||||
                            break;
 | 
			
		||||
                        }
 | 
			
		||||
                        case "m":
 | 
			
		||||
                        case "main": {
 | 
			
		||||
                            ClassicPlotWorld.MAIN_BLOCK_DEFAULT = Configuration.BLOCKLIST.parseString(value);
 | 
			
		||||
                            config.set(base + "plot.filling", Arrays.asList(StringMan.join(Configuration.BLOCKLIST.parseString(value), ",").split(",")));
 | 
			
		||||
                            break;
 | 
			
		||||
                        }
 | 
			
		||||
                        case "w":
 | 
			
		||||
                        case "wall": {
 | 
			
		||||
                            ClassicPlotWorld.WALL_FILLING_DEFAULT = Configuration.BLOCK.parseString(value);
 | 
			
		||||
                            config.set(base + "wall.filling", Arrays.asList(StringMan.join(Configuration.BLOCKLIST.parseString(value), ",").split(",")));
 | 
			
		||||
                            break;
 | 
			
		||||
                        }
 | 
			
		||||
                        case "b":
 | 
			
		||||
                        case "border": {
 | 
			
		||||
                            ClassicPlotWorld.WALL_BLOCK_DEFAULT = Configuration.BLOCK.parseString(value);
 | 
			
		||||
                            config.set(base + "wall.block", Configuration.BLOCK.parseString(value).toString());
 | 
			
		||||
                            break;
 | 
			
		||||
                        }
 | 
			
		||||
                        default: {
 | 
			
		||||
@@ -1380,20 +1371,8 @@ public class PS {
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            try {
 | 
			
		||||
                final String root = "worlds." + world;
 | 
			
		||||
                if (!config.contains(root)) {
 | 
			
		||||
                    config.createSection(root);
 | 
			
		||||
                }
 | 
			
		||||
                plotworld.saveConfiguration(config.getConfigurationSection(root));
 | 
			
		||||
                ClassicPlotWorld.PLOT_HEIGHT_DEFAULT = height;
 | 
			
		||||
                ClassicPlotWorld.ROAD_HEIGHT_DEFAULT = height;
 | 
			
		||||
                ClassicPlotWorld.WALL_HEIGHT_DEFAULT = height;
 | 
			
		||||
                ClassicPlotWorld.TOP_BLOCK_DEFAULT = floor;
 | 
			
		||||
                ClassicPlotWorld.MAIN_BLOCK_DEFAULT = main;
 | 
			
		||||
                ClassicPlotWorld.WALL_BLOCK_DEFAULT = border;
 | 
			
		||||
                ClassicPlotWorld.WALL_FILLING_DEFAULT = wall;
 | 
			
		||||
                SquarePlotWorld.PLOT_WIDTH_DEFAULT = width;
 | 
			
		||||
                SquarePlotWorld.ROAD_WIDTH_DEFAULT = gap;
 | 
			
		||||
                plotworld.loadConfiguration(config);
 | 
			
		||||
                config.save(configFile);
 | 
			
		||||
            } catch (final Exception e) {
 | 
			
		||||
                e.printStackTrace();
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
@@ -75,7 +75,7 @@ public class Inbox extends SubCommand {
 | 
			
		||||
            } else {
 | 
			
		||||
                color = "&7";
 | 
			
		||||
            }
 | 
			
		||||
            string.append("&8[&7#" + x + "&8][&7" + c.world + ";" + c.id + "&8][&6" + c.senderName + "&8]" + color + c.comment + "\n");
 | 
			
		||||
            string.append("&8[&7#" + (x + 1) + "&8][&7" + c.world + ";" + c.id + "&8][&6" + c.senderName + "&8]" + color + c.comment + "\n");
 | 
			
		||||
        }
 | 
			
		||||
        MainUtil.sendMessage(player, string.toString());
 | 
			
		||||
    }
 | 
			
		||||
@@ -155,6 +155,7 @@ public class Inbox extends SubCommand {
 | 
			
		||||
                            final List<PlotComment> comments = (List<PlotComment>) value;
 | 
			
		||||
                            if (index > comments.size()) {
 | 
			
		||||
                                sendMessage(player, C.NOT_VALID_INBOX_INDEX, index + "");
 | 
			
		||||
                                return;
 | 
			
		||||
                            }
 | 
			
		||||
                            final PlotComment comment = comments.get(index - 1);
 | 
			
		||||
                            inbox.removeComment(plot, comment);
 | 
			
		||||
 
 | 
			
		||||
@@ -112,7 +112,7 @@ public interface AbstractDB {
 | 
			
		||||
     * @param world Which the plot is located in
 | 
			
		||||
     * @param id cluster id
 | 
			
		||||
     *
 | 
			
		||||
     * @return Integer = Cluster Entry Id
 | 
			
		||||
     * @return Integer = Cluster Entry Id
 | 
			
		||||
     */
 | 
			
		||||
    int getClusterId(final PlotCluster cluster);
 | 
			
		||||
    
 | 
			
		||||
 
 | 
			
		||||
@@ -53,7 +53,6 @@ import com.intellectualcrafters.plot.object.PlotId;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotSettings;
 | 
			
		||||
import com.intellectualcrafters.plot.object.RunnableVal;
 | 
			
		||||
import com.intellectualcrafters.plot.object.comment.PlotComment;
 | 
			
		||||
import com.intellectualcrafters.plot.util.ClusterManager;
 | 
			
		||||
import com.intellectualcrafters.plot.util.MainUtil;
 | 
			
		||||
import com.intellectualcrafters.plot.util.StringMan;
 | 
			
		||||
import com.intellectualcrafters.plot.util.TaskManager;
 | 
			
		||||
@@ -145,12 +144,31 @@ public class SQLManager implements AbstractDB {
 | 
			
		||||
        }
 | 
			
		||||
        tasks.add(task);
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    
 | 
			
		||||
    public synchronized void addClusterTask(final PlotCluster cluster, UniqueStatement task) {
 | 
			
		||||
        Queue<UniqueStatement> tasks = clusterTasks.get(cluster);
 | 
			
		||||
        if (tasks == null) {
 | 
			
		||||
            tasks = new ConcurrentLinkedQueue<>();
 | 
			
		||||
            clusterTasks.put(cluster, tasks);
 | 
			
		||||
        }
 | 
			
		||||
        if (task == null) {
 | 
			
		||||
            task = new UniqueStatement(cluster.hashCode() + "") {
 | 
			
		||||
                
 | 
			
		||||
                @Override
 | 
			
		||||
                public PreparedStatement get() throws SQLException {
 | 
			
		||||
                    return null;
 | 
			
		||||
                }
 | 
			
		||||
                
 | 
			
		||||
                @Override
 | 
			
		||||
                public void set(final PreparedStatement stmt) throws SQLException {}
 | 
			
		||||
                
 | 
			
		||||
                @Override
 | 
			
		||||
                public void addBatch(final PreparedStatement stmt) throws SQLException {}
 | 
			
		||||
                
 | 
			
		||||
                @Override
 | 
			
		||||
                public void execute(final PreparedStatement stmt) throws SQLException {}
 | 
			
		||||
                
 | 
			
		||||
            };
 | 
			
		||||
        }
 | 
			
		||||
        tasks.add(task);
 | 
			
		||||
    }
 | 
			
		||||
@@ -1271,6 +1289,46 @@ public class SQLManager implements AbstractDB {
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    @Override
 | 
			
		||||
    public int getClusterId(final PlotCluster cluster) {
 | 
			
		||||
        if (cluster.temp > 0) {
 | 
			
		||||
            return cluster.temp;
 | 
			
		||||
        }
 | 
			
		||||
        PreparedStatement stmt = null;
 | 
			
		||||
        try {
 | 
			
		||||
            commit();
 | 
			
		||||
            if (cluster.temp > 0) {
 | 
			
		||||
                return cluster.temp;
 | 
			
		||||
            }
 | 
			
		||||
            stmt = connection.prepareStatement("SELECT `id` FROM `"
 | 
			
		||||
            + prefix
 | 
			
		||||
            + "cluster` WHERE `pos1_x` = ? AND `pos1_z` = ? AND `pos2_x` = ? AND `pos2_z` = ? AND `world` = ? ORDER BY `timestamp` ASC");
 | 
			
		||||
            stmt.setInt(1, cluster.getP1().x);
 | 
			
		||||
            stmt.setInt(2, cluster.getP1().y);
 | 
			
		||||
            stmt.setInt(3, cluster.getP2().x);
 | 
			
		||||
            stmt.setInt(4, cluster.getP2().y);
 | 
			
		||||
            stmt.setString(5, cluster.world);
 | 
			
		||||
            final ResultSet r = stmt.executeQuery();
 | 
			
		||||
            int c_id = Integer.MAX_VALUE;
 | 
			
		||||
            while (r.next()) {
 | 
			
		||||
                c_id = r.getInt("id");
 | 
			
		||||
            }
 | 
			
		||||
            stmt.close();
 | 
			
		||||
            r.close();
 | 
			
		||||
            if ((c_id == Integer.MAX_VALUE) || (c_id == 0)) {
 | 
			
		||||
                if (cluster.temp > 0) {
 | 
			
		||||
                    return cluster.temp;
 | 
			
		||||
                }
 | 
			
		||||
                throw new SQLException("Cluster does not exist in database");
 | 
			
		||||
            }
 | 
			
		||||
            cluster.temp = c_id;
 | 
			
		||||
            return c_id;
 | 
			
		||||
        } catch (final SQLException e) {
 | 
			
		||||
            e.printStackTrace();
 | 
			
		||||
        }
 | 
			
		||||
        return Integer.MAX_VALUE;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public int getId(final Plot plot) {
 | 
			
		||||
@@ -2114,7 +2172,7 @@ public class SQLManager implements AbstractDB {
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    @Override
 | 
			
		||||
    public void delete(final PlotCluster cluster) {
 | 
			
		||||
    public void delete(final PlotCluster cluster) {
 | 
			
		||||
        final int id = getClusterId(cluster);
 | 
			
		||||
        addClusterTask(cluster, new UniqueStatement("delete_cluster_settings") {
 | 
			
		||||
            @Override
 | 
			
		||||
@@ -2161,32 +2219,6 @@ public class SQLManager implements AbstractDB {
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    @Override
 | 
			
		||||
    public int getClusterId(final String world, final PlotClusterId id) {
 | 
			
		||||
        PreparedStatement stmt = null;
 | 
			
		||||
        try {
 | 
			
		||||
            stmt = connection.prepareStatement("SELECT `id` FROM `"
 | 
			
		||||
            + prefix
 | 
			
		||||
            + "cluster` WHERE `pos1_x` = ? AND `pos1_z` = ? AND `pos2_x` = ? AND `pos2_z` = ? AND `world` = ? ORDER BY `timestamp` ASC");
 | 
			
		||||
            stmt.setInt(1, id.pos1.x);
 | 
			
		||||
            stmt.setInt(2, id.pos1.y);
 | 
			
		||||
            stmt.setInt(3, id.pos2.x);
 | 
			
		||||
            stmt.setInt(4, id.pos2.y);
 | 
			
		||||
            stmt.setString(5, world);
 | 
			
		||||
            final ResultSet r = stmt.executeQuery();
 | 
			
		||||
            int c_id = Integer.MAX_VALUE;
 | 
			
		||||
            while (r.next()) {
 | 
			
		||||
                c_id = r.getInt("id");
 | 
			
		||||
            }
 | 
			
		||||
            stmt.close();
 | 
			
		||||
            r.close();
 | 
			
		||||
            return c_id;
 | 
			
		||||
        } catch (final SQLException e) {
 | 
			
		||||
            e.printStackTrace();
 | 
			
		||||
        }
 | 
			
		||||
        return Integer.MAX_VALUE;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    @Override
 | 
			
		||||
    public HashMap<String, HashSet<PlotCluster>> getClusters() {
 | 
			
		||||
@@ -2229,7 +2261,7 @@ public class SQLManager implements AbstractDB {
 | 
			
		||||
                if (user == null) {
 | 
			
		||||
                    user = UUID.fromString(owner);
 | 
			
		||||
                    uuids.put(owner, user);
 | 
			
		||||
                }
 | 
			
		||||
                }
 | 
			
		||||
                cluster = new PlotCluster(worldname, pos1, pos2, user, id);
 | 
			
		||||
                clusters.put(id, cluster);
 | 
			
		||||
            }
 | 
			
		||||
@@ -2381,7 +2413,7 @@ public class SQLManager implements AbstractDB {
 | 
			
		||||
        addClusterTask(cluster, new UniqueStatement("setFlags") {
 | 
			
		||||
            @Override
 | 
			
		||||
            public void set(final PreparedStatement stmt) throws SQLException {
 | 
			
		||||
                stmt.setString(1, flag_string.toString());
 | 
			
		||||
                stmt.setString(1, flag_string.toString());
 | 
			
		||||
                stmt.setInt(2, getClusterId(cluster));
 | 
			
		||||
            }
 | 
			
		||||
            
 | 
			
		||||
@@ -2397,7 +2429,7 @@ public class SQLManager implements AbstractDB {
 | 
			
		||||
        addClusterTask(cluster, new UniqueStatement("setClusterName") {
 | 
			
		||||
            @Override
 | 
			
		||||
            public void set(final PreparedStatement stmt) throws SQLException {
 | 
			
		||||
                stmt.setString(1, name);
 | 
			
		||||
                stmt.setString(1, name);
 | 
			
		||||
                stmt.setInt(2, getClusterId(cluster));
 | 
			
		||||
            }
 | 
			
		||||
            
 | 
			
		||||
@@ -2413,7 +2445,7 @@ public class SQLManager implements AbstractDB {
 | 
			
		||||
    public void removeHelper(final PlotCluster cluster, final UUID uuid) {
 | 
			
		||||
        addClusterTask(cluster, new UniqueStatement("removeHelper") {
 | 
			
		||||
            @Override
 | 
			
		||||
            public void set(final PreparedStatement statement) throws SQLException {
 | 
			
		||||
            public void set(final PreparedStatement statement) throws SQLException {
 | 
			
		||||
                statement.setInt(1, getClusterId(cluster));
 | 
			
		||||
                statement.setString(2, uuid.toString());
 | 
			
		||||
            }
 | 
			
		||||
@@ -2429,7 +2461,7 @@ public class SQLManager implements AbstractDB {
 | 
			
		||||
    public void setHelper(final PlotCluster cluster, final UUID uuid) {
 | 
			
		||||
        addClusterTask(cluster, new UniqueStatement("setHelper") {
 | 
			
		||||
            @Override
 | 
			
		||||
            public void set(final PreparedStatement statement) throws SQLException {
 | 
			
		||||
            public void set(final PreparedStatement statement) throws SQLException {
 | 
			
		||||
                statement.setInt(1, getClusterId(cluster));
 | 
			
		||||
                statement.setString(2, uuid.toString());
 | 
			
		||||
            }
 | 
			
		||||
@@ -2442,7 +2474,7 @@ public class SQLManager implements AbstractDB {
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    @Override
 | 
			
		||||
    public void createCluster(final PlotCluster cluster) {
 | 
			
		||||
    public void createCluster(final PlotCluster cluster) {
 | 
			
		||||
        addClusterTask(cluster, new UniqueStatement("createCluster_" + cluster.hashCode()) {
 | 
			
		||||
            @Override
 | 
			
		||||
            public void set(final PreparedStatement stmt) throws SQLException {
 | 
			
		||||
@@ -2451,22 +2483,32 @@ public class SQLManager implements AbstractDB {
 | 
			
		||||
                stmt.setInt(3, cluster.getP2().x);
 | 
			
		||||
                stmt.setInt(4, cluster.getP2().y);
 | 
			
		||||
                stmt.setString(5, cluster.owner.toString());
 | 
			
		||||
                stmt.setString(6, cluster.world);
 | 
			
		||||
                stmt.setString(6, cluster.world);
 | 
			
		||||
            }
 | 
			
		||||
            
 | 
			
		||||
            @Override
 | 
			
		||||
            public PreparedStatement get() throws SQLException {
 | 
			
		||||
            public PreparedStatement get() throws SQLException {
 | 
			
		||||
                return connection.prepareStatement(CREATE_CLUSTER, Statement.RETURN_GENERATED_KEYS);
 | 
			
		||||
            }
 | 
			
		||||
            
 | 
			
		||||
            @Override
 | 
			
		||||
            public void execute(final PreparedStatement stmt) throws SQLException {
 | 
			
		||||
                
 | 
			
		||||
            }
 | 
			
		||||
            
 | 
			
		||||
            @Override
 | 
			
		||||
            public void addBatch(final PreparedStatement stmt) throws SQLException {
 | 
			
		||||
                stmt.executeUpdate();
 | 
			
		||||
                final ResultSet keys = stmt.getGeneratedKeys();
 | 
			
		||||
                if (keys.next()) {
 | 
			
		||||
                    cluster.temp = keys.getInt(1);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
        });
 | 
			
		||||
        addClusterTask(cluster, new UniqueStatement("createCluster_settings_" + cluster.hashCode()) {
 | 
			
		||||
            @Override
 | 
			
		||||
            public void set(final PreparedStatement stmt) throws SQLException {
 | 
			
		||||
                final int id = getClusterId(cluster.world, ClusterManager.getClusterId(cluster));
 | 
			
		||||
            public void set(final PreparedStatement stmt) throws SQLException {
 | 
			
		||||
                stmt.setInt(1, getClusterId(cluster));
 | 
			
		||||
                stmt.setString(2, cluster.settings.getAlias());
 | 
			
		||||
                stmt.executeUpdate();
 | 
			
		||||
                stmt.setString(2, cluster.settings.getAlias());
 | 
			
		||||
            }
 | 
			
		||||
            
 | 
			
		||||
@@ -2490,7 +2532,7 @@ public class SQLManager implements AbstractDB {
 | 
			
		||||
                stmt.setInt(1, pos1.x);
 | 
			
		||||
                stmt.setInt(2, pos1.y);
 | 
			
		||||
                stmt.setInt(3, pos2.x);
 | 
			
		||||
                stmt.setInt(4, pos2.y);
 | 
			
		||||
                stmt.setInt(4, pos2.y);
 | 
			
		||||
                stmt.setInt(5, getClusterId(current));
 | 
			
		||||
            }
 | 
			
		||||
            
 | 
			
		||||
@@ -2506,7 +2548,7 @@ public class SQLManager implements AbstractDB {
 | 
			
		||||
        addClusterTask(cluster, new UniqueStatement("setPosition") {
 | 
			
		||||
            @Override
 | 
			
		||||
            public void set(final PreparedStatement stmt) throws SQLException {
 | 
			
		||||
                stmt.setString(1, position);
 | 
			
		||||
                stmt.setString(1, position);
 | 
			
		||||
                stmt.setInt(2, getClusterId(cluster));
 | 
			
		||||
            }
 | 
			
		||||
            
 | 
			
		||||
@@ -2521,7 +2563,7 @@ public class SQLManager implements AbstractDB {
 | 
			
		||||
    public void removeInvited(final PlotCluster cluster, final UUID uuid) {
 | 
			
		||||
        addClusterTask(cluster, new UniqueStatement("removeInvited") {
 | 
			
		||||
            @Override
 | 
			
		||||
            public void set(final PreparedStatement statement) throws SQLException {
 | 
			
		||||
            public void set(final PreparedStatement statement) throws SQLException {
 | 
			
		||||
                statement.setInt(1, getClusterId(cluster));
 | 
			
		||||
                statement.setString(2, uuid.toString());
 | 
			
		||||
            }
 | 
			
		||||
@@ -2537,7 +2579,7 @@ public class SQLManager implements AbstractDB {
 | 
			
		||||
    public void setInvited(final PlotCluster cluster, final UUID uuid) {
 | 
			
		||||
        addClusterTask(cluster, new UniqueStatement("setInvited") {
 | 
			
		||||
            @Override
 | 
			
		||||
            public void set(final PreparedStatement statement) throws SQLException {
 | 
			
		||||
            public void set(final PreparedStatement statement) throws SQLException {
 | 
			
		||||
                statement.setInt(1, getClusterId(cluster));
 | 
			
		||||
                statement.setString(2, uuid.toString());
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
@@ -14,6 +14,8 @@ public class PlotCluster {
 | 
			
		||||
    private PlotId pos1;
 | 
			
		||||
    private PlotId pos2;
 | 
			
		||||
    
 | 
			
		||||
    public int temp;
 | 
			
		||||
 | 
			
		||||
    public PlotId getP1() {
 | 
			
		||||
        return pos1;
 | 
			
		||||
    }
 | 
			
		||||
@@ -36,8 +38,18 @@ public class PlotCluster {
 | 
			
		||||
        this.pos2 = pos2;
 | 
			
		||||
        this.owner = owner;
 | 
			
		||||
        settings = new PlotSettings();
 | 
			
		||||
        this.temp = -1;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    public PlotCluster(final String world, final PlotId pos1, final PlotId pos2, final UUID owner, int temp) {
 | 
			
		||||
        this.world = world;
 | 
			
		||||
        this.pos1 = pos1;
 | 
			
		||||
        this.pos2 = pos2;
 | 
			
		||||
        this.owner = owner;
 | 
			
		||||
        settings = new PlotSettings();
 | 
			
		||||
        this.temp = temp;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public boolean isAdded(final UUID uuid) {
 | 
			
		||||
        return (owner.equals(uuid) || invited.contains(uuid) || invited.contains(DBFunc.everyone) || helpers.contains(uuid) || helpers.contains(DBFunc.everyone));
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user