From d6a801d854b14dd4ffc28fd0a540d1826012978b Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Wed, 6 Feb 2019 16:42:27 +0000 Subject: [PATCH] Reformat --- .../plotsquared/plot/PlotSquared.java | 15 +++--- .../plotsquared/plot/commands/Cluster.java | 4 +- .../plotsquared/plot/commands/Database.java | 4 +- .../plotsquared/plot/database/SQLManager.java | 46 +++++++++---------- .../plotsquared/plot/flag/FlagManager.java | 5 +- .../plotsquared/plot/object/Plot.java | 2 +- .../plot/object/PlotInventory.java | 2 + .../plot/util/expiry/ExpireManager.java | 20 ++++---- 8 files changed, 52 insertions(+), 46 deletions(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotSquared.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotSquared.java index c686b21de..991cc9706 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotSquared.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotSquared.java @@ -214,8 +214,8 @@ import java.util.zip.ZipInputStream; } // Economy if (Settings.Enabled_Components.ECONOMY) { - TaskManager.runTask( - () -> EconHandler.manager = PlotSquared.this.IMP.getEconomyHandler()); + TaskManager + .runTask(() -> EconHandler.manager = PlotSquared.this.IMP.getEconomyHandler()); } /* // Check for updates @@ -250,8 +250,9 @@ import java.util.zip.ZipInputStream; continue; } if (!WorldUtil.IMP.isWorld(world) && !world.equals("*")) { - debug("&c`" + world + "` was not properly loaded - " + IMP - .getPluginName() + " will now try to load it properly: "); + debug( + "&c`" + world + "` was not properly loaded - " + IMP.getPluginName() + + " will now try to load it properly: "); debug( "&8 - &7Are you trying to delete this world? Remember to remove it from the settings.yml, bukkit.yml and multiverse worlds.yml"); debug( @@ -1873,8 +1874,8 @@ import java.util.zip.ZipInputStream; } public int getPlotCount() { - return Arrays.stream(this.plotAreaManager.getAllPlotAreas()).mapToInt(PlotArea::getPlotCount) - .sum(); + return Arrays.stream(this.plotAreaManager.getAllPlotAreas()) + .mapToInt(PlotArea::getPlotCount).sum(); } public Set getPlotAreas() { @@ -1968,7 +1969,7 @@ import java.util.zip.ZipInputStream; * * @param alias to search plots * @param worldname to filter alias to a specific world [optional] null means all worlds - * @return Set<{ @ link Plot }> empty if nothing found + * @return Set<{ @ link Plot }> empty if nothing found */ public Set getPlotsByAlias(@Nullable final String alias, @NonNull final String worldname) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Cluster.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Cluster.java index 4cb20487b..914b04c3c 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Cluster.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Cluster.java @@ -87,7 +87,7 @@ import java.util.UUID; PlotId pos1; PlotId pos2; // check pos1 / pos2 - try{ + try { pos1 = PlotId.fromString(args[2]); pos2 = PlotId.fromString(args[3]); } catch (IllegalArgumentException ignored) { @@ -215,7 +215,7 @@ import java.util.UUID; PlotId pos1; PlotId pos2; // check pos1 / pos2 - try{ + try { pos1 = PlotId.fromString(args[2]); pos2 = PlotId.fromString(args[3]); } catch (IllegalArgumentException ignored) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Database.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Database.java index 039959916..e94850121 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Database.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Database.java @@ -39,8 +39,8 @@ import java.util.Map.Entry; manager.close(); }); } catch (Exception e) { - MainUtil.sendMessage(player, - "Failed to insert plot objects, see stacktrace for info"); + MainUtil + .sendMessage(player, "Failed to insert plot objects, see stacktrace for info"); e.printStackTrace(); } }); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/SQLManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/SQLManager.java index 8629efd17..e1099076e 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/SQLManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/SQLManager.java @@ -557,20 +557,18 @@ import java.util.concurrent.atomic.AtomicInteger; @Override public void run() { createTiers(trusted, "trusted", new Runnable() { @Override public void run() { - createTiers(denied, "denied", - new Runnable() { - @Override public void run() { - try { - SQLManager.this.connection - .commit(); - } catch (SQLException e) { - e.printStackTrace(); - } - if (whenDone != null) { - whenDone.run(); - } + createTiers(denied, "denied", new Runnable() { + @Override public void run() { + try { + SQLManager.this.connection.commit(); + } catch (SQLException e) { + e.printStackTrace(); } - }); + if (whenDone != null) { + whenDone.run(); + } + } + }); } }); } @@ -2091,8 +2089,7 @@ import java.util.concurrent.atomic.AtomicInteger; try (ResultSet r = stmt.executeQuery()) { ids = new HashSet<>(); while (r.next()) { - PlotId plot_id = - new PlotId(r.getInt("plot_id_x"), r.getInt("plot_id_z")); + PlotId plot_id = new PlotId(r.getInt("plot_id_x"), r.getInt("plot_id_z")); if (plots.contains(plot_id)) { ids.add(r.getInt("id")); } @@ -2562,7 +2559,8 @@ import java.util.concurrent.atomic.AtomicInteger; } cluster = new PlotCluster(null, pos1, pos2, user, id); clusters.put(id, cluster); - Set set = newClusters.computeIfAbsent(areaid, k -> new HashSet<>()); + Set set = + newClusters.computeIfAbsent(areaid, k -> new HashSet<>()); set.add(cluster); } //Getting helpers @@ -3039,17 +3037,17 @@ import java.util.concurrent.atomic.AtomicInteger; "UPDATE `" + SQLManager.this.prefix + "cluster_invited` SET `user_uuid` = '" + now.toString() + "' WHERE `user_uuid` = '" + old.toString() + '\''); stmt.executeUpdate( - "UPDATE `" + SQLManager.this.prefix + "plot` SET `owner` = '" + now - .toString() + "' WHERE `owner` = '" + old.toString() + '\''); + "UPDATE `" + SQLManager.this.prefix + "plot` SET `owner` = '" + now.toString() + + "' WHERE `owner` = '" + old.toString() + '\''); stmt.executeUpdate( - "UPDATE `" + SQLManager.this.prefix + "plot_denied` SET `user_uuid` = '" - + now.toString() + "' WHERE `user_uuid` = '" + old.toString() + '\''); + "UPDATE `" + SQLManager.this.prefix + "plot_denied` SET `user_uuid` = '" + now + .toString() + "' WHERE `user_uuid` = '" + old.toString() + '\''); stmt.executeUpdate( - "UPDATE `" + SQLManager.this.prefix + "plot_helpers` SET `user_uuid` = '" - + now.toString() + "' WHERE `user_uuid` = '" + old.toString() + '\''); + "UPDATE `" + SQLManager.this.prefix + "plot_helpers` SET `user_uuid` = '" + now + .toString() + "' WHERE `user_uuid` = '" + old.toString() + '\''); stmt.executeUpdate( - "UPDATE `" + SQLManager.this.prefix + "plot_trusted` SET `user_uuid` = '" - + now.toString() + "' WHERE `user_uuid` = '" + old.toString() + '\''); + "UPDATE `" + SQLManager.this.prefix + "plot_trusted` SET `user_uuid` = '" + now + .toString() + "' WHERE `user_uuid` = '" + old.toString() + '\''); } catch (SQLException e) { e.printStackTrace(); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/FlagManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/FlagManager.java index b35d96a43..6dc4aa2ff 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/FlagManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/FlagManager.java @@ -2,7 +2,10 @@ package com.github.intellectualsites.plotsquared.plot.flag; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; -import com.github.intellectualsites.plotsquared.plot.object.*; +import com.github.intellectualsites.plotsquared.plot.object.Plot; +import com.github.intellectualsites.plotsquared.plot.object.PlotArea; +import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; +import com.github.intellectualsites.plotsquared.plot.object.PlotSettings; import com.github.intellectualsites.plotsquared.plot.util.EventUtil; import com.github.intellectualsites.plotsquared.plot.util.Permissions; import com.google.common.collect.ImmutableSet; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Plot.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Plot.java index 69d0e63ab..44b731ec5 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Plot.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Plot.java @@ -1523,9 +1523,9 @@ public class Plot { } //TODO Better documentation needed. + /** * Return the bottom location for the plot. - * */ public Location getBottomAbs() { Location loc = this.area.getPlotManager().getPlotBottomLocAbs(this.area, this.id); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotInventory.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotInventory.java index 5280d6459..4598a2fff 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotInventory.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotInventory.java @@ -12,12 +12,14 @@ public class PlotInventory { private final PlotItemStack[] items; private String title; private boolean open = false; + public PlotInventory(PlotPlayer player) { this.size = 4; this.title = null; this.player = player; this.items = InventoryUtil.manager.getItems(player); } + public PlotInventory(PlotPlayer player, int size, String name) { this.size = size; this.title = name == null ? "" : name; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/expiry/ExpireManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/expiry/ExpireManager.java index 4614cfe25..a4f64c2a2 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/expiry/ExpireManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/expiry/ExpireManager.java @@ -101,19 +101,19 @@ public class ExpireManager { pp.setMeta("ignoreExpireTask", true); pp.teleport(current.getCenter()); pp.deleteMeta("ignoreExpireTask"); - PlotMessage msg = new PlotMessage().text( - num + " " + (num > 1 ? "plots are" : "plot is") + " expired: ") + PlotMessage msg = new PlotMessage() + .text(num + " " + (num > 1 ? "plots are" : "plot is") + " expired: ") .color("$1").text(current.toString()).color("$2") .suggest("/plot list expired").tooltip("/plot list expired") //.text("\n - ").color("$3").text("Delete all (/plot delete expired)").color("$2").command("/plot delete expired") .text("\n - ").color("$3").text("Delete this (/plot delete)") .color("$2").suggest("/plot delete").tooltip("/plot delete") .text("\n - ").color("$3").text("Remind later (/plot set keep 1d)") - .color("$2").suggest("/plot set keep 1d") - .tooltip("/plot set keep 1d").text("\n - ").color("$3") - .text("Keep this (/plot set keep true)").color("$2") - .suggest("/plot set keep true").tooltip("/plot set keep true") - .text("\n - ").color("$3").text("Don't show me this").color("$2") + .color("$2").suggest("/plot set keep 1d").tooltip("/plot set keep 1d") + .text("\n - ").color("$3").text("Keep this (/plot set keep true)") + .color("$2").suggest("/plot set keep true") + .tooltip("/plot set keep true").text("\n - ").color("$3") + .text("Don't show me this").color("$2") .suggest("/plot toggle clear-confirmation") .tooltip("/plot toggle clear-confirmation"); msg.send(pp); @@ -271,7 +271,8 @@ public class ExpireManager { } for (ExpiryTask expiryTask : expired) { if (!expiryTask.needsAnalysis()) { - expiredTask.run(newPlot, () -> TaskManager.IMP.taskLaterAsync(task, 1), expiryTask.requiresConfirmation()); + expiredTask.run(newPlot, () -> TaskManager.IMP.taskLaterAsync(task, 1), + expiryTask.requiresConfirmation()); return; } } @@ -281,7 +282,8 @@ public class ExpireManager { passesComplexity(changed, expired, new RunnableVal() { @Override public void run(Boolean confirmation) { expiredTask.run(newPlot, - () -> TaskManager.IMP.taskLaterAsync(task, 1), confirmation); + () -> TaskManager.IMP.taskLaterAsync(task, 1), + confirmation); } }, () -> { FlagManager