mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-01-19 16:59:36 +01:00
Refactor
This commit is contained in:
parent
fbaca34218
commit
0d75622196
@ -474,7 +474,7 @@ import com.intellectualcrafters.plot.uuid.UUIDWrapper;
|
||||
final ArrayList<Plot> pPlots = new ArrayList<>();
|
||||
for (final Plot plot : PlotSquared.getPlots(world.getName()).values()) {
|
||||
if (just_owner) {
|
||||
if ((plot.owner_ != null) && (plot.owner_ == UUIDHandler.getUUID(BukkitUtil.getPlayer(plr)))) {
|
||||
if ((plot.owner != null) && (plot.owner == UUIDHandler.getUUID(BukkitUtil.getPlayer(plr)))) {
|
||||
pPlots.add(plot);
|
||||
}
|
||||
} else {
|
||||
|
@ -193,7 +193,7 @@ public class Auto extends SubCommand {
|
||||
if ((size_x == 1) && (size_z == 1)) {
|
||||
while (!br) {
|
||||
final Plot plot = MainUtil.getPlot(worldname, getLastPlot(worldname));
|
||||
if ((plot.owner_ == null)) {
|
||||
if ((plot.owner == null)) {
|
||||
Claim.claimPlot(plr, plot, true, true);
|
||||
br = true;
|
||||
}
|
||||
@ -207,7 +207,7 @@ public class Auto extends SubCommand {
|
||||
MainUtil.lastPlot.put(worldname, start);
|
||||
if (lastPlot) {
|
||||
}
|
||||
if ((PlotSquared.getPlots(worldname).get(start) != null) && (PlotSquared.getPlots(worldname).get(start).owner_ != null)) {
|
||||
if ((PlotSquared.getPlots(worldname).get(start) != null) && (PlotSquared.getPlots(worldname).get(start).owner != null)) {
|
||||
continue;
|
||||
} else {
|
||||
lastPlot = false;
|
||||
|
@ -98,8 +98,8 @@ public class Buy extends SubCommand {
|
||||
}
|
||||
EconHandler.withdrawPlayer(plr, price);
|
||||
sendMessage(plr, C.REMOVED_BALANCE, price + "");
|
||||
EconHandler.depositPlayer(UUIDHandler.uuidWrapper.getOfflinePlayer(plot.owner_), initPrice);
|
||||
final PlotPlayer owner = UUIDHandler.getPlayer(plot.owner_);
|
||||
EconHandler.depositPlayer(UUIDHandler.uuidWrapper.getOfflinePlayer(plot.owner), initPrice);
|
||||
final PlotPlayer owner = UUIDHandler.getPlayer(plot.owner);
|
||||
if (owner != null) {
|
||||
sendMessage(plr, C.PLOT_SOLD, plot.id + "", plr.getName(), initPrice + "");
|
||||
}
|
||||
@ -109,8 +109,8 @@ public class Buy extends SubCommand {
|
||||
|
||||
for (PlotId myId : MainUtil.getPlotSelectionIds(plot.id, top.id)) {
|
||||
Plot myPlot = MainUtil.getPlot(plot.world, myId);
|
||||
myPlot.owner_ = plr.getUUID();
|
||||
DBFunc.setOwner(plot, myPlot.owner_);
|
||||
myPlot.owner = plr.getUUID();
|
||||
DBFunc.setOwner(plot, myPlot.owner);
|
||||
}
|
||||
MainUtil.sendMessage(plr, C.CLAIMED);
|
||||
return true;
|
||||
|
@ -62,7 +62,7 @@ public class Clear extends SubCommand {
|
||||
Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
MainUtil.clear(world, plot, plot.owner_ == null, null);
|
||||
MainUtil.clear(world, plot, plot.owner == null, null);
|
||||
PlotSquared.log("Plot " + plot.getId().toString() + " cleared.");
|
||||
}
|
||||
};
|
||||
@ -122,7 +122,7 @@ public class Clear extends SubCommand {
|
||||
@Override
|
||||
public void run() {
|
||||
final long start = System.currentTimeMillis();
|
||||
final boolean result = MainUtil.clearAsPlayer(plot, plot.owner_ == null, new Runnable() {
|
||||
final boolean result = MainUtil.clearAsPlayer(plot, plot.owner == null, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
MainUtil.sendMessage(plr, C.CLEARING_DONE, "" + (System.currentTimeMillis() - start));
|
||||
|
@ -129,9 +129,9 @@ public class Cluster extends SubCommand {
|
||||
// Add any existing plots to the current cluster
|
||||
for (final Plot plot : PlotSquared.getPlots(plr.getLocation().getWorld()).values()) {
|
||||
final PlotCluster current = ClusterManager.getCluster(plot);
|
||||
if (cluster.equals(current) && !cluster.hasRights(plot.owner_)) {
|
||||
cluster.invited.add(plot.owner_);
|
||||
DBFunc.setInvited(world, cluster, plot.owner_);
|
||||
if (cluster.equals(current) && !cluster.hasRights(plot.owner)) {
|
||||
cluster.invited.add(plot.owner);
|
||||
DBFunc.setInvited(world, cluster, plot.owner);
|
||||
}
|
||||
}
|
||||
if (!PlotSquared.isPlotWorld(world)) {
|
||||
|
@ -123,7 +123,7 @@ public class DebugClaimTest extends SubCommand {
|
||||
}
|
||||
if (uuid != null) {
|
||||
MainUtil.sendMessage(null, " - &aFound plot: " + plot.id + " : " + line);
|
||||
plot.owner_ = uuid;
|
||||
plot.owner = uuid;
|
||||
plot.hasChanged = true;
|
||||
plots.add(plot);
|
||||
} else {
|
||||
|
@ -97,7 +97,7 @@ public class DebugExec extends SubCommand {
|
||||
for (final Entry<Plot, Long> entry : ExpireManager.expiredPlots.get(args[1]).entrySet()) {
|
||||
final Plot plot = entry.getKey();
|
||||
final Long stamp = entry.getValue();
|
||||
MainUtil.sendMessage(null, " - " + plot.world + ";" + plot.id.x + ";" + plot.id.y + ";" + UUIDHandler.getName(plot.owner_) + " : " + stamp);
|
||||
MainUtil.sendMessage(null, " - " + plot.world + ";" + plot.id.x + ";" + plot.id.y + ";" + UUIDHandler.getName(plot.owner) + " : " + stamp);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ public class Info extends SubCommand {
|
||||
return true;
|
||||
}
|
||||
String owner = "none";
|
||||
if (plot.owner_ == null) {
|
||||
if (plot.owner == null) {
|
||||
owner = "unowned";
|
||||
}
|
||||
else {
|
||||
@ -173,7 +173,7 @@ public class Info extends SubCommand {
|
||||
final String flags = "&6" + (StringUtils.join(FlagManager.getPlotFlags(plot), "").length() > 0 ? StringUtils.join(FlagManager.getPlotFlags(plot), "&7, &6") : "none");
|
||||
final boolean build = (player == null) || plot.isAdded(player.getUUID());
|
||||
String owner = "none";
|
||||
if (plot.owner_ == null) {
|
||||
if (plot.owner == null) {
|
||||
owner = "unowned";
|
||||
}
|
||||
else {
|
||||
|
@ -138,10 +138,10 @@ public class Merge extends SubCommand {
|
||||
boolean multiMerge = false;
|
||||
final HashSet<UUID> multiUUID = new HashSet<UUID>();
|
||||
HashSet<PlotId> multiPlots = new HashSet<>();
|
||||
final UUID u1 = plot.owner_;
|
||||
final UUID u1 = plot.owner;
|
||||
for (final PlotId myid : plots) {
|
||||
final Plot myplot = PlotSquared.getPlots(world).get(myid);
|
||||
UUID u2 = myplot.owner_;
|
||||
UUID u2 = myplot.owner;
|
||||
if (myplot == null || u2 == null) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERM_MERGE.s().replaceAll("%plot%", myid.toString()));
|
||||
return false;
|
||||
@ -190,7 +190,7 @@ public class Merge extends SubCommand {
|
||||
}
|
||||
MainUtil.sendMessage(plr, C.SUCCESS_MERGE);
|
||||
MainUtil.mergePlots(world, plots, true);
|
||||
MainUtil.setSign(UUIDHandler.getName(plot.owner_), plot);
|
||||
MainUtil.setSign(UUIDHandler.getName(plot.owner), plot);
|
||||
MainUtil.update(loc);
|
||||
}
|
||||
MainUtil.sendMessage(accepter, C.MERGE_ACCEPTED);
|
||||
@ -219,7 +219,7 @@ public class Merge extends SubCommand {
|
||||
}
|
||||
MainUtil.sendMessage(plr, C.SUCCESS_MERGE);
|
||||
MainUtil.mergePlots(world, plots, true);
|
||||
MainUtil.setSign(UUIDHandler.getName(plot.owner_), plot);
|
||||
MainUtil.setSign(UUIDHandler.getName(plot.owner), plot);
|
||||
MainUtil.update(loc);
|
||||
return true;
|
||||
}
|
||||
|
@ -120,8 +120,8 @@ public class Purge extends SubCommand {
|
||||
final Collection<Plot> plots = PlotSquared.getPlots(worldname).values();
|
||||
final Set<PlotId> ids = new HashSet<>();
|
||||
for (final Plot plot : plots) {
|
||||
if (plot.owner_ != null) {
|
||||
final String name = UUIDHandler.getName(plot.owner_);
|
||||
if (plot.owner != null) {
|
||||
final String name = UUIDHandler.getName(plot.owner);
|
||||
if (name == null) {
|
||||
ids.add(plot.id);
|
||||
}
|
||||
@ -138,7 +138,7 @@ public class Purge extends SubCommand {
|
||||
final Collection<Plot> plots = PlotSquared.getPlots(worldname).values();
|
||||
final Set<PlotId> ids = new HashSet<>();
|
||||
for (final Plot plot : plots) {
|
||||
if (plot.owner_ == null) {
|
||||
if (plot.owner == null) {
|
||||
ids.add(plot.id);
|
||||
}
|
||||
}
|
||||
|
@ -222,7 +222,7 @@ public class SchematicCmd extends SubCommand {
|
||||
}
|
||||
final Plot plot = SchematicCmd.this.plots[SchematicCmd.this.counter];
|
||||
final CompoundTag sch = SchematicHandler.manager.getCompoundTag(worldname, plot.id);
|
||||
final String o = UUIDHandler.getName(plot.owner_);
|
||||
final String o = UUIDHandler.getName(plot.owner);
|
||||
final String owner = o == null ? "unknown" : o;
|
||||
if (sch == null) {
|
||||
MainUtil.sendMessage(null, "&7 - Skipped plot &c" + plot.id);
|
||||
@ -303,7 +303,7 @@ public class SchematicCmd extends SubCommand {
|
||||
}
|
||||
final Plot plot = SchematicCmd.this.plots[SchematicCmd.this.counter];
|
||||
final CompoundTag sch = SchematicHandler.manager.getCompoundTag(world, plot.id);
|
||||
final String o = UUIDHandler.getName(plot.owner_);
|
||||
final String o = UUIDHandler.getName(plot.owner);
|
||||
final String owner = o == null ? "unknown" : o;
|
||||
if (sch == null) {
|
||||
MainUtil.sendMessage(plr, "&7 - Skipped plot &c" + plot.id);
|
||||
|
@ -52,7 +52,7 @@ public class SetOwner extends SubCommand {
|
||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||
final Location loc = plr.getLocation();
|
||||
final Plot plot = MainUtil.getPlot(loc);
|
||||
if ((plot == null) || (plot.owner_ == null)) {
|
||||
if ((plot == null) || (plot.owner == null)) {
|
||||
MainUtil.sendMessage(plr, C.NOT_IN_PLOT);
|
||||
return false;
|
||||
}
|
||||
@ -75,9 +75,9 @@ public class SetOwner extends SubCommand {
|
||||
MainUtil.sendMessage(plr, C.INVALID_PLAYER, args[0]);
|
||||
return false;
|
||||
}
|
||||
current.owner_ = uuid;
|
||||
current.owner = uuid;
|
||||
PlotSquared.updatePlot(current);
|
||||
DBFunc.setOwner(current, current.owner_);
|
||||
DBFunc.setOwner(current, current.owner);
|
||||
}
|
||||
MainUtil.setSign(args[0], plot);
|
||||
MainUtil.sendMessage(plr, C.SET_OWNER);
|
||||
|
@ -66,7 +66,7 @@ public class Swap extends SubCommand {
|
||||
try {
|
||||
plotid = new PlotId(Integer.parseInt(id.split(";")[0]), Integer.parseInt(id.split(";")[1]));
|
||||
final Plot plot2 = PlotSquared.getPlots(world).get(plotid);
|
||||
if (((plot2 == null) || !plot2.hasOwner() || !(plot2.owner_.equals(plr.getUUID()))) && !Permissions.hasPermission(plr, "plots.admin.command.swap")) {
|
||||
if (((plot2 == null) || !plot2.hasOwner() || !(plot2.owner.equals(plr.getUUID()))) && !Permissions.hasPermission(plr, "plots.admin.command.swap")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERM_MERGE, plotid.toString());
|
||||
return false;
|
||||
}
|
||||
|
@ -124,14 +124,14 @@ public class Unlink extends SubCommand {
|
||||
if (ly) {
|
||||
manager.createRoadSouth(plotworld, p);
|
||||
}
|
||||
MainUtil.setSign(UUIDHandler.getName(plot.owner_), plot);
|
||||
MainUtil.setSign(UUIDHandler.getName(plot.owner), plot);
|
||||
}
|
||||
}
|
||||
manager.finishPlotUnlink(plotworld, ids);
|
||||
for (final PlotId id : ids) {
|
||||
final Plot myPlot = MainUtil.getPlot(world, id);
|
||||
if (plot.hasOwner()) {
|
||||
final String name = UUIDHandler.getName(myPlot.owner_);
|
||||
final String name = UUIDHandler.getName(myPlot.owner);
|
||||
if (name != null) {
|
||||
MainUtil.setSign(name, myPlot);
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ public class list extends SubCommand {
|
||||
case "unowned": {
|
||||
plots = new HashSet<>();
|
||||
for (Plot plot : PlotSquared.getPlots()) {
|
||||
if (plot.owner_ == null) {
|
||||
if (plot.owner == null) {
|
||||
plots.add(plot);
|
||||
}
|
||||
}
|
||||
@ -160,10 +160,10 @@ public class list extends SubCommand {
|
||||
case "unknown": {
|
||||
plots = new HashSet<>();
|
||||
for (Plot plot : PlotSquared.getPlots()) {
|
||||
if (plot.owner_ == null) {
|
||||
if (plot.owner == null) {
|
||||
continue;
|
||||
}
|
||||
if (UUIDHandler.getName(plot.owner_) == null) {
|
||||
if (UUIDHandler.getName(plot.owner) == null) {
|
||||
plots.add(plot);
|
||||
}
|
||||
}
|
||||
@ -219,7 +219,7 @@ public class list extends SubCommand {
|
||||
// This might work xD
|
||||
for (int x = (page * 12); x < max; x++) {
|
||||
p = (Plot) plots.toArray()[x];
|
||||
string.append(C.PLOT_LIST_ITEM_ORDERED.s().replaceAll("%in", x + 1 + "").replaceAll("%id", p.id.toString()).replaceAll("%world", p.world).replaceAll("%owner", getName(p.owner_))).append("\n");
|
||||
string.append(C.PLOT_LIST_ITEM_ORDERED.s().replaceAll("%in", x + 1 + "").replaceAll("%id", p.id.toString()).replaceAll("%world", p.world).replaceAll("%owner", getName(p.owner))).append("\n");
|
||||
}
|
||||
string.append(C.PLOT_LIST_FOOTER.s().replaceAll("%word%", "There is").replaceAll("%num%", plots.size() + "").replaceAll("%plot%", plots.size() == 1 ? "plot" : "plots"));
|
||||
MainUtil.sendMessage(player, string.toString());
|
||||
|
@ -263,7 +263,7 @@ public class SQLManager implements AbstractDB {
|
||||
stmt.setInt((i * 4) + 1, plot.id.x);
|
||||
stmt.setInt((i * 4) + 2, plot.id.y);
|
||||
try {
|
||||
stmt.setString((i * 4) + 3, plot.owner_.toString());
|
||||
stmt.setString((i * 4) + 3, plot.owner.toString());
|
||||
} catch (final Exception e) {
|
||||
stmt.setString((i * 4) + 3, DBFunc.everyone.toString());
|
||||
}
|
||||
@ -299,7 +299,7 @@ public class SQLManager implements AbstractDB {
|
||||
stmt.setInt((i * 6) + 2, plot.id.x);
|
||||
stmt.setInt((i * 6) + 3, plot.id.y);
|
||||
try {
|
||||
stmt.setString((i * 6) + 4, plot.owner_.toString());
|
||||
stmt.setString((i * 6) + 4, plot.owner.toString());
|
||||
} catch (final Exception e1) {
|
||||
stmt.setString((i * 6) + 4, DBFunc.everyone.toString());
|
||||
}
|
||||
@ -344,7 +344,7 @@ public class SQLManager implements AbstractDB {
|
||||
stmt = SQLManager.this.connection.prepareStatement(SQLManager.this.CREATE_PLOT);
|
||||
stmt.setInt(1, plot.id.x);
|
||||
stmt.setInt(2, plot.id.y);
|
||||
stmt.setString(3, plot.owner_.toString());
|
||||
stmt.setString(3, plot.owner.toString());
|
||||
stmt.setString(4, plot.world);
|
||||
stmt.executeUpdate();
|
||||
stmt.close();
|
||||
@ -366,7 +366,7 @@ public class SQLManager implements AbstractDB {
|
||||
stmt = SQLManager.this.connection.prepareStatement(SQLManager.this.CREATE_PLOT);
|
||||
stmt.setInt(1, plot.id.x);
|
||||
stmt.setInt(2, plot.id.y);
|
||||
stmt.setString(3, plot.owner_.toString());
|
||||
stmt.setString(3, plot.owner.toString());
|
||||
stmt.setString(4, plot.world);
|
||||
stmt.executeUpdate();
|
||||
stmt.close();
|
||||
|
@ -180,7 +180,7 @@ public class PlotListener {
|
||||
}
|
||||
if ((booleanFlag(plot, "titles", Settings.TITLES)) && (C.TITLE_ENTERED_PLOT.s().length() > 2)) {
|
||||
final String sTitleMain = C.TITLE_ENTERED_PLOT.s().replaceAll("%x%", plot.id.x + "").replaceAll("%z%", plot.id.y + "").replaceAll("%world%", plot.world + "");
|
||||
final String sTitleSub = C.TITLE_ENTERED_PLOT_SUB.s().replaceFirst("%s", getName(plot.owner_));
|
||||
final String sTitleSub = C.TITLE_ENTERED_PLOT_SUB.s().replaceFirst("%s", getName(plot.owner));
|
||||
if (AbstractTitle.TITLE_CLASS != null) {
|
||||
AbstractTitle.TITLE_CLASS.sendTitle(player, sTitleMain, sTitleSub, ChatColor.valueOf(C.TITLE_ENTERED_PLOT_COLOR.s()), ChatColor.valueOf(C.TITLE_ENTERED_PLOT_SUB_COLOR.s()));
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ public class InfoInventory implements InventoryHolder {
|
||||
}
|
||||
|
||||
public String getName(final UUID uuid) {
|
||||
final String name = UUIDHandler.getName(this.plot.owner_);
|
||||
final String name = UUIDHandler.getName(this.plot.owner);
|
||||
if (name == null) {
|
||||
return "unknown";
|
||||
}
|
||||
@ -52,7 +52,7 @@ public class InfoInventory implements InventoryHolder {
|
||||
|
||||
public InfoInventory build() {
|
||||
final UUID uuid = UUIDHandler.getUUID(BukkitUtil.getPlayer(this.player));
|
||||
final ItemStack generalInfo = getItem(Material.EMERALD, "&cPlot Info", "&cID: &6" + this.plot.getId().toString(), "&cOwner: &6" + getName(this.plot.owner_), "&cAlias: &6" + this.plot.settings.getAlias(), "&cBiome: &6" + this.plot.settings.getBiome().toString().replaceAll("_", "").toLowerCase(), "&cCan Build: &6" + this.plot.isAdded(uuid), "&cIs Denied: &6" + this.plot.isDenied(uuid));
|
||||
final ItemStack generalInfo = getItem(Material.EMERALD, "&cPlot Info", "&cID: &6" + this.plot.getId().toString(), "&cOwner: &6" + getName(this.plot.owner), "&cAlias: &6" + this.plot.settings.getAlias(), "&cBiome: &6" + this.plot.settings.getBiome().toString().replaceAll("_", "").toLowerCase(), "&cCan Build: &6" + this.plot.isAdded(uuid), "&cIs Denied: &6" + this.plot.isDenied(uuid));
|
||||
final ItemStack helpers = getItem(Material.EMERALD, "&cHelpers", "&cAmount: &6" + this.plot.helpers.size(), "&8Click to view a list of the plot helpers");
|
||||
final ItemStack trusted = getItem(Material.EMERALD, "&cTrusted", "&cAmount: &6" + this.plot.trusted.size(), "&8Click to view a list of trusted players");
|
||||
final ItemStack denied = getItem(Material.EMERALD, "&cDenied", "&cAmount: &6" + this.plot.denied.size(), "&8Click to view a list of denied players");
|
||||
|
@ -48,7 +48,7 @@ public class Plot implements Cloneable {
|
||||
/**
|
||||
* plot owner
|
||||
*/
|
||||
public UUID owner_;
|
||||
public UUID owner;
|
||||
/**
|
||||
* Deny Entry
|
||||
*/
|
||||
@ -90,8 +90,8 @@ public class Plot implements Cloneable {
|
||||
public Plot(final PlotId id, final UUID owner, final ArrayList<UUID> helpers, final ArrayList<UUID> denied, final String world) {
|
||||
this.id = id;
|
||||
this.settings = new PlotSettings(this);
|
||||
this.owner_ = owner;
|
||||
this.deny_entry = this.owner_ == null;
|
||||
this.owner = owner;
|
||||
this.deny_entry = this.owner == null;
|
||||
this.helpers = helpers;
|
||||
this.denied = denied;
|
||||
this.trusted = new ArrayList<>();
|
||||
@ -113,8 +113,8 @@ public class Plot implements Cloneable {
|
||||
public Plot(final PlotId id, final UUID owner, final ArrayList<UUID> helpers, final ArrayList<UUID> trusted, final ArrayList<UUID> denied, final String alias, final BlockLoc position, final Set<Flag> flags, final String world, final boolean[] merged) {
|
||||
this.id = id;
|
||||
this.settings = new PlotSettings(this);
|
||||
this.owner_ = owner;
|
||||
this.deny_entry = this.owner_ != null;
|
||||
this.owner = owner;
|
||||
this.deny_entry = this.owner != null;
|
||||
this.trusted = trusted;
|
||||
this.helpers = helpers;
|
||||
this.denied = denied;
|
||||
@ -136,7 +136,7 @@ public class Plot implements Cloneable {
|
||||
* @return false if there is no owner
|
||||
*/
|
||||
public boolean hasOwner() {
|
||||
return this.owner_ != null;
|
||||
return this.owner != null;
|
||||
}
|
||||
|
||||
public boolean isOwner(UUID uuid) {
|
||||
@ -205,7 +205,7 @@ public class Plot implements Cloneable {
|
||||
public Object clone() throws CloneNotSupportedException {
|
||||
final Plot p = (Plot) super.clone();
|
||||
if (!p.equals(this) || (p != this)) {
|
||||
return new Plot(this.id, this.owner_, this.helpers, this.trusted, this.denied, this.settings.getAlias(), this.settings.getPosition(), this.settings.flags, this.world, this.settings.getMerged());
|
||||
return new Plot(this.id, this.owner, this.helpers, this.trusted, this.denied, this.settings.getAlias(), this.settings.getPosition(), this.settings.flags, this.world, this.settings.getMerged());
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||
|
||||
public class PlotHandler {
|
||||
public static HashSet<UUID> getOwners(Plot plot) {
|
||||
if (plot.owner_ == null) {
|
||||
if (plot.owner == null) {
|
||||
return new HashSet<UUID>();
|
||||
}
|
||||
if (plot.settings.isMerged()) {
|
||||
@ -19,42 +19,42 @@ public class PlotHandler {
|
||||
Plot top = MainUtil.getTopPlot(plot);
|
||||
ArrayList<PlotId> ids = MainUtil.getPlotSelectionIds(plot.id, top.id);
|
||||
for (PlotId id : ids) {
|
||||
UUID owner = MainUtil.getPlot(plot.world, id).owner_;
|
||||
UUID owner = MainUtil.getPlot(plot.world, id).owner;
|
||||
if (owner != null) {
|
||||
owners.add(owner);
|
||||
}
|
||||
}
|
||||
return owners;
|
||||
}
|
||||
return new HashSet<>(Arrays.asList(plot.owner_));
|
||||
return new HashSet<>(Arrays.asList(plot.owner));
|
||||
}
|
||||
|
||||
public static boolean isOwner(Plot plot, UUID uuid) {
|
||||
if (plot.owner_ == null) {
|
||||
if (plot.owner == null) {
|
||||
return false;
|
||||
}
|
||||
if (plot.settings.isMerged()) {
|
||||
Plot top = MainUtil.getTopPlot(plot);
|
||||
ArrayList<PlotId> ids = MainUtil.getPlotSelectionIds(plot.id, top.id);
|
||||
for (PlotId id : ids) {
|
||||
UUID owner = MainUtil.getPlot(plot.world, id).owner_;
|
||||
UUID owner = MainUtil.getPlot(plot.world, id).owner;
|
||||
if (owner != null && owner.equals(uuid)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return plot.owner_.equals(uuid);
|
||||
return plot.owner.equals(uuid);
|
||||
}
|
||||
|
||||
public static boolean isOnline(Plot plot) {
|
||||
if (plot.owner_ == null) {
|
||||
if (plot.owner == null) {
|
||||
return false;
|
||||
}
|
||||
if (plot.settings.isMerged()) {
|
||||
Plot top = MainUtil.getTopPlot(plot);
|
||||
ArrayList<PlotId> ids = MainUtil.getPlotSelectionIds(plot.id, top.id);
|
||||
for (PlotId id : ids) {
|
||||
UUID owner = MainUtil.getPlot(plot.world, id).owner_;
|
||||
UUID owner = MainUtil.getPlot(plot.world, id).owner;
|
||||
if (owner != null) {
|
||||
if (UUIDHandler.getPlayer(owner) != null) {
|
||||
return true;
|
||||
@ -63,11 +63,11 @@ public class PlotHandler {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return UUIDHandler.getPlayer(plot.owner_) != null;
|
||||
return UUIDHandler.getPlayer(plot.owner) != null;
|
||||
}
|
||||
|
||||
public static boolean sameOwners(Plot plot1, Plot plot2) {
|
||||
if (plot1.owner_ == null || plot2.owner_ == null) {
|
||||
if (plot1.owner == null || plot2.owner == null) {
|
||||
return false;
|
||||
}
|
||||
HashSet<UUID> owners = getOwners(plot1);
|
||||
@ -76,7 +76,7 @@ public class PlotHandler {
|
||||
}
|
||||
|
||||
public static boolean isAdded(Plot plot, final UUID uuid) {
|
||||
if (plot.owner_ == null) {
|
||||
if (plot.owner == null) {
|
||||
return false;
|
||||
}
|
||||
if (plot.denied.contains(uuid)) {
|
||||
|
@ -116,7 +116,7 @@ public class ExpireManager {
|
||||
PlotSquared.log("&cDeleted expired plot: " + plot.id);
|
||||
PlotSquared.log("&3 - World: " + plot.world);
|
||||
if (plot.hasOwner()) {
|
||||
PlotSquared.log("&3 - Owner: " + UUIDHandler.getName(plot.owner_));
|
||||
PlotSquared.log("&3 - Owner: " + UUIDHandler.getName(plot.owner));
|
||||
} else {
|
||||
PlotSquared.log("&3 - Owner: Unowned");
|
||||
}
|
||||
@ -159,7 +159,7 @@ public class ExpireManager {
|
||||
final HashMap<UUID, Long> remove = new HashMap<>();
|
||||
final Set<UUID> keep = new HashSet<>();
|
||||
for (final Plot plot : plots) {
|
||||
final UUID uuid = plot.owner_;
|
||||
final UUID uuid = plot.owner;
|
||||
if ((uuid == null) || remove.containsKey(uuid)) {
|
||||
Long stamp;
|
||||
if (uuid == null) {
|
||||
|
@ -90,7 +90,7 @@ public class MainUtil {
|
||||
final UUID uuid = plr.getUUID();
|
||||
int count = 0;
|
||||
for (final Plot plot : PlotSquared.getPlots(world).values()) {
|
||||
if (plot.hasOwner() && plot.owner_.equals(uuid) && plot.countsTowardsMax) {
|
||||
if (plot.hasOwner() && plot.owner.equals(uuid) && plot.countsTowardsMax) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
@ -369,10 +369,10 @@ public class MainUtil {
|
||||
if (plot == null) {
|
||||
return;
|
||||
}
|
||||
if (plot.owner_ == null) {
|
||||
if (plot.owner == null) {
|
||||
return;
|
||||
}
|
||||
if (!plot.owner_.equals(uuid)) {
|
||||
if (!plot.owner.equals(uuid)) {
|
||||
return;
|
||||
}
|
||||
ArrayList<PlotId> plots;
|
||||
@ -427,7 +427,7 @@ public class MainUtil {
|
||||
final PlotId id_max = plots.get(plots.size() - 1);
|
||||
for (final PlotId myid : plots) {
|
||||
final Plot myplot = PlotSquared.getPlots(world).get(myid);
|
||||
if ((myplot == null) || myplot.owner_ == null || !(myplot.owner_.equals(uuid))) {
|
||||
if ((myplot == null) || myplot.owner == null || !(myplot.owner.equals(uuid))) {
|
||||
return false;
|
||||
}
|
||||
final PlotId top = getTopPlot(myplot).id;
|
||||
@ -770,7 +770,7 @@ public class MainUtil {
|
||||
for (int y = pos1.y; y <= pos2.y; y++) {
|
||||
final PlotId id = new PlotId(x, y);
|
||||
if (PlotSquared.getPlots(world).get(id) != null) {
|
||||
if (PlotSquared.getPlots(world).get(id).owner_ != null) {
|
||||
if (PlotSquared.getPlots(world).get(id).owner != null) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -782,7 +782,7 @@ public class MainUtil {
|
||||
public static boolean swap(final String world, final PlotId current, final PlotId newPlot, final Runnable whenDone) {
|
||||
Plot p1 = PlotSquared.getPlots(world).get(current);
|
||||
Plot p2 = PlotSquared.getPlots(world).get(newPlot);
|
||||
if (p1==null || p2 == null || p1.owner_ == null || !p1.owner_.equals(p2.owner_)) {
|
||||
if (p1==null || p2 == null || p1.owner == null || !p1.owner.equals(p2.owner)) {
|
||||
return false;
|
||||
}
|
||||
// Swap blocks
|
||||
@ -807,7 +807,7 @@ public class MainUtil {
|
||||
final com.intellectualcrafters.plot.object.Location bot2 = MainUtil.getPlotBottomLoc(world, newPlot);
|
||||
final Location top = MainUtil.getPlotTopLoc(world, current);
|
||||
final Plot currentPlot = MainUtil.getPlot(world, current);
|
||||
if (currentPlot.owner_ == null) {
|
||||
if (currentPlot.owner == null) {
|
||||
TaskManager.runTaskLater(whenDone, 1);
|
||||
return false;
|
||||
}
|
||||
@ -845,7 +845,7 @@ public class MainUtil {
|
||||
final com.intellectualcrafters.plot.object.Location bot2 = MainUtil.getPlotBottomLoc(world, newPlot);
|
||||
final Location top = MainUtil.getPlotTopLoc(world, current);
|
||||
final Plot currentPlot = MainUtil.getPlot(world, current);
|
||||
if (currentPlot.owner_ == null) {
|
||||
if (currentPlot.owner == null) {
|
||||
TaskManager.runTaskLater(whenDone, 1);
|
||||
return false;
|
||||
}
|
||||
@ -862,7 +862,7 @@ public class MainUtil {
|
||||
for (final PlotId id : selection) {
|
||||
int x = id.x + offset_x;
|
||||
int y = id.y + offset_y;
|
||||
Plot plot = createPlotAbs(currentPlot.owner_, getPlot(world, new PlotId(x, y)));
|
||||
Plot plot = createPlotAbs(currentPlot.owner, getPlot(world, new PlotId(x, y)));
|
||||
if (currentPlot.settings.flags != null && currentPlot.settings.flags.size() > 0) {
|
||||
plot.settings.flags = currentPlot.settings.flags;
|
||||
DBFunc.setFlags(world, plot, currentPlot.settings.flags);
|
||||
|
@ -115,12 +115,12 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
final Location bot = new Location(world, x1, 0, z1);
|
||||
Plot plot;
|
||||
plot = MainUtil.getPlot(bot);
|
||||
if ((plot != null) && (plot.owner_ != null)) {
|
||||
if ((plot != null) && (plot.owner != null)) {
|
||||
return plot;
|
||||
}
|
||||
final Location top = new Location(world, x2, 0, z2);
|
||||
plot = MainUtil.getPlot(top);
|
||||
if ((plot != null) && (plot.owner_ != null)) {
|
||||
if ((plot != null) && (plot.owner != null)) {
|
||||
return plot;
|
||||
}
|
||||
return null;
|
||||
|
Loading…
x
Reference in New Issue
Block a user