From 482f4d6815c2ab0d45d8ac3504abc0e1b6de4ea8 Mon Sep 17 00:00:00 2001 From: MattBDev Date: Fri, 10 Jun 2016 13:00:34 -0400 Subject: [PATCH] Modify Setting and Storage class names. --- .../com/plotsquared/bukkit/BukkitMain.java | 21 +- .../plotme/ClassicPlotMeConnector.java | 2 +- .../database/plotme/LikePlotMeConverter.java | 4 +- .../database/plotme/PlotMeConnector_017.java | 2 +- .../bukkit/listeners/ChunkListener.java | 26 +- .../bukkit/listeners/PlayerEvents.java | 14 +- .../com/intellectualcrafters/plot/PS.java | 65 ++-- .../plot/commands/Auto.java | 6 +- .../plot/commands/Claim.java | 2 +- .../plot/commands/Clear.java | 2 +- .../plot/commands/Cluster.java | 8 +- .../plot/commands/Continue.java | 2 +- .../plot/commands/DebugExec.java | 16 +- .../plot/commands/Done.java | 2 +- .../plot/commands/Download.java | 2 +- .../plot/commands/Load.java | 4 +- .../plot/commands/Merge.java | 2 +- .../plot/commands/Owner.java | 2 +- .../plot/commands/Rate.java | 16 +- .../plot/commands/Save.java | 2 +- .../plot/commands/SchematicCmd.java | 2 +- .../plot/commands/Template.java | 6 +- .../plot/config/Config.java | 45 +-- .../plot/config/Settings.java | 278 +++++++++--------- .../plot/config/Storage.java | 38 +-- .../plot/database/AbstractDB.java | 96 +++--- .../plot/database/SQLManager.java | 21 +- .../plot/generator/HybridPlotManager.java | 2 +- .../intellectualcrafters/plot/object/BO3.java | 2 +- .../plot/object/Plot.java | 10 +- .../plot/object/PlotArea.java | 2 +- .../plot/object/PlotBlock.java | 9 +- .../plot/object/PlotManager.java | 4 +- .../plot/object/PlotPlayer.java | 14 +- .../plot/object/Rating.java | 12 +- .../plot/util/BO3Handler.java | 4 +- .../plot/util/CommentManager.java | 2 +- .../plot/util/EventUtil.java | 6 +- .../plot/util/HttpUtil.java | 2 +- .../plot/util/MainUtil.java | 25 +- .../plot/util/Permissions.java | 4 +- .../plot/util/SchematicHandler.java | 8 +- .../plot/util/expiry/ExpiryTask.java | 5 +- .../plot/util/expiry/PlotAnalysis.java | 8 +- .../plotsquared/listener/PlotListener.java | 2 +- .../listener/ProcessedWEExtent.java | 5 +- .../com/plotsquared/listener/WEManager.java | 3 +- .../plotsquared/listener/WESubscriber.java | 3 +- .../com/plotsquared/sponge/SpongeMain.java | 15 +- .../sponge/listener/MainListener.java | 2 +- 50 files changed, 432 insertions(+), 403 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java index 6fb9ac9c9..10bdfe5dc 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java @@ -71,12 +71,6 @@ import com.plotsquared.bukkit.uuid.LowerOfflineUUIDWrapper; import com.plotsquared.bukkit.uuid.OfflineUUIDWrapper; import com.plotsquared.bukkit.uuid.SQLUUIDHandler; import com.sk89q.worldedit.WorldEdit; -import java.io.File; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; -import java.util.UUID; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Chunk; @@ -93,6 +87,13 @@ import org.bukkit.metadata.MetadataValue; import org.bukkit.plugin.Plugin; import org.bukkit.plugin.java.JavaPlugin; +import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import java.util.UUID; + public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain { public static WorldEdit worldEdit; @@ -135,7 +136,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain public void log(String message) { try { message = C.color(message); - if (!Settings.CHAT.CONSOLE_COLOR) { + if (!Settings.Chat.CONSOLE_COLOR) { message = ChatColor.stripColor(message); } this.getServer().getConsoleSender().sendMessage(message); @@ -241,7 +242,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain case MINECART_MOB_SPAWNER: case MINECART_TNT: case BOAT: { - if (!Settings.ENABLED_COMPONENTS.KILL_ROAD_VEHICLES) { + if (!Settings.Enabled_Components.KILL_ROAD_VEHICLES) { continue; } com.intellectualcrafters.plot.object.Location location = BukkitUtil.getLocation(entity.getLocation()); @@ -308,7 +309,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain case ZOMBIE: case SHULKER: default: - if (!Settings.ENABLED_COMPONENTS.KILL_ROAD_MOBS) { + if (!Settings.Enabled_Components.KILL_ROAD_MOBS) { continue; } Location location = entity.getLocation(); @@ -660,7 +661,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain @Override public ChatManager initChatManager() { - if (Settings.CHAT.INTERACTIVE) { + if (Settings.Chat.INTERACTIVE) { return new BukkitChatManager(); } else { return new BukkitPlainChatManager(); diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/database/plotme/ClassicPlotMeConnector.java b/Bukkit/src/main/java/com/plotsquared/bukkit/database/plotme/ClassicPlotMeConnector.java index f124aeb57..92db4f3cf 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/database/plotme/ClassicPlotMeConnector.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/database/plotme/ClassicPlotMeConnector.java @@ -64,7 +64,7 @@ public class ClassicPlotMeConnector extends APlotMeConnector { } else if (checkUUID2) { column = "ownerId"; } - boolean merge = !"plotme".equalsIgnoreCase(this.plugin) && Settings.ENABLED_COMPONENTS.PLOTME_CONVERTER; + boolean merge = !"plotme".equalsIgnoreCase(this.plugin) && Settings.Enabled_Components.PLOTME_CONVERTER; int missing = 0; while (resultSet.next()) { PlotId id = new PlotId(resultSet.getInt("idX"), resultSet.getInt("idZ")); diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/database/plotme/LikePlotMeConverter.java b/Bukkit/src/main/java/com/plotsquared/bukkit/database/plotme/LikePlotMeConverter.java index 97a328809..672b0644b 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/database/plotme/LikePlotMeConverter.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/database/plotme/LikePlotMeConverter.java @@ -144,7 +144,7 @@ public class LikePlotMeConverter { sendMessage(" - " + dbPrefix + "Plots"); final Set worlds = getPlotMeWorlds(plotConfig); - if (Settings.ENABLED_COMPONENTS.PLOTME_CONVERTER) { + if (Settings.Enabled_Components.PLOTME_CONVERTER) { sendMessage("Updating bukkit.yml"); updateWorldYml("bukkit.yml"); updateWorldYml("plugins/Multiverse-Core/worlds.yml"); @@ -166,7 +166,7 @@ public class LikePlotMeConverter { for (Entry> entry : plots.entrySet()) { plotCount += entry.getValue().size(); } - if (!Settings.ENABLED_COMPONENTS.PLOTME_CONVERTER) { + if (!Settings.Enabled_Components.PLOTME_CONVERTER) { return false; } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/database/plotme/PlotMeConnector_017.java b/Bukkit/src/main/java/com/plotsquared/bukkit/database/plotme/PlotMeConnector_017.java index bd4dbaf77..124e55594 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/database/plotme/PlotMeConnector_017.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/database/plotme/PlotMeConnector_017.java @@ -67,7 +67,7 @@ public class PlotMeConnector_017 extends APlotMeConnector { return null; } boolean checkUUID = DBFunc.hasColumn(resultSet, "ownerID"); - boolean merge = !this.plugin.equals("plotme") && Settings.ENABLED_COMPONENTS.PLOTME_CONVERTER; + boolean merge = !this.plugin.equals("plotme") && Settings.Enabled_Components.PLOTME_CONVERTER; while (resultSet.next()) { int key = resultSet.getInt("plot_id"); PlotId id = new PlotId(resultSet.getInt("plotX"), resultSet.getInt("plotZ")); diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/ChunkListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/ChunkListener.java index 91ce77738..f6355eeec 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/ChunkListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/ChunkListener.java @@ -1,5 +1,7 @@ package com.plotsquared.bukkit.listeners; +import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass; + import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.object.Location; @@ -8,8 +10,6 @@ import com.intellectualcrafters.plot.util.ReflectionUtils.RefClass; import com.intellectualcrafters.plot.util.ReflectionUtils.RefField; import com.intellectualcrafters.plot.util.ReflectionUtils.RefMethod; import com.intellectualcrafters.plot.util.TaskManager; -import java.lang.reflect.Method; -import java.util.HashSet; import org.bukkit.Bukkit; import org.bukkit.Chunk; import org.bukkit.Material; @@ -28,8 +28,8 @@ import org.bukkit.event.entity.ItemSpawnEvent; import org.bukkit.event.world.ChunkLoadEvent; import org.bukkit.event.world.ChunkUnloadEvent; - -import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass; +import java.lang.reflect.Method; +import java.util.HashSet; public class ChunkListener implements Listener { @@ -39,7 +39,7 @@ public class ChunkListener implements Listener { public ChunkListener() { - if (Settings.CHUNK_PROCESSOR.AUTO_TRIM) { + if (Settings.Chunk_Processor.AUTO_TRIM) { try { RefClass classChunk = getRefClass("{nms}.Chunk"); RefClass classCraftChunk = getRefClass("{cb}.CraftChunk"); @@ -47,10 +47,10 @@ public class ChunkListener implements Listener { this.methodGetHandleChunk = classCraftChunk.getMethod("getHandle"); } catch (Throwable ignored) { PS.debug("PlotSquared/Server not compatible for chunk processor trim/gc"); - Settings.CHUNK_PROCESSOR.AUTO_TRIM = false; + Settings.Chunk_Processor.AUTO_TRIM = false; } } - if (!Settings.CHUNK_PROCESSOR.AUTO_TRIM) { + if (!Settings.Chunk_Processor.AUTO_TRIM) { return; } for (World world : Bukkit.getWorlds()) { @@ -139,7 +139,7 @@ public class ChunkListener implements Listener { @EventHandler public void onChunkUnload(ChunkUnloadEvent event) { - if (Settings.CHUNK_PROCESSOR.AUTO_TRIM) { + if (Settings.Chunk_Processor.AUTO_TRIM) { Chunk chunk = event.getChunk(); String world = chunk.getWorld().getName(); if (PS.get().hasPlotArea(world)) { @@ -171,7 +171,7 @@ public class ChunkListener implements Listener { return; } Entity[] entities = chunk.getEntities(); - if (entities.length > Settings.CHUNK_PROCESSOR.MAX_ENTITIES) { + if (entities.length > Settings.Chunk_Processor.MAX_ENTITIES) { event.getEntity().remove(); event.setCancelled(true); this.lastChunk = chunk; @@ -182,7 +182,7 @@ public class ChunkListener implements Listener { @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onBlockPhysics(BlockPhysicsEvent event) { - if (Settings.CHUNK_PROCESSOR.DISABLE_PHYSICS) { + if (Settings.Chunk_Processor.DISABLE_PHYSICS) { event.setCancelled(true); } } @@ -200,7 +200,7 @@ public class ChunkListener implements Listener { return; } Entity[] entities = chunk.getEntities(); - if (entities.length > Settings.CHUNK_PROCESSOR.MAX_ENTITIES) { + if (entities.length > Settings.Chunk_Processor.MAX_ENTITIES) { event.getEntity().remove(); event.setCancelled(true); this.lastChunk = chunk; @@ -254,7 +254,7 @@ public class ChunkListener implements Listener { } Entity[] entities = chunk.getEntities(); BlockState[] tiles = chunk.getTileEntities(); - if (entities.length > Settings.CHUNK_PROCESSOR.MAX_ENTITIES) { + if (entities.length > Settings.Chunk_Processor.MAX_ENTITIES) { for (Entity ent : entities) { if (!(ent instanceof Player)) { ent.remove(); @@ -262,7 +262,7 @@ public class ChunkListener implements Listener { } PS.debug("[PlotSquared] &a detected unsafe chunk and processed: " + (chunk.getX() << 4) + "," + (chunk.getX() << 4)); } - if (tiles.length > Settings.CHUNK_PROCESSOR.MAX_TILES) { + if (tiles.length > Settings.Chunk_Processor.MAX_TILES) { if (unload) { PS.debug("[PlotSquared] &c detected unsafe chunk: " + (chunk.getX() << 4) + "," + (chunk.getX() << 4)); cleanChunk(chunk); diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java index ffc47dc67..b2730a828 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java @@ -200,7 +200,7 @@ public class PlayerEvents extends PlotListener implements Listener { event.setNewCurrent(0); return; } - if (Settings.REDSTONE.DISABLE_OFFLINE) { + if (Settings.Redstone.DISABLE_OFFLINE) { if (UUIDHandler.getPlayer(plot.owner) == null) { boolean disable = true; for (UUID trusted : plot.getTrusted()) { @@ -215,7 +215,7 @@ public class PlayerEvents extends PlotListener implements Listener { } } } - if (Settings.REDSTONE.DISABLE_UNOCCUPIED) { + if (Settings.Redstone.DISABLE_UNOCCUPIED) { for (Entry entry : UUIDHandler.getPlayers().entrySet()) { if (plot.equals(entry.getValue().getCurrentPlot())) { return; @@ -350,7 +350,7 @@ public class PlayerEvents extends PlotListener implements Listener { if (cmd == null) { if (split[0].equals("plotme") || split[0].equals("ap")) { Player player = event.getPlayer(); - if (Settings.PLOTME.ALIAS) { + if (Settings.PlotMe.ALIAS) { player.performCommand("plots " + StringMan.join(Arrays.copyOfRange(split, 1, split.length), " ")); } else { MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NOT_USING_PLOTME); @@ -647,7 +647,7 @@ public class PlayerEvents extends PlotListener implements Listener { } MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_DESTROY_OTHER); event.setCancelled(true); - } else if (Settings.DONE.RESTRICT_BUILDING && plot.getFlags().containsKey(Flags.DONE)) { + } else if (Settings.Done.RESTRICT_BUILDING && plot.getFlags().containsKey(Flags.DONE)) { if (!Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_BUILD_OTHER)) { MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER); event.setCancelled(true); @@ -741,7 +741,7 @@ public class PlayerEvents extends PlotListener implements Listener { } } } - if (Settings.ENABLED_COMPONENTS.PERMISSION_CACHE) { + if (Settings.Enabled_Components.PERMISSION_CACHE) { pp.deleteMeta("perm"); } } @@ -1883,7 +1883,7 @@ public class PlayerEvents extends PlotListener implements Listener { entity.remove(); return; } - if (Settings.ENABLED_COMPONENTS.KILL_ROAD_VEHICLES) { + if (Settings.Enabled_Components.KILL_ROAD_VEHICLES) { entity.setMetadata("plot", new FixedMetadataValue((Plugin) PS.get().IMP, plot)); } } @@ -2302,7 +2302,7 @@ public class PlayerEvents extends PlotListener implements Listener { event.setCancelled(true); return; } - } else if (Settings.DONE.RESTRICT_BUILDING && plot.getFlags().containsKey(Flags.DONE)) { + } else if (Settings.Done.RESTRICT_BUILDING && plot.getFlags().containsKey(Flags.DONE)) { if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_OTHER)) { MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER); event.setCancelled(true); diff --git a/Core/src/main/java/com/intellectualcrafters/plot/PS.java b/Core/src/main/java/com/intellectualcrafters/plot/PS.java index e14485896..cac83d664 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/PS.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/PS.java @@ -10,9 +10,7 @@ import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.config.Storage; import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.database.Database; -import com.intellectualcrafters.plot.database.MySQL; import com.intellectualcrafters.plot.database.SQLManager; -import com.intellectualcrafters.plot.database.SQLite; import com.intellectualcrafters.plot.generator.GeneratorWrapper; import com.intellectualcrafters.plot.generator.HybridPlotWorld; import com.intellectualcrafters.plot.generator.HybridUtils; @@ -52,6 +50,7 @@ import com.intellectualcrafters.plot.util.expiry.ExpireManager; import com.intellectualcrafters.plot.util.expiry.ExpiryTask; import com.plotsquared.listener.WESubscriber; import com.sk89q.worldedit.WorldEdit; + import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; @@ -156,21 +155,21 @@ public class PS { } this.TASK = this.IMP.getTaskManager(); setupConfigs(); - this.translationFile = MainUtil.getFile(this.IMP.getDirectory(), Settings.PATHS.TRANSLATIONS + File.separator + "PlotSquared.use_THIS.yml"); + this.translationFile = MainUtil.getFile(this.IMP.getDirectory(), Settings.Paths.TRANSLATIONS + File.separator + "PlotSquared.use_THIS.yml"); C.load(this.translationFile); // Database - if (Settings.ENABLED_COMPONENTS.DATABASE) { + if (Settings.Enabled_Components.DATABASE) { setupDatabase(); } // Comments CommentManager.registerDefaultInboxes(); // Kill entities - if (Settings.ENABLED_COMPONENTS.KILL_ROAD_MOBS || Settings.ENABLED_COMPONENTS.KILL_ROAD_VEHICLES) { + if (Settings.Enabled_Components.KILL_ROAD_MOBS || Settings.Enabled_Components.KILL_ROAD_VEHICLES) { this.IMP.runEntityTask(); } // WorldEdit - if (Settings.ENABLED_COMPONENTS.WORLDEDIT_RESTRICTIONS) { + if (Settings.Enabled_Components.WORLDEDIT_RESTRICTIONS) { try { if (this.IMP.initWorldEdit()) { this.worldedit = WorldEdit.getInstance(); @@ -183,10 +182,10 @@ public class PS { } } // Commands - if (Settings.ENABLED_COMPONENTS.COMMANDS) { + if (Settings.Enabled_Components.COMMANDS) { this.IMP.registerCommands(); } - if (Settings.ENABLED_COMPONENTS.EVENTS) { + if (Settings.Enabled_Components.EVENTS) { this.IMP.registerPlayerEvents(); this.IMP.registerInventoryEvents(); this.IMP.registerPlotPlusEvents(); @@ -194,17 +193,17 @@ public class PS { } // Required this.IMP.registerWorldEvents(); - if (Settings.ENABLED_COMPONENTS.METRICS) { + if (Settings.Enabled_Components.METRICS) { this.IMP.startMetrics(); } else { PS.log(C.CONSOLE_PLEASE_ENABLE_METRICS); } - if (Settings.ENABLED_COMPONENTS.CHUNK_PROCESSOR) { + if (Settings.Enabled_Components.CHUNK_PROCESSOR) { this.IMP.registerChunkProcessor(); } // create UUIDWrapper UUIDHandler.implementation = this.IMP.initUUIDHandler(); - if (Settings.ENABLED_COMPONENTS.UUID_CACHE) { + if (Settings.Enabled_Components.UUID_CACHE) { startUuidCatching(); } else { // Start these separately @@ -233,7 +232,7 @@ public class PS { // Chat ChatManager.manager = this.IMP.initChatManager(); // Economy - if (Settings.ENABLED_COMPONENTS.ECONOMY) { + if (Settings.Enabled_Components.ECONOMY) { TaskManager.runTask(new Runnable() { @Override public void run() { @@ -243,7 +242,7 @@ public class PS { } // Check for updates - if (Settings.ENABLED_COMPONENTS.UPDATER) { + if (Settings.Enabled_Components.UPDATER) { TaskManager.runTaskAsync(new Runnable() { @Override public void run() { @@ -293,13 +292,13 @@ public class PS { } // Copy files - copyFile("automerge.js", Settings.PATHS.SCRIPTS); - copyFile("town.template", Settings.PATHS.TEMPLATES); - copyFile("skyblock.template", Settings.PATHS.TEMPLATES); - copyFile("german.yml", Settings.PATHS.TRANSLATIONS); - copyFile("s_chinese_unescaped.yml", Settings.PATHS.TRANSLATIONS); - copyFile("s_chinese.yml", Settings.PATHS.TRANSLATIONS); - copyFile("italian.yml", Settings.PATHS.TRANSLATIONS); + copyFile("automerge.js", Settings.Paths.SCRIPTS); + copyFile("town.template", Settings.Paths.TEMPLATES); + copyFile("skyblock.template", Settings.Paths.TEMPLATES); + copyFile("german.yml", Settings.Paths.TRANSLATIONS); + copyFile("s_chinese_unescaped.yml", Settings.Paths.TRANSLATIONS); + copyFile("s_chinese.yml", Settings.Paths.TRANSLATIONS); + copyFile("italian.yml", Settings.Paths.TRANSLATIONS); showDebug(); } catch (Throwable e) { e.printStackTrace(); @@ -384,10 +383,10 @@ public class PS { } private void startExpiryTasks() { - if (Settings.ENABLED_COMPONENTS.PLOT_EXPIRY) { + if (Settings.Enabled_Components.PLOT_EXPIRY) { ExpireManager.IMP = new ExpireManager(); ExpireManager.IMP.runAutomatedTask(); - for (Settings.AUTO_CLEAR settings : Settings.AUTO_CLEAR.getInstances()) { + for (Settings.Auto_Clear settings : Settings.AUTO_CLEAR.getInstances()) { ExpiryTask task = new ExpiryTask(settings); ExpireManager.IMP.addTask(task); } @@ -395,13 +394,13 @@ public class PS { } private void startPlotMeConversion() { - if (Settings.ENABLED_COMPONENTS.PLOTME_CONVERTER || Settings.PLOTME.CACHE_UUDS) { + if (Settings.Enabled_Components.PLOTME_CONVERTER || Settings.PlotMe.CACHE_UUDS) { TaskManager.runTaskLater(new Runnable() { @Override public void run() { if (PS.this.IMP.initPlotMeConverter()) { PS.log("&c=== IMPORTANT ==="); - PS.log("&cTHIS MESSAGE MAY BE EXTREMELY HELPFUL IF YOU HAVE TROUBLE CONVERTING PLOTME!"); + PS.log("&cTHIS MESSAGE MAY BE EXTREMELY HELPFUL IF YOU HAVE TROUBLE CONVERTING PlotMe!"); PS.log("&c - Make sure 'UUID.read-from-disk' is disabled (false)!"); PS.log("&c - Sometimes the database can be locked, deleting PlotMe.jar beforehand will fix the issue!"); PS.log("&c - After the conversion is finished, please set 'plotme-convert.enabled' to false in the " @@ -1816,11 +1815,11 @@ public class PS { public void setupDatabase() { try { if (DBFunc.dbManager == null) { - if (Storage.MYSQL.USE) { - this.database = new MySQL(Storage.MYSQL.HOST, Storage.MYSQL.PORT, Storage.MYSQL.DATABASE, Storage.MYSQL.USER, Storage.MYSQL.PASSWORD); - } else if (Storage.SQLITE.USE) { - File file = MainUtil.getFile(IMP.getDirectory(), Storage.SQLITE.DB + ".db"); - this.database = new SQLite(file); + if (Storage.MySQL.USE) { + this.database = new com.intellectualcrafters.plot.database.MySQL(Storage.MySQL.HOST, Storage.MySQL.PORT, Storage.MySQL.DATABASE, Storage.MySQL.USER, Storage.MySQL.PASSWORD); + } else if (Storage.SQLite.USE) { + File file = MainUtil.getFile(IMP.getDirectory(), Storage.SQLite.DB + ".db"); + this.database = new com.intellectualcrafters.plot.database.SQLite(file); } else { PS.log(C.PREFIX + "&cNo storage type is set!"); this.IMP.disable(); @@ -1832,9 +1831,9 @@ public class PS { this.clusters_tmp = DBFunc.getClusters(); } catch (ClassNotFoundException | SQLException e) { PS.log(C.PREFIX + "&cFailed to open DATABASE connection. The plugin will disable itself."); - if (Storage.MYSQL.USE) { + if (Storage.MySQL.USE) { PS.log("$4MYSQL"); - } else if (Storage.SQLITE.USE) { + } else if (Storage.SQLite.USE) { PS.log("$4SQLITE"); } PS.log("&d==== Here is an ugly stacktrace, if you are interested in those things ==="); @@ -1906,7 +1905,7 @@ public class PS { PS.log("Failed to save settings.yml"); } try { - this.styleFile = MainUtil.getFile(IMP.getDirectory(), Settings.PATHS.TRANSLATIONS +File.separator + "style.yml" ); + this.styleFile = MainUtil.getFile(IMP.getDirectory(), Settings.Paths.TRANSLATIONS +File.separator + "style.yml" ); if (!this.styleFile.exists()) { if (!this.styleFile.getParentFile().exists()) { this.styleFile.getParentFile().mkdirs(); @@ -1963,7 +1962,7 @@ public class PS { */ private void showDebug() { if (Settings.DEBUG) { - Map components = Settings.getFields(Settings.ENABLED_COMPONENTS.class); + Map components = Settings.getFields(Settings.Enabled_Components.class); for (Entry component : components.entrySet()) { PS.log(C.PREFIX + String.format("&cKey: &6%s&c, Value: &6%s", component.getKey(), component.getValue())); } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Auto.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Auto.java index 48069767f..4cdb09563 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Auto.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Auto.java @@ -86,11 +86,11 @@ public class Auto extends SubCommand { // return false; } } - if (size_x * size_z > Settings.CLAIM.MAX_AUTO_AREA) { - MainUtil.sendMessage(player, C.CANT_CLAIM_MORE_PLOTS_NUM, Settings.CLAIM.MAX_AUTO_AREA + ""); + if (size_x * size_z > Settings.Claim.MAX_AUTO_AREA) { + MainUtil.sendMessage(player, C.CANT_CLAIM_MORE_PLOTS_NUM, Settings.Claim.MAX_AUTO_AREA + ""); return false; } - int currentPlots = Settings.LIMIT.GLOBAL ? player.getPlotCount() : player.getPlotCount(plotarea.worldname); + int currentPlots = Settings.Limit.GLOBAL ? player.getPlotCount() : player.getPlotCount(plotarea.worldname); int diff = currentPlots - player.getAllowedPlots(); if (diff + size_x * size_z > 0) { if (diff < 0) { diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Claim.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Claim.java index 4a0000ef4..ccb3e5437 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Claim.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Claim.java @@ -30,7 +30,7 @@ public class Claim extends SubCommand { if (plot == null) { return sendMessage(player, C.NOT_IN_PLOT); } - int currentPlots = Settings.LIMIT.GLOBAL ? player.getPlotCount() : player.getPlotCount(loc.getWorld()); + int currentPlots = Settings.Limit.GLOBAL ? player.getPlotCount() : player.getPlotCount(loc.getWorld()); int grants = 0; if (currentPlots >= player.getAllowedPlots()) { if (player.hasPersistentMeta("grantedPlots")) { diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Clear.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Clear.java index 06c6e74b2..925438343 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Clear.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Clear.java @@ -36,7 +36,7 @@ public class Clear extends Command { final Plot plot = check(player.getCurrentPlot(), C.NOT_IN_PLOT); checkTrue(plot.isOwner(player.getUUID()) || Permissions.hasPermission(player, "plots.admin.command.clear"), C.NO_PLOT_PERMS); checkTrue(plot.getRunning() == 0, C.WAIT_FOR_TIMER); - checkTrue((!Flags.DONE.isSet(plot) || Permissions.hasPermission(player, "plots.continue")) && (!Settings.DONE.COUNTS_TOWARDS_LIMIT || player.getAllowedPlots() >= player.getPlotCount() + plot.getConnectedPlots().size()), C.DONE_ALREADY_DONE); + checkTrue((!Flags.DONE.isSet(plot) || Permissions.hasPermission(player, "plots.continue")) && (!Settings.Done.COUNTS_TOWARDS_LIMIT || player.getAllowedPlots() >= player.getPlotCount() + plot.getConnectedPlots().size()), C.DONE_ALREADY_DONE); confirm.run(this, new Runnable() { @Override public void run() { diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Cluster.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Cluster.java index 29a781ccf..b667d9f6e 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Cluster.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Cluster.java @@ -127,12 +127,12 @@ public class Cluster extends SubCommand { // Check allowed cluster size cluster = new PlotCluster(area, pos1, pos2, player.getUUID()); int current; - if (Settings.LIMIT.GLOBAL) { + if (Settings.Limit.GLOBAL) { current = player.getPlayerClusterCount(); } else { current = player.getPlayerClusterCount(player.getLocation().getWorld()); } - int allowed = Permissions.hasPermissionRange(player, "plots.cluster", Settings.LIMIT.MAX_PLOTS); + int allowed = Permissions.hasPermissionRange(player, "plots.cluster", Settings.Limit.MAX_PLOTS); if (current + cluster.getArea() > allowed) { MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster." + (current + cluster.getArea())); return false; @@ -257,13 +257,13 @@ public class Cluster extends SubCommand { } // Check allowed cluster size int current; - if (Settings.LIMIT.GLOBAL) { + if (Settings.Limit.GLOBAL) { current = player.getPlayerClusterCount(); } else { current = player.getPlayerClusterCount(player.getLocation().getWorld()); } current -= cluster.getArea() + (1 + pos2.x - pos1.x) * (1 + pos2.y - pos1.y); - int allowed = Permissions.hasPermissionRange(player, "plots.cluster", Settings.LIMIT.MAX_PLOTS); + int allowed = Permissions.hasPermissionRange(player, "plots.cluster", Settings.Limit.MAX_PLOTS); if (current + cluster.getArea() > allowed) { MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster." + (current + cluster.getArea())); return false; diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Continue.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Continue.java index 4334b1d28..995e72759 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Continue.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Continue.java @@ -32,7 +32,7 @@ public class Continue extends SubCommand { return false; } int size = plot.getConnectedPlots().size(); - if (Settings.DONE.COUNTS_TOWARDS_LIMIT && (player.getAllowedPlots() < player.getPlotCount() + size)) { + if (Settings.Done.COUNTS_TOWARDS_LIMIT && (player.getAllowedPlots() < player.getPlotCount() + size)) { MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.admin.command.continue"); return false; } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/DebugExec.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/DebugExec.java index be2cbaf84..9d1346b6d 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/DebugExec.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/DebugExec.java @@ -12,7 +12,6 @@ import com.intellectualcrafters.plot.object.ConsolePlayer; import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.OfflinePlotPlayer; import com.intellectualcrafters.plot.object.Plot; -import com.intellectualcrafters.plot.util.expiry.PlotAnalysis; import com.intellectualcrafters.plot.object.PlotArea; import com.intellectualcrafters.plot.object.PlotBlock; import com.intellectualcrafters.plot.object.PlotId; @@ -25,7 +24,6 @@ import com.intellectualcrafters.plot.util.AbstractTitle; import com.intellectualcrafters.plot.util.ChunkManager; import com.intellectualcrafters.plot.util.EconHandler; import com.intellectualcrafters.plot.util.EventUtil; -import com.intellectualcrafters.plot.util.expiry.ExpireManager; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.MathMan; import com.intellectualcrafters.plot.util.SchematicHandler; @@ -35,6 +33,8 @@ import com.intellectualcrafters.plot.util.StringMan; import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualcrafters.plot.util.UUIDHandler; import com.intellectualcrafters.plot.util.WorldUtil; +import com.intellectualcrafters.plot.util.expiry.ExpireManager; +import com.intellectualcrafters.plot.util.expiry.PlotAnalysis; import com.plotsquared.general.commands.Command; import com.plotsquared.general.commands.CommandDeclaration; import com.plotsquared.listener.WEManager; @@ -68,11 +68,11 @@ public class DebugExec extends SubCommand { public DebugExec() { try { if (PS.get() != null) { - File file = new File(PS.get().IMP.getDirectory(), Settings.PATHS.SCRIPTS + File.separator + "start.js"); + File file = new File(PS.get().IMP.getDirectory(), Settings.Paths.SCRIPTS + File.separator + "start.js"); if (file.exists()) { init(); String script = StringMan.join(Files - .readLines(new File(new File(PS.get().IMP.getDirectory() + File.separator + Settings.PATHS.SCRIPTS), "start.js"), + .readLines(new File(new File(PS.get().IMP.getDirectory() + File.separator + Settings.Paths.SCRIPTS), "start.js"), StandardCharsets.UTF_8), System.getProperty("line.separator")); this.scope.put("THIS", this); @@ -283,7 +283,8 @@ public class DebugExec extends SubCommand { case "addcmd": try { final String cmd = StringMan.join(Files - .readLines(MainUtil.getFile(new File(PS.get().IMP.getDirectory() + File.separator + Settings.PATHS.SCRIPTS), args[1]), + .readLines(MainUtil.getFile(new File(PS.get().IMP.getDirectory() + File.separator + Settings.Paths.SCRIPTS), + args[1]), StandardCharsets.UTF_8), System.getProperty("line.separator")); new Command(MainCommand.getInstance(), true, args[1].split("\\.")[0], null, RequiredType.NONE, CommandCategory.DEBUG) { @@ -310,7 +311,8 @@ public class DebugExec extends SubCommand { case "run": try { script = StringMan.join(Files - .readLines(MainUtil.getFile(new File(PS.get().IMP.getDirectory() + File.separator + Settings.PATHS.SCRIPTS), args[1]), + .readLines(MainUtil.getFile(new File(PS.get().IMP.getDirectory() + File.separator + Settings.Paths.SCRIPTS), + args[1]), StandardCharsets.UTF_8), System.getProperty("line.separator")); if (args.length > 2) { @@ -326,7 +328,7 @@ public class DebugExec extends SubCommand { } break; case "list-scripts": - String path = PS.get().IMP.getDirectory() + File.separator + Settings.PATHS.SCRIPTS; + String path = PS.get().IMP.getDirectory() + File.separator + Settings.Paths.SCRIPTS; File folder = new File(path); File[] filesArray = folder.listFiles(); diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Done.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Done.java index dc47a3b14..1447a644c 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Done.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Done.java @@ -43,7 +43,7 @@ public class Done extends SubCommand { } plot.addRunning(); MainUtil.sendMessage(player, C.GENERATING_LINK); - final Settings.AUTO_CLEAR doneRequirements = Settings.AUTO_CLEAR.get("done"); + final Settings.Auto_Clear doneRequirements = Settings.AUTO_CLEAR.get("done"); if (ExpireManager.IMP == null || doneRequirements == null) { finish(plot, player, true); plot.removeRunning(); diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Download.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Download.java index c1f82901b..b63428ce3 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Download.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Download.java @@ -41,7 +41,7 @@ public class Download extends SubCommand { MainUtil.sendMessage(player, C.PLOT_UNOWNED); return false; } - if ((Settings.DONE.REQUIRED_FOR_DOWNLOAD && (!plot.getFlag(Flags.DONE).isPresent())) && !Permissions + if ((Settings.Done.REQUIRED_FOR_DOWNLOAD && (!plot.getFlag(Flags.DONE).isPresent())) && !Permissions .hasPermission(player, "plots.admin.command.download")) { MainUtil.sendMessage(player, C.DONE_NOT_DONE); return false; diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Load.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Load.java index 2454d001e..33ad0d795 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Load.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Load.java @@ -31,7 +31,7 @@ public class Load extends SubCommand { @Override public boolean onCommand(final PlotPlayer player, String[] args) { - if (!Settings.ENABLED_COMPONENTS.METRICS) { + if (!Settings.Enabled_Components.METRICS) { MainUtil.sendMessage(player, "&cPlease enable metrics in order to use this command.\n&7 - Or host it yourself if you don't like the free service"); return false; @@ -75,7 +75,7 @@ public class Load extends SubCommand { } final URL url; try { - url = new URL(Settings.WEB.URL + "saves/" + player.getUUID() + '/' + schematic + ".schematic"); + url = new URL(Settings.Web.URL + "saves/" + player.getUUID() + '/' + schematic + ".schematic"); } catch (MalformedURLException e) { e.printStackTrace(); MainUtil.sendMessage(player, C.LOAD_FAILED); diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Merge.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Merge.java index 5d906be76..c1f0aa7e7 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Merge.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Merge.java @@ -77,7 +77,7 @@ public class Merge extends SubCommand { return false; } final int size = plot.getConnectedPlots().size(); - final int maxSize = Permissions.hasPermissionRange(player, "plots.merge", Settings.LIMIT.MAX_PLOTS); + final int maxSize = Permissions.hasPermissionRange(player, "plots.merge", Settings.Limit.MAX_PLOTS); if (size - 1 > maxSize) { MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.merge." + (size + 1)); return false; diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Owner.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Owner.java index d679bd526..d521af803 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Owner.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Owner.java @@ -65,7 +65,7 @@ public class Owner extends SetCommand { return false; } int size = plots.size(); - int currentPlots = (Settings.LIMIT.GLOBAL ? other.getPlotCount() : other.getPlotCount(plot.getArea().worldname)) + size; + int currentPlots = (Settings.Limit.GLOBAL ? other.getPlotCount() : other.getPlotCount(plot.getArea().worldname)) + size; if (currentPlots > other.getAllowedPlots()) { sendMessage(player, C.CANT_TRANSFER_MORE_PLOTS); return false; diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Rate.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Rate.java index 235a6c2a8..f4d2db06f 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Rate.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Rate.java @@ -62,7 +62,7 @@ public class Rate extends SubCommand { }); UUID uuid = player.getUUID(); for (Plot p : plots) { - if ((!Settings.DONE.REQUIRED_FOR_RATINGS || p.hasFlag(Flags.DONE)) && p.isBasePlot() && (p.hasRatings() || !p.getRatings() + if ((!Settings.Done.REQUIRED_FOR_RATINGS || p.hasFlag(Flags.DONE)) && p.isBasePlot() && (p.hasRatings() || !p.getRatings() .containsKey(uuid)) && !p.isAdded(uuid)) { p.teleportPlayer(player); MainUtil.sendMessage(player, C.RATE_THIS); @@ -85,11 +85,11 @@ public class Rate extends SubCommand { sendMessage(player, C.RATING_NOT_YOUR_OWN); return false; } - if (Settings.DONE.REQUIRED_FOR_RATINGS && !plot.hasFlag(Flags.DONE)) { + if (Settings.Done.REQUIRED_FOR_RATINGS && !plot.hasFlag(Flags.DONE)) { sendMessage(player, C.RATING_NOT_DONE); return false; } - if (Settings.RATINGS.CATEGORIES != null && !Settings.RATINGS.CATEGORIES.isEmpty()) { + if (Settings.Ratings.CATEGORIES != null && !Settings.Ratings.CATEGORIES.isEmpty()) { final Runnable run = new Runnable() { @Override public void run() { @@ -99,13 +99,13 @@ public class Rate extends SubCommand { } final MutableInt index = new MutableInt(0); final MutableInt rating = new MutableInt(0); - String title = Settings.RATINGS.CATEGORIES.get(0); + String title = Settings.Ratings.CATEGORIES.get(0); PlotInventory inventory = new PlotInventory(player, 1, title) { @Override public boolean onClick(int i) { rating.add((i + 1) * Math.pow(10, index.getValue())); index.increment(); - if (index.getValue() >= Settings.RATINGS.CATEGORIES.size()) { + if (index.getValue() >= Settings.Ratings.CATEGORIES.size()) { int rV = rating.getValue(); Rating result = EventUtil.manager.callRating(this.player, plot, new Rating(rV)); plot.addRating(this.player.getUUID(), result); @@ -118,7 +118,7 @@ public class Rate extends SubCommand { } return false; } - setTitle(Settings.RATINGS.CATEGORIES.get(index.getValue())); + setTitle(Settings.Ratings.CATEGORIES.get(index.getValue())); return true; } }; @@ -135,7 +135,7 @@ public class Rate extends SubCommand { } }; if (plot.getSettings().ratings == null) { - if (!Settings.ENABLED_COMPONENTS.RATING_CACHE) { + if (!Settings.Enabled_Components.RATING_CACHE) { TaskManager.runTaskAsync(new Runnable() { @Override public void run() { @@ -180,7 +180,7 @@ public class Rate extends SubCommand { } }; if (plot.getSettings().ratings == null) { - if (!Settings.ENABLED_COMPONENTS.RATING_CACHE) { + if (!Settings.Enabled_Components.RATING_CACHE) { TaskManager.runTaskAsync(new Runnable() { @Override public void run() { diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Save.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Save.java index 7f00d3d5c..c2c99f258 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Save.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Save.java @@ -30,7 +30,7 @@ public class Save extends SubCommand { @Override public boolean onCommand(final PlotPlayer player, String[] args) { - if (!Settings.ENABLED_COMPONENTS.METRICS) { + if (!Settings.Enabled_Components.METRICS) { MainUtil.sendMessage(player, "&cPlease enable metrics in order to use this command.\n&7 - Or host it yourself if you don't like the free service"); return false; diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/SchematicCmd.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/SchematicCmd.java index 1b0d53ec1..a423acde0 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/SchematicCmd.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/SchematicCmd.java @@ -75,7 +75,7 @@ public class SchematicCmd extends SubCommand { if (location.startsWith("url:")) { try { UUID uuid = UUID.fromString(location.substring(4)); - URL base = new URL(Settings.WEB.URL); + URL base = new URL(Settings.Web.URL); URL url = new URL(base, "uploads/" + uuid + ".schematic"); schematic = SchematicHandler.manager.getSchematic(url); } catch (Exception e) { diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Template.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Template.java index 900f16244..2ff6d7ac0 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Template.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Template.java @@ -39,7 +39,7 @@ public class Template extends SubCommand { public static boolean extractAllFiles(String world, String template) { try { - File folder = MainUtil.getFile(PS.get().IMP.getDirectory(), Settings.PATHS.TEMPLATES); + File folder = MainUtil.getFile(PS.get().IMP.getDirectory(), Settings.Paths.TEMPLATES); if (!folder.exists()) { return false; } @@ -89,7 +89,7 @@ public class Template extends SubCommand { } public static void zipAll(String world, Set files) throws IOException { - File output = MainUtil.getFile(PS.get().IMP.getDirectory(), Settings.PATHS.TEMPLATES); + File output = MainUtil.getFile(PS.get().IMP.getDirectory(), Settings.Paths.TEMPLATES); output.mkdirs(); try (FileOutputStream fos = new FileOutputStream(output + File.separator + world + ".template"); ZipOutputStream zos = new ZipOutputStream(fos)) { @@ -134,7 +134,7 @@ public class Template extends SubCommand { MainUtil.sendMessage(player, "&cInvalid template file: " + args[2] + ".template"); return false; } - File worldFile = MainUtil.getFile(PS.get().IMP.getDirectory(), Settings.PATHS.TEMPLATES + File.separator + "tmp-data.yml"); + File worldFile = MainUtil.getFile(PS.get().IMP.getDirectory(), Settings.Paths.TEMPLATES + File.separator + "tmp-data.yml"); YamlConfiguration worldConfig = YamlConfiguration.loadConfiguration(worldFile); PS.get().worlds.set("worlds." + world, worldConfig.get("")); try { diff --git a/Core/src/main/java/com/intellectualcrafters/plot/config/Config.java b/Core/src/main/java/com/intellectualcrafters/plot/config/Config.java index 5475f0510..1fbdb8c19 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/config/Config.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/config/Config.java @@ -26,6 +26,7 @@ public class Config { * Get the value for a node
* Probably throws some error if you try to get a non existent key * @param key + * @param root * @param * @return */ @@ -51,6 +52,7 @@ public class Config { * Probably throws some error if you supply non existing keys or invalid values * @param key config node * @param value value + * @param root * */ public static void set(String key, Object value, Class root) { @@ -91,6 +93,7 @@ public class Config { /** * Set all values in the file (load first to avoid overwriting) * @param file + * @param root */ public static void save(File file, Class root) { try { @@ -108,7 +111,7 @@ public class Config { } /** - * Get the static fields in a section + * Get the static fields in a section. * @param clazz * @return */ @@ -150,7 +153,7 @@ public class Config { private static void save(PrintWriter writer, Class clazz, Object instance, int indent) { try { - String CTRF = System.lineSeparator(); + String lineSeparator = System.lineSeparator(); String spacing = StringMan.repeat(" ", indent); for (Field field : clazz.getFields()) { if (field.getAnnotation(Ignore.class) != null) { @@ -159,7 +162,7 @@ public class Config { Comment comment = field.getAnnotation(Comment.class); if (comment != null) { for (String commentLine : comment.value()) { - writer.write(spacing + "# " + commentLine + CTRF); + writer.write(spacing + "# " + commentLine + lineSeparator); } } Create create = field.getAnnotation(Create.class); @@ -177,7 +180,7 @@ public class Config { } continue; } else { - writer.write(spacing + toNodeName(field.getName() + ": ") + toYamlString(field.get(instance), spacing) + CTRF); + writer.write(spacing + toNodeName(field.getName() + ": ") + toYamlString(field.get(instance), spacing) + lineSeparator); } } for (Class current : clazz.getClasses()) { @@ -185,15 +188,15 @@ public class Config { continue; } if (indent == 0) { - writer.write(CTRF); + writer.write(lineSeparator); } Comment comment = current.getAnnotation(Comment.class); if (comment != null) { for (String commentLine : comment.value()) { - writer.write(spacing + "# " + commentLine + CTRF); + writer.write(spacing + "# " + commentLine + lineSeparator); } } - writer.write(spacing + toNodeName(current.getSimpleName()) + ":" + CTRF); + writer.write(spacing + toNodeName(current.getSimpleName()) + ":" + lineSeparator); BlockName blockNames = current.getAnnotation(BlockName.class); if (blockNames != null) { Field instanceField = clazz.getDeclaredField(toFieldName(current.getSimpleName())); @@ -209,7 +212,7 @@ public class Config { // Save each instance for (Map.Entry entry: ((Map) value.getRaw()).entrySet()) { String key = entry.getKey(); - writer.write(spacing + " " + toNodeName(key) + ":" + CTRF); + writer.write(spacing + " " + toNodeName(key) + ":" + lineSeparator); save(writer, current, entry.getValue(), indent + 4); } continue; @@ -223,8 +226,9 @@ public class Config { } /** - * Get the field for a specific config node + * Get the field for a specific config node. * @param split the node (split by period) + * @param root * @return */ private static Field getField(String[] split, Class root) { @@ -254,8 +258,9 @@ public class Config { } /** - * Get the instance for a specific config node + * Get the instance for a specific config node. * @param split the node (split by period) + * @param root * @return The instance or null */ private static Object getInstance(String[] split, Class root) { @@ -270,7 +275,7 @@ public class Config { Class found = null; Class[] classes = clazz.getDeclaredClasses(); for (Class current : classes) { - if (StringMan.isEqual(current.getSimpleName(), toFieldName(split[0]))) { + if (current.getSimpleName().equalsIgnoreCase(toFieldName(split[0]))) { found = current; break; } @@ -302,7 +307,7 @@ public class Config { clazz = found; split = Arrays.copyOfRange(split, 2, split.length); continue; - } catch (NoSuchFieldException ignore) {} + } catch (NoSuchFieldException ignore) { } if (found != null) { split = Arrays.copyOfRange(split, 1, split.length); clazz = found; @@ -319,7 +324,7 @@ public class Config { } /** - * Translate a node to a java field name + * Translate a node to a java field name. * @param node * @return */ @@ -328,7 +333,7 @@ public class Config { } /** - * Translate a field to a config node + * Translate a field to a config node. * @param field * @return */ @@ -337,7 +342,7 @@ public class Config { } /** - * Set some field to be accesible + * Set some field to be accessible. * @param field * @throws NoSuchFieldException * @throws IllegalAccessException @@ -350,21 +355,21 @@ public class Config { } /** - * Indicates that a field should be instantiated / created + * Indicates that a field should be instantiated / created. */ @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.FIELD}) public @interface Create {} /** - * Indicates that a field cannot be modified + * Indicates that a field cannot be modified. */ @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.FIELD}) public @interface Final {} /** - * Creates a comment + * Creates a comment. */ @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.FIELD,ElementType.TYPE}) @@ -373,7 +378,7 @@ public class Config { } /** - * The names of any default blocks + * The names of any default blocks. */ @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.FIELD,ElementType.TYPE}) @@ -382,7 +387,7 @@ public class Config { } /** - * Any field or class with is not part of the config + * Any field or class with is not part of the config. */ @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.FIELD,ElementType.TYPE}) diff --git a/Core/src/main/java/com/intellectualcrafters/plot/config/Settings.java b/Core/src/main/java/com/intellectualcrafters/plot/config/Settings.java index aed7798ad..b18c3f76e 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/config/Settings.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/config/Settings.java @@ -1,9 +1,10 @@ package com.intellectualcrafters.plot.config; import com.intellectualcrafters.configuration.file.YamlConfiguration; + import java.io.File; import java.util.ArrayList; -import java.util.Arrays; +import java.util.Collections; import java.util.List; public class Settings extends Config { @@ -29,13 +30,132 @@ public class Settings extends Config { public static boolean TITLES = true; @Create // This value will be generated automatically - public static ConfigBlock AUTO_CLEAR = null; // A ConfigBlock is a section that can have multiple instances e.g. multiple expiry tasks + public static ConfigBlock AUTO_CLEAR = null; // A ConfigBlock is a section that can have multiple instances e.g. multiple expiry tasks + + public static void save(File file) { + save(file, Settings.class); + } + + public static void load(File file) { + load(file, Settings.class); + } + + public static boolean convertLegacy(File file) { + if (!file.exists()) { + return false; + } + YamlConfiguration config = YamlConfiguration.loadConfiguration(file); + + // Protection + Redstone.DISABLE_OFFLINE = config.getBoolean("protection.redstone.disable-offline"); + Redstone.DISABLE_UNOCCUPIED = config.getBoolean("protection.redstone.disable-unoccupied", Redstone.DISABLE_UNOCCUPIED); + + // PlotMe + PlotMe.ALIAS = config.getBoolean("plotme-alias", PlotMe.ALIAS); + Enabled_Components.PLOTME_CONVERTER = config.getBoolean("plotme-convert.enabled", Enabled_Components.PLOTME_CONVERTER); + PlotMe.CACHE_UUDS = config.getBoolean("plotme-convert.cache-uuids", PlotMe.CACHE_UUDS); + + // UUID + UUID.USE_SQLUUIDHANDLER = config.getBoolean("uuid.use_sqluuidhandler", UUID.USE_SQLUUIDHANDLER); + UUID.OFFLINE = config.getBoolean("UUID.offline", UUID.OFFLINE); + UUID.FORCE_LOWERCASE = config.getBoolean("UUID.force-lowercase", UUID.FORCE_LOWERCASE); + + // Mob stuff + Enabled_Components.KILL_ROAD_MOBS = config.getBoolean("kill_road_mobs", Enabled_Components.KILL_ROAD_MOBS); + Enabled_Components.KILL_ROAD_VEHICLES = config.getBoolean("kill_road_vehicles", Enabled_Components.KILL_ROAD_VEHICLES); + + // Clearing + Expiry +// FAST_CLEAR = config.getBoolean("clear.fastmode"); + Enabled_Components.PLOT_EXPIRY = config.getBoolean("clear.auto.enabled", Enabled_Components.PLOT_EXPIRY); + if (Enabled_Components.PLOT_EXPIRY) { + Enabled_Components.BAN_DELETER = config.getBoolean("clear.on.ban"); + AUTO_CLEAR = new ConfigBlock<>(); + AUTO_CLEAR.put("task1", new Auto_Clear()); + Auto_Clear task = AUTO_CLEAR.get("task1"); + task.CALIBRATION = new Auto_Clear.CALIBRATION(); + + task.DAYS = config.getInt("clear.auto.days", task.DAYS); + task.THRESHOLD = config.getInt("clear.auto.threshold", task.THRESHOLD); + task.CONFIRMATION = config.getBoolean("clear.auto.confirmation", task.CONFIRMATION); + task.CALIBRATION.CHANGES = config.getInt("clear.auto.calibration.changes", task.CALIBRATION.CHANGES); + task.CALIBRATION.FACES = config.getInt("clear.auto.calibration.faces", task.CALIBRATION.FACES); + task.CALIBRATION.DATA = config.getInt("clear.auto.calibration.data", task.CALIBRATION.DATA); + task.CALIBRATION.AIR = config.getInt("clear.auto.calibration.air", task.CALIBRATION.AIR); + task.CALIBRATION.VARIETY = config.getInt("clear.auto.calibration.variety", task.CALIBRATION.VARIETY); + task.CALIBRATION.CHANGES_SD = config.getInt("clear.auto.calibration.changes_sd", task.CALIBRATION.CHANGES_SD); + task.CALIBRATION.FACES_SD = config.getInt("clear.auto.calibration.faces_sd", task.CALIBRATION.FACES_SD); + task.CALIBRATION.DATA_SD = config.getInt("clear.auto.calibration.data_sd", task.CALIBRATION.DATA_SD); + task.CALIBRATION.AIR_SD = config.getInt("clear.auto.calibration.air_sd", task.CALIBRATION.AIR_SD); + task.CALIBRATION.VARIETY_SD = config.getInt("clear.auto.calibration.variety_sd", task.CALIBRATION.VARIETY_SD); + } + + // Done + Done.REQUIRED_FOR_RATINGS = config.getBoolean("approval.ratings.check-done", Done.REQUIRED_FOR_RATINGS); + Done.COUNTS_TOWARDS_LIMIT = config.getBoolean("approval.done.counts-towards-limit", Done.COUNTS_TOWARDS_LIMIT); + Done.RESTRICT_BUILDING = config.getBoolean("approval.done.restrict-building", Done.RESTRICT_BUILDING); + Done.REQUIRED_FOR_DOWNLOAD = config.getBoolean("approval.done.required-for-download", Done.REQUIRED_FOR_DOWNLOAD); + + // Schematics + Paths.SCHEMATICS = config.getString("schematics.save_path", Paths.SCHEMATICS); + Paths.BO3 = config.getString("bo3.save_path", Paths.BO3); + + // Web + Web.URL = config.getString("web.url", Web.URL); + Web.SERVER_IP = config.getString("web.server-ip", Web.SERVER_IP); + + // Caching + Enabled_Components.PERMISSION_CACHE = config.getBoolean("cache.permissions", Enabled_Components.PERMISSION_CACHE); + Enabled_Components.RATING_CACHE = config.getBoolean("cache.ratings", Enabled_Components.RATING_CACHE); + + // Rating system + Ratings.CATEGORIES = config.contains("ratings.categories") ? config.getStringList("ratings.categories") : Ratings.CATEGORIES; + + // Titles + TITLES = config.getBoolean("titles", TITLES); + + // Teleportation + Teleport.DELAY = config.getInt("teleport.delay", Teleport.DELAY); + Teleport.ON_LOGIN = config.getBoolean("teleport.on_login", Teleport.ON_LOGIN); + Teleport.ON_DEATH = config.getBoolean("teleport.on_death", Teleport.ON_DEATH); + + // WorldEdit +// WE_ALLOW_HELPER = config.getBoolean("worldedit.enable-for-helpers"); + + // Chunk processor + Enabled_Components.CHUNK_PROCESSOR = config.getBoolean("chunk-processor.enabled", Enabled_Components.CHUNK_PROCESSOR); + Chunk_Processor.AUTO_TRIM = config.getBoolean("chunk-processor.auto-unload", Chunk_Processor.AUTO_TRIM); + Chunk_Processor.MAX_TILES = config.getInt("chunk-processor.max-blockstates", Chunk_Processor.MAX_TILES); + Chunk_Processor.MAX_ENTITIES = config.getInt("chunk-processor.max-entities", Chunk_Processor.MAX_ENTITIES); + Chunk_Processor.DISABLE_PHYSICS = config.getBoolean("chunk-processor.disable-physics", Chunk_Processor.DISABLE_PHYSICS); + + // Comments + Enabled_Components.COMMENT_NOTIFIER = config.getBoolean("comments.notifications.enabled", Enabled_Components.COMMENT_NOTIFIER); + + // Plot limits + Claim.MAX_AUTO_AREA = config.getInt("claim.max-auto-area", Claim.MAX_AUTO_AREA); + Limit.MAX_PLOTS = config.getInt("max_plots", Limit.MAX_PLOTS); + Limit.GLOBAL = config.getBoolean("global_limit", Limit.GLOBAL); + + // Misc + DEBUG = config.getBoolean("debug", DEBUG); + Chat.CONSOLE_COLOR = config.getBoolean("console.color", Chat.CONSOLE_COLOR); + Chat.INTERACTIVE = config.getBoolean("chat.fancy", Chat.INTERACTIVE); + + Enabled_Components.METRICS = config.getBoolean("metrics", Enabled_Components.METRICS); + Enabled_Components.UPDATER = config.getBoolean("update-notifications", Enabled_Components.UPDATER); + Enabled_Components.DATABASE_PURGER = config.getBoolean("auto-purge", Enabled_Components.DATABASE_PURGER); + return true; + } @Comment("This is an auto clearing task called `task1`") @BlockName("task1") // The name for the default block - public static final class AUTO_CLEAR extends ConfigBlock { + public static final class Auto_Clear extends ConfigBlock { @Create // This value has to be generated since an instance isn't static public CALIBRATION CALIBRATION = null; + public int THRESHOLD = 1; + public boolean CONFIRMATION = true; + public int DAYS = 7; + public List WORLDS = new ArrayList<>(Collections.singletonList("*")); @Comment("See: https://github.com/IntellectualSites/PlotSquared/wiki/Plot-analysis") public static final class CALIBRATION { @@ -50,14 +170,9 @@ public class Settings extends Config { public int AIR_SD = 0; public int DATA = 0; } - - public int THRESHOLD = 1; - public boolean CONFIRMATION = true; - public int DAYS = 7; - public List WORLDS = new ArrayList<>(Arrays.asList("*")); } - public static class CHUNK_PROCESSOR { + public static class Chunk_Processor { @Comment("Auto trim will not save chunks which aren't claimed") public static boolean AUTO_TRIM = false; @Comment("Max tile entities per chunk") @@ -80,7 +195,7 @@ public class Settings extends Config { } @Comment("Configure the paths PlotSquared will use") - public static final class PATHS { + public static final class Paths { public static String SCHEMATICS = "schematics"; public static String BO3 = "bo3"; public static String SCRIPTS = "scripts"; @@ -88,14 +203,14 @@ public class Settings extends Config { public static String TRANSLATIONS = "translations"; } - public static class WEB { + public static class Web { @Comment("We are already hosting a web interface for you:") public static String URL = "http://empcraft.com/plots/"; @Comment("The ip that will show up in the interface") public static String SERVER_IP = "your.ip.here"; } - public static final class DONE { + public static final class Done { @Comment("Require a done plot to download") public static boolean REQUIRED_FOR_DOWNLOAD = false; @Comment("Only done plots can be rated") @@ -106,7 +221,7 @@ public class Settings extends Config { public static boolean COUNTS_TOWARDS_LIMIT = true; } - public static final class CHAT { + public static final class Chat { @Comment("Sometimes console color doesn't work, you can disable it here") public static boolean CONSOLE_COLOR = true; @Comment("Should chat be interactive") @@ -114,7 +229,7 @@ public class Settings extends Config { } @Comment("Relating to how many plots someone can claim ") - public static final class LIMIT { + public static final class Limit { @Comment("Should the limit be global (over multiple worlds)") public static boolean GLOBAL = false; @Comment("The range of permissions to check e.g. plots.plot.127") @@ -122,14 +237,14 @@ public class Settings extends Config { } @Comment("Switching from PlotMe?") - public static final class PLOTME { + public static final class PlotMe { @Comment("Cache the uuids from the PlotMe database") public static boolean CACHE_UUDS = false; @Comment("Have `/plotme` as a command alias") public static boolean ALIAS = false; } - public static final class TELEPORT { + public static final class Teleport { @Comment("Teleport to your plot on death") public static boolean ON_DEATH = false; @Comment("Teleport to your plot on login") @@ -138,24 +253,28 @@ public class Settings extends Config { public static int DELAY = 0; } - public static final class REDSTONE { + public static final class Redstone { @Comment("Disable redstone in unoccupied plots") public static boolean DISABLE_UNOCCUPIED = false; @Comment("Disable redstone when all owners/trusted/members are offline") public static boolean DISABLE_OFFLINE = false; } - public static final class CLAIM { + /* + END OF CONFIGURATION SECTION: + */ + + public static final class Claim { @Comment("The max plots claimed in a single `/plot auto ` command") public static int MAX_AUTO_AREA = 4; } - public static final class RATINGS { + public static final class Ratings { public static List CATEGORIES = new ArrayList<>(); } @Comment({"Enable or disable part of the plugin","Note: A cache will use some memory if enabled"}) - public static final class ENABLED_COMPONENTS { // Group the following values into a new config section + public static final class Enabled_Components { // Group the following values into a new config section @Comment("The database stores all the plots") public static boolean DATABASE = true; @Comment("Events are needed to track a lot of things") @@ -194,123 +313,4 @@ public class Settings extends Config { @Comment("Delete plots when a player is banned") public static boolean BAN_DELETER = false; } - - /* - END OF CONFIGURATION SECTION: - */ - - public static void save(File file) { - save(file, Settings.class); - } - - public static void load(File file) { - load(file, Settings.class); - } - - public static boolean convertLegacy(File file) { - if (!file.exists()) { - return false; - } - YamlConfiguration config = YamlConfiguration.loadConfiguration(file); - - // Protection - REDSTONE.DISABLE_OFFLINE = config.getBoolean("protection.redstone.disable-offline"); - REDSTONE.DISABLE_UNOCCUPIED = config.getBoolean("protection.redstone.disable-unoccupied", REDSTONE.DISABLE_UNOCCUPIED); - - // PlotMe - PLOTME.ALIAS = config.getBoolean("plotme-alias", PLOTME.ALIAS); - ENABLED_COMPONENTS.PLOTME_CONVERTER = config.getBoolean("plotme-convert.enabled", ENABLED_COMPONENTS.PLOTME_CONVERTER); - PLOTME.CACHE_UUDS = config.getBoolean("plotme-convert.cache-uuids", PLOTME.CACHE_UUDS); - - // UUID - UUID.USE_SQLUUIDHANDLER = config.getBoolean("uuid.use_sqluuidhandler", UUID.USE_SQLUUIDHANDLER); - UUID.OFFLINE = config.getBoolean("UUID.offline", UUID.OFFLINE); - UUID.FORCE_LOWERCASE = config.getBoolean("UUID.force-lowercase", UUID.FORCE_LOWERCASE); - - // Mob stuff - ENABLED_COMPONENTS.KILL_ROAD_MOBS = config.getBoolean("kill_road_mobs", ENABLED_COMPONENTS.KILL_ROAD_MOBS); - ENABLED_COMPONENTS.KILL_ROAD_VEHICLES = config.getBoolean("kill_road_vehicles", ENABLED_COMPONENTS.KILL_ROAD_VEHICLES); - - // Clearing + Expiry -// FAST_CLEAR = config.getBoolean("clear.fastmode"); - ENABLED_COMPONENTS.PLOT_EXPIRY = config.getBoolean("clear.auto.enabled", ENABLED_COMPONENTS.PLOT_EXPIRY); - if (ENABLED_COMPONENTS.PLOT_EXPIRY) { - ENABLED_COMPONENTS.BAN_DELETER = config.getBoolean("clear.on.ban"); - AUTO_CLEAR = new ConfigBlock<>(); - AUTO_CLEAR.put("task1", new AUTO_CLEAR()); - AUTO_CLEAR task = AUTO_CLEAR.get("task1"); - task.CALIBRATION = new AUTO_CLEAR.CALIBRATION(); - - task.DAYS = config.getInt("clear.auto.days", task.DAYS); - task.THRESHOLD = config.getInt("clear.auto.threshold", task.THRESHOLD); - task.CONFIRMATION = config.getBoolean("clear.auto.confirmation", task.CONFIRMATION); - task.CALIBRATION.CHANGES = config.getInt("clear.auto.calibration.changes", task.CALIBRATION.CHANGES); - task.CALIBRATION.FACES = config.getInt("clear.auto.calibration.faces", task.CALIBRATION.FACES); - task.CALIBRATION.DATA = config.getInt("clear.auto.calibration.data", task.CALIBRATION.DATA); - task.CALIBRATION.AIR = config.getInt("clear.auto.calibration.air", task.CALIBRATION.AIR); - task.CALIBRATION.VARIETY = config.getInt("clear.auto.calibration.variety", task.CALIBRATION.VARIETY); - task.CALIBRATION.CHANGES_SD = config.getInt("clear.auto.calibration.changes_sd", task.CALIBRATION.CHANGES_SD); - task.CALIBRATION.FACES_SD = config.getInt("clear.auto.calibration.faces_sd", task.CALIBRATION.FACES_SD); - task.CALIBRATION.DATA_SD = config.getInt("clear.auto.calibration.data_sd", task.CALIBRATION.DATA_SD); - task.CALIBRATION.AIR_SD = config.getInt("clear.auto.calibration.air_sd", task.CALIBRATION.AIR_SD); - task.CALIBRATION.VARIETY_SD = config.getInt("clear.auto.calibration.variety_sd", task.CALIBRATION.VARIETY_SD); - } - - // Done - DONE.REQUIRED_FOR_RATINGS = config.getBoolean("approval.ratings.check-done", DONE.REQUIRED_FOR_RATINGS); - DONE.COUNTS_TOWARDS_LIMIT = config.getBoolean("approval.done.counts-towards-limit", DONE.COUNTS_TOWARDS_LIMIT); - DONE.RESTRICT_BUILDING = config.getBoolean("approval.done.restrict-building", DONE.RESTRICT_BUILDING); - DONE.REQUIRED_FOR_DOWNLOAD = config.getBoolean("approval.done.required-for-download", DONE.REQUIRED_FOR_DOWNLOAD); - - // Schematics - PATHS.SCHEMATICS = config.getString("schematics.save_path", PATHS.SCHEMATICS); - PATHS.BO3 = config.getString("bo3.save_path", PATHS.BO3); - - // Web - WEB.URL = config.getString("web.url", WEB.URL); - WEB.SERVER_IP = config.getString("web.server-ip", WEB.SERVER_IP); - - // Caching - ENABLED_COMPONENTS.PERMISSION_CACHE = config.getBoolean("cache.permissions", ENABLED_COMPONENTS.PERMISSION_CACHE); - ENABLED_COMPONENTS.RATING_CACHE = config.getBoolean("cache.ratings", ENABLED_COMPONENTS.RATING_CACHE); - - // Rating system - RATINGS.CATEGORIES = config.contains("ratings.categories") ? config.getStringList("ratings.categories") : RATINGS.CATEGORIES; - - // Titles - TITLES = config.getBoolean("titles", TITLES); - - // Teleportation - TELEPORT.DELAY = config.getInt("teleport.delay", TELEPORT.DELAY); - TELEPORT.ON_LOGIN = config.getBoolean("teleport.on_login", TELEPORT.ON_LOGIN); - TELEPORT.ON_DEATH = config.getBoolean("teleport.on_death", TELEPORT.ON_DEATH); - - // WorldEdit -// WE_ALLOW_HELPER = config.getBoolean("worldedit.enable-for-helpers"); - - // Chunk processor - ENABLED_COMPONENTS.CHUNK_PROCESSOR = config.getBoolean("chunk-processor.enabled", ENABLED_COMPONENTS.CHUNK_PROCESSOR); - CHUNK_PROCESSOR.AUTO_TRIM = config.getBoolean("chunk-processor.auto-unload", CHUNK_PROCESSOR.AUTO_TRIM); - CHUNK_PROCESSOR.MAX_TILES = config.getInt("chunk-processor.max-blockstates", CHUNK_PROCESSOR.MAX_TILES); - CHUNK_PROCESSOR.MAX_ENTITIES = config.getInt("chunk-processor.max-entities", CHUNK_PROCESSOR.MAX_ENTITIES); - CHUNK_PROCESSOR.DISABLE_PHYSICS = config.getBoolean("chunk-processor.disable-physics", CHUNK_PROCESSOR.DISABLE_PHYSICS); - - // Comments - ENABLED_COMPONENTS.COMMENT_NOTIFIER = config.getBoolean("comments.notifications.enabled", ENABLED_COMPONENTS.COMMENT_NOTIFIER); - - // Plot limits - CLAIM.MAX_AUTO_AREA = config.getInt("claim.max-auto-area", CLAIM.MAX_AUTO_AREA); - LIMIT.MAX_PLOTS = config.getInt("max_plots", LIMIT.MAX_PLOTS); - LIMIT.GLOBAL = config.getBoolean("global_limit", LIMIT.GLOBAL); - - // Misc - DEBUG = config.getBoolean("debug", DEBUG); - CHAT.CONSOLE_COLOR = config.getBoolean("console.color", CHAT.CONSOLE_COLOR); - CHAT.INTERACTIVE = config.getBoolean("chat.fancy", CHAT.INTERACTIVE); - - ENABLED_COMPONENTS.METRICS = config.getBoolean("metrics", ENABLED_COMPONENTS.METRICS); - ENABLED_COMPONENTS.UPDATER = config.getBoolean("update-notifications", ENABLED_COMPONENTS.UPDATER); - ENABLED_COMPONENTS.DATABASE_PURGER = config.getBoolean("auto-purge", ENABLED_COMPONENTS.DATABASE_PURGER); - return true; - } } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/config/Storage.java b/Core/src/main/java/com/intellectualcrafters/plot/config/Storage.java index 8d55bfc9f..5dfda8914 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/config/Storage.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/config/Storage.java @@ -4,25 +4,6 @@ import java.io.File; public class Storage extends Config { - @Comment("MySQL section") - public static final class MYSQL { - @Comment("Should MySQL be used?") - public static boolean USE = false; - public static String HOST = "localhost"; - public static String PORT = "3306"; - public static String USER = "root"; - public static String PASSWORD = "password"; - public static String DATABASE = "plot_db"; - } - - @Comment("SQLite section") - public static final class SQLITE { - @Comment("Should SQLite be used?") - public static boolean USE = true; - @Comment("The file to use") - public static String DB = "storage"; - } - public static final String PREFIX = ""; public static void save(File file) { @@ -33,4 +14,23 @@ public class Storage extends Config { load(file, Storage.class); } + @Comment("MySQL section") + public static final class MySQL { + @Comment("Should MySQL be used?") + public static boolean USE = false; + public static String HOST = "localhost"; + public static String PORT = "3306"; + public static String USER = "root"; + public static String PASSWORD = "password"; + public static String DATABASE = "plot_db"; + } + + @Comment("SQLite section") + public static final class SQLite { + @Comment("Should SQLite be used?") + public static boolean USE = true; + @Comment("The file to use") + public static String DB = "storage"; + } + } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/database/AbstractDB.java b/Core/src/main/java/com/intellectualcrafters/plot/database/AbstractDB.java index ccae8566d..15a291053 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/database/AbstractDB.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/database/AbstractDB.java @@ -24,8 +24,8 @@ public interface AbstractDB { /** * Set Plot owner. * - * @param plot Plot in which the owner should be set - * @param uuid The uuid of the new owner + * @param plot the plot + * @param uuid the uuid of the new owner */ void setOwner(Plot plot, UUID uuid); @@ -33,14 +33,14 @@ public interface AbstractDB { * Create all settings, and create default helpers, trusted + denied lists. * * @param plots Plots for which the default table entries should be created - * @param whenDone + * @param whenDone the task to run when the method is finished executing */ void createPlotsAndData(List plots, Runnable whenDone); /** - * Create a plot + * Create a plot. * - * @param plot That should be created + * @param plot the plot to create */ void createPlot(Plot plot); @@ -54,7 +54,7 @@ public interface AbstractDB { /** * Delete a plot. * - * @param plot The plot to delete. + * @param plot the plot to delete */ void delete(Plot plot); @@ -63,9 +63,17 @@ public interface AbstractDB { void deleteHelpers(Plot plot); void deleteTrusted(Plot plot); - + + /** + * Remove all denied players from the plot. + * @param plot the plot + */ void deleteDenied(Plot plot); - + + /** + * Delete all comments from the plot. + * @param plot the plot + */ void deleteComments(Plot plot); void deleteRatings(Plot plot); @@ -79,19 +87,19 @@ public interface AbstractDB { void getPersistentMeta(UUID uuid, RunnableVal> result); /** - * Create plot settings. + * Create the plot settings. * - * @param id Plot Entry ID - * @param plot Plot Object + * @param id the plot entry id + * @param plot the plot */ void createPlotSettings(int id, Plot plot); /** * Get the table entry ID. * - * @param plot Plot Object + * @param plot the plot * - * @return Integer = Plot Entry Id + * @return {@code Integer} = Plot Entry Id */ int getId(Plot plot); @@ -138,7 +146,7 @@ public interface AbstractDB { /** * Set plot flags. * @param plot Plot Object - * @param flags flags to set (flag[]) + * @param flags flags to set */ void setFlags(Plot plot, HashMap, Object> flags); @@ -149,9 +157,11 @@ public interface AbstractDB { * @param flags flags to set (flag[]) */ void setFlags(PlotCluster cluster, HashMap, Object> flags); - + /** - * Rename a cluster. + * Rename a cluster to the given name. + * @param cluster the cluster to rename + * @param name the new cluster name */ void setClusterName(PlotCluster cluster, String name); @@ -174,15 +184,15 @@ public interface AbstractDB { * Purge a whole world. * * @param area World in which the plots should be purged - * @param plotIds + * @param plotIds the {@code PlotId}s of {@code Plot}s to purge */ void purge(PlotArea area, Set plotIds); /** - * Set Plot Home Position. + * Set the plot home position. * - * @param plot Plot Object - * @param position Plot Home Position + * @param plot the plot + * @param position the position of plot home */ void setPosition(Plot plot, String position); @@ -194,11 +204,12 @@ public interface AbstractDB { void setPosition(PlotCluster cluster, String position); /** - * @param plot Plot Object - * @param uuid Player that should be removed + * Remove the specified player from the trust list of the specified plot. + * @param plot the plot + * @param uuid the uuid of the player to remove */ void removeTrusted(Plot plot, UUID uuid); - + /** * @param cluster PlotCluster Object * @param uuid Player that should be removed @@ -206,7 +217,7 @@ public interface AbstractDB { void removeHelper(PlotCluster cluster, UUID uuid); /** - * @param plot Plot Object + * @param plot the plot * @param uuid Player that should be removed */ void removeMember(Plot plot, UUID uuid); @@ -242,25 +253,27 @@ public interface AbstractDB { * @param uuid */ void setInvited(PlotCluster cluster, UUID uuid); - + /** - * @param plot Plot Object - * @param uuid Player uuid + * Remove the specified player from the denied list of the specified plot. + * @param plot the plot + * @param uuid the uuid of the player to remove */ void removeDenied(Plot plot, UUID uuid); /** + * Deny the specified player from the given plot. * @param plot the plot * @param uuid the uuid of the player to deny */ void setDenied(Plot plot, UUID uuid); /** - * Get Plots ratings. + * Get the ratings from the specified plot. * - * @param plot Plot Object + * @param plot the plot * - * @return Plot Ratings (pre-calculated) + * @return the plot ratings (pre-calculated) */ HashMap getRatings(Plot plot); @@ -273,26 +286,26 @@ public interface AbstractDB { void setRating(Plot plot, UUID rater, int value); /** - * Remove a plot comment. + * Remove the specified comment from the given plot. * - * @param plot Plot Object - * @param comment Comment to remove + * @param plot the plot + * @param comment the comment to remove */ void removeComment(Plot plot, PlotComment comment); /** - * Clear an inbox. + * Clear the specified inbox on the given plot. * - * @param plot - * @param inbox + * @param plot the plot + * @param inbox the inbox to clear */ void clearInbox(Plot plot, String inbox); /** - * Set a plot comment. + * Add the specified comment to the given plot. * - * @param plot Plot Object - * @param comment Comment to add + * @param plot the plot + * @param comment the comment to add */ void setComment(Plot plot, PlotComment comment); @@ -328,7 +341,10 @@ public interface AbstractDB { * @return true if the tables were deleted, false when an error is encountered */ boolean deleteTables(); - + + /** + * Close the database. Generally not recommended to be used by add-ons. + */ void close(); void replaceWorld(String oldWorld, String newWorld, PlotId min, PlotId max); diff --git a/Core/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java b/Core/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java index 58b7673b7..d558326e2 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java @@ -18,6 +18,7 @@ import com.intellectualcrafters.plot.object.comment.PlotComment; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.StringMan; import com.intellectualcrafters.plot.util.TaskManager; + import java.sql.Connection; import java.sql.DatabaseMetaData; import java.sql.PreparedStatement; @@ -1321,7 +1322,7 @@ public class SQLManager implements AbstractDB { @Override public void deleteRatings(final Plot plot) { - if (Settings.ENABLED_COMPONENTS.RATING_CACHE && plot.getSettings().getRatings().isEmpty()) { + if (Settings.Enabled_Components.RATING_CACHE && plot.getSettings().getRatings().isEmpty()) { return; } addPlotTask(plot, new UniqueStatement("delete_plot_ratings") { @@ -1479,7 +1480,7 @@ public class SQLManager implements AbstractDB { rs.close(); try (Statement statement = this.connection.createStatement()) { statement.addBatch("DROP TABLE `" + this.prefix + "plot_comments`"); - if (Storage.MYSQL.USE) { + if (Storage.MySQL.USE) { statement.addBatch("CREATE TABLE IF NOT EXISTS `" + this.prefix + "plot_comments` (" @@ -1625,7 +1626,7 @@ public class SQLManager implements AbstractDB { id = resultSet.getInt("id"); String areaid = resultSet.getString("world"); if (!areas.contains(areaid)) { - if (Settings.ENABLED_COMPONENTS.DATABASE_PURGER) { + if (Settings.Enabled_Components.DATABASE_PURGER) { toDelete.add(id); continue; } else { @@ -1652,7 +1653,7 @@ public class SQLManager implements AbstractDB { Plot last = map.put(p.getId(), p); if (last != null) { map.put(last.getId(), last); - if (Settings.ENABLED_COMPONENTS.DATABASE_PURGER) { + if (Settings.Enabled_Components.DATABASE_PURGER) { toDelete.add(id); } else { PS.debug("&cPLOT " + id + " in `" + this.prefix @@ -1669,7 +1670,7 @@ public class SQLManager implements AbstractDB { } deleteRows(toDelete, this.prefix + "plot", "id"); } - if (Settings.ENABLED_COMPONENTS.RATING_CACHE) { + if (Settings.Enabled_Components.RATING_CACHE) { try (ResultSet r = statement.executeQuery("SELECT `plot_plot_id`, `player`, `rating` FROM `" + this.prefix + "plot_rating`")) { ArrayList toDelete = new ArrayList<>(); while (r.next()) { @@ -1683,7 +1684,7 @@ public class SQLManager implements AbstractDB { Plot plot = plots.get(id); if (plot != null) { plot.getSettings().getRatings().put(user, r.getInt("rating")); - } else if (Settings.ENABLED_COMPONENTS.DATABASE_PURGER) { + } else if (Settings.Enabled_Components.DATABASE_PURGER) { toDelete.add(id); } else { PS.debug("&cENTRY " + id + " in `plot_rating` does not exist. Create this plot or set `auto-purge: true` in the " @@ -1710,7 +1711,7 @@ public class SQLManager implements AbstractDB { Plot plot = plots.get(id); if (plot != null) { plot.getTrusted().add(user); - } else if (Settings.ENABLED_COMPONENTS.DATABASE_PURGER) { + } else if (Settings.Enabled_Components.DATABASE_PURGER) { toDelete.add(id); } else { PS.debug("&cENTRY " + id + " in `plot_helpers` does not exist. Create this plot or set `auto-purge: true` in the settings" @@ -1736,7 +1737,7 @@ public class SQLManager implements AbstractDB { Plot plot = plots.get(id); if (plot != null) { plot.getMembers().add(user); - } else if (Settings.ENABLED_COMPONENTS.DATABASE_PURGER) { + } else if (Settings.Enabled_Components.DATABASE_PURGER) { toDelete.add(id); } else { PS.debug("&cENTRY " + id + " in `plot_trusted` does not exist. Create this plot or set `auto-purge: true` in the settings" @@ -1762,7 +1763,7 @@ public class SQLManager implements AbstractDB { Plot plot = plots.get(id); if (plot != null) { plot.getDenied().add(user); - } else if (Settings.ENABLED_COMPONENTS.DATABASE_PURGER) { + } else if (Settings.Enabled_Components.DATABASE_PURGER) { toDelete.add(id); } else { PS.debug("&cENTRY " + id @@ -1851,7 +1852,7 @@ public class SQLManager implements AbstractDB { this.setFlags(plot, flags); } plot.getSettings().flags = flags; - } else if (Settings.ENABLED_COMPONENTS.DATABASE_PURGER) { + } else if (Settings.Enabled_Components.DATABASE_PURGER) { toDelete.add(id); } else { PS.debug( diff --git a/Core/src/main/java/com/intellectualcrafters/plot/generator/HybridPlotManager.java b/Core/src/main/java/com/intellectualcrafters/plot/generator/HybridPlotManager.java index c4aee9db9..c94334d22 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/generator/HybridPlotManager.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/generator/HybridPlotManager.java @@ -30,7 +30,7 @@ public class HybridPlotManager extends ClassicPlotManager { @Override public void exportTemplate(PlotArea plotArea) throws IOException { HashSet files = new HashSet<>( - Collections.singletonList(new FileBytes(Settings.PATHS.TEMPLATES + "/tmp-data.yml", Template.getBytes(plotArea)))); + Collections.singletonList(new FileBytes(Settings.Paths.TEMPLATES + "/tmp-data.yml", Template.getBytes(plotArea)))); String dir = "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + plotArea.worldname + File.separator; String newDir = "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + "__TEMP_DIR__" + File.separator; try { diff --git a/Core/src/main/java/com/intellectualcrafters/plot/object/BO3.java b/Core/src/main/java/com/intellectualcrafters/plot/object/BO3.java index 7ef0159c8..5c36daa5c 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/object/BO3.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/object/BO3.java @@ -59,7 +59,7 @@ public class BO3 { } public File getFile() { - return MainUtil.getFile(PS.get().IMP.getDirectory(), Settings.PATHS.BO3 + File.separator + getWorld() + File.separator + getFilename()); + return MainUtil.getFile(PS.get().IMP.getDirectory(), Settings.Paths.BO3 + File.separator + getWorld() + File.separator + getFilename()); } public String getFilename() { diff --git a/Core/src/main/java/com/intellectualcrafters/plot/object/Plot.java b/Core/src/main/java/com/intellectualcrafters/plot/object/Plot.java index a61b6c469..af05f693f 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/object/Plot.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/object/Plot.java @@ -926,7 +926,7 @@ public class Plot { * This will return null if the plot hasn't been analyzed * @return analysis of plot */ - public PlotAnalysis getComplexity(Settings.AUTO_CLEAR settings) { + public PlotAnalysis getComplexity(Settings.Auto_Clear settings) { return PlotAnalysis.getAnalysis(this, settings); } @@ -1737,7 +1737,7 @@ public class Plot { public void run() { String name = Plot.this.id + "," + Plot.this.area + ',' + MainUtil.getName(Plot.this.owner); boolean result = - SchematicHandler.manager.save(value, Settings.PATHS.SCHEMATICS + File.separator + name + ".schematic"); + SchematicHandler.manager.save(value, Settings.Paths.SCHEMATICS + File.separator + name + ".schematic"); if (whenDone != null) { whenDone.value = result; TaskManager.runTask(whenDone); @@ -2549,12 +2549,12 @@ public class Plot { } else { location = this.getDefaultHome(); } - if (Settings.TELEPORT.DELAY == 0 || Permissions.hasPermission(player, "plots.teleport.delay.bypass")) { + if (Settings.Teleport.DELAY == 0 || Permissions.hasPermission(player, "plots.teleport.delay.bypass")) { MainUtil.sendMessage(player, C.TELEPORTED_TO_PLOT); player.teleport(location); return true; } - MainUtil.sendMessage(player, C.TELEPORT_IN_SECONDS, Settings.TELEPORT.DELAY + ""); + MainUtil.sendMessage(player, C.TELEPORT_IN_SECONDS, Settings.Teleport.DELAY + ""); final String name = player.getName(); TaskManager.TELEPORT_QUEUE.add(name); TaskManager.runTaskLater(new Runnable() { @@ -2570,7 +2570,7 @@ public class Plot { player.teleport(location); } } - }, Settings.TELEPORT.DELAY * 20); + }, Settings.Teleport.DELAY * 20); return true; } return false; diff --git a/Core/src/main/java/com/intellectualcrafters/plot/object/PlotArea.java b/Core/src/main/java/com/intellectualcrafters/plot/object/PlotArea.java index af4ecd4b3..56169ae2b 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/object/PlotArea.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/object/PlotArea.java @@ -491,7 +491,7 @@ public abstract class PlotArea { } public int getPlotCount(UUID uuid) { - if (!Settings.DONE.COUNTS_TOWARDS_LIMIT) { + if (!Settings.Done.COUNTS_TOWARDS_LIMIT) { int count = 0; for (Plot plot : getPlotsAbs(uuid)) { if (!plot.hasFlag(Flags.DONE)) { diff --git a/Core/src/main/java/com/intellectualcrafters/plot/object/PlotBlock.java b/Core/src/main/java/com/intellectualcrafters/plot/object/PlotBlock.java index 5839cc97f..45da2b056 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/object/PlotBlock.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/object/PlotBlock.java @@ -14,18 +14,17 @@ public class PlotBlock { } } - public static PlotBlock get(int id, int data) { - return Settings.ENABLED_COMPONENTS.BLOCK_CACHE && data > 0 ? CACHE[(id << 4) + data] : new PlotBlock((short) id, (byte) data); - } - public final short id; public final byte data; - public PlotBlock(short id, byte data) { this.id = id; this.data = data; } + public static PlotBlock get(int id, int data) { + return Settings.Enabled_Components.BLOCK_CACHE && data > 0 ? CACHE[(id << 4) + data] : new PlotBlock((short) id, (byte) data); + } + @Override public boolean equals(Object obj) { if (this == obj) { diff --git a/Core/src/main/java/com/intellectualcrafters/plot/object/PlotManager.java b/Core/src/main/java/com/intellectualcrafters/plot/object/PlotManager.java index fba9305c6..1f0a9949b 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/object/PlotManager.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/object/PlotManager.java @@ -1,8 +1,8 @@ package com.intellectualcrafters.plot.object; import com.intellectualcrafters.plot.commands.Template; - import com.intellectualcrafters.plot.config.Settings; + import java.io.IOException; import java.util.ArrayList; import java.util.Collections; @@ -69,7 +69,7 @@ public abstract class PlotManager { public void exportTemplate(PlotArea plotArea) throws IOException { HashSet files = new HashSet<>( - Collections.singletonList(new FileBytes(Settings.PATHS.TEMPLATES + "/tmp-data.yml", Template.getBytes(plotArea)))); + Collections.singletonList(new FileBytes(Settings.Paths.TEMPLATES + "/tmp-data.yml", Template.getBytes(plotArea)))); Template.zipAll(plotArea.worldname, files); } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/object/PlotPlayer.java b/Core/src/main/java/com/intellectualcrafters/plot/object/PlotPlayer.java index 25f19afde..127faebc5 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/object/PlotPlayer.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/object/PlotPlayer.java @@ -7,11 +7,11 @@ import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.flag.Flags; import com.intellectualcrafters.plot.util.EconHandler; import com.intellectualcrafters.plot.util.EventUtil; -import com.intellectualcrafters.plot.util.expiry.ExpireManager; import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.PlotGameMode; import com.intellectualcrafters.plot.util.PlotWeather; import com.intellectualcrafters.plot.util.UUIDHandler; +import com.intellectualcrafters.plot.util.expiry.ExpireManager; import com.plotsquared.general.commands.CommandCaller; import java.util.HashMap; @@ -113,7 +113,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer { */ public Plot getCurrentPlot() { Plot value = (Plot) getMeta("lastplot"); - if (value == null && !Settings.ENABLED_COMPONENTS.EVENTS) { + if (value == null && !Settings.Enabled_Components.EVENTS) { return getLocation().getPlot(); } return value; @@ -125,7 +125,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer { * @return number of allowed plots within the scope (globally, or in the player's current world as defined in the settings.yml) */ public int getAllowedPlots() { - return Permissions.hasPermissionRange(this, "plots.plot", Settings.LIMIT.MAX_PLOTS); + return Permissions.hasPermissionRange(this, "plots.plot", Settings.Limit.MAX_PLOTS); } /** @@ -137,7 +137,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer { * @return number of plots within the scope (globally, or in the player's current world as defined in the settings.yml) */ public int getPlotCount() { - if (!Settings.LIMIT.GLOBAL) { + if (!Settings.Limit.GLOBAL) { return getPlotCount(getLocation().getWorld()); } final AtomicInteger count = new AtomicInteger(0); @@ -145,7 +145,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer { PS.get().foreachPlotArea(new RunnableVal() { @Override public void run(PlotArea value) { - if (!Settings.DONE.COUNTS_TOWARDS_LIMIT) { + if (!Settings.Done.COUNTS_TOWARDS_LIMIT) { for (Plot plot : value.getPlotsAbs(uuid)) { if (!plot.hasFlag(Flags.DONE)) { count.incrementAndGet(); @@ -168,7 +168,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer { UUID uuid = getUUID(); int count = 0; for (PlotArea area : PS.get().getPlotAreas(world)) { - if (!Settings.DONE.COUNTS_TOWARDS_LIMIT) { + if (!Settings.Done.COUNTS_TOWARDS_LIMIT) { for (Plot plot : area.getPlotsAbs(uuid)) { if (!plot.getFlag(Flags.DONE).isPresent()) { count++; @@ -347,7 +347,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer { if (plot != null) { EventUtil.manager.callLeave(this, plot); } - if (Settings.ENABLED_COMPONENTS.BAN_DELETER && isBanned()) { + if (Settings.Enabled_Components.BAN_DELETER && isBanned()) { for (Plot owned : getPlots()) { owned.deletePlot(null); PS.debug(String.format("&cPlot &6%s &cwas deleted + cleared due to &6%s&c getting banned", plot.getId(), getName())); diff --git a/Core/src/main/java/com/intellectualcrafters/plot/object/Rating.java b/Core/src/main/java/com/intellectualcrafters/plot/object/Rating.java index 3fbde5bd8..56cbf3f5b 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/object/Rating.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/object/Rating.java @@ -18,15 +18,15 @@ public class Rating { public Rating(int value) { this.initial = value; this.ratingMap = new HashMap<>(); - if (Settings.RATINGS.CATEGORIES != null && Settings.RATINGS.CATEGORIES.size() > 1) { + if (Settings.Ratings.CATEGORIES != null && Settings.Ratings.CATEGORIES.size() > 1) { if (value < 10) { - for (String ratingCategory : Settings.RATINGS.CATEGORIES) { + for (String ratingCategory : Settings.Ratings.CATEGORIES) { this.ratingMap.put(ratingCategory, value); } this.changed = true; return; } - for (String ratingCategory : Settings.RATINGS.CATEGORIES) { + for (String ratingCategory : Settings.Ratings.CATEGORIES) { this.ratingMap.put(ratingCategory, value % 10 - 1); value = value / 10; } @@ -66,10 +66,10 @@ public class Rating { if (!this.changed) { return this.initial; } - if (Settings.RATINGS.CATEGORIES != null && Settings.RATINGS.CATEGORIES.size() > 1) { + if (Settings.Ratings.CATEGORIES != null && Settings.Ratings.CATEGORIES.size() > 1) { int val = 0; - for (int i = 0; i < Settings.RATINGS.CATEGORIES.size(); i++) { - val += (i + 1) * Math.pow(10, this.ratingMap.get(Settings.RATINGS.CATEGORIES.get(i))); + for (int i = 0; i < Settings.Ratings.CATEGORIES.size(); i++) { + val += (i + 1) * Math.pow(10, this.ratingMap.get(Settings.Ratings.CATEGORIES.get(i))); } return val; } else { diff --git a/Core/src/main/java/com/intellectualcrafters/plot/util/BO3Handler.java b/Core/src/main/java/com/intellectualcrafters/plot/util/BO3Handler.java index d213a57a0..9b00cbc02 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/util/BO3Handler.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/util/BO3Handler.java @@ -289,9 +289,9 @@ public class BO3Handler { } public static File getBaseFile(String category) { - File base = MainUtil.getFile(PS.get().IMP.getDirectory(), Settings.PATHS.BO3 + File.separator + category + File.separator + "base.yml"); + File base = MainUtil.getFile(PS.get().IMP.getDirectory(), Settings.Paths.BO3 + File.separator + category + File.separator + "base.yml"); if (!base.exists()) { - PS.get().copyFile("base.yml", Settings.PATHS.BO3 + File.separator + category); + PS.get().copyFile("base.yml", Settings.Paths.BO3 + File.separator + category); } return base; } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/util/CommentManager.java b/Core/src/main/java/com/intellectualcrafters/plot/util/CommentManager.java index 2785f304b..3ce8b2df1 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/util/CommentManager.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/util/CommentManager.java @@ -21,7 +21,7 @@ public class CommentManager { public static final HashMap inboxes = new HashMap<>(); public static void sendTitle(final PlotPlayer player, final Plot plot) { - if (!Settings.ENABLED_COMPONENTS.COMMENT_NOTIFIER || !plot.isOwner(player.getUUID())) { + if (!Settings.Enabled_Components.COMMENT_NOTIFIER || !plot.isOwner(player.getUUID())) { return; } TaskManager.runTaskLaterAsync(new Runnable() { diff --git a/Core/src/main/java/com/intellectualcrafters/plot/util/EventUtil.java b/Core/src/main/java/com/intellectualcrafters/plot/util/EventUtil.java index 78dc4f945..3feedba99 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/util/EventUtil.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/util/EventUtil.java @@ -67,11 +67,11 @@ public abstract class EventUtil { MainUtil.sendMessage(player, C.WORLDEDIT_BYPASSED); } } - if (PS.get().update != null && Permissions.hasPermission(player, C.PERMISSION_ADMIN_UPDATE) && Settings.ENABLED_COMPONENTS.UPDATER) { + if (PS.get().update != null && Permissions.hasPermission(player, C.PERMISSION_ADMIN_UPDATE) && Settings.Enabled_Components.UPDATER) { MainUtil.sendMessage(player, "&6An update for PlotSquared is available: &7/plot update"); } final Plot plot = player.getCurrentPlot(); - if (Settings.TELEPORT.ON_LOGIN && plot != null) { + if (Settings.Teleport.ON_LOGIN && plot != null) { TaskManager.runTask(new Runnable() { @Override public void run() { @@ -84,7 +84,7 @@ public abstract class EventUtil { public void doRespawnTask(final PlotPlayer player) { final Plot plot = player.getCurrentPlot(); - if (Settings.TELEPORT.ON_DEATH && plot != null) { + if (Settings.Teleport.ON_DEATH && plot != null) { TaskManager.runTask(new Runnable() { @Override public void run() { diff --git a/Core/src/main/java/com/intellectualcrafters/plot/util/HttpUtil.java b/Core/src/main/java/com/intellectualcrafters/plot/util/HttpUtil.java index 55972eb1e..1769f67ec 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/util/HttpUtil.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/util/HttpUtil.java @@ -10,7 +10,7 @@ import java.net.URL; public class HttpUtil { public static String readUrl(String urlString) { - try (BufferedReader reader = new BufferedReader(new InputStreamReader(new URL(urlString).openStream()))){ + try (BufferedReader reader = new BufferedReader(new InputStreamReader(new URL(urlString).openStream()))) { StringBuilder buffer = new StringBuilder(); int read; char[] chars = new char[1024]; diff --git a/Core/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java b/Core/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java index feda1a1e4..6630bd7a1 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java @@ -19,6 +19,7 @@ import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PseudoRandom; import com.intellectualcrafters.plot.object.RegionWrapper; import com.intellectualcrafters.plot.object.RunnableVal; + import java.io.File; import java.io.IOException; import java.io.OutputStream; @@ -123,15 +124,15 @@ public class MainUtil { final String website; if (uuid == null) { uuid = UUID.randomUUID(); - website = Settings.WEB.URL + "upload.php?" + uuid; + website = Settings.Web.URL + "upload.php?" + uuid; filename = "plot." + extension; } else { - website = Settings.WEB.URL + "save.php?" + uuid; + website = Settings.Web.URL + "save.php?" + uuid; filename = file + '.' + extension; } final URL url; try { - url = new URL(Settings.WEB.URL + "?key=" + uuid + "&ip=" + Settings.WEB.SERVER_IP + "&type=" + extension); + url = new URL(Settings.Web.URL + "?key=" + uuid + "&ip=" + Settings.Web.SERVER_IP + "&type=" + extension); } catch (MalformedURLException e) { e.printStackTrace(); whenDone.run(); @@ -663,14 +664,14 @@ public class MainUtil { HashMap rating; if (plot.getSettings().ratings != null) { rating = plot.getSettings().ratings; - } else if (Settings.ENABLED_COMPONENTS.RATING_CACHE) { + } else if (Settings.Enabled_Components.RATING_CACHE) { rating = new HashMap<>(); } else { rating = DBFunc.getRatings(plot); } int size = 1; - if (!Settings.RATINGS.CATEGORIES.isEmpty()) { - size = Math.max(1, Settings.RATINGS.CATEGORIES.size()); + if (!Settings.Ratings.CATEGORIES.isEmpty()) { + size = Math.max(1, Settings.Ratings.CATEGORIES.size()); } double[] ratings = new double[size]; if (rating == null || rating.isEmpty()) { @@ -678,10 +679,10 @@ public class MainUtil { } for (Entry entry : rating.entrySet()) { int current = entry.getValue(); - if (Settings.RATINGS.CATEGORIES.isEmpty()) { + if (Settings.Ratings.CATEGORIES.isEmpty()) { ratings[0] += current; } else { - for (int i = 0; i < Settings.RATINGS.CATEGORIES.size(); i++) { + for (int i = 0; i < Settings.Ratings.CATEGORIES.size(); i++) { ratings[i] += current % 10 - 1; current /= 10; } @@ -739,7 +740,7 @@ public class MainUtil { String members = getPlayerList(plot.getMembers()); String denied = getPlayerList(plot.getDenied()); String expires = C.UNKNOWN.s(); - if (Settings.ENABLED_COMPONENTS.PLOT_EXPIRY) { + if (Settings.Enabled_Components.PLOT_EXPIRY) { if (plot.hasOwner()) { Optional keep = plot.getFlag(Flags.KEEP); if (keep.isPresent()) { @@ -803,11 +804,11 @@ public class MainUtil { @Override public void run() { int max = 10; - if (Settings.RATINGS.CATEGORIES != null && !Settings.RATINGS.CATEGORIES.isEmpty()) { + if (Settings.Ratings.CATEGORIES != null && !Settings.Ratings.CATEGORIES.isEmpty()) { max = 8; } String info; - if (full && Settings.RATINGS.CATEGORIES != null && Settings.RATINGS.CATEGORIES.size() > 1) { + if (full && Settings.Ratings.CATEGORIES != null && Settings.Ratings.CATEGORIES.size() > 1) { double[] ratings = MainUtil.getAverageRatings(plot); for (double v : ratings) { @@ -816,7 +817,7 @@ public class MainUtil { String rating = ""; String prefix = ""; for (int i = 0; i < ratings.length; i++) { - rating += prefix + Settings.RATINGS.CATEGORIES.get(i) + '=' + String.format("%.1f", ratings[i]); + rating += prefix + Settings.Ratings.CATEGORIES.get(i) + '=' + String.format("%.1f", ratings[i]); prefix = ","; } info = newInfo.replaceAll("%rating%", rating); diff --git a/Core/src/main/java/com/intellectualcrafters/plot/util/Permissions.java b/Core/src/main/java/com/intellectualcrafters/plot/util/Permissions.java index a895e9f5c..b97c0ed9d 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/util/Permissions.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/util/Permissions.java @@ -31,7 +31,7 @@ public class Permissions { * @return */ public static boolean hasPermission(PlotPlayer player, String permission) { - if (!Settings.ENABLED_COMPONENTS.PERMISSION_CACHE) { + if (!Settings.Enabled_Components.PERMISSION_CACHE) { return hasPermission((CommandCaller) player, permission); } HashMap map = player.getMeta("perm"); @@ -93,7 +93,7 @@ public class Permissions { /** * Check the the highest permission a PlotPlayer has within a specified range.
* - Excessively high values will lag
- * - The default range that is checked is {@link Settings#LIMIT#MAX_PLOTS}
+ * - The default range that is checked is {@link Settings.Limit#MAX_PLOTS}
* @param player * @param stub The permission stub to check e.g. for `plots.plot.#` the stub is `plots.plot` * @param range The range to check diff --git a/Core/src/main/java/com/intellectualcrafters/plot/util/SchematicHandler.java b/Core/src/main/java/com/intellectualcrafters/plot/util/SchematicHandler.java index 0978d0685..c99ed8659 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/util/SchematicHandler.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/util/SchematicHandler.java @@ -87,7 +87,7 @@ public abstract class SchematicHandler { } final String directory; if (outputDir == null) { - directory = Settings.PATHS.SCHEMATICS; + directory = Settings.Paths.SCHEMATICS; } else { directory = outputDir.getAbsolutePath(); } @@ -451,14 +451,14 @@ public abstract class SchematicHandler { * @return schematic if found, else null */ public Schematic getSchematic(String name) { - File parent = MainUtil.getFile(PS.get().IMP.getDirectory(), Settings.PATHS.SCHEMATICS); + File parent = MainUtil.getFile(PS.get().IMP.getDirectory(), Settings.Paths.SCHEMATICS); if (!parent.exists()) { if (!parent.mkdir()) { throw new RuntimeException("Could not create schematic parent directory"); } } File file = MainUtil.getFile(PS.get().IMP.getDirectory(), - Settings.PATHS.SCHEMATICS + File.separator + name + (name.endsWith(".schematic") ? "" : ".schematic")); + Settings.Paths.SCHEMATICS + File.separator + name + (name.endsWith(".schematic") ? "" : ".schematic")); return getSchematic(file); } @@ -512,7 +512,7 @@ public abstract class SchematicHandler { public List getSaves(UUID uuid) { StringBuilder rawJSON = new StringBuilder(); try { - String website = Settings.WEB.URL + "list.php?" + uuid.toString(); + String website = Settings.Web.URL + "list.php?" + uuid.toString(); URL url = new URL(website); URLConnection connection = new URL(url.toString()).openConnection(); connection.setRequestProperty("User-Agent", "Mozilla/5.0"); diff --git a/Core/src/main/java/com/intellectualcrafters/plot/util/expiry/ExpiryTask.java b/Core/src/main/java/com/intellectualcrafters/plot/util/expiry/ExpiryTask.java index 85871d850..0c1dbd13b 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/util/expiry/ExpiryTask.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/util/expiry/ExpiryTask.java @@ -2,12 +2,13 @@ package com.intellectualcrafters.plot.util.expiry; import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.object.PlotArea; + import java.util.concurrent.TimeUnit; public class ExpiryTask { - private final Settings.AUTO_CLEAR settings; + private final Settings.Auto_Clear settings; - public ExpiryTask(Settings.AUTO_CLEAR settings) { + public ExpiryTask(Settings.Auto_Clear settings) { this.settings = settings; } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/util/expiry/PlotAnalysis.java b/Core/src/main/java/com/intellectualcrafters/plot/util/expiry/PlotAnalysis.java index 4a4c69695..9e90bbe56 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/util/expiry/PlotAnalysis.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/util/expiry/PlotAnalysis.java @@ -32,7 +32,7 @@ public class PlotAnalysis { public int variety_sd; private int complexity; - public static PlotAnalysis getAnalysis(Plot plot, Settings.AUTO_CLEAR settings) { + public static PlotAnalysis getAnalysis(Plot plot, Settings.Auto_Clear settings) { Optional> flag = plot.getFlag(Flags.ANALYSIS); if (flag.isPresent()) { PlotAnalysis analysis = new PlotAnalysis(); @@ -207,7 +207,7 @@ public class PlotAnalysis { PS.debug(" - The analyzed plots which were processed and put into bulk data will be compared and correlated to the plot ranking"); PS.debug(" - The calculated correlation constant will then be used to calibrate the threshold for auto plot clearing"); - Settings.AUTO_CLEAR settings = new Settings.AUTO_CLEAR(); + Settings.Auto_Clear settings = new Settings.Auto_Clear(); int[] rankChanges = rank(changes); int[] sdChanges = getSD(rankChanges, rankRatings); @@ -527,8 +527,8 @@ public class PlotAnalysis { this.variety_sd); } - public int getComplexity(Settings.AUTO_CLEAR settings) { - Settings.AUTO_CLEAR.CALIBRATION modifiers = settings.CALIBRATION; + public int getComplexity(Settings.Auto_Clear settings) { + Settings.Auto_Clear.CALIBRATION modifiers = settings.CALIBRATION; if (this.complexity != 0) { return this.complexity; } diff --git a/Core/src/main/java/com/plotsquared/listener/PlotListener.java b/Core/src/main/java/com/plotsquared/listener/PlotListener.java index 1157c0ddf..efcedfdaf 100644 --- a/Core/src/main/java/com/plotsquared/listener/PlotListener.java +++ b/Core/src/main/java/com/plotsquared/listener/PlotListener.java @@ -14,7 +14,6 @@ import com.intellectualcrafters.plot.object.RunnableVal; import com.intellectualcrafters.plot.util.AbstractTitle; import com.intellectualcrafters.plot.util.CommentManager; import com.intellectualcrafters.plot.util.EventUtil; -import com.intellectualcrafters.plot.util.expiry.ExpireManager; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.PlotGameMode; @@ -22,6 +21,7 @@ import com.intellectualcrafters.plot.util.PlotWeather; import com.intellectualcrafters.plot.util.StringMan; import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualcrafters.plot.util.UUIDHandler; +import com.intellectualcrafters.plot.util.expiry.ExpireManager; import java.util.HashMap; import java.util.Map; diff --git a/Core/src/main/java/com/plotsquared/listener/ProcessedWEExtent.java b/Core/src/main/java/com/plotsquared/listener/ProcessedWEExtent.java index 72c6432d0..3b76d39dc 100644 --- a/Core/src/main/java/com/plotsquared/listener/ProcessedWEExtent.java +++ b/Core/src/main/java/com/plotsquared/listener/ProcessedWEExtent.java @@ -14,6 +14,7 @@ import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.NullExtent; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.biome.BaseBiome; + import java.lang.reflect.Field; import java.util.HashSet; @@ -92,7 +93,7 @@ public class ProcessedWEExtent extends AbstractDelegateExtent { return false; } this.BScount++; - if (this.BScount > Settings.CHUNK_PROCESSOR.MAX_TILES) { + if (this.BScount > Settings.Chunk_Processor.MAX_TILES) { this.BSblocked = true; PS.debug("&cPlotSquared detected unsafe WorldEdit: " + location.getBlockX() + "," + location.getBlockZ()); } @@ -243,7 +244,7 @@ public class ProcessedWEExtent extends AbstractDelegateExtent { return null; } this.Ecount++; - if (this.Ecount > Settings.CHUNK_PROCESSOR.MAX_ENTITIES) { + if (this.Ecount > Settings.Chunk_Processor.MAX_ENTITIES) { this.Eblocked = true; PS.debug("&cPlotSquared detected unsafe WorldEdit: " + location.getBlockX() + "," + location.getBlockZ()); } diff --git a/Core/src/main/java/com/plotsquared/listener/WEManager.java b/Core/src/main/java/com/plotsquared/listener/WEManager.java index e6f7dbe6f..4a035457d 100644 --- a/Core/src/main/java/com/plotsquared/listener/WEManager.java +++ b/Core/src/main/java/com/plotsquared/listener/WEManager.java @@ -9,6 +9,7 @@ import com.intellectualcrafters.plot.object.PlotArea; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.RegionWrapper; import com.sk89q.worldedit.blocks.BaseBlock; + import java.util.HashSet; import java.util.UUID; @@ -48,7 +49,7 @@ public class WEManager { return regions; } for (Plot plot : area.getPlots()) { - if (!plot.isBasePlot() || (Settings.DONE.RESTRICT_BUILDING && (plot.getFlag(Flags.DONE).isPresent()))) { + if (!plot.isBasePlot() || (Settings.Done.RESTRICT_BUILDING && (plot.getFlag(Flags.DONE).isPresent()))) { continue; } boolean allowMember = player.hasPermission("plots.worldedit.member"); diff --git a/Core/src/main/java/com/plotsquared/listener/WESubscriber.java b/Core/src/main/java/com/plotsquared/listener/WESubscriber.java index 9079c0cfd..5f3ec1b18 100644 --- a/Core/src/main/java/com/plotsquared/listener/WESubscriber.java +++ b/Core/src/main/java/com/plotsquared/listener/WESubscriber.java @@ -17,6 +17,7 @@ import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.eventbus.EventHandler.Priority; import com.sk89q.worldedit.util.eventbus.Subscribe; import com.sk89q.worldedit.world.World; + import java.util.HashSet; public class WESubscriber { @@ -61,7 +62,7 @@ public class WESubscriber { return; } } - if (Settings.ENABLED_COMPONENTS.CHUNK_PROCESSOR) { + if (Settings.Enabled_Components.CHUNK_PROCESSOR) { if (PS.get().hasPlotArea(world)) { event.setExtent(new ProcessedWEExtent(world, mask, event.getMaxBlocks(), event.getExtent(), event.getExtent())); } diff --git a/Sponge/src/main/java/com/plotsquared/sponge/SpongeMain.java b/Sponge/src/main/java/com/plotsquared/sponge/SpongeMain.java index 8d28a060a..0466dc3f7 100644 --- a/Sponge/src/main/java/com/plotsquared/sponge/SpongeMain.java +++ b/Sponge/src/main/java/com/plotsquared/sponge/SpongeMain.java @@ -52,12 +52,6 @@ import com.plotsquared.sponge.util.block.SlowQueue; import com.plotsquared.sponge.uuid.SpongeLowerOfflineUUIDWrapper; import com.plotsquared.sponge.uuid.SpongeOnlineUUIDWrapper; import com.plotsquared.sponge.uuid.SpongeUUIDHandler; -import java.io.File; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.UUID; -import java.util.stream.Collectors; import org.slf4j.Logger; import org.spongepowered.api.Game; import org.spongepowered.api.Server; @@ -74,7 +68,14 @@ import org.spongepowered.api.world.World; import org.spongepowered.api.world.gen.GenerationPopulator; 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; +import java.util.UUID; +import java.util.stream.Collectors; @Plugin(id = "plotsquared", name = "PlotSquared", description = "Easy, yet powerful Plot World generation and management.", url = "https://github.com/IntellectualSites/PlotSquared", version = "3.3.3") @@ -134,7 +135,7 @@ public class SpongeMain implements IPlotMain { @Override public void log(String message) { message = C.format(message, C.replacements); - if (!Settings.CHAT.CONSOLE_COLOR) { + if (!Settings.Chat.CONSOLE_COLOR) { message = message.replaceAll('\u00a7' + "[a-z|0-9]", ""); } if (this.server == null) { diff --git a/Sponge/src/main/java/com/plotsquared/sponge/listener/MainListener.java b/Sponge/src/main/java/com/plotsquared/sponge/listener/MainListener.java index 9c222cd87..fa8d13584 100644 --- a/Sponge/src/main/java/com/plotsquared/sponge/listener/MainListener.java +++ b/Sponge/src/main/java/com/plotsquared/sponge/listener/MainListener.java @@ -95,7 +95,7 @@ public class MainListener { if (source == null) { return; } - if (Settings.PLOTME.ALIAS) { + if (Settings.PlotMe.ALIAS) { SpongeMain.THIS.getGame().getCommandManager().process(source, ("plots " + event.getArguments()).trim()); } else { source.sendMessage(SpongeUtil.getText(C.NOT_USING_PLOTME.s()));