From d44ca23abd330c350798c84e7e09d9f1d7d7ce75 Mon Sep 17 00:00:00 2001 From: manuelgu Date: Wed, 25 May 2016 21:14:16 +0200 Subject: [PATCH 1/4] Minor change to issue template (#1132) --- .github/ISSUE_TEMPLATE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 8e1322977..c15ba3171 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -7,6 +7,6 @@ Make sure you've completed the following steps (put an X between of brackets): - [] Include `/plot debugpaste` -- [] Made sure there aren't duplicates of this report [(Use Search)](https://github.com/IntellectualSites/PlotSquared/issues) +- [] Made sure there aren't duplicates of this report [(Use Search)](https://github.com/IntellectualSites/PlotSquared/issues?utf8=%E2%9C%93&q=is%3Aissue) - [] Made sure you're using an updated version of PlotSquared - [] Made sure the bug/error isn't caused by any other plugin From cc2d99849be25cc6fe618266de909884adffffd6 Mon Sep 17 00:00:00 2001 From: MattBDev Date: Thu, 26 May 2016 09:19:38 -0400 Subject: [PATCH 2/4] Optimizations and javadoc tweaks --- .../plot/api/PlotAPI.java | 26 +++++------ .../com/intellectualcrafters/plot/PS.java | 44 ++++++++----------- .../com/plotsquared/sponge/SpongeMain.java | 9 +++- 3 files changed, 39 insertions(+), 40 deletions(-) diff --git a/Bukkit/src/main/java/com/intellectualcrafters/plot/api/PlotAPI.java b/Bukkit/src/main/java/com/intellectualcrafters/plot/api/PlotAPI.java index 892847ea2..ed38fe5b2 100644 --- a/Bukkit/src/main/java/com/intellectualcrafters/plot/api/PlotAPI.java +++ b/Bukkit/src/main/java/com/intellectualcrafters/plot/api/PlotAPI.java @@ -302,7 +302,7 @@ public class PlotAPI { /** * Get the settings for a world. * - * @param world The world + * @param world the world to retrieve settings from * * @return The {@link PlotArea} for the world or null if not in plotworld * @@ -329,8 +329,8 @@ public class PlotAPI { /** * Send a message to a player. * - * @param player Player that will receive the message - * @param caption Caption + * @param player the recipient of the message + * @param caption the message * * @see MainUtil#sendMessage(PlotPlayer, C, String...) */ @@ -339,10 +339,10 @@ public class PlotAPI { } /** - * Send a message to a player. Supports color codes. + * Send a message to a player. The message supports color codes. * - * @param player Player that will receive the message - * @param string The message + * @param player the recipient of the message + * @param string the message * * @see MainUtil#sendMessage(PlotPlayer, String) */ @@ -351,9 +351,9 @@ public class PlotAPI { } /** - * Send a message to the console. Supports color codes. + * Send a message to the console. The message supports color codes. * - * @param message Message that should be sent to the console + * @param message the message * * @see MainUtil#sendConsoleMessage(C, String...) */ @@ -364,7 +364,7 @@ public class PlotAPI { /** * Send a message to the console. * - * @param caption The caption + * @param caption the message * * @see #sendConsoleMessage(String) * @see C @@ -376,7 +376,7 @@ public class PlotAPI { /** * Register a flag for use in plots. * - * @param flag Flag that should be registered + * @param flag the flag being registered * */ public void addFlag(Flag flag) { @@ -386,7 +386,7 @@ public class PlotAPI { /** * Get a plot based on the ID. * - * @param world World in which the plot is located + * @param world the world the plot is located in * @param x The PlotID x coordinate * @param z The PlotID y coordinate * @@ -409,7 +409,7 @@ public class PlotAPI { /** * Get a plot based on the location. * - * @param location The location to retrieve the plot from + * @param location the location to check * * @return plot if found, otherwise it creates a temporary plot * @@ -425,7 +425,7 @@ public class PlotAPI { /** * Get a plot based on the player location. * - * @param player Get the current plot for the player location + * @param player the player to check * * @return plot if found, otherwise it creates a temporary plot * diff --git a/Core/src/main/java/com/intellectualcrafters/plot/PS.java b/Core/src/main/java/com/intellectualcrafters/plot/PS.java index 58e39a79e..db5bbc5ba 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/PS.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/PS.java @@ -664,9 +664,8 @@ public class PS { } } } else { - for (Entry entry : plots.entrySet()) { - Plot plot = entry.getValue(); - plot.setArea(plotArea); + for (Plot entry : plots.values()) { + entry.setArea(plotArea); } } Set clusters = this.clusters_tmp.remove(plotArea.toString()); @@ -821,8 +820,7 @@ public class PS { } map.putAll(entry.getValue()); } else { - for (Entry entry2 : entry.getValue().entrySet()) { - Plot plot = entry2.getValue(); + for (Plot plot : entry.getValue().values()) { plot.setArea(area); area.addPlot(plot); } @@ -2081,7 +2079,7 @@ public class PS { * - Translation: PlotSquared.use_THIS.yml, style.yml
*/ public void setupConfigs() { - File folder = new File(this.IMP.getDirectory() + File.separator + "config"); + File folder = new File(this.IMP.getDirectory(),"config"); if (!folder.exists() && !folder.mkdirs()) { PS.log(C.PREFIX + "&cFailed to create the /plugins/config folder. Please create it manually."); } @@ -2102,11 +2100,9 @@ public class PS { PS.log("failed to save style.yml"); } try { - this.configFile = new File(this.IMP.getDirectory() + File.separator + "config" + File.separator + "settings.yml"); - if (!this.configFile.exists()) { - if (!this.configFile.createNewFile()) { - PS.log("Could not create the settings file, please create \"settings.yml\" manually."); - } + this.configFile = new File(folder,"settings.yml"); + if (!this.configFile.exists() && !this.configFile.createNewFile()) { + PS.log("Could not create the settings file, please create \"settings.yml\" manually."); } this.config = YamlConfiguration.loadConfiguration(this.configFile); setupConfig(); @@ -2114,11 +2110,9 @@ public class PS { PS.log("Failed to save settings.yml"); } try { - this.storageFile = new File(this.IMP.getDirectory() + File.separator + "config" + File.separator + "storage.yml"); - if (!this.storageFile.exists()) { - if (!this.storageFile.createNewFile()) { - PS.log("Could not the storage settings file, please create \"storage.yml\" manually."); - } + this.storageFile = new File(folder,"storage.yml"); + if (!this.storageFile.exists() && !this.storageFile.createNewFile()) { + PS.log("Could not the storage settings file, please create \"storage.yml\" manually."); } this.storage = YamlConfiguration.loadConfiguration(this.storageFile); setupStorage(); @@ -2126,11 +2120,9 @@ public class PS { PS.log("Failed to save storage.yml"); } try { - this.commandsFile = new File(this.IMP.getDirectory() + File.separator + "config" + File.separator + "commands.yml"); - if (!this.commandsFile.exists()) { - if (!this.commandsFile.createNewFile()) { - PS.log("Could not the storage settings file, please create \"commands.yml\" manually."); - } + this.commandsFile = new File(folder,"commands.yml"); + if (!this.commandsFile.exists() && !this.commandsFile.createNewFile()) { + PS.log("Could not the storage settings file, please create \"commands.yml\" manually."); } this.commands = YamlConfiguration.loadConfiguration(this.commandsFile); setupStorage(); @@ -2245,9 +2237,9 @@ public class PS { } } if (this.plots_tmp != null) { - for (Entry> entry : this.plots_tmp.entrySet()) { - for (Entry entry2 : entry.getValue().entrySet()) { - runnable.run(entry2.getValue()); + for (HashMap entry : this.plots_tmp.values()) { + for (Plot entry2 : entry.values()) { + runnable.run(entry2); } } } @@ -2298,8 +2290,8 @@ public class PS { @Deprecated public Set getPlotWorldStrings() { HashSet set = new HashSet<>(this.plotAreaMap.size()); - for (Entry entry : this.plotAreaMap.entrySet()) { - set.add(entry.getKey()); + for (String entry : this.plotAreaMap.keySet()) { + set.add(entry); } return set; } diff --git a/Sponge/src/main/java/com/plotsquared/sponge/SpongeMain.java b/Sponge/src/main/java/com/plotsquared/sponge/SpongeMain.java index 15c2d9dae..e8392f5c8 100644 --- a/Sponge/src/main/java/com/plotsquared/sponge/SpongeMain.java +++ b/Sponge/src/main/java/com/plotsquared/sponge/SpongeMain.java @@ -56,6 +56,7 @@ import org.slf4j.Logger; import org.spongepowered.api.Game; import org.spongepowered.api.Server; import org.spongepowered.api.Sponge; +import org.spongepowered.api.config.ConfigDir; import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.event.Listener; import org.spongepowered.api.event.game.state.GameAboutToStartServerEvent; @@ -71,6 +72,7 @@ import org.spongepowered.api.world.gen.WorldGenerator; import org.spongepowered.api.world.gen.WorldGeneratorModifier; import java.io.File; +import java.nio.file.Path; import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -91,8 +93,13 @@ public class SpongeMain implements IPlotMain { @Inject private Game game; + private Server server; + @Inject + @ConfigDir(sharedRoot = false) + private Path privateConfigDir; + private GameProfileManager resolver; // @Override @@ -153,7 +160,7 @@ public class SpongeMain implements IPlotMain { @Override public File getDirectory() { - return new File("mods/PlotSquared"); + return privateConfigDir.toFile(); } @Override From 6c40ed77184896ebd7d579645397de5076c2a0f4 Mon Sep 17 00:00:00 2001 From: MattBDev Date: Fri, 27 May 2016 10:54:06 -0400 Subject: [PATCH 3/4] Fix Titles --- Core/src/main/java/com/plotsquared/listener/PlotListener.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Core/src/main/java/com/plotsquared/listener/PlotListener.java b/Core/src/main/java/com/plotsquared/listener/PlotListener.java index c5be669c2..243f55ced 100644 --- a/Core/src/main/java/com/plotsquared/listener/PlotListener.java +++ b/Core/src/main/java/com/plotsquared/listener/PlotListener.java @@ -54,7 +54,9 @@ public class PlotListener { return true; } } else { - titles = plot.getFlag(Flags.TITLES, true); + if (Settings.TITLES) { + titles = plot.getFlag(Flags.TITLES, true); + } Optional greetingFlag = plot.getFlag(Flags.GREETING); if (greetingFlag.isPresent()) { greeting = greetingFlag.get(); From 604f62dbd3d6a450d5985d1091242fdd7c257039 Mon Sep 17 00:00:00 2001 From: Matt Date: Fri, 27 May 2016 11:10:36 -0400 Subject: [PATCH 4/4] Remove dumb log statement --- .../com/intellectualcrafters/configuration/MemorySection.java | 1 - 1 file changed, 1 deletion(-) diff --git a/Core/src/main/java/com/intellectualcrafters/configuration/MemorySection.java b/Core/src/main/java/com/intellectualcrafters/configuration/MemorySection.java index d2d8b7798..eafe6bf67 100644 --- a/Core/src/main/java/com/intellectualcrafters/configuration/MemorySection.java +++ b/Core/src/main/java/com/intellectualcrafters/configuration/MemorySection.java @@ -539,7 +539,6 @@ public class MemorySection implements ConfigurationSection { List list = getList(path); if (list == null) { - PS.get().log(path + " is null"); return new ArrayList<>(0); }