From 0d75622196f39218a6f857e3f410d5d781e03303 Mon Sep 17 00:00:00 2001 From: boy0001 Date: Fri, 20 Mar 2015 15:11:02 +1100 Subject: [PATCH] Refactor --- .../plot/api/PlotAPI.java | 2 +- .../plot/commands/Auto.java | 4 ++-- .../plot/commands/Buy.java | 8 +++---- .../plot/commands/Clear.java | 4 ++-- .../plot/commands/Cluster.java | 6 ++--- .../plot/commands/DebugClaimTest.java | 2 +- .../plot/commands/DebugExec.java | 2 +- .../plot/commands/Info.java | 4 ++-- .../plot/commands/Merge.java | 8 +++---- .../plot/commands/Purge.java | 6 ++--- .../plot/commands/SchematicCmd.java | 4 ++-- .../plot/commands/SetOwner.java | 6 ++--- .../plot/commands/Swap.java | 2 +- .../plot/commands/Unlink.java | 4 ++-- .../plot/commands/list.java | 8 +++---- .../plot/database/SQLManager.java | 8 +++---- .../plot/listeners/PlotListener.java | 2 +- .../plot/object/InfoInventory.java | 4 ++-- .../plot/object/Plot.java | 14 ++++++------ .../plot/object/PlotHandler.java | 22 +++++++++---------- .../plot/util/ExpireManager.java | 4 ++-- .../plot/util/MainUtil.java | 18 +++++++-------- .../plot/util/bukkit/BukkitChunkManager.java | 4 ++-- 23 files changed, 73 insertions(+), 73 deletions(-) diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/api/PlotAPI.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/api/PlotAPI.java index fd1f29417..f49f80a5f 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/api/PlotAPI.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/api/PlotAPI.java @@ -474,7 +474,7 @@ import com.intellectualcrafters.plot.uuid.UUIDWrapper; final ArrayList 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 { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Auto.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Auto.java index d121fec4f..ef40badde 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Auto.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Auto.java @@ -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; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Buy.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Buy.java index 91ba1901e..d9b4ff159 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Buy.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Buy.java @@ -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; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Clear.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Clear.java index f0b363208..287c0e05d 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Clear.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Clear.java @@ -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)); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Cluster.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Cluster.java index 3613a7e26..89a5ee654 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Cluster.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Cluster.java @@ -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)) { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugClaimTest.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugClaimTest.java index d7ec5885c..76b92e195 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugClaimTest.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugClaimTest.java @@ -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 { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugExec.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugExec.java index 71d46599a..83f52878f 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugExec.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugExec.java @@ -97,7 +97,7 @@ public class DebugExec extends SubCommand { for (final Entry 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; } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Info.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Info.java index fb0b65a29..9fc861387 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Info.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Info.java @@ -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 { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Merge.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Merge.java index 0b9504469..a4d3bbca3 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Merge.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Merge.java @@ -138,10 +138,10 @@ public class Merge extends SubCommand { boolean multiMerge = false; final HashSet multiUUID = new HashSet(); HashSet 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; } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Purge.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Purge.java index e6327b99b..2fd574adc 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Purge.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Purge.java @@ -120,8 +120,8 @@ public class Purge extends SubCommand { final Collection plots = PlotSquared.getPlots(worldname).values(); final Set 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 plots = PlotSquared.getPlots(worldname).values(); final Set ids = new HashSet<>(); for (final Plot plot : plots) { - if (plot.owner_ == null) { + if (plot.owner == null) { ids.add(plot.id); } } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/SchematicCmd.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/SchematicCmd.java index 913806733..0524b48e0 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/SchematicCmd.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/SchematicCmd.java @@ -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); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/SetOwner.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/SetOwner.java index 0f5c4e2bf..389331aae 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/SetOwner.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/SetOwner.java @@ -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); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Swap.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Swap.java index aa6f2b435..e64f33fa6 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Swap.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Swap.java @@ -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; } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unlink.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unlink.java index fffb7226a..936ef01a2 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unlink.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unlink.java @@ -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); } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/list.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/list.java index d41bb5fec..d563738d9 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/list.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/list.java @@ -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()); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java index 11a1835f5..9a2ae8931 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java @@ -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(); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlotListener.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlotListener.java index 909da03bd..549fed1e5 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlotListener.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlotListener.java @@ -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())); } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/InfoInventory.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/InfoInventory.java index 8c4168ae1..9cdca9426 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/InfoInventory.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/InfoInventory.java @@ -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"); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/Plot.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/Plot.java index d495d29e8..e192be634 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/Plot.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/Plot.java @@ -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 helpers, final ArrayList 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 helpers, final ArrayList trusted, final ArrayList denied, final String alias, final BlockLoc position, final Set 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; } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotHandler.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotHandler.java index 057a4a2c2..42127a5de 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotHandler.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotHandler.java @@ -11,7 +11,7 @@ import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; public class PlotHandler { public static HashSet getOwners(Plot plot) { - if (plot.owner_ == null) { + if (plot.owner == null) { return new HashSet(); } if (plot.settings.isMerged()) { @@ -19,42 +19,42 @@ public class PlotHandler { Plot top = MainUtil.getTopPlot(plot); ArrayList 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 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 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 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)) { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ExpireManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ExpireManager.java index 6852c839a..a408587d3 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ExpireManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ExpireManager.java @@ -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 remove = new HashMap<>(); final Set 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) { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java index c586f59a1..6e8fbf665 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java @@ -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 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); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitChunkManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitChunkManager.java index e9936705f..7dde64ef3 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitChunkManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitChunkManager.java @@ -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;