From 477e698f7ecb693e836933563868ac8b68d372f3 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Wed, 13 Feb 2019 17:13:57 +0000 Subject: [PATCH] Reformat --- .../plotsquared/bukkit/chat/FancyMessage.java | 5 ++++- .../bukkit/uuid/FileUUIDHandler.java | 13 +++++------- .../bukkit/uuid/SQLUUIDHandler.java | 20 ++++++++----------- Core/build.gradle | 2 -- .../plotsquared/plot/PlotSquared.java | 10 ++++------ .../plotsquared/plot/commands/Auto.java | 4 +++- .../plotsquared/plot/commands/Claim.java | 4 +++- .../plotsquared/plot/commands/Inbox.java | 6 ++++-- .../plotsquared/plot/commands/Purge.java | 7 +++++-- .../plotsquared/plot/commands/Rate.java | 4 +++- .../plotsquared/plot/object/PlotSettings.java | 5 +---- .../plotsquared/plot/util/ChunkManager.java | 4 ++-- .../plotsquared/plot/util/CommentManager.java | 3 +-- .../plot/util/UUIDHandlerImplementation.java | 9 ++++----- 14 files changed, 47 insertions(+), 49 deletions(-) diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/FancyMessage.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/FancyMessage.java index 4411aa0a5..56635abb0 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/FancyMessage.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/chat/FancyMessage.java @@ -5,7 +5,10 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParser; import com.google.gson.stream.JsonWriter; -import org.bukkit.*; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.Statistic; import org.bukkit.Statistic.Type; import org.bukkit.command.CommandSender; import org.bukkit.configuration.serialization.ConfigurationSerializable; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/FileUUIDHandler.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/FileUUIDHandler.java index 23887799c..42a83f466 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/FileUUIDHandler.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/FileUUIDHandler.java @@ -84,8 +84,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation { if (Settings.UUID.NATIVE_UUID_PROVIDER) { HashSet all = UUIDHandler.getAllUUIDS(); PlotSquared.debug("&aFast mode UUID caching enabled!"); - File playerDataFolder = - new File(container, world + File.separator + "playerdata"); + File playerDataFolder = new File(container, world + File.separator + "playerdata"); String[] dat = playerDataFolder.list(new DatFileFilter()); boolean check = all.isEmpty(); if (dat != null) { @@ -127,8 +126,8 @@ public class FileUUIDHandler extends UUIDHandlerImplementation { } return; } else { - PlotSquared.debug("Failed to cache: " + all.size() - + " uuids - slowly processing all files"); + PlotSquared.debug( + "Failed to cache: " + all.size() + " uuids - slowly processing all files"); } } HashSet worlds1 = Sets.newHashSet(world, "world"); @@ -137,8 +136,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation { File playerDataFolder = null; for (String worldName : worlds1) { // Getting UUIDs - playerDataFolder = - new File(container, worldName + File.separator + "playerdata"); + playerDataFolder = new File(container, worldName + File.separator + "playerdata"); String[] dat = playerDataFolder.list(new DatFileFilter()); if ((dat != null) && (dat.length != 0)) { for (String current : dat) { @@ -212,8 +210,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation { } if (getUUIDMap().isEmpty()) { - for (OfflinePlotPlayer op : FileUUIDHandler.this.uuidWrapper - .getOfflinePlayers()) { + for (OfflinePlotPlayer op : FileUUIDHandler.this.uuidWrapper.getOfflinePlayers()) { long last = op.getLastPlayed(); if (last != 0) { String name = op.getName(); diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/SQLUUIDHandler.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/SQLUUIDHandler.java index 99b3e7bf6..8df215693 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/SQLUUIDHandler.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/SQLUUIDHandler.java @@ -73,14 +73,12 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation { } TaskManager.runTaskAsync(() -> { try { - HashBiMap toAdd = - HashBiMap.create(new HashMap<>()); + HashBiMap toAdd = HashBiMap.create(new HashMap<>()); try (PreparedStatement statement = getConnection() .prepareStatement("SELECT `uuid`, `username` FROM `usercache`"); ResultSet resultSet = statement.executeQuery()) { while (resultSet.next()) { - StringWrapper username = - new StringWrapper(resultSet.getString("username")); + StringWrapper username = new StringWrapper(resultSet.getString("username")); UUID uuid = UUID.fromString(resultSet.getString("uuid")); toAdd.put(new StringWrapper(username.value), uuid); } @@ -99,8 +97,7 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation { } return; } - FileUUIDHandler fileHandler = - new FileUUIDHandler(SQLUUIDHandler.this.uuidWrapper); + FileUUIDHandler fileHandler = new FileUUIDHandler(SQLUUIDHandler.this.uuidWrapper); fileHandler.startCaching(() -> { // If the file based UUID handler didn't cache it, then we can't cache offline mode // Also, trying to cache based on files again, is useless as that's what the file based uuid cacher does @@ -203,13 +200,12 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation { // Ignoring duplicates if (super.add(name, uuid)) { TaskManager.runTaskAsync(() -> { - try (PreparedStatement statement = getConnection().prepareStatement( - "REPLACE INTO usercache (`uuid`, `username`) VALUES(?, ?)")) { + try (PreparedStatement statement = getConnection() + .prepareStatement("REPLACE INTO usercache (`uuid`, `username`) VALUES(?, ?)")) { statement.setString(1, uuid.toString()); statement.setString(2, name.toString()); statement.execute(); - PlotSquared - .debug(C.PREFIX + "&cAdded '&6" + uuid + "&c' - '&6" + name + "&c'"); + PlotSquared.debug(C.PREFIX + "&cAdded '&6" + uuid + "&c' - '&6" + name + "&c'"); } catch (SQLException e) { e.printStackTrace(); } @@ -230,8 +226,8 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation { statement.setString(1, name.value); statement.setString(2, uuid.toString()); statement.execute(); - PlotSquared.debug( - C.PREFIX + "Name change for '" + uuid + "' to '" + name.value + '\''); + PlotSquared + .debug(C.PREFIX + "Name change for '" + uuid + "' to '" + name.value + '\''); } catch (SQLException e) { e.printStackTrace(); } diff --git a/Core/build.gradle b/Core/build.gradle index 14bda6198..2327ddf81 100644 --- a/Core/build.gradle +++ b/Core/build.gradle @@ -1,5 +1,3 @@ -import org.ajoberstar.grgit.Grgit - dependencies { testCompile 'junit:junit:4.12' compile 'org.yaml:snakeyaml:1.23' 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 73ad60982..44ba326c8 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 @@ -49,8 +49,7 @@ import java.util.zip.ZipInputStream; * An implementation of the core, with a static getter for easy access. */ @SuppressWarnings({"unused", "WeakerAccess"}) public class PlotSquared { - private static final Set EMPTY_SET = - Collections.unmodifiableSet(Collections.emptySet()); + private static final Set EMPTY_SET = Collections.unmodifiableSet(Collections.emptySet()); private static PlotSquared instance; // Implementation public final IPlotMain IMP; @@ -1143,9 +1142,8 @@ import java.util.zip.ZipInputStream; PlotSquared.log(C.PREFIX + "&aDetected world load for '" + world + "'"); String gen_string = worldSection.getString("generator.plugin", IMP.getPluginName()); if (type == 2) { - Set clusters = this.clusters_tmp != null ? - this.clusters_tmp.get(world) : - new HashSet<>(); + Set clusters = + this.clusters_tmp != null ? this.clusters_tmp.get(world) : new HashSet<>(); if (clusters == null) { throw new IllegalArgumentException("No cluster exists for world: " + world); } @@ -1964,7 +1962,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/Auto.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Auto.java index b205fd957..fb4eca2e9 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Auto.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Auto.java @@ -11,7 +11,9 @@ import com.github.intellectualsites.plotsquared.plot.util.*; import javax.annotation.Nullable; import java.util.Set; -@CommandDeclaration(command = "auto", permission = "plots.auto", category = CommandCategory.CLAIMING, requiredType = RequiredType.NONE, description = "Claim the nearest plot", aliases = "a", usage = "/plot auto [length,width]") +@CommandDeclaration(command = "auto", permission = "plots.auto", + category = CommandCategory.CLAIMING, requiredType = RequiredType.NONE, + description = "Claim the nearest plot", aliases = "a", usage = "/plot auto [length,width]") public class Auto extends SubCommand { @Deprecated public static PlotId getNextPlotId(PlotId id, int step) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Claim.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Claim.java index ce7ee4c26..e49155b8d 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Claim.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Claim.java @@ -10,7 +10,9 @@ import com.github.intellectualsites.plotsquared.plot.util.EconHandler; import com.github.intellectualsites.plotsquared.plot.util.Permissions; import com.github.intellectualsites.plotsquared.plot.util.TaskManager; -@CommandDeclaration(command = "claim", aliases = "c", description = "Claim the current plot you're standing on", category = CommandCategory.CLAIMING, requiredType = RequiredType.NONE, permission = "plots.claim", usage = "/plot claim") +@CommandDeclaration(command = "claim", aliases = "c", + description = "Claim the current plot you're standing on", category = CommandCategory.CLAIMING, + requiredType = RequiredType.NONE, permission = "plots.claim", usage = "/plot claim") public class Claim extends SubCommand { @Override public boolean onCommand(final PlotPlayer player, String[] args) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Inbox.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Inbox.java index 5e8a5550c..b8ffd4261 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Inbox.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Inbox.java @@ -13,8 +13,10 @@ import com.github.intellectualsites.plotsquared.plot.util.StringMan; import java.util.List; -@CommandDeclaration(command = "inbox", description = "Review the comments for a plot", usage = "/plot inbox [inbox] [delete |clear|page]", permission = "plots.inbox", category = CommandCategory.CHAT, requiredType = RequiredType.NONE) -public class Inbox extends SubCommand { +@CommandDeclaration(command = "inbox", description = "Review the comments for a plot", + usage = "/plot inbox [inbox] [delete |clear|page]", permission = "plots.inbox", + category = CommandCategory.CHAT, requiredType = RequiredType.NONE) public class Inbox + extends SubCommand { public void displayComments(PlotPlayer player, List oldComments, int page) { if (oldComments == null || oldComments.isEmpty()) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Purge.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Purge.java index 40d4bf763..a50ffbc90 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Purge.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Purge.java @@ -18,8 +18,11 @@ import java.util.HashSet; import java.util.Map.Entry; import java.util.UUID; -@CommandDeclaration(usage = "/plot purge world: area: id: owner: shared: unknown:[true|false]", command = "purge", permission = "plots.admin", description = "Purge all plots for a world", category = CommandCategory.ADMINISTRATION, requiredType = RequiredType.CONSOLE, confirmation = true) -public class Purge extends SubCommand { +@CommandDeclaration( + usage = "/plot purge world: area: id: owner: shared: unknown:[true|false]", + command = "purge", permission = "plots.admin", description = "Purge all plots for a world", + category = CommandCategory.ADMINISTRATION, requiredType = RequiredType.CONSOLE, + confirmation = true) public class Purge extends SubCommand { @Override public boolean onCommand(final PlotPlayer player, String[] args) { if (args.length == 0) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Rate.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Rate.java index 59e2b2d43..8446b62a3 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Rate.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Rate.java @@ -10,8 +10,10 @@ import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.object.*; import com.github.intellectualsites.plotsquared.plot.util.*; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; import java.util.Map.Entry; +import java.util.UUID; @CommandDeclaration(command = "rate", permission = "plots.rate", description = "Rate the plot", usage = "/plot rate [#|next|purge]", aliases = "rt", category = CommandCategory.INFO, diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotSettings.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotSettings.java index 86b41dc45..74c371d17 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotSettings.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotSettings.java @@ -27,22 +27,19 @@ public class PlotSettings { * @deprecated Raw access */ @Deprecated public String alias = ""; - - private List comments = null; - /** * The ratings for a plot. * * @deprecated Raw access */ @Deprecated public HashMap ratings; - /** * Flags. * * @deprecated Raw access */ @Deprecated public HashMap, Object> flags = new HashMap<>(); + private List comments = null; /** * Home Position. * diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ChunkManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ChunkManager.java index d27dc7597..cf2ca96ed 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ChunkManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/ChunkManager.java @@ -240,8 +240,8 @@ public abstract class ChunkManager { TaskManager.runTaskAsync(() -> { for (ChunkLoc loc : chunks) { String directory = - world + File.separator + "region" + File.separator + "r." + loc.x + "." - + loc.z + ".mca"; + world + File.separator + "region" + File.separator + "r." + loc.x + "." + loc.z + + ".mca"; File file = new File(PlotSquared.get().IMP.getWorldContainer(), directory); PlotSquared.log("&6 - Deleting file: " + file.getName() + " (max 1024 chunks)"); if (file.exists()) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/CommentManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/CommentManager.java index cc5021c57..524ea7f67 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/CommentManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/CommentManager.java @@ -31,8 +31,7 @@ public class CommentManager { if (value != null) { int num = 0; for (PlotComment comment : value) { - if (comment.timestamp > getTimestamp(player, - inbox.toString())) { + if (comment.timestamp > getTimestamp(player, inbox.toString())) { num++; } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/UUIDHandlerImplementation.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/UUIDHandlerImplementation.java index 347bc48e6..69e252474 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/UUIDHandlerImplementation.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/UUIDHandlerImplementation.java @@ -15,12 +15,11 @@ import java.util.concurrent.ConcurrentHashMap; public abstract class UUIDHandlerImplementation { - private final ConcurrentHashMap players; public final HashSet unknown = new HashSet<>(); + private final ConcurrentHashMap players; protected UUIDWrapper uuidWrapper; private boolean cached = false; - private BiMap uuidMap = - HashBiMap.create(new HashMap<>()); + private BiMap uuidMap = HashBiMap.create(new HashMap<>()); // private BiMap nameMap = uuidMap.inverse(); public UUIDHandlerImplementation(UUIDWrapper wrapper) { @@ -138,8 +137,8 @@ public abstract class UUIDHandlerImplementation { TaskManager.runTaskAsync(() -> { UUID offlineUpper = UUID.nameUUIDFromBytes( ("OfflinePlayer:" + name.value).getBytes(Charsets.UTF_8)); - if (UUIDHandlerImplementation.this.unknown.contains(offlineUpper) - && !offlineUpper.equals(uuid)) { + if (UUIDHandlerImplementation.this.unknown.contains(offlineUpper) && !offlineUpper + .equals(uuid)) { UUIDHandlerImplementation.this.unknown.remove(offlineUpper); Set plots = PlotSquared.get().getPlotsAbs(offlineUpper); if (!plots.isEmpty()) {