mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-25 02:04:44 +02:00
Various changes
Plot class is now more reliable as most fields are private Cleanup some classes. Fixes #955 makes progress on #953
This commit is contained in:
@ -8,7 +8,11 @@ import com.intellectualcrafters.plot.commands.WE_Anywhere;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.config.Configuration;
|
||||
import com.intellectualcrafters.plot.config.Settings;
|
||||
import com.intellectualcrafters.plot.database.*;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.database.Database;
|
||||
import com.intellectualcrafters.plot.database.MySQL;
|
||||
import com.intellectualcrafters.plot.database.SQLManager;
|
||||
import com.intellectualcrafters.plot.database.SQLite;
|
||||
import com.intellectualcrafters.plot.flag.AbstractFlag;
|
||||
import com.intellectualcrafters.plot.flag.FlagManager;
|
||||
import com.intellectualcrafters.plot.flag.FlagValue;
|
||||
@ -16,21 +20,67 @@ import com.intellectualcrafters.plot.generator.GeneratorWrapper;
|
||||
import com.intellectualcrafters.plot.generator.HybridPlotWorld;
|
||||
import com.intellectualcrafters.plot.generator.HybridUtils;
|
||||
import com.intellectualcrafters.plot.generator.IndependentPlotGenerator;
|
||||
import com.intellectualcrafters.plot.object.*;
|
||||
import com.intellectualcrafters.plot.util.*;
|
||||
import com.intellectualcrafters.plot.object.Location;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotAnalysis;
|
||||
import com.intellectualcrafters.plot.object.PlotArea;
|
||||
import com.intellectualcrafters.plot.object.PlotCluster;
|
||||
import com.intellectualcrafters.plot.object.PlotFilter;
|
||||
import com.intellectualcrafters.plot.object.PlotId;
|
||||
import com.intellectualcrafters.plot.object.PlotManager;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.object.RegionWrapper;
|
||||
import com.intellectualcrafters.plot.object.RunnableVal;
|
||||
import com.intellectualcrafters.plot.util.AbstractTitle;
|
||||
import com.intellectualcrafters.plot.util.ChatManager;
|
||||
import com.intellectualcrafters.plot.util.ChunkManager;
|
||||
import com.intellectualcrafters.plot.util.CommentManager;
|
||||
import com.intellectualcrafters.plot.util.EconHandler;
|
||||
import com.intellectualcrafters.plot.util.EventUtil;
|
||||
import com.intellectualcrafters.plot.util.ExpireManager;
|
||||
import com.intellectualcrafters.plot.util.InventoryUtil;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.MathMan;
|
||||
import com.intellectualcrafters.plot.util.PlotGamemode;
|
||||
import com.intellectualcrafters.plot.util.PlotWeather;
|
||||
import com.intellectualcrafters.plot.util.ReflectionUtils;
|
||||
import com.intellectualcrafters.plot.util.SchematicHandler;
|
||||
import com.intellectualcrafters.plot.util.SetQueue;
|
||||
import com.intellectualcrafters.plot.util.SetupUtils;
|
||||
import com.intellectualcrafters.plot.util.StringMan;
|
||||
import com.intellectualcrafters.plot.util.TaskManager;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import com.intellectualcrafters.plot.util.WorldUtil;
|
||||
import com.intellectualcrafters.plot.util.area.QuadMap;
|
||||
import com.plotsquared.listener.WESubscriber;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
|
||||
import java.io.*;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.nio.file.Files;
|
||||
import java.sql.SQLException;
|
||||
import java.util.*;
|
||||
import java.util.ArrayDeque;
|
||||
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.Iterator;
|
||||
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;
|
||||
@ -46,12 +96,7 @@ public class PS {
|
||||
|
||||
// protected static:
|
||||
private static PS instance;
|
||||
private HashSet<Integer> plotareaHashCheck = new HashSet<>();
|
||||
private boolean plotareaHasCollision = false;
|
||||
/**
|
||||
* All plot areas (quick global access)
|
||||
*/
|
||||
private PlotArea[] plotareas = new PlotArea[0];
|
||||
private final HashSet<Integer> plotareaHashCheck = new HashSet<>();
|
||||
/**
|
||||
* All plot areas mapped by world (quick world access)
|
||||
*/
|
||||
@ -73,6 +118,11 @@ public class PS {
|
||||
public TaskManager TASK;
|
||||
public WorldEdit worldedit;
|
||||
public URL update;
|
||||
private boolean plotareaHasCollision = false;
|
||||
/**
|
||||
* All plot areas (quick global access)
|
||||
*/
|
||||
private PlotArea[] plotareas = new PlotArea[0];
|
||||
// private:
|
||||
private File storageFile;
|
||||
private File FILE = null; // This file
|
||||
@ -2312,7 +2362,7 @@ public class PS {
|
||||
*/
|
||||
private void setupStorage() {
|
||||
storage.set("version", StringMan.join(VERSION, "."));
|
||||
final Map<String, Object> options = new HashMap<>();
|
||||
final Map<String, Object> options = new HashMap<>(9);
|
||||
options.put("mysql.use", false);
|
||||
options.put("sqlite.use", true);
|
||||
options.put("sqlite.db", "storage");
|
||||
@ -2343,7 +2393,7 @@ public class PS {
|
||||
*/
|
||||
private void showDebug() {
|
||||
if (Settings.DEBUG) {
|
||||
final Map<String, String> settings = new HashMap<>();
|
||||
final Map<String, String> settings = new HashMap<>(9);
|
||||
settings.put("Kill Road Mobs", "" + Settings.KILL_ROAD_MOBS);
|
||||
settings.put("Use Metrics", "" + Settings.METRICS);
|
||||
settings.put("Delete Plots On Ban", "" + Settings.DELETE_PLOTS_ON_BAN);
|
||||
|
@ -20,8 +20,6 @@
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
@ -32,8 +30,9 @@ import com.intellectualcrafters.plot.object.RunnableVal;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.plotsquared.general.commands.CommandDeclaration;
|
||||
|
||||
@CommandDeclaration(command = "info", aliases = { "i" }, description = "Display plot info", usage = "/plot info <id>",
|
||||
category = CommandCategory.INFO)
|
||||
import java.util.UUID;
|
||||
|
||||
@CommandDeclaration(command = "info", aliases = "i", description = "Display plot info", usage = "/plot info <id>", category = CommandCategory.INFO)
|
||||
public class Info extends SubCommand {
|
||||
|
||||
@Override
|
||||
@ -73,7 +72,7 @@ public class Info extends SubCommand {
|
||||
plot = player.getCurrentPlot();
|
||||
}
|
||||
if (plot == null) {
|
||||
MainUtil.sendMessage(player, C.NOT_IN_PLOT);
|
||||
MainUtil.sendMessage(player, C.NOT_IN_PLOT.s());
|
||||
return false;
|
||||
}
|
||||
if (arg != null) {
|
||||
@ -116,8 +115,8 @@ public class Info extends SubCommand {
|
||||
boolean trustedEveryone;
|
||||
// Wildcard player {added}
|
||||
{
|
||||
containsEveryone = (plot.getTrusted() != null) && plot.getTrusted().contains(DBFunc.everyone);
|
||||
trustedEveryone = (plot.getMembers() != null) && plot.getMembers().contains(DBFunc.everyone);
|
||||
containsEveryone = plot.getTrusted().contains(DBFunc.everyone);
|
||||
trustedEveryone = plot.getMembers().contains(DBFunc.everyone);
|
||||
}
|
||||
// Unclaimed?
|
||||
if (!hasOwner && !containsEveryone && !trustedEveryone) {
|
||||
|
@ -41,7 +41,6 @@ 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;
|
||||
|
||||
@ -53,8 +52,7 @@ import java.util.List;
|
||||
public class MainCommand extends CommandManager<PlotPlayer> {
|
||||
|
||||
private static MainCommand instance;
|
||||
private HashMap<String, Command<PlotPlayer>> setCommands;
|
||||
|
||||
|
||||
private MainCommand() {
|
||||
super(null, new ArrayList<Command<PlotPlayer>>());
|
||||
instance = this;
|
||||
@ -282,8 +280,8 @@ public class MainCommand extends CommandManager<PlotPlayer> {
|
||||
break;
|
||||
}
|
||||
// Save meta
|
||||
loc = (Location) player.getMeta("location");
|
||||
plot = (Plot) player.getMeta("lastplot");
|
||||
loc = player.getMeta("location");
|
||||
plot = player.getMeta("lastplot");
|
||||
tp = true;
|
||||
// Set loc
|
||||
player.setMeta("location", newPlot.getBottomAbs());
|
||||
@ -320,7 +318,7 @@ public class MainCommand extends CommandManager<PlotPlayer> {
|
||||
public int getMatch(String[] args, Command<PlotPlayer> cmd) {
|
||||
int count = 0;
|
||||
String perm = cmd.getPermission();
|
||||
HashSet<String> desc = new HashSet<String>();
|
||||
HashSet<String> desc = new HashSet<>();
|
||||
for (String alias : cmd.getAliases()) {
|
||||
if (alias.startsWith(args[0])) {
|
||||
count += 5;
|
||||
|
@ -122,18 +122,10 @@ public class Settings {
|
||||
* Max allowed plots
|
||||
*/
|
||||
public static int MAX_PLOTS = 127;
|
||||
/**
|
||||
* WorldGuard region on claimed plots
|
||||
*/
|
||||
public static boolean WORLDGUARD = false;
|
||||
/**
|
||||
* metrics
|
||||
*/
|
||||
public static boolean METRICS = true;
|
||||
/**
|
||||
* plot specific resource pack
|
||||
*/
|
||||
public static String PLOT_SPECIFIC_RESOURCE_PACK = "";
|
||||
/**
|
||||
* Kill road mobs?
|
||||
*/
|
||||
|
@ -25,15 +25,37 @@ import com.intellectualcrafters.plot.PS;
|
||||
import com.intellectualcrafters.plot.config.Settings;
|
||||
import com.intellectualcrafters.plot.flag.Flag;
|
||||
import com.intellectualcrafters.plot.flag.FlagManager;
|
||||
import com.intellectualcrafters.plot.object.*;
|
||||
import com.intellectualcrafters.plot.object.BlockLoc;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotArea;
|
||||
import com.intellectualcrafters.plot.object.PlotCluster;
|
||||
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.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.StringMan;
|
||||
import com.intellectualcrafters.plot.util.TaskManager;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.*;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DatabaseMetaData;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Queue;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
@ -1224,9 +1246,6 @@ public class SQLManager implements AbstractDB {
|
||||
|
||||
@Override
|
||||
public void deleteSettings(final Plot plot) {
|
||||
if (plot.settings == null) {
|
||||
return;
|
||||
}
|
||||
addPlotTask(plot, new UniqueStatement("delete_plot_settings") {
|
||||
@Override
|
||||
public void set(final PreparedStatement stmt) throws SQLException {
|
||||
@ -1669,10 +1688,7 @@ public class SQLManager implements AbstractDB {
|
||||
}
|
||||
final Plot plot = plots.get(id);
|
||||
if (plot != null) {
|
||||
if (plot.getSettings().ratings == null) {
|
||||
plot.getSettings().ratings = new HashMap<>();
|
||||
}
|
||||
plot.getSettings().ratings.put(user, r.getInt("rating"));
|
||||
plot.getSettings().getRatings().put(user, r.getInt("rating"));
|
||||
} else if (Settings.AUTO_PURGE) {
|
||||
toDelete.add(id);
|
||||
} else {
|
||||
|
@ -115,9 +115,7 @@ public abstract class SquarePlotManager extends GridPlotManager {
|
||||
end = pathWidthLower + dpw.PLOT_WIDTH;
|
||||
}
|
||||
int dx;
|
||||
int dz;
|
||||
int rx;
|
||||
int rz;
|
||||
if (x < 0) {
|
||||
dx = (x / size);
|
||||
rx = size + (x % size);
|
||||
@ -125,6 +123,8 @@ public abstract class SquarePlotManager extends GridPlotManager {
|
||||
dx = (x / size) + 1;
|
||||
rx = (x % size);
|
||||
}
|
||||
int dz;
|
||||
int rz;
|
||||
if (z < 0) {
|
||||
dz = (z / size);
|
||||
rz = size + (z % size);
|
||||
|
@ -29,18 +29,34 @@ import com.intellectualcrafters.plot.config.Settings;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.flag.Flag;
|
||||
import com.intellectualcrafters.plot.flag.FlagManager;
|
||||
import com.intellectualcrafters.plot.util.*;
|
||||
import com.intellectualcrafters.plot.util.BO3Handler;
|
||||
import com.intellectualcrafters.plot.util.ChunkManager;
|
||||
import com.intellectualcrafters.plot.util.EventUtil;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.SchematicHandler;
|
||||
import com.intellectualcrafters.plot.util.SetQueue;
|
||||
import com.intellectualcrafters.plot.util.TaskManager;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import com.intellectualcrafters.plot.util.WorldUtil;
|
||||
import com.plotsquared.listener.PlotListener;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.geom.Area;
|
||||
import java.awt.geom.PathIterator;
|
||||
import java.io.File;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
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;
|
||||
|
||||
@ -61,11 +77,9 @@ public class Plot {
|
||||
private static HashSet<Plot> connected_cache;
|
||||
private static HashSet<RegionWrapper> regions_cache;
|
||||
/**
|
||||
* plot ID
|
||||
* Direct access is Deprecated: use getId()
|
||||
* The {@link PlotId}
|
||||
*/
|
||||
@Deprecated
|
||||
public final PlotId id;
|
||||
private final PlotId id;
|
||||
/**
|
||||
* plot owner
|
||||
* (Merged plots can have multiple owners)
|
||||
@ -73,39 +87,6 @@ public class Plot {
|
||||
*/
|
||||
@Deprecated
|
||||
public UUID owner;
|
||||
/**
|
||||
* Plot creation timestamp (not accurate if the plot was created before this was implemented)<br>
|
||||
* - Milliseconds since the epoch<br>
|
||||
* Direct access is Deprecated: use {@link #getTimestamp() getTimestamp}
|
||||
*/
|
||||
@Deprecated
|
||||
public long timestamp;
|
||||
/**
|
||||
* List of trusted (with plot permissions)
|
||||
* Direct access is Deprecated: use getTrusted()
|
||||
*/
|
||||
@Deprecated
|
||||
public HashSet<UUID> trusted;
|
||||
/**
|
||||
* List of members users (with plot permissions)
|
||||
* Direct access is Deprecated: use getMembers()
|
||||
*/
|
||||
@Deprecated
|
||||
public HashSet<UUID> members;
|
||||
/**
|
||||
* List of denied players
|
||||
* Direct access is Deprecated: use getDenied()
|
||||
*/
|
||||
@Deprecated
|
||||
public HashSet<UUID> denied;
|
||||
/**
|
||||
* External settings class<br>
|
||||
* - Please favor the methods over direct access to this class<br>
|
||||
* - The methods are more likely to be left unchanged from version changes<br>
|
||||
* Direct access is Deprecated: use getSettings()
|
||||
*/
|
||||
@Deprecated
|
||||
public PlotSettings settings;
|
||||
/**
|
||||
* Has the plot changed since the last save cycle?
|
||||
*/
|
||||
@ -119,8 +100,30 @@ public class Plot {
|
||||
@Deprecated
|
||||
public int temp;
|
||||
/**
|
||||
* plot world
|
||||
* Direct access is Deprecated: use getWorld()
|
||||
* Plot creation timestamp (not accurate if the plot was created before this was implemented)<br>
|
||||
* - Milliseconds since the epoch<br>
|
||||
*/
|
||||
private long timestamp;
|
||||
/**
|
||||
* List of trusted (with plot permissions)
|
||||
*/
|
||||
private HashSet<UUID> trusted;
|
||||
/**
|
||||
* List of members users (with plot permissions)
|
||||
*/
|
||||
private HashSet<UUID> members;
|
||||
/**
|
||||
* List of denied players
|
||||
*/
|
||||
private HashSet<UUID> denied;
|
||||
/**
|
||||
* External settings class<br>
|
||||
* - Please favor the methods over direct access to this class<br>
|
||||
* - The methods are more likely to be left unchanged from version changes<br>
|
||||
*/
|
||||
private PlotSettings settings;
|
||||
/**
|
||||
* The {@link PlotArea}
|
||||
*/
|
||||
private PlotArea area;
|
||||
/**
|
||||
@ -486,10 +489,7 @@ public class Plot {
|
||||
* @return
|
||||
*/
|
||||
public boolean isBasePlot() {
|
||||
if ((this.settings == null) || !this.isMerged()) {
|
||||
return true;
|
||||
}
|
||||
return this.equals(this.getBasePlot(false));
|
||||
return !this.isMerged() || this.equals(this.getBasePlot(false));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -530,10 +530,7 @@ public class Plot {
|
||||
* @return
|
||||
*/
|
||||
public boolean isMerged() {
|
||||
if (this.settings == null) {
|
||||
return false;
|
||||
}
|
||||
return this.settings.getMerged(0) || this.settings.getMerged(2) || this.settings.getMerged(1) || this.settings.getMerged(3);
|
||||
return getSettings().getMerged(0) || getSettings().getMerged(2) || getSettings().getMerged(1) || getSettings().getMerged(3);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -567,40 +564,41 @@ public class Plot {
|
||||
* @return true if merged in that direction
|
||||
*/
|
||||
public boolean getMerged(final int direction) {
|
||||
if (this.settings == null) {
|
||||
return false;
|
||||
}
|
||||
switch (direction) {
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
return this.settings.getMerged(direction);
|
||||
case 7:
|
||||
int i = direction - 4;
|
||||
int i2 = 0;
|
||||
if (this.settings.getMerged(i2)) {
|
||||
if (this.settings.getMerged(i)) {
|
||||
if (this.area.getPlotAbs(this.id.getRelative(i)).getMerged(i2)) {
|
||||
if (this.area.getPlotAbs(this.id.getRelative(i2)).getMerged(i)) {
|
||||
return true;
|
||||
if (isMerged()) {
|
||||
switch (direction) {
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
return this.getSettings().getMerged(direction);
|
||||
case 7:
|
||||
int i = direction - 4;
|
||||
int i2 = 0;
|
||||
if (this.getSettings().getMerged(i2)) {
|
||||
if (this.getSettings().getMerged(i)) {
|
||||
if (this.area.getPlotAbs(this.id.getRelative(i)).getMerged(i2)) {
|
||||
if (this.area.getPlotAbs(this.id.getRelative(i2)).getMerged(i)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
i = direction - 4;
|
||||
i2 = direction - 3;
|
||||
return this.settings.getMerged(i2)
|
||||
&& this.settings.getMerged(i)
|
||||
&& this.area.getPlotAbs(this.id.getRelative(i)).getMerged(i2)
|
||||
&& this.area.getPlotAbs(this.id.getRelative(i2)).getMerged(i);
|
||||
|
||||
return false;
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
i = direction - 4;
|
||||
i2 = direction - 3;
|
||||
return this.getSettings().getMerged(i2)
|
||||
&& this.getSettings().getMerged(i)
|
||||
&& this.area.getPlotAbs(this.id.getRelative(i)).getMerged(i2)
|
||||
&& this.area.getPlotAbs(this.id.getRelative(i2)).getMerged(i);
|
||||
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1132,16 +1130,12 @@ public class Plot {
|
||||
*/
|
||||
public void setHome(final BlockLoc loc) {
|
||||
final BlockLoc pos = this.getSettings().getPosition();
|
||||
if ((((pos == null) || pos.equals(new BlockLoc(0, 0, 0))) && (loc == null)) || ((pos != null) && pos.equals(loc))) {
|
||||
if (pos.equals(new BlockLoc(0, 0, 0)) && loc == null || pos.equals(loc)) {
|
||||
return;
|
||||
}
|
||||
final Plot plot = this.getBasePlot(false);
|
||||
plot.getSettings().setPosition(loc);
|
||||
if (plot.getSettings().getPosition() == null) {
|
||||
DBFunc.setPosition(plot, "");
|
||||
} else {
|
||||
DBFunc.setPosition(plot, this.getSettings().getPosition().toString());
|
||||
}
|
||||
DBFunc.setPosition(plot, this.getSettings().getPosition().toString());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1240,11 +1234,7 @@ public class Plot {
|
||||
|
||||
public boolean hasRatings() {
|
||||
Plot base = this.getBasePlot(false);
|
||||
if (base.settings != null && base.settings.ratings != null) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return base.settings != null && base.settings.ratings != null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1368,7 +1358,7 @@ public class Plot {
|
||||
this.getDenied().clear();
|
||||
this.settings = new PlotSettings();
|
||||
if (this.area.addPlot(this)) {
|
||||
DBFunc.createPlotAndSettings(Plot.this, new Runnable() {
|
||||
DBFunc.createPlotAndSettings(this, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
final PlotArea plotworld = Plot.this.area;
|
||||
@ -1910,10 +1900,7 @@ public class Plot {
|
||||
* @return boolean [ north, east, south, west ]
|
||||
*/
|
||||
public boolean[] getMerged() {
|
||||
if (this.settings == null) {
|
||||
return new boolean[] { false, false, false, false };
|
||||
}
|
||||
return this.settings.getMerged();
|
||||
return this.getSettings().getMerged();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1948,10 +1935,7 @@ public class Plot {
|
||||
* @return
|
||||
*/
|
||||
public BlockLoc getPosition() {
|
||||
if (this.settings == null) {
|
||||
return new BlockLoc(0, 0, 0);
|
||||
}
|
||||
return this.settings.getPosition();
|
||||
return this.getSettings().getPosition();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2256,10 +2240,10 @@ public class Plot {
|
||||
PS.debug("Fixing invalid merge: " + this);
|
||||
if (tmp.isOwnerAbs(owner)) {
|
||||
tmp.getSettings().setMerged(2, true);
|
||||
DBFunc.setMerged(tmp, tmp.settings.getMerged());
|
||||
DBFunc.setMerged(tmp, tmp.getSettings().getMerged());
|
||||
} else {
|
||||
this.getSettings().setMerged(0, false);
|
||||
DBFunc.setMerged(this, this.settings.getMerged());
|
||||
DBFunc.setMerged(this, this.getSettings().getMerged());
|
||||
}
|
||||
}
|
||||
queuecache.add(tmp);
|
||||
@ -2272,10 +2256,10 @@ public class Plot {
|
||||
PS.debug("Fixing invalid merge: " + this);
|
||||
if (tmp.isOwnerAbs(owner)) {
|
||||
tmp.getSettings().setMerged(3, true);
|
||||
DBFunc.setMerged(tmp, tmp.settings.getMerged());
|
||||
DBFunc.setMerged(tmp, tmp.getSettings().getMerged());
|
||||
} else {
|
||||
this.getSettings().setMerged(1, false);
|
||||
DBFunc.setMerged(this, this.settings.getMerged());
|
||||
DBFunc.setMerged(this, this.getSettings().getMerged());
|
||||
}
|
||||
}
|
||||
queuecache.add(tmp);
|
||||
@ -2288,10 +2272,10 @@ public class Plot {
|
||||
PS.debug("Fixing invalid merge: " + this);
|
||||
if (tmp.isOwnerAbs(owner)) {
|
||||
tmp.getSettings().setMerged(0, true);
|
||||
DBFunc.setMerged(tmp, tmp.settings.getMerged());
|
||||
DBFunc.setMerged(tmp, tmp.getSettings().getMerged());
|
||||
} else {
|
||||
this.getSettings().setMerged(2, false);
|
||||
DBFunc.setMerged(this, this.settings.getMerged());
|
||||
DBFunc.setMerged(this, this.getSettings().getMerged());
|
||||
}
|
||||
}
|
||||
queuecache.add(tmp);
|
||||
@ -2304,10 +2288,10 @@ public class Plot {
|
||||
PS.debug("Fixing invalid merge: " + this);
|
||||
if (tmp.isOwnerAbs(owner)) {
|
||||
tmp.getSettings().setMerged(1, true);
|
||||
DBFunc.setMerged(tmp, tmp.settings.getMerged());
|
||||
DBFunc.setMerged(tmp, tmp.getSettings().getMerged());
|
||||
} else {
|
||||
this.getSettings().setMerged(3, false);
|
||||
DBFunc.setMerged(this, this.settings.getMerged());
|
||||
DBFunc.setMerged(this, this.getSettings().getMerged());
|
||||
}
|
||||
}
|
||||
queuecache.add(tmp);
|
||||
@ -2324,6 +2308,9 @@ public class Plot {
|
||||
connected_cache.add(current);
|
||||
queuecache.remove(current);
|
||||
merged = current.getMerged();
|
||||
for (int i = 0; i < 5; i++) {
|
||||
|
||||
}
|
||||
if (merged[0]) {
|
||||
tmp = current.area.getPlotAbs(current.id.getRelative(0));
|
||||
if ((tmp != null) && !queuecache.contains(tmp) && !connected_cache.contains(tmp)) {
|
||||
@ -2794,7 +2781,7 @@ public class Plot {
|
||||
for (final Plot plot : plots) {
|
||||
final Plot other = plot.getRelative(offset.x, offset.y);
|
||||
other.create(other.owner, false);
|
||||
if ((plot.getFlags() != null) && !plot.getFlags().isEmpty()) {
|
||||
if (!plot.getFlags().isEmpty()) {
|
||||
other.getSettings().flags = plot.getFlags();
|
||||
DBFunc.setFlags(other, plot.getFlags().values());
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ public class StringMan {
|
||||
if (obj == null) {
|
||||
return "null";
|
||||
}
|
||||
if (obj.getClass() == String.class) {
|
||||
if (obj instanceof String) {
|
||||
return (String) obj;
|
||||
}
|
||||
if (obj.getClass().isArray()) {
|
||||
|
Reference in New Issue
Block a user