diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/BukkitMain.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/BukkitMain.java index 22ecb54aa..45efce06b 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/BukkitMain.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/BukkitMain.java @@ -11,7 +11,7 @@ import com.github.intellectualsites.plotsquared.bukkit.util.block.*; import com.github.intellectualsites.plotsquared.bukkit.uuid.*; import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection; import com.github.intellectualsites.plotsquared.plot.IPlotMain; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.C; import com.github.intellectualsites.plotsquared.plot.config.ConfigurationNode; import com.github.intellectualsites.plotsquared.plot.config.Settings; @@ -124,8 +124,8 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain } } catch (NumberFormatException e) { e.printStackTrace(); - PS.debug(StringMan.getString(Bukkit.getBukkitVersion())); - PS.debug(StringMan.getString(Bukkit.getBukkitVersion().split("-")[0].split("\\."))); + PlotSquared.debug(StringMan.getString(Bukkit.getBukkitVersion())); + PlotSquared.debug(StringMan.getString(Bukkit.getBukkitVersion().split("-")[0].split("\\."))); return new int[] {1, 13, 0}; } } @@ -138,12 +138,12 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain } this.pluginName = getDescription().getName(); getServer().getName(); - new PS(this, "Bukkit"); + new PlotSquared(this, "Bukkit"); if (Settings.Enabled_Components.METRICS) { new Metrics(this).start(); - PS.log(C.PREFIX + "&6Metrics enabled."); + PlotSquared.log(C.PREFIX + "&6Metrics enabled."); } else { - PS.log(C.CONSOLE_PLEASE_ENABLE_METRICS.f(getPluginName())); + PlotSquared.log(C.CONSOLE_PLEASE_ENABLE_METRICS.f(getPluginName())); } if (Settings.Enabled_Components.WORLDS) { TaskManager.IMP.taskRepeat(new Runnable() { @@ -171,7 +171,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain ignore.printStackTrace(); } } - final PlotAreaManager manager = PS.get().getPlotAreaManager(); + final PlotAreaManager manager = PlotSquared.get().getPlotAreaManager(); if (manager instanceof SinglePlotAreaManager) { long start = System.currentTimeMillis(); final SinglePlotArea area = ((SinglePlotAreaManager) manager).getArea(); @@ -200,7 +200,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain final Chunk[] chunks = world.getLoadedChunks(); if (chunks.length == 0) { if (!Bukkit.unloadWorld(world, true)) { - PS.debug("Failed to unload " + world.getName()); + PlotSquared.debug("Failed to unload " + world.getName()); } return; } else { @@ -236,7 +236,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain } @Override public void onDisable() { - PS.get().disable(); + PlotSquared.get().disable(); Bukkit.getScheduler().cancelTasks(this); } @@ -291,10 +291,10 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain } @Override @SuppressWarnings("deprecation") public void runEntityTask() { - PS.log(C.PREFIX + "KillAllEntities started."); + PlotSquared.log(C.PREFIX + "KillAllEntities started."); TaskManager.runTaskRepeat(new Runnable() { @Override public void run() { - PS.get().foreachPlotArea(new RunnableVal() { + PlotSquared.get().foreachPlotArea(new RunnableVal() { @Override public void run(PlotArea plotArea) { final World world = Bukkit.getWorld(plotArea.worldname); try { @@ -522,7 +522,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain if (currentPlotId != null) { entity.setMetadata("plot", new FixedMetadataValue( - (Plugin) PS.get().IMP, + (Plugin) PlotSquared.get().IMP, currentPlotId)); } } @@ -549,8 +549,8 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain if (id != null && id.equalsIgnoreCase("single")) { result = new SingleWorldGenerator(); } else { - result = PS.get().IMP.getDefaultGenerator(); - if (!PS.get().setupPlotWorld(world, id, result)) { + result = PlotSquared.get().IMP.getDefaultGenerator(); + if (!PlotSquared.get().setupPlotWorld(world, id, result)) { return null; } } @@ -565,30 +565,30 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain Class.forName("org.bukkit.event.entity.EntitySpawnEvent"); getServer().getPluginManager().registerEvents(new EntitySpawnListener(), this); } catch (final NoSuchMethodException | ClassNotFoundException ignored) { - PS.debug("Not running Spigot. Skipping EntitySpawnListener event."); + PlotSquared.debug("Not running Spigot. Skipping EntitySpawnListener event."); } - if (PS.get().checkVersion(getServerVersion(), 1, 7, 9)) { + if (PlotSquared.get().checkVersion(getServerVersion(), 1, 7, 9)) { try { getServer().getPluginManager().registerEvents(new EntityPortal_1_7_9(), this); } catch (Throwable e) { e.printStackTrace(); } } - if (PS.get().checkVersion(getServerVersion(), BukkitVersion.v1_8_0)) { + if (PlotSquared.get().checkVersion(getServerVersion(), BukkitVersion.v1_8_0)) { try { getServer().getPluginManager().registerEvents(new PlayerEvents_1_8(), this); } catch (Throwable e) { e.printStackTrace(); } } - if (PS.get().checkVersion(getServerVersion(), BukkitVersion.v1_8_3)) { + if (PlotSquared.get().checkVersion(getServerVersion(), BukkitVersion.v1_8_3)) { try { getServer().getPluginManager().registerEvents(new PlayerEvents183(), this); } catch (Throwable e) { e.printStackTrace(); } } - if (PS.get().checkVersion(getServerVersion(), BukkitVersion.v1_9_0)) { + if (PlotSquared.get().checkVersion(getServerVersion(), BukkitVersion.v1_9_0)) { try { getServer().getPluginManager().registerEvents(new PlayerEvents_1_9(main), this); } catch (Throwable e) { @@ -604,7 +604,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain @Override public void registerPlotPlusEvents() { PlotPlusListener.startRunnable(this); getServer().getPluginManager().registerEvents(new PlotPlusListener(), this); - if (PS.get().checkVersion(getServerVersion(), BukkitVersion.v1_12_0)) { + if (PlotSquared.get().checkVersion(getServerVersion(), BukkitVersion.v1_12_0)) { getServer().getPluginManager().registerEvents(new PlotPlusListener_1_12(), this); } else { getServer().getPluginManager().registerEvents(new PlotPlusListener_Legacy(), this); @@ -629,7 +629,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain return econ; } } catch (Throwable ignored) { - PS.debug("No economy detected!"); + PlotSquared.debug("No economy detected!"); } return null; } @@ -639,20 +639,20 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain new SendChunk(); MainUtil.canSendChunk = true; } catch (ClassNotFoundException | NoSuchFieldException | NoSuchMethodException e) { - PS.debug( + PlotSquared.debug( SendChunk.class + " does not support " + StringMan.getString(getServerVersion())); MainUtil.canSendChunk = false; } - if (PS.get().checkVersion(getServerVersion(), BukkitVersion.v1_13_0)) { + if (PlotSquared.get().checkVersion(getServerVersion(), BukkitVersion.v1_13_0)) { return QueueProvider.of(BukkitLocalQueue.class, BukkitLocalQueue.class); } - if (PS.get().checkVersion(getServerVersion(), BukkitVersion.v1_9_0)) { + if (PlotSquared.get().checkVersion(getServerVersion(), BukkitVersion.v1_9_0)) { return QueueProvider.of(BukkitLocalQueue_1_9.class, BukkitLocalQueue.class); } - if (PS.get().checkVersion(getServerVersion(), BukkitVersion.v1_8_3)) { + if (PlotSquared.get().checkVersion(getServerVersion(), BukkitVersion.v1_8_3)) { return QueueProvider.of(BukkitLocalQueue_1_8_3.class, BukkitLocalQueue.class); } - if (PS.get().checkVersion(getServerVersion(), BukkitVersion.v1_8_0)) { + if (PlotSquared.get().checkVersion(getServerVersion(), BukkitVersion.v1_8_0)) { return QueueProvider.of(BukkitLocalQueue_1_8.class, BukkitLocalQueue.class); } return QueueProvider.of(BukkitLocalQueue_1_7.class, BukkitLocalQueue.class); @@ -683,7 +683,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain } return new BukkitPlotGenerator(world, gen); } else { - return new BukkitPlotGenerator(PS.get().IMP.getDefaultGenerator()); + return new BukkitPlotGenerator(PlotSquared.get().IMP.getDefaultGenerator()); } } @@ -722,7 +722,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain Settings.UUID.OFFLINE = true; } if (!checkVersion) { - PS.log(C.PREFIX + PlotSquared.log(C.PREFIX + " &c[WARN] Titles are disabled - please update your version of Bukkit to support this feature."); Settings.TITLES = false; } else { @@ -733,11 +733,11 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain } } if (Settings.UUID.OFFLINE) { - PS.log(C.PREFIX + " &6" + getPluginName() + PlotSquared.log(C.PREFIX + " &6" + getPluginName() + " is using Offline Mode UUIDs either because of user preference, or because you are using an old version of " + "Bukkit"); } else { - PS.log(C.PREFIX + " &6" + getPluginName() + " is using online UUIDs"); + PlotSquared.log(C.PREFIX + " &6" + getPluginName() + " is using online UUIDs"); } if (Settings.UUID.USE_SQLUUIDHANDLER) { return new SQLUUIDHandler(wrapper); @@ -776,7 +776,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain @Override public void startMetrics() { new Metrics(this).start(); - PS.log(C.PREFIX + "&6Metrics enabled."); + PlotSquared.log(C.PREFIX + "&6Metrics enabled."); } @Override public void setGenerator(@NonNull final String worldName) { @@ -784,7 +784,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain if (world == null) { // create world ConfigurationSection worldConfig = - PS.get().worlds.getConfigurationSection("worlds." + worldName); + PlotSquared.get().worlds.getConfigurationSection("worlds." + worldName); String manager = worldConfig.getString("generator.plugin", getPluginName()); SetupObject setup = new SetupObject(); setup.plotManager = manager; @@ -797,22 +797,22 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain world = Bukkit.getWorld(worldName); } else { try { - if (!PS.get().hasPlotArea(worldName)) { + if (!PlotSquared.get().hasPlotArea(worldName)) { SetGenCB.setGenerator(BukkitUtil.getWorld(worldName)); } } catch (Exception ignored) { - PS.log("Failed to reload world: " + world + " | " + ignored.getMessage()); + PlotSquared.log("Failed to reload world: " + world + " | " + ignored.getMessage()); Bukkit.getServer().unloadWorld(world, false); return; } } ChunkGenerator gen = world.getGenerator(); if (gen instanceof BukkitPlotGenerator) { - PS.get().loadWorld(worldName, (BukkitPlotGenerator) gen); + PlotSquared.get().loadWorld(worldName, (BukkitPlotGenerator) gen); } else if (gen != null) { - PS.get().loadWorld(worldName, new BukkitPlotGenerator(worldName, gen)); - } else if (PS.get().worlds.contains("worlds." + worldName)) { - PS.get().loadWorld(worldName, null); + PlotSquared.get().loadWorld(worldName, new BukkitPlotGenerator(worldName, gen)); + } else if (PlotSquared.get().worlds.contains("worlds." + worldName)) { + PlotSquared.get().loadWorld(worldName, null); } } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/commands/DebugUUID.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/commands/DebugUUID.java index df30144a5..e53c69b02 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/commands/DebugUUID.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/commands/DebugUUID.java @@ -6,7 +6,7 @@ import com.github.intellectualsites.plotsquared.bukkit.uuid.LowerOfflineUUIDWrap import com.github.intellectualsites.plotsquared.bukkit.uuid.OfflineUUIDWrapper; import com.github.intellectualsites.plotsquared.commands.Argument; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.commands.CommandCategory; import com.github.intellectualsites.plotsquared.plot.commands.RequiredType; import com.github.intellectualsites.plotsquared.plot.commands.SubCommand; @@ -180,7 +180,7 @@ public class DebugUUID extends SubCommand { MainUtil.sendMessage(player, "&7 - Scanning for applicable files (uuids.txt)"); - File file = new File(PS.get().IMP.getDirectory(), "uuids.txt"); + File file = new File(PlotSquared.get().IMP.getDirectory(), "uuids.txt"); if (file.exists()) { try { List lines = @@ -220,7 +220,7 @@ public class DebugUUID extends SubCommand { MainUtil.sendMessage(player, "&7 - Updating plot objects"); - for (Plot plot : PS.get().getPlots()) { + for (Plot plot : PlotSquared.get().getPlots()) { UUID value = uCMap.get(plot.owner); if (value != null) { plot.owner = value; @@ -239,13 +239,13 @@ public class DebugUUID extends SubCommand { DBFunc.createTables(); if (!result) { MainUtil.sendMessage(player, "&cConversion failed! Attempting recovery"); - for (Plot plot : PS.get().getPlots()) { + for (Plot plot : PlotSquared.get().getPlots()) { UUID value = uCReverse.get(plot.owner); if (value != null) { plot.owner = value; } } - DBFunc.createPlotsAndData(new ArrayList<>(PS.get().getPlots()), + DBFunc.createPlotsAndData(new ArrayList<>(PlotSquared.get().getPlots()), new Runnable() { @Override public void run() { MainUtil.sendMessage(player, "&6Recovery was successful!"); @@ -259,14 +259,14 @@ public class DebugUUID extends SubCommand { } if (newWrapper instanceof OfflineUUIDWrapper) { - PS.get().worlds.set("UUID.force-lowercase", false); - PS.get().worlds.set("UUID.offline", true); + PlotSquared.get().worlds.set("UUID.force-lowercase", false); + PlotSquared.get().worlds.set("UUID.offline", true); } else if (newWrapper instanceof DefaultUUIDWrapper) { - PS.get().worlds.set("UUID.force-lowercase", false); - PS.get().worlds.set("UUID.offline", false); + PlotSquared.get().worlds.set("UUID.force-lowercase", false); + PlotSquared.get().worlds.set("UUID.offline", false); } try { - PS.get().worlds.save(PS.get().worldsFile); + PlotSquared.get().worlds.save(PlotSquared.get().worldsFile); } catch (IOException ignored) { MainUtil.sendMessage(player, "Could not save configuration. It will need to be manual set!"); @@ -276,7 +276,7 @@ public class DebugUUID extends SubCommand { TaskManager.runTaskAsync(new Runnable() { @Override public void run() { - ArrayList plots = new ArrayList<>(PS.get().getPlots()); + ArrayList plots = new ArrayList<>(PlotSquared.get().getPlots()); DBFunc.createPlotsAndData(plots, new Runnable() { @Override public void run() { MainUtil.sendMessage(player, "&aConversion complete!"); diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/database/plotme/APlotMeConnector.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/database/plotme/APlotMeConnector.java index 740307ad7..c55020080 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/database/plotme/APlotMeConnector.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/database/plotme/APlotMeConnector.java @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.database.plotme; import com.github.intellectualsites.plotsquared.configuration.file.FileConfiguration; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotId; @@ -27,23 +27,23 @@ public abstract class APlotMeConnector { public void copyConfig(FileConfiguration plotConfig, String world, String actualWorldName) { int pathWidth = plotConfig.getInt("worlds." + world + ".PathWidth"); // - PS.get().worlds.set("worlds." + actualWorldName + ".road.width", pathWidth); + PlotSquared.get().worlds.set("worlds." + actualWorldName + ".road.width", pathWidth); int plotSize = plotConfig.getInt("worlds." + world + ".PlotSize"); // - PS.get().worlds.set("worlds." + actualWorldName + ".plot.size", plotSize); + PlotSquared.get().worlds.set("worlds." + actualWorldName + ".plot.size", plotSize); String wallBlock = plotConfig.getString("worlds." + world + ".WallBlockId"); // - PS.get().worlds.set("worlds." + actualWorldName + ".wall.block", wallBlock); + PlotSquared.get().worlds.set("worlds." + actualWorldName + ".wall.block", wallBlock); String floor = plotConfig.getString("worlds." + world + ".PlotFloorBlockId"); // - PS.get().worlds + PlotSquared.get().worlds .set("worlds." + actualWorldName + ".plot.floor", Collections.singletonList(floor)); String filling = plotConfig.getString("worlds." + world + ".PlotFillingBlockId"); // - PS.get().worlds + PlotSquared.get().worlds .set("worlds." + actualWorldName + ".plot.filling", Collections.singletonList(filling)); String road = plotConfig.getString("worlds." + world + ".RoadMainBlockId"); - PS.get().worlds.set("worlds." + actualWorldName + ".road.block", road); + PlotSquared.get().worlds.set("worlds." + actualWorldName + ".road.block", road); int height = plotConfig.getInt("worlds." + world + ".RoadHeight"); // - PS.get().worlds.set("worlds." + actualWorldName + ".road.height", height); - PS.get().worlds.set("worlds." + actualWorldName + ".plot.height", height); - PS.get().worlds.set("worlds." + actualWorldName + ".wall.height", height); + PlotSquared.get().worlds.set("worlds." + actualWorldName + ".road.height", height); + PlotSquared.get().worlds.set("worlds." + actualWorldName + ".plot.height", height); + PlotSquared.get().worlds.set("worlds." + actualWorldName + ".wall.height", height); } public Location getPlotTopLocAbs(int path, int plot, PlotId plotId) { diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/database/plotme/ClassicPlotMeConnector.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/database/plotme/ClassicPlotMeConnector.java index 17aaa2073..7016fabc8 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/database/plotme/ClassicPlotMeConnector.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/database/plotme/ClassicPlotMeConnector.java @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.database.plotme; import com.github.intellectualsites.plotsquared.configuration.file.FileConfiguration; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.database.SQLite; @@ -68,8 +68,8 @@ public class ClassicPlotMeConnector extends APlotMeConnector { if (!plots.containsKey(world)) { plots.put(world, new HashMap()); if (merge) { - int plot = PS.get().worlds.getInt("worlds." + world + ".plot.size"); - int path = PS.get().worlds.getInt("worlds." + world + ".road.width"); + int plot = PlotSquared.get().worlds.getInt("worlds." + world + ".plot.size"); + int path = PlotSquared.get().worlds.getInt("worlds." + world + ".road.width"); plotWidth.put(world, plot); roadWidth.put(world, path); merges.put(world, new HashMap()); @@ -113,7 +113,8 @@ public class ClassicPlotMeConnector extends APlotMeConnector { } } if (name.isEmpty()) { - PS.log("&cCould not identify owner for plot: " + id + " -> '" + name + "'"); + PlotSquared + .log("&cCould not identify owner for plot: " + id + " -> '" + name + "'"); missing++; continue; } @@ -127,10 +128,10 @@ public class ClassicPlotMeConnector extends APlotMeConnector { plots.get(world).put(id, plot); } if (missing > 0) { - PS.log("&cSome names could not be identified:"); - PS.log("&7 - Empty quotes mean PlotMe just stored an unowned plot in the database"); - PS.log("&7 - Names you have never seen before could be from people mistyping commands"); - PS.log( + PlotSquared.log("&cSome names could not be identified:"); + PlotSquared.log("&7 - Empty quotes mean PlotMe just stored an unowned plot in the database"); + PlotSquared.log("&7 - Names you have never seen before could be from people mistyping commands"); + PlotSquared.log( "&7 - Converting from a non-uuid version of PlotMe can't identify owners if the playerdata files are deleted (these plots will " + "remain unknown until the player connects)"); } @@ -151,7 +152,7 @@ public class ClassicPlotMeConnector extends APlotMeConnector { try { - PS.log(" - " + this.prefix + "Denied"); + PlotSquared.log(" - " + this.prefix + "Denied"); statement = connection.prepareStatement("SELECT * FROM `" + this.prefix + "Denied`"); resultSet = statement.executeQuery(); @@ -174,7 +175,7 @@ public class ClassicPlotMeConnector extends APlotMeConnector { } } if (denied == null) { - PS.log("&6Could not identify denied for plot: " + id); + PlotSquared.log("&6Could not identify denied for plot: " + id); continue; } } @@ -209,7 +210,7 @@ public class ClassicPlotMeConnector extends APlotMeConnector { } } if (helper == null) { - PS.log("&6Could not identify helper for plot: " + id); + PlotSquared.log("&6Could not identify helper for plot: " + id); continue; } } @@ -231,7 +232,7 @@ public class ClassicPlotMeConnector extends APlotMeConnector { } @Override public boolean accepts(String version) { - return version == null || PS.get().canUpdate(version, "0.17.0") || PS.get() + return version == null || PlotSquared.get().canUpdate(version, "0.17.0") || PlotSquared.get() .canUpdate("0.999.999", version); } } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/database/plotme/LikePlotMeConverter.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/database/plotme/LikePlotMeConverter.java index e42c87c61..8f8d7b90a 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/database/plotme/LikePlotMeConverter.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/database/plotme/LikePlotMeConverter.java @@ -5,7 +5,7 @@ import com.github.intellectualsites.plotsquared.configuration.ConfigurationSecti import com.github.intellectualsites.plotsquared.configuration.MemorySection; import com.github.intellectualsites.plotsquared.configuration.file.FileConfiguration; import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.object.Plot; @@ -47,7 +47,7 @@ public class LikePlotMeConverter { } private void sendMessage(String message) { - PS.debug("&3PlotMe&8->&3" + PS.imp().getPluginName() + "&8: &7" + message); + PlotSquared.debug("&3PlotMe&8->&3" + PlotSquared.imp().getPluginName() + "&8: &7" + message); } public String getPlotMePath() { @@ -96,7 +96,7 @@ public class LikePlotMeConverter { return; } String content = new String(Files.readAllBytes(path), StandardCharsets.UTF_8); - String pluginName = PS.imp().getPluginName(); + String pluginName = PlotSquared.imp().getPluginName(); content = content.replace("PlotMe-DefaultGenerator", pluginName); content = content.replace("PlotMe", pluginName); content = content.replace("AthionPlots", pluginName); @@ -110,32 +110,32 @@ public class LikePlotMeConverter { String actualWorldName = getWorld(world); String plotMeWorldName = world.toLowerCase(); Integer pathWidth = plotmeDgYml.getInt("worlds." + plotMeWorldName + ".PathWidth"); // - PS.get().worlds.set("worlds." + world + ".road.width", pathWidth); + PlotSquared.get().worlds.set("worlds." + world + ".road.width", pathWidth); int height = plotmeDgYml.getInt("worlds." + plotMeWorldName + ".RoadHeight", plotmeDgYml.getInt("worlds." + plotMeWorldName + ".GroundHeight", 64)); // - PS.get().worlds.set("worlds." + world + ".road.height", height); - PS.get().worlds.set("worlds." + world + ".wall.height", height); - PS.get().worlds.set("worlds." + world + ".plot.height", height); + PlotSquared.get().worlds.set("worlds." + world + ".road.height", height); + PlotSquared.get().worlds.set("worlds." + world + ".wall.height", height); + PlotSquared.get().worlds.set("worlds." + world + ".plot.height", height); int plotSize = plotmeDgYml.getInt("worlds." + plotMeWorldName + ".PlotSize", 32); // - PS.get().worlds.set("worlds." + world + ".plot.size", plotSize); + PlotSquared.get().worlds.set("worlds." + world + ".plot.size", plotSize); String wallblock = plotmeDgYml.getString("worlds." + plotMeWorldName + ".UnclaimedBorder", plotmeDgYml.getString("worlds." + plotMeWorldName + ".WallBlock", "44")); // - PS.get().worlds.set("worlds." + world + ".wall.block", wallblock); + PlotSquared.get().worlds.set("worlds." + world + ".wall.block", wallblock); String claimed = plotmeDgYml.getString("worlds." + plotMeWorldName + ".ProtectedWallBlock", "44:1"); // - PS.get().worlds.set("worlds." + world + ".wall.block_claimed", claimed); + PlotSquared.get().worlds.set("worlds." + world + ".wall.block_claimed", claimed); String floor = plotmeDgYml.getString("worlds." + plotMeWorldName + ".PlotFloorBlock", "2"); // - PS.get().worlds.set("worlds." + world + ".plot.floor", Collections.singletonList(floor)); + PlotSquared.get().worlds.set("worlds." + world + ".plot.floor", Collections.singletonList(floor)); String filling = plotmeDgYml.getString("worlds." + plotMeWorldName + ".FillBlock", "3"); // - PS.get().worlds + PlotSquared.get().worlds .set("worlds." + world + ".plot.filling", Collections.singletonList(filling)); String road = plotmeDgYml.getString("worlds." + plotMeWorldName + ".RoadMainBlock", "5"); - PS.get().worlds.set("worlds." + world + ".road.block", road); - PS.get().worlds.set("worlds." + actualWorldName + ".road.height", height); - PS.get().worlds.set("worlds." + actualWorldName + ".plot.height", height); - PS.get().worlds.set("worlds." + actualWorldName + ".wall.height", height); - PS.get().worlds.save(PS.get().worldsFile); + PlotSquared.get().worlds.set("worlds." + world + ".road.block", road); + PlotSquared.get().worlds.set("worlds." + actualWorldName + ".road.height", height); + PlotSquared.get().worlds.set("worlds." + actualWorldName + ".plot.height", height); + PlotSquared.get().worlds.set("worlds." + actualWorldName + ".wall.height", height); + PlotSquared.get().worlds.save(PlotSquared.get().worldsFile); } public boolean run(APlotMeConnector connector) { @@ -154,7 +154,7 @@ public class LikePlotMeConverter { return false; } - PS.debug("&3Using connector: " + connector.getClass().getCanonicalName()); + PlotSquared.debug("&3Using connector: " + connector.getClass().getCanonicalName()); Connection connection = connector.getPlotMeConnection(plugin, plotConfig, dataFolder); @@ -187,7 +187,7 @@ public class LikePlotMeConverter { try { String actualWorldName = getWorld(world); connector.copyConfig(plotConfig, world, actualWorldName); - PS.get().worlds.save(PS.get().worldsFile); + PlotSquared.get().worlds.save(PlotSquared.get().worldsFile); } catch (IOException e) { e.printStackTrace(); sendMessage("&c-- &lFailed to save configuration for world '" + world @@ -224,7 +224,7 @@ public class LikePlotMeConverter { } for (Entry> entry : plots.entrySet()) { String world = entry.getKey(); - PlotArea area = PS.get().getPlotArea(world, null); + PlotArea area = PlotSquared.get().getPlotArea(world, null); int duplicate = 0; if (area != null) { for (Entry entry2 : entry.getValue().entrySet()) { @@ -235,13 +235,13 @@ public class LikePlotMeConverter { } } if (duplicate > 0) { - PS.debug("&c[WARNING] Found " + duplicate + PlotSquared.debug("&c[WARNING] Found " + duplicate + " duplicate plots already in DB for world: '" + world + "'. Have you run the converter already?"); } } else { - if (PS.get().plots_tmp != null) { - HashMap map = PS.get().plots_tmp.get(world); + if (PlotSquared.get().plots_tmp != null) { + HashMap map = PlotSquared.get().plots_tmp.get(world); if (map != null) { for (Entry entry2 : entry.getValue().entrySet()) { if (map.containsKey(entry2.getKey())) { @@ -251,7 +251,7 @@ public class LikePlotMeConverter { } } if (duplicate > 0) { - PS.debug("&c[WARNING] Found " + duplicate + PlotSquared.debug("&c[WARNING] Found " + duplicate + " duplicate plots already in DB for world: '" + world + "'. Have you run the converter already?"); } @@ -269,13 +269,13 @@ public class LikePlotMeConverter { if (done.get()) { done(); sendMessage("&aDatabase conversion is now complete!"); - PS.debug("&c - Stop the server"); - PS.debug( + PlotSquared.debug("&c - Stop the server"); + PlotSquared.debug( "&c - Disable 'plotme-converter' and 'plotme-convert.cache-uuids' in the settings.yml"); - PS.debug( + PlotSquared.debug( "&c - Correct any generator settings that haven't copied to 'settings.yml' properly"); - PS.debug("&c - Start the server"); - PS.get().setPlots(DBFunc.getPlots()); + PlotSquared.debug("&c - Start the server"); + PlotSquared.get().setPlots(DBFunc.getPlots()); } else { sendMessage( "&cPlease wait until database conversion is complete. You will be notified with instructions when this happens!"); @@ -285,7 +285,7 @@ public class LikePlotMeConverter { }); sendMessage("Saving configuration..."); try { - PS.get().worlds.save(PS.get().worldsFile); + PlotSquared.get().worlds.save(PlotSquared.get().worldsFile); } catch (IOException ignored) { sendMessage(" - &cFailed to save configuration."); } @@ -316,7 +316,7 @@ public class LikePlotMeConverter { sendMessage( "&cYou need to stop the server to reload this world properly"); } else { - PS.get().removePlotAreas(actualWorldName); + PlotSquared.get().removePlotAreas(actualWorldName); if (mv) { // unload world with MV Bukkit.getServer() @@ -330,7 +330,7 @@ public class LikePlotMeConverter { // load world with MV Bukkit.getServer() .dispatchCommand(Bukkit.getServer().getConsoleSender(), - "mv import " + actualWorldName + " normal -g " + PS + "mv import " + actualWorldName + " normal -g " + PlotSquared .imp().getPluginName()); } else if (mw) { // unload world with MW @@ -345,14 +345,15 @@ public class LikePlotMeConverter { // load world with MW Bukkit.getServer() .dispatchCommand(Bukkit.getServer().getConsoleSender(), - "mw create " + actualWorldName + " plugin:" + PS.imp() + "mw create " + actualWorldName + " plugin:" + PlotSquared + .imp() .getPluginName()); } else { // Load using Bukkit API // - User must set generator manually Bukkit.getServer().unloadWorld(world, true); World myWorld = WorldCreator.name(actualWorldName).generator( - new BukkitPlotGenerator(PS.get().IMP.getDefaultGenerator())) + new BukkitPlotGenerator(PlotSquared.get().IMP.getDefaultGenerator())) .createWorld(); myWorld.save(); } @@ -364,12 +365,12 @@ public class LikePlotMeConverter { if (done.get()) { done(); sendMessage("&aDatabase conversion is now complete!"); - PS.debug("&c - Stop the server"); - PS.debug( + PlotSquared.debug("&c - Stop the server"); + PlotSquared.debug( "&c - Disable 'plotme-converter' and 'plotme-convert.cache-uuids' in the settings.yml"); - PS.debug( + PlotSquared.debug( "&c - Correct any generator settings that haven't copied to 'settings.yml' properly"); - PS.debug("&c - Start the server"); + PlotSquared.debug("&c - Start the server"); } else { sendMessage( "&cPlease wait until database conversion is complete. You will be notified with instructions when this happens!"); @@ -379,12 +380,12 @@ public class LikePlotMeConverter { }); } catch (InterruptedException | SQLException e) { e.printStackTrace(); - PS.debug("&/end/"); + PlotSquared.debug("&/end/"); } return true; } public void done() { - PS.get().setPlots(DBFunc.getPlots()); + PlotSquared.get().setPlots(DBFunc.getPlots()); } } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/database/plotme/PlotMeConnector_017.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/database/plotme/PlotMeConnector_017.java index e3fc827bb..db35eec58 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/database/plotme/PlotMeConnector_017.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/database/plotme/PlotMeConnector_017.java @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.database.plotme; import com.github.intellectualsites.plotsquared.configuration.file.FileConfiguration; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.database.SQLite; @@ -53,12 +53,12 @@ public class PlotMeConnector_017 extends APlotMeConnector { connection.prepareStatement("SELECT * FROM `" + this.plugin + "core_plots`"); resultSet = statement.executeQuery(); } catch (SQLException e) { - PS.debug("========= Table does not exist ========="); + PlotSquared.debug("========= Table does not exist ========="); e.printStackTrace(); - PS.debug("======================================="); - PS.debug( + PlotSquared.debug("======================================="); + PlotSquared.debug( "&8 - &7The database does not match the version specified in the PlotMe config"); - PS.debug("&8 - &7Please correct this, or if you are unsure, the most common is 0.16.3"); + PlotSquared.debug("&8 - &7Please correct this, or if you are unsure, the most common is 0.16.3"); return null; } boolean checkUUID = DBFunc.hasColumn(resultSet, "ownerID"); @@ -70,8 +70,8 @@ public class PlotMeConnector_017 extends APlotMeConnector { String name = resultSet.getString("owner"); String world = LikePlotMeConverter.getWorld(resultSet.getString("world")); if (!plots.containsKey(world) && merge) { - int plot = PS.get().worlds.getInt("worlds." + world + ".plot.size"); - int path = PS.get().worlds.getInt("worlds." + world + ".road.width"); + int plot = PlotSquared.get().worlds.getInt("worlds." + world + ".plot.size"); + int path = PlotSquared.get().worlds.getInt("worlds." + world + ".road.width"); plotWidth.put(world, plot); roadWidth.put(world, path); merges.put(world, new HashMap()); @@ -111,7 +111,7 @@ public class PlotMeConnector_017 extends APlotMeConnector { } } if (owner == null) { - PS.log( + PlotSquared.log( "&cCould not identify owner for plot: " + id + " -> '" + name + '\''); continue; } @@ -133,7 +133,7 @@ public class PlotMeConnector_017 extends APlotMeConnector { resultSet.close(); statement.close(); try { - PS.log(" - " + this.plugin + "core_denied"); + PlotSquared.log(" - " + this.plugin + "core_denied"); statement = connection.prepareStatement("SELECT * FROM `" + this.plugin + "core_denied`"); resultSet = statement.executeQuery(); @@ -142,7 +142,7 @@ public class PlotMeConnector_017 extends APlotMeConnector { int key = resultSet.getInt("plot_id"); Plot plot = plots.get(key); if (plot == null) { - PS.log("&6Denied (" + key + ") references deleted plot; ignoring entry."); + PlotSquared.log("&6Denied (" + key + ") references deleted plot; ignoring entry."); continue; } String player = resultSet.getString("player"); @@ -150,7 +150,7 @@ public class PlotMeConnector_017 extends APlotMeConnector { plot.getDenied().add(denied); } - PS.log(" - " + this.plugin + "core_allowed"); + PlotSquared.log(" - " + this.plugin + "core_allowed"); statement = connection.prepareStatement("SELECT * FROM `" + this.plugin + "core_allowed`"); resultSet = statement.executeQuery(); @@ -159,7 +159,7 @@ public class PlotMeConnector_017 extends APlotMeConnector { int key = resultSet.getInt("plot_id"); Plot plot = plots.get(key); if (plot == null) { - PS.log("&6Allowed (" + key + ") references deleted plot; ignoring entry."); + PlotSquared.log("&6Allowed (" + key + ") references deleted plot; ignoring entry."); continue; } String player = resultSet.getString("player"); @@ -189,6 +189,6 @@ public class PlotMeConnector_017 extends APlotMeConnector { if (version == null) { return false; } - return !PS.get().canUpdate(version, "0.17"); + return !PlotSquared.get().canUpdate(version, "0.17"); } } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/BukkitPlotGenerator.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/BukkitPlotGenerator.java index 22f6f8483..3b9dfffa8 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/BukkitPlotGenerator.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/generator/BukkitPlotGenerator.java @@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.bukkit.generator; import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil; import com.github.intellectualsites.plotsquared.bukkit.util.block.GenChunk; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.generator.GeneratorWrapper; import com.github.intellectualsites.plotsquared.plot.generator.IndependentPlotGenerator; import com.github.intellectualsites.plotsquared.plot.object.*; @@ -78,7 +78,7 @@ public class BukkitPlotGenerator extends ChunkGenerator } } BukkitPlotGenerator.this.random.state = c.getX() << 16 | c.getZ() & 0xFFFF; - PlotArea area = PS.get().getPlotArea(world.getName(), null); + PlotArea area = PlotSquared.get().getPlotArea(world.getName(), null); ChunkWrapper wrap = new ChunkWrapper(area.worldname, c.getX(), c.getZ()); ScopedLocalBlockQueue chunk = queue.getForChunk(wrap.x, wrap.z); if (BukkitPlotGenerator.this.plotGenerator @@ -98,7 +98,7 @@ public class BukkitPlotGenerator extends ChunkGenerator + " is already a BukkitPlotGenerator!"); } this.full = false; - PS.debug("BukkitPlotGenerator does not fully support: " + cg); + PlotSquared.debug("BukkitPlotGenerator does not fully support: " + cg); this.platformGenerator = cg; this.plotGenerator = new IndependentPlotGenerator() { @Override public void processSetup(SetupObject setup) { @@ -108,7 +108,7 @@ public class BukkitPlotGenerator extends ChunkGenerator } @Override public PlotManager getNewPlotManager() { - return PS.get().IMP.getDefaultGenerator().getNewPlotManager(); + return PlotSquared.get().IMP.getDefaultGenerator().getNewPlotManager(); } @Override public String getName() { @@ -117,7 +117,7 @@ public class BukkitPlotGenerator extends ChunkGenerator @Override public PlotArea getNewPlotArea(String world, String id, PlotId min, PlotId max) { - return PS.get().IMP.getDefaultGenerator().getNewPlotArea(world, id, min, max); + return PlotSquared.get().IMP.getDefaultGenerator().getNewPlotArea(world, id, min, max); } @Override @@ -199,8 +199,8 @@ public class BukkitPlotGenerator extends ChunkGenerator try { if (!this.loaded) { String name = world.getName(); - PS.get().loadWorld(name, this); - Set areas = PS.get().getPlotAreas(name); + PlotSquared.get().loadWorld(name, this); + Set areas = PlotSquared.get().getPlotAreas(name); if (!areas.isEmpty()) { PlotArea area = areas.iterator().next(); if (!area.MOB_SPAWNING) { @@ -276,7 +276,7 @@ public class BukkitPlotGenerator extends ChunkGenerator // Load if improperly loaded if (!this.loaded) { String name = world.getName(); - PS.get().loadWorld(name, this); + PlotSquared.get().loadWorld(name, this); this.loaded = true; } // Set random seed @@ -285,7 +285,7 @@ public class BukkitPlotGenerator extends ChunkGenerator if (ChunkManager.preProcessChunk(result)) { return; } - PlotArea area = PS.get().getPlotArea(world.getName(), null); + PlotArea area = PlotSquared.get().getPlotArea(world.getName(), null); try { this.plotGenerator.generateChunk(this.chunkSetter, area, this.random); } catch (Throwable e) { diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/ChunkListener.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/ChunkListener.java index 46ccb4a97..23e31c0cc 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/ChunkListener.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/ChunkListener.java @@ -1,6 +1,6 @@ package com.github.intellectualsites.plotsquared.bukkit.listeners; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.C; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.object.Location; @@ -47,7 +47,7 @@ public class ChunkListener implements Listener { this.mustSave = classChunk.getField("mustSave"); this.methodGetHandleChunk = classCraftChunk.getMethod("getHandle"); } catch (Throwable ignored) { - PS.debug(PS.imp().getPluginName() + PlotSquared.debug(PlotSquared.imp().getPluginName() + "/Server not compatible for chunk processor trim/gc"); Settings.Chunk_Processor.AUTO_TRIM = false; } @@ -64,7 +64,7 @@ public class ChunkListener implements Listener { HashSet toUnload = new HashSet<>(); for (World world : Bukkit.getWorlds()) { String worldName = world.getName(); - if (!PS.get().hasPlotArea(worldName)) { + if (!PlotSquared.get().hasPlotArea(worldName)) { continue; } Object w = world.getClass().getDeclaredMethod("getHandle").invoke(world); @@ -153,7 +153,7 @@ public class ChunkListener implements Listener { if (Settings.Chunk_Processor.AUTO_TRIM) { Chunk chunk = event.getChunk(); String world = chunk.getWorld().getName(); - if (PS.get().hasPlotArea(world)) { + if (PlotSquared.get().hasPlotArea(world)) { if (unloadChunk(world, chunk, true)) { return; } @@ -176,7 +176,7 @@ public class ChunkListener implements Listener { event.setCancelled(true); return; } - if (!PS.get().hasPlotArea(chunk.getWorld().getName())) { + if (!PlotSquared.get().hasPlotArea(chunk.getWorld().getName())) { return; } Entity[] entities = chunk.getEntities(); @@ -205,7 +205,7 @@ public class ChunkListener implements Listener { event.setCancelled(true); return; } - if (!PS.get().hasPlotArea(chunk.getWorld().getName())) { + if (!PlotSquared.get().hasPlotArea(chunk.getWorld().getName())) { return; } Entity[] entities = chunk.getEntities(); @@ -226,7 +226,7 @@ public class ChunkListener implements Listener { if (!chunk.isLoaded()) { Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex)); TaskManager.tasks.remove(currentIndex); - PS.debug(C.PREFIX.s() + "&aSuccessfully processed and unloaded chunk!"); + PlotSquared.debug(C.PREFIX.s() + "&aSuccessfully processed and unloaded chunk!"); chunk.unload(true, true); return; } @@ -234,7 +234,7 @@ public class ChunkListener implements Listener { if (tiles.length == 0) { Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex)); TaskManager.tasks.remove(currentIndex); - PS.debug(C.PREFIX.s() + "&aSuccessfully processed and unloaded chunk!"); + PlotSquared.debug(C.PREFIX.s() + "&aSuccessfully processed and unloaded chunk!"); chunk.unload(true, true); return; } @@ -244,7 +244,7 @@ public class ChunkListener implements Listener { if (i >= tiles.length) { Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex)); TaskManager.tasks.remove(currentIndex); - PS.debug(C.PREFIX.s() + "&aSuccessfully processed and unloaded chunk!"); + PlotSquared.debug(C.PREFIX.s() + "&aSuccessfully processed and unloaded chunk!"); chunk.unload(true, true); return; } @@ -257,7 +257,7 @@ public class ChunkListener implements Listener { } public boolean processChunk(Chunk chunk, boolean unload) { - if (!PS.get().hasPlotArea(chunk.getWorld().getName())) { + if (!PlotSquared.get().hasPlotArea(chunk.getWorld().getName())) { return false; } Entity[] entities = chunk.getEntities(); @@ -268,12 +268,14 @@ public class ChunkListener implements Listener { ent.remove(); } } - PS.debug(C.PREFIX.s() + "&a detected unsafe chunk and processed: " + (chunk.getX() << 4) + PlotSquared + .debug(C.PREFIX.s() + "&a detected unsafe chunk and processed: " + (chunk.getX() << 4) + "," + (chunk.getX() << 4)); } if (tiles.length > Settings.Chunk_Processor.MAX_TILES) { if (unload) { - PS.debug(C.PREFIX.s() + "&c detected unsafe chunk: " + (chunk.getX() << 4) + "," + ( + PlotSquared + .debug(C.PREFIX.s() + "&c detected unsafe chunk: " + (chunk.getX() << 4) + "," + ( chunk.getX() << 4)); cleanChunk(chunk); return true; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/EntityPortal_1_7_9.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/EntityPortal_1_7_9.java index cf757ab89..754301598 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/EntityPortal_1_7_9.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/EntityPortal_1_7_9.java @@ -1,6 +1,6 @@ package com.github.intellectualsites.plotsquared.bukkit.listeners; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import org.bukkit.Location; import org.bukkit.World; import org.bukkit.entity.ArmorStand; @@ -28,9 +28,9 @@ public class EntityPortal_1_7_9 implements Listener { List meta = entity.getMetadata("plotworld"); World world = entity.getLocation().getWorld(); if (meta == null || meta.isEmpty()) { - if (PS.get().hasPlotArea(world.getName())) { + if (PlotSquared.get().hasPlotArea(world.getName())) { entity.setMetadata("plotworld", - new FixedMetadataValue((Plugin) PS.get().IMP, entity.getLocation())); + new FixedMetadataValue((Plugin) PlotSquared.get().IMP, entity.getLocation())); } } else { Location origin = (Location) meta.get(0).value(); diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/EntitySpawnListener.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/EntitySpawnListener.java index 0fbbce055..8f8a4db18 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/EntitySpawnListener.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/EntitySpawnListener.java @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.listeners; import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.object.Location; @@ -54,7 +54,7 @@ public class EntitySpawnListener implements Listener { case SHULKER: if (!entity.hasMetadata("plot")) { entity.setMetadata("plot", - new FixedMetadataValue((Plugin) PS.get().IMP, plot.getId())); + new FixedMetadataValue((Plugin) PlotSquared.get().IMP, plot.getId())); } } } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java index 614f64d06..49803d8ac 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java @@ -5,7 +5,7 @@ import com.github.intellectualsites.plotsquared.bukkit.object.BukkitLazyBlock; import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer; import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil; import com.github.intellectualsites.plotsquared.bukkit.util.BukkitVersion; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.C; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.flag.Flags; @@ -66,7 +66,7 @@ public class PlayerEvents extends PlotListener implements Listener { private Field fieldPlayer; private PlayerMoveEvent moveTmp; private boolean v112 = - PS.get().checkVersion(PS.imp().getServerVersion(), BukkitVersion.v1_12_0); + PlotSquared.get().checkVersion(PlotSquared.imp().getServerVersion(), BukkitVersion.v1_12_0); { try { @@ -483,7 +483,7 @@ public class PlayerEvents extends PlotListener implements Listener { return; } Location l = BukkitUtil.getLocation(entity); - if (!PS.get().hasPlotArea(l.getWorld())) { + if (!PlotSquared.get().hasPlotArea(l.getWorld())) { return; } PlotPlayer pp = BukkitUtil.getPlayer((Player) shooter); @@ -497,7 +497,7 @@ public class PlayerEvents extends PlotListener implements Listener { @EventHandler public boolean onProjectileHit(ProjectileHitEvent event) { Projectile entity = event.getEntity(); Location loc = BukkitUtil.getLocation(entity); - if (!PS.get().hasPlotArea(loc.getWorld())) { + if (!PlotSquared.get().hasPlotArea(loc.getWorld())) { return true; } PlotArea area = loc.getPlotArea(); @@ -685,7 +685,7 @@ public class PlayerEvents extends PlotListener implements Listener { Player player = event.getPlayer(); PlotPlayer pp = PlotPlayer.wrap(player); Location loc = BukkitUtil.getLocation(to); - PlotArea area = PS.get().getPlotAreaAbs(loc); + PlotArea area = PlotSquared.get().getPlotAreaAbs(loc); if (area == null) { return; } @@ -776,7 +776,7 @@ public class PlayerEvents extends PlotListener implements Listener { } } else if (toPlot != null) { vehicle.setMetadata("plot", - new FixedMetadataValue((Plugin) PS.get().IMP, toPlot)); + new FixedMetadataValue((Plugin) PlotSquared.get().IMP, toPlot)); } } } @@ -956,7 +956,7 @@ public class PlayerEvents extends PlotListener implements Listener { player.sendMessage(spyMessage); } } - PS.debug(full); + PlotSquared.debug(full); } @EventHandler(priority = EventPriority.LOWEST) public void blockDestroy(BlockBreakEvent event) { @@ -1021,8 +1021,8 @@ public class PlayerEvents extends PlotListener implements Listener { if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_ROAD)) { return; } - if (PS.get().worldedit != null && pp.getAttribute("worldedit")) { - if (player.getItemInHand().getTypeId() == PS.get().worldedit + if (PlotSquared.get().worldedit != null && pp.getAttribute("worldedit")) { + if (player.getItemInHand().getTypeId() == PlotSquared.get().worldedit .getConfiguration().wandItem) { return; } @@ -1036,7 +1036,7 @@ public class PlayerEvents extends PlotListener implements Listener { Location location = BukkitUtil.getLocation(event.getLocation()); PlotArea area = location.getPlotArea(); if (area == null) { - if (!PS.get().hasPlotArea(location.getWorld())) { + if (!PlotSquared.get().hasPlotArea(location.getWorld())) { return; } Iterator iterator = event.blockList().iterator(); @@ -1066,7 +1066,7 @@ public class PlayerEvents extends PlotListener implements Listener { .equals(EntityType.MINECART_TNT)) { if (!near.hasMetadata("plot")) { near.setMetadata("plot", - new FixedMetadataValue((Plugin) PS.get().IMP, plot)); + new FixedMetadataValue((Plugin) PlotSquared.get().IMP, plot)); } } } @@ -1097,7 +1097,7 @@ public class PlayerEvents extends PlotListener implements Listener { if (plot != null) { plotExit(pp, plot); } - if (PS.get().worldedit != null) { + if (PlotSquared.get().worldedit != null) { if (!Permissions.hasPermission(pp, C.PERMISSION_WORLDEDIT_BYPASS)) { if (pp.getAttribute("worldedit")) { pp.removeAttribute("worldedit"); @@ -1108,7 +1108,7 @@ public class PlayerEvents extends PlotListener implements Listener { pp.deleteMeta("perm"); } Location loc = pp.getLocation(); - PlotArea area = PS.get().getPlotAreaAbs(loc); + PlotArea area = PlotSquared.get().getPlotAreaAbs(loc); if (area == null) { return; } @@ -1136,7 +1136,7 @@ public class PlayerEvents extends PlotListener implements Listener { @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onEntityBlockForm(EntityBlockFormEvent event) { String world = event.getBlock().getWorld().getName(); - if (!PS.get().hasPlotArea(world)) { + if (!PlotSquared.get().hasPlotArea(world)) { return; } Location location = BukkitUtil.getLocation(event.getBlock().getLocation()); @@ -1381,7 +1381,7 @@ public class PlayerEvents extends PlotListener implements Listener { Vector relative = new Vector(face.getModX(), face.getModY(), face.getModZ()); PlotArea area = location.getPlotArea(); if (area == null) { - if (!PS.get().hasPlotArea(location.getWorld())) { + if (!PlotSquared.get().hasPlotArea(location.getWorld())) { return; } for (Block b : event.getBlocks()) { @@ -1419,7 +1419,7 @@ public class PlayerEvents extends PlotListener implements Listener { Location location = BukkitUtil.getLocation(block.getLocation()); PlotArea area = location.getPlotArea(); if (area == null) { - if (!PS.get().hasPlotArea(location.getWorld())) { + if (!PlotSquared.get().hasPlotArea(location.getWorld())) { return; } if (this.pistonBlocks) { @@ -1512,7 +1512,7 @@ public class PlayerEvents extends PlotListener implements Listener { @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onStructureGrow(StructureGrowEvent event) { - if (!PS.get().hasPlotArea(event.getWorld().getName())) { + if (!PlotSquared.get().hasPlotArea(event.getWorld().getName())) { return; } List blocks = event.getBlocks(); @@ -1761,8 +1761,8 @@ public class PlayerEvents extends PlotListener implements Listener { default: return; } - if (PS.get().worldedit != null && pp.getAttribute("worldedit")) { - if (player.getItemInHand().getTypeId() == PS.get().worldedit + if (PlotSquared.get().worldedit != null && pp.getAttribute("worldedit")) { + if (player.getItemInHand().getTypeId() == PlotSquared.get().worldedit .getConfiguration().wandItem) { return; } @@ -1832,7 +1832,7 @@ public class PlayerEvents extends PlotListener implements Listener { Block block = event.getBlock(); World world = block.getWorld(); String worldName = world.getName(); - if (!PS.get().hasPlotArea(worldName)) { + if (!PlotSquared.get().hasPlotArea(worldName)) { return; } Location location = BukkitUtil.getLocation(block.getLocation()); @@ -1858,7 +1858,7 @@ public class PlayerEvents extends PlotListener implements Listener { } } else if (event.getTo() == Material.AIR) { event.getEntity() - .setMetadata("plot", new FixedMetadataValue((Plugin) PS.get().IMP, plot)); + .setMetadata("plot", new FixedMetadataValue((Plugin) PlotSquared.get().IMP, plot)); } } @@ -2100,7 +2100,7 @@ public class PlayerEvents extends PlotListener implements Listener { return; } if (Settings.Enabled_Components.KILL_ROAD_VEHICLES) { - entity.setMetadata("plot", new FixedMetadataValue((Plugin) PS.get().IMP, plot)); + entity.setMetadata("plot", new FixedMetadataValue((Plugin) PlotSquared.get().IMP, plot)); } } @@ -2314,7 +2314,7 @@ public class PlayerEvents extends PlotListener implements Listener { public void onPotionSplash(PotionSplashEvent event) { ThrownPotion damager = event.getPotion(); Location l = BukkitUtil.getLocation(damager); - if (!PS.get().hasPlotArea(l.getWorld())) { + if (!PlotSquared.get().hasPlotArea(l.getWorld())) { return; } int count = 0; @@ -2332,7 +2332,7 @@ public class PlayerEvents extends PlotListener implements Listener { @SuppressWarnings("deprecation") @EventHandler(priority = EventPriority.HIGHEST) public void onEntityCombustByEntity(EntityCombustByEntityEvent event) { EntityDamageByEntityEvent eventChange = null; - if (PS.get().checkVersion(PS.get().IMP.getServerVersion(), BukkitVersion.v1_11_0)) { + if (PlotSquared.get().checkVersion(PlotSquared.get().IMP.getServerVersion(), BukkitVersion.v1_11_0)) { eventChange = new EntityDamageByEntityEvent(event.getCombuster(), event.getEntity(), EntityDamageEvent.DamageCause.FIRE_TICK, (double) event.getDuration()); } else { @@ -2359,7 +2359,7 @@ public class PlayerEvents extends PlotListener implements Listener { public void onEntityDamageByEntityEvent(EntityDamageByEntityEvent event) { Entity damager = event.getDamager(); Location l = BukkitUtil.getLocation(damager); - if (!PS.get().hasPlotArea(l.getWorld())) { + if (!PlotSquared.get().hasPlotArea(l.getWorld())) { return; } Entity victim = event.getEntity(); diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents183.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents183.java index 3f6116bc7..4ea390f14 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents183.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents183.java @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.listeners; import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; @@ -20,7 +20,7 @@ public class PlayerEvents183 implements Listener { Block block = event.getBlock(); Location location = BukkitUtil.getLocation(block.getLocation()); String world = location.getWorld(); - if (!PS.get().hasPlotArea(world)) { + if (!PlotSquared.get().hasPlotArea(world)) { return; } PlotArea area = location.getPlotArea(); diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents_1_8.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents_1_8.java index 552077e3d..0ec6acaa3 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents_1_8.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents_1_8.java @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.listeners; import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.C; import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.listener.PlotListener; @@ -42,7 +42,7 @@ public class PlayerEvents_1_8 extends PlotListener implements Listener { return; } HumanEntity entity = event.getWhoClicked(); - if (!(entity instanceof Player) || !PS.get().hasPlotArea(entity.getWorld().getName())) { + if (!(entity instanceof Player) || !PlotSquared.get().hasPlotArea(entity.getWorld().getName())) { return; } Player player = (Player) entity; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents_1_9.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents_1_9.java index d8c74a9ed..4bd896479 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents_1_9.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents_1_9.java @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.listeners; import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.Location; import org.bukkit.entity.LingeringPotion; import org.bukkit.event.EventHandler; @@ -21,7 +21,7 @@ public class PlayerEvents_1_9 implements Listener { public void onPotionSplash(LingeringPotionSplashEvent event) { LingeringPotion entity = event.getEntity(); Location l = BukkitUtil.getLocation(entity); - if (!PS.get().hasPlotArea(l.getWorld())) { + if (!PlotSquared.get().hasPlotArea(l.getWorld())) { return; } if (!parent.onProjectileHit(event)) { diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/SingleWorldListener.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/SingleWorldListener.java index fccf90a25..e67310d4b 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/SingleWorldListener.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/SingleWorldListener.java @@ -1,6 +1,6 @@ package com.github.intellectualsites.plotsquared.bukkit.listeners; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.worlds.PlotAreaManager; import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotAreaManager; import com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils; @@ -58,7 +58,7 @@ public class SingleWorldListener implements Listener { private void handle(ChunkEvent event) { World world = event.getWorld(); String name = world.getName(); - PlotAreaManager man = PS.get().getPlotAreaManager(); + PlotAreaManager man = PlotSquared.get().getPlotAreaManager(); if (!(man instanceof SinglePlotAreaManager)) return; if (!isPlotId(name)) diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/WorldEvents.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/WorldEvents.java index 505434687..7b7f203f5 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/WorldEvents.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/WorldEvents.java @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.listeners; import com.github.intellectualsites.plotsquared.bukkit.generator.BukkitPlotGenerator; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.generator.GeneratorWrapper; import com.github.intellectualsites.plotsquared.plot.object.worlds.PlotAreaManager; import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotAreaManager; @@ -18,7 +18,7 @@ public class WorldEvents implements Listener { public void onWorldInit(WorldInitEvent event) { World world = event.getWorld(); String name = world.getName(); - PlotAreaManager manager = PS.get().getPlotAreaManager(); + PlotAreaManager manager = PlotSquared.get().getPlotAreaManager(); if (manager instanceof SinglePlotAreaManager) { SinglePlotAreaManager single = (SinglePlotAreaManager) manager; if (single.isWorld(name)) { @@ -28,9 +28,9 @@ public class WorldEvents implements Listener { } ChunkGenerator gen = world.getGenerator(); if (gen instanceof GeneratorWrapper) { - PS.get().loadWorld(name, (GeneratorWrapper) gen); + PlotSquared.get().loadWorld(name, (GeneratorWrapper) gen); } else { - PS.get().loadWorld(name, new BukkitPlotGenerator(name, gen)); + PlotSquared.get().loadWorld(name, new BukkitPlotGenerator(name, gen)); } } } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java index abccf091b..a97993cfc 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.object; import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.C; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; @@ -76,7 +76,7 @@ public class BukkitPlayer extends PlotPlayer { private void callEvent(final Event event) { RegisteredListener[] listeners = event.getHandlers().getRegisteredListeners(); for (RegisteredListener listener : listeners) { - if (listener.getPlugin().getName().equals(PS.imp().getPluginName())) { + if (listener.getPlugin().getName().equals(PlotSquared.imp().getPluginName())) { continue; } try { diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/ReplicatingEntityWrapper.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/ReplicatingEntityWrapper.java index a9de09619..4ea5055af 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/ReplicatingEntityWrapper.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/ReplicatingEntityWrapper.java @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.object.entity; import com.github.intellectualsites.plotsquared.bukkit.util.BukkitVersion; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import org.bukkit.*; import org.bukkit.block.BlockFace; import org.bukkit.entity.*; @@ -53,7 +53,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper { if (depth == 1) { return; } - if (PS.get().checkVersion(PS.get().IMP.getServerVersion(), BukkitVersion.v1_10_0) + if (PlotSquared.get().checkVersion(PlotSquared.get().IMP.getServerVersion(), BukkitVersion.v1_10_0) || entity instanceof ArmorStand) { if (!entity.hasGravity()) { this.noGravity = true; @@ -62,7 +62,8 @@ public final class ReplicatingEntityWrapper extends EntityWrapper { switch (entity.getType()) { case ARROW: case BOAT: - if (PS.get().checkVersion(PS.get().IMP.getServerVersion(), BukkitVersion.v1_9_0)) { + if (PlotSquared + .get().checkVersion(PlotSquared.get().IMP.getServerVersion(), BukkitVersion.v1_9_0)) { Boat boat = (Boat) entity; this.dataByte = getOrdinal(TreeSpecies.values(), boat.getWoodType()); } @@ -102,7 +103,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper { // Do this stuff later return; default: - PS.debug("&cCOULD NOT IDENTIFY ENTITY: " + entity.getType()); + PlotSquared.debug("&cCOULD NOT IDENTIFY ENTITY: " + entity.getType()); return; // MISC // case DROPPED_ITEM: @@ -322,7 +323,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper { void restoreEquipment(LivingEntity entity) { EntityEquipment equipment = entity.getEquipment(); - if (PS.get().checkVersion(PS.get().IMP.getServerVersion(), BukkitVersion.v1_9_0)) { + if (PlotSquared.get().checkVersion(PlotSquared.get().IMP.getServerVersion(), BukkitVersion.v1_9_0)) { equipment.setItemInMainHand(this.lived.mainHand); equipment.setItemInOffHand(this.lived.offHand); } else { @@ -338,7 +339,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper { try { entity.getInventory().setContents(this.inventory); } catch (IllegalArgumentException e) { - PS.debug("&c[WARN] Failed to restore inventory.\n Reason: " + e.getMessage()); + PlotSquared.debug("&c[WARN] Failed to restore inventory.\n Reason: " + e.getMessage()); } } @@ -366,7 +367,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper { } void storeEquipment(EntityEquipment equipment) { - if (PS.get().checkVersion(PS.get().IMP.getServerVersion(), BukkitVersion.v1_9_0)) { + if (PlotSquared.get().checkVersion(PlotSquared.get().IMP.getServerVersion(), BukkitVersion.v1_9_0)) { this.lived.mainHand = equipment.getItemInMainHand().clone(); this.lived.offHand = equipment.getItemInOffHand().clone(); } else { @@ -458,7 +459,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper { if (this.depth == 1) { return entity; } - if (PS.get().checkVersion(PS.get().IMP.getServerVersion(), BukkitVersion.v1_10_0) + if (PlotSquared.get().checkVersion(PlotSquared.get().IMP.getServerVersion(), BukkitVersion.v1_10_0) || entity instanceof ArmorStand) { if (this.noGravity) { entity.setGravity(false); @@ -467,7 +468,8 @@ public final class ReplicatingEntityWrapper extends EntityWrapper { switch (entity.getType()) { case ARROW: case BOAT: - if (PS.get().checkVersion(PS.get().IMP.getServerVersion(), BukkitVersion.v1_9_0)) { + if (PlotSquared + .get().checkVersion(PlotSquared.get().IMP.getServerVersion(), BukkitVersion.v1_9_0)) { Boat boat = (Boat) entity; boat.setWoodType(TreeSpecies.values()[dataByte]); } @@ -512,7 +514,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper { // Do this stuff later return entity; default: - PS.debug("&cCOULD NOT IDENTIFY ENTITY: " + entity.getType()); + PlotSquared.debug("&cCOULD NOT IDENTIFY ENTITY: " + entity.getType()); return entity; // MISC // case ITEM_FRAME: diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/titles/DefaultTitle_111.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/titles/DefaultTitle_111.java index 30e4f3ceb..8dcdc6a76 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/titles/DefaultTitle_111.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/titles/DefaultTitle_111.java @@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.bukkit.titles; import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer; import com.github.intellectualsites.plotsquared.bukkit.util.BukkitVersion; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.util.AbstractTitle; import org.bukkit.entity.Player; @@ -12,7 +12,8 @@ import org.bukkit.entity.Player; private final boolean valid; public DefaultTitle_111() { - this.valid = PS.get().checkVersion(PS.get().IMP.getServerVersion(), BukkitVersion.v1_11_0); + this.valid = PlotSquared + .get().checkVersion(PlotSquared.get().IMP.getServerVersion(), BukkitVersion.v1_11_0); } @Override diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/titles/HackTitle.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/titles/HackTitle.java index 16787bae1..ae2b50a60 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/titles/HackTitle.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/titles/HackTitle.java @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.titles; import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.util.AbstractTitle; @@ -14,7 +14,7 @@ public class HackTitle extends AbstractTitle { HackTitleManager title = new HackTitleManager(head, sub, in, delay, out); title.send(((BukkitPlayer) player).player); } catch (Exception ignored) { - PS.debug("&cYour server version does not support titles!"); + PlotSquared.debug("&cYour server version does not support titles!"); Settings.TITLES = false; AbstractTitle.TITLE_CLASS = null; } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitChunkManager.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitChunkManager.java index 31b7f84ce..6c82721ef 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitChunkManager.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitChunkManager.java @@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.bukkit.util; import com.github.intellectualsites.plotsquared.bukkit.object.entity.EntityWrapper; import com.github.intellectualsites.plotsquared.bukkit.object.entity.ReplicatingEntityWrapper; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.generator.AugmentedUtils; import com.github.intellectualsites.plotsquared.plot.object.*; import com.github.intellectualsites.plotsquared.plot.util.ChunkManager; @@ -344,7 +344,7 @@ public class BukkitChunkManager extends ChunkManager { @SuppressWarnings("deprecation") @Override public void unloadChunk(final String world, final ChunkLoc loc, final boolean save, final boolean safe) { - if (!PS.get().isMainThread(Thread.currentThread())) { + if (!PlotSquared.get().isMainThread(Thread.currentThread())) { TaskManager.runTask(new Runnable() { @SuppressWarnings("deprecation") @Override public void run() { BukkitUtil.getWorld(world).unloadChunk(loc.x, loc.z, save, safe); @@ -700,7 +700,7 @@ public class BukkitChunkManager extends ChunkManager { try { entity.spawn(world, xOffset, zOffset); } catch (Exception e) { - PS.debug("Failed to restore entity (e): " + e.toString()); + PlotSquared.debug("Failed to restore entity (e): " + e.toString()); e.printStackTrace(); } } @@ -719,12 +719,12 @@ public class BukkitChunkManager extends ChunkManager { chest.getInventory().setContents(blockLocEntry.getValue()); state.update(true); } else { - PS.debug("&c[WARN] Plot clear failed to regenerate chest: " + ( + PlotSquared.debug("&c[WARN] Plot clear failed to regenerate chest: " + ( blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry.getKey().y + ',' + (blockLocEntry.getKey().z + zOffset)); } } catch (IllegalArgumentException ignored) { - PS.debug("&c[WARN] Plot clear failed to regenerate chest (e): " + ( + PlotSquared.debug("&c[WARN] Plot clear failed to regenerate chest (e): " + ( blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry.getKey().y + ',' + (blockLocEntry.getKey().z + zOffset)); } @@ -744,12 +744,12 @@ public class BukkitChunkManager extends ChunkManager { } state.update(true); } else { - PS.debug("&c[WARN] Plot clear failed to regenerate sign: " + ( + PlotSquared.debug("&c[WARN] Plot clear failed to regenerate sign: " + ( blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry.getKey().y + ',' + (blockLocEntry.getKey().z + zOffset)); } } catch (IndexOutOfBoundsException ignored) { - PS.debug("&c[WARN] Plot clear failed to regenerate sign: " + ( + PlotSquared.debug("&c[WARN] Plot clear failed to regenerate sign: " + ( blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry.getKey().y + ',' + (blockLocEntry.getKey().z + zOffset)); } @@ -765,12 +765,12 @@ public class BukkitChunkManager extends ChunkManager { .setContents(blockLocEntry.getValue()); state.update(true); } else { - PS.debug("&c[WARN] Plot clear failed to regenerate dispenser: " + ( + PlotSquared.debug("&c[WARN] Plot clear failed to regenerate dispenser: " + ( blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry.getKey().y + ',' + (blockLocEntry.getKey().z + zOffset)); } } catch (IllegalArgumentException ignored) { - PS.debug("&c[WARN] Plot clear failed to regenerate dispenser (e): " + ( + PlotSquared.debug("&c[WARN] Plot clear failed to regenerate dispenser (e): " + ( blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry.getKey().y + ',' + (blockLocEntry.getKey().z + zOffset)); } @@ -786,12 +786,12 @@ public class BukkitChunkManager extends ChunkManager { .setContents(blockLocEntry.getValue()); state.update(true); } else { - PS.debug("&c[WARN] Plot clear failed to regenerate dispenser: " + ( + PlotSquared.debug("&c[WARN] Plot clear failed to regenerate dispenser: " + ( blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry.getKey().y + ',' + (blockLocEntry.getKey().z + zOffset)); } } catch (IllegalArgumentException ignored) { - PS.debug("&c[WARN] Plot clear failed to regenerate dispenser (e): " + ( + PlotSquared.debug("&c[WARN] Plot clear failed to regenerate dispenser (e): " + ( blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry.getKey().y + ',' + (blockLocEntry.getKey().z + zOffset)); } @@ -807,12 +807,12 @@ public class BukkitChunkManager extends ChunkManager { .setContents(blockLocEntry.getValue()); state.update(true); } else { - PS.debug("&c[WARN] Plot clear failed to regenerate beacon: " + ( + PlotSquared.debug("&c[WARN] Plot clear failed to regenerate beacon: " + ( blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry.getKey().y + ',' + (blockLocEntry.getKey().z + zOffset)); } } catch (IllegalArgumentException ignored) { - PS.debug("&c[WARN] Plot clear failed to regenerate beacon (e): " + ( + PlotSquared.debug("&c[WARN] Plot clear failed to regenerate beacon (e): " + ( blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry.getKey().y + ',' + (blockLocEntry.getKey().z + zOffset)); } @@ -827,13 +827,13 @@ public class BukkitChunkManager extends ChunkManager { ((Jukebox) state).setPlaying(blockLocMaterialEntry.getValue()); state.update(true); } else { - PS.debug("&c[WARN] Plot clear failed to restore jukebox: " + ( + PlotSquared.debug("&c[WARN] Plot clear failed to restore jukebox: " + ( blockLocMaterialEntry.getKey().x + xOffset) + ',' + blockLocMaterialEntry.getKey().y + ',' + ( blockLocMaterialEntry.getKey().z + zOffset)); } } catch (Exception ignored) { - PS.debug("&c[WARN] Plot clear failed to regenerate jukebox (e): " + ( + PlotSquared.debug("&c[WARN] Plot clear failed to regenerate jukebox (e): " + ( blockLocMaterialEntry.getKey().x + xOffset) + ',' + blockLocMaterialEntry .getKey().y + ',' + (blockLocMaterialEntry.getKey().z + zOffset)); } @@ -853,12 +853,12 @@ public class BukkitChunkManager extends ChunkManager { ((Skull) state).setSkullType((SkullType) data[3]); state.update(true); } else { - PS.debug("&c[WARN] Plot clear failed to restore skull: " + ( + PlotSquared.debug("&c[WARN] Plot clear failed to restore skull: " + ( blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry.getKey().y + ',' + (blockLocEntry.getKey().z + zOffset)); } } catch (Exception e) { - PS.debug("&c[WARN] Plot clear failed to regenerate skull (e): " + ( + PlotSquared.debug("&c[WARN] Plot clear failed to regenerate skull (e): " + ( blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry.getKey().y + ',' + (blockLocEntry.getKey().z + zOffset)); e.printStackTrace(); @@ -875,12 +875,12 @@ public class BukkitChunkManager extends ChunkManager { .setContents(blockLocEntry.getValue()); state.update(true); } else { - PS.debug("&c[WARN] Plot clear failed to regenerate hopper: " + ( + PlotSquared.debug("&c[WARN] Plot clear failed to regenerate hopper: " + ( blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry.getKey().y + ',' + (blockLocEntry.getKey().z + zOffset)); } } catch (IllegalArgumentException ignored) { - PS.debug("&c[WARN] Plot clear failed to regenerate hopper (e): " + ( + PlotSquared.debug("&c[WARN] Plot clear failed to regenerate hopper (e): " + ( blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry.getKey().y + ',' + (blockLocEntry.getKey().z + zOffset)); } @@ -894,12 +894,12 @@ public class BukkitChunkManager extends ChunkManager { ((NoteBlock) state).setNote(blockLocNoteEntry.getValue()); state.update(true); } else { - PS.debug("&c[WARN] Plot clear failed to regenerate note block: " + ( + PlotSquared.debug("&c[WARN] Plot clear failed to regenerate note block: " + ( blockLocNoteEntry.getKey().x + xOffset) + ',' + blockLocNoteEntry .getKey().y + ',' + (blockLocNoteEntry.getKey().z + zOffset)); } } catch (Exception ignored) { - PS.debug("&c[WARN] Plot clear failed to regenerate note block (e): " + ( + PlotSquared.debug("&c[WARN] Plot clear failed to regenerate note block (e): " + ( blockLocNoteEntry.getKey().x + xOffset) + ',' + blockLocNoteEntry.getKey().y + ',' + (blockLocNoteEntry.getKey().z + zOffset)); } @@ -912,12 +912,14 @@ public class BukkitChunkManager extends ChunkManager { if (state instanceof BrewingStand) { ((BrewingStand) state).setBrewingTime(blockLocShortEntry.getValue()); } else { - PS.debug("&c[WARN] Plot clear failed to restore brewing stand cooking: " + ( + PlotSquared + .debug("&c[WARN] Plot clear failed to restore brewing stand cooking: " + ( blockLocShortEntry.getKey().x + xOffset) + ',' + blockLocShortEntry .getKey().y + ',' + (blockLocShortEntry.getKey().z + zOffset)); } } catch (Exception ignored) { - PS.debug("&c[WARN] Plot clear failed to restore brewing stand cooking (e): " + ( + PlotSquared + .debug("&c[WARN] Plot clear failed to restore brewing stand cooking (e): " + ( blockLocShortEntry.getKey().x + xOffset) + ',' + blockLocShortEntry .getKey().y + ',' + (blockLocShortEntry.getKey().z + zOffset)); } @@ -934,13 +936,13 @@ public class BukkitChunkManager extends ChunkManager { .setSpawnedType(blockLocEntityTypeEntry.getValue()); state.update(true); } else { - PS.debug("&c[WARN] Plot clear failed to restore spawner type: " + ( + PlotSquared.debug("&c[WARN] Plot clear failed to restore spawner type: " + ( blockLocEntityTypeEntry.getKey().x + xOffset) + ',' + blockLocEntityTypeEntry.getKey().y + ',' + ( blockLocEntityTypeEntry.getKey().z + zOffset)); } } catch (Exception ignored) { - PS.debug("&c[WARN] Plot clear failed to restore spawner type (e): " + ( + PlotSquared.debug("&c[WARN] Plot clear failed to restore spawner type (e): " + ( blockLocEntityTypeEntry.getKey().x + xOffset) + ',' + blockLocEntityTypeEntry.getKey().y + ',' + ( blockLocEntityTypeEntry.getKey().z + zOffset)); @@ -955,12 +957,12 @@ public class BukkitChunkManager extends ChunkManager { ((CommandBlock) state).setCommand(blockLocStringEntry.getValue()); state.update(true); } else { - PS.debug("&c[WARN] Plot clear failed to restore command block: " + ( + PlotSquared.debug("&c[WARN] Plot clear failed to restore command block: " + ( blockLocStringEntry.getKey().x + xOffset) + ',' + blockLocStringEntry .getKey().y + ',' + (blockLocStringEntry.getKey().z + zOffset)); } } catch (Exception ignored) { - PS.debug("&c[WARN] Plot clear failed to restore command block (e): " + ( + PlotSquared.debug("&c[WARN] Plot clear failed to restore command block (e): " + ( blockLocStringEntry.getKey().x + xOffset) + ',' + blockLocStringEntry .getKey().y + ',' + (blockLocStringEntry.getKey().z + zOffset)); } @@ -977,12 +979,14 @@ public class BukkitChunkManager extends ChunkManager { .setContents(blockLocEntry.getValue()); state.update(true); } else { - PS.debug("&c[WARN] Plot clear failed to regenerate brewing stand: " + ( + PlotSquared + .debug("&c[WARN] Plot clear failed to regenerate brewing stand: " + ( blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry.getKey().y + ',' + (blockLocEntry.getKey().z + zOffset)); } } catch (IllegalArgumentException ignored) { - PS.debug("&c[WARN] Plot clear failed to regenerate brewing stand (e): " + ( + PlotSquared + .debug("&c[WARN] Plot clear failed to regenerate brewing stand (e): " + ( blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry.getKey().y + ',' + (blockLocEntry.getKey().z + zOffset)); } @@ -998,12 +1002,14 @@ public class BukkitChunkManager extends ChunkManager { ((Furnace) state).setBurnTime(time[0]); ((Furnace) state).setCookTime(time[1]); } else { - PS.debug("&c[WARN] Plot clear failed to restore furnace cooking: " + ( + PlotSquared + .debug("&c[WARN] Plot clear failed to restore furnace cooking: " + ( blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry.getKey().y + ',' + (blockLocEntry.getKey().z + zOffset)); } } catch (Exception ignored) { - PS.debug("&c[WARN] Plot clear failed to restore furnace cooking (e): " + ( + PlotSquared + .debug("&c[WARN] Plot clear failed to restore furnace cooking (e): " + ( blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry.getKey().y + ',' + (blockLocEntry.getKey().z + zOffset)); } @@ -1019,12 +1025,12 @@ public class BukkitChunkManager extends ChunkManager { .setContents(blockLocEntry.getValue()); state.update(true); } else { - PS.debug("&c[WARN] Plot clear failed to regenerate furnace: " + ( + PlotSquared.debug("&c[WARN] Plot clear failed to regenerate furnace: " + ( blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry.getKey().y + ',' + (blockLocEntry.getKey().z + zOffset)); } } catch (IllegalArgumentException ignored) { - PS.debug("&c[WARN] Plot clear failed to regenerate furnace (e): " + ( + PlotSquared.debug("&c[WARN] Plot clear failed to regenerate furnace (e): " + ( blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry.getKey().y + ',' + (blockLocEntry.getKey().z + zOffset)); } @@ -1043,12 +1049,12 @@ public class BukkitChunkManager extends ChunkManager { banner.setPatterns(patterns); state.update(true); } else { - PS.debug("&c[WARN] Plot clear failed to regenerate banner: " + ( + PlotSquared.debug("&c[WARN] Plot clear failed to regenerate banner: " + ( blockLocByteEntry.getKey().x + xOffset) + ',' + blockLocByteEntry .getKey().y + ',' + (blockLocByteEntry.getKey().z + zOffset)); } } catch (Exception ignored) { - PS.debug("&c[WARN] Plot clear failed to regenerate banner (e): " + ( + PlotSquared.debug("&c[WARN] Plot clear failed to regenerate banner (e): " + ( blockLocByteEntry.getKey().x + xOffset) + ',' + blockLocByteEntry.getKey().y + ',' + (blockLocByteEntry.getKey().z + zOffset)); } @@ -1155,9 +1161,9 @@ public class BukkitChunkManager extends ChunkManager { } } catch (Exception e) { - PS.debug("------------ FAILED TO DO SOMETHING --------"); + PlotSquared.debug("------------ FAILED TO DO SOMETHING --------"); e.printStackTrace(); - PS.debug("------------ but we caught it ^ --------"); + PlotSquared.debug("------------ but we caught it ^ --------"); } } } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitSetupUtils.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitSetupUtils.java index 5abf35b3e..d56dba523 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitSetupUtils.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitSetupUtils.java @@ -3,7 +3,7 @@ package com.github.intellectualsites.plotsquared.bukkit.util; import com.github.intellectualsites.plotsquared.bukkit.generator.BukkitPlotGenerator; import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection; import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.ConfigurationNode; import com.github.intellectualsites.plotsquared.plot.generator.GeneratorWrapper; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; @@ -33,7 +33,7 @@ public class BukkitSetupUtils extends SetupUtils { if (plugin.isEnabled()) { ChunkGenerator generator = plugin.getDefaultWorldGenerator(testWorld, ""); if (generator != null) { - PS.get().removePlotAreas(testWorld); + PlotSquared.get().removePlotAreas(testWorld); String name = plugin.getDescription().getName(); GeneratorWrapper wrapped; if (generator instanceof GeneratorWrapper) { @@ -80,11 +80,11 @@ public class BukkitSetupUtils extends SetupUtils { switch (type) { case 2: { if (object.id != null) { - if (!PS.get().worlds.contains(worldPath)) { - PS.get().worlds.createSection(worldPath); + if (!PlotSquared.get().worlds.contains(worldPath)) { + PlotSquared.get().worlds.createSection(worldPath); } ConfigurationSection worldSection = - PS.get().worlds.getConfigurationSection(worldPath); + PlotSquared.get().worlds.getConfigurationSection(worldPath); String areaName = object.id + "-" + object.min + "-" + object.max; String areaPath = "areas." + areaName; if (!worldSection.contains(areaPath)) { @@ -123,20 +123,20 @@ public class BukkitSetupUtils extends SetupUtils { break; } case 1: { - if (!PS.get().worlds.contains(worldPath)) { - PS.get().worlds.createSection(worldPath); + if (!PlotSquared.get().worlds.contains(worldPath)) { + PlotSquared.get().worlds.createSection(worldPath); } ConfigurationSection worldSection = - PS.get().worlds.getConfigurationSection(worldPath); + PlotSquared.get().worlds.getConfigurationSection(worldPath); for (ConfigurationNode step : steps) { worldSection.set(step.getConstant(), step.getValue()); } - PS.get().worlds.set("worlds." + world + ".generator.type", object.type); - PS.get().worlds.set("worlds." + world + ".generator.terrain", object.terrain); - PS.get().worlds.set("worlds." + world + ".generator.plugin", object.plotManager); + PlotSquared.get().worlds.set("worlds." + world + ".generator.type", object.type); + PlotSquared.get().worlds.set("worlds." + world + ".generator.terrain", object.terrain); + PlotSquared.get().worlds.set("worlds." + world + ".generator.plugin", object.plotManager); if (object.setupGenerator != null && !object.setupGenerator .equals(object.plotManager)) { - PS.get().worlds + PlotSquared.get().worlds .set("worlds." + world + ".generator.init", object.setupGenerator); } GeneratorWrapper gen = SetupUtils.generators.get(object.setupGenerator); @@ -147,11 +147,11 @@ public class BukkitSetupUtils extends SetupUtils { } case 0: { if (steps.length != 0) { - if (!PS.get().worlds.contains(worldPath)) { - PS.get().worlds.createSection(worldPath); + if (!PlotSquared.get().worlds.contains(worldPath)) { + PlotSquared.get().worlds.createSection(worldPath); } ConfigurationSection worldSection = - PS.get().worlds.getConfigurationSection(worldPath); + PlotSquared.get().worlds.getConfigurationSection(worldPath); for (ConfigurationNode step : steps) { worldSection.set(step.getConstant(), step.getValue()); } @@ -160,7 +160,7 @@ public class BukkitSetupUtils extends SetupUtils { } } try { - PS.get().worlds.save(PS.get().worldsFile); + PlotSquared.get().worlds.save(PlotSquared.get().worldsFile); } catch (IOException e) { e.printStackTrace(); } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/SendChunk.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/SendChunk.java index 638cf18b8..250e89d56 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/SendChunk.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/SendChunk.java @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.util; import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.ChunkLoc; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; @@ -50,7 +50,7 @@ public class SendChunk { RefClass classChunk = getRefClass("{nms}.Chunk"); this.methodInitLighting = classChunk.getMethod("initLighting"); RefClass classMapChunk = getRefClass("{nms}.PacketPlayOutMapChunk"); - if (PS.get().checkVersion(PS.get().IMP.getServerVersion(), BukkitVersion.v1_9_4)) { + if (PlotSquared.get().checkVersion(PlotSquared.get().IMP.getServerVersion(), BukkitVersion.v1_9_4)) { //this works for 1.9.4 and 1.10 tempMapChunk = classMapChunk.getConstructor(classChunk.getRealClass(), int.class); } else { @@ -118,7 +118,8 @@ public class SendChunk { chunks.remove(chunk); Object con = this.connection.of(entity).get(); Object packet = null; - if (PS.get().checkVersion(PS.get().IMP.getServerVersion(), BukkitVersion.v1_9_4)) { + if (PlotSquared + .get().checkVersion(PlotSquared.get().IMP.getServerVersion(), BukkitVersion.v1_9_4)) { try { packet = this.mapChunk.create(c, 65535); } catch (Exception ignored) { @@ -135,7 +136,7 @@ public class SendChunk { } } if (packet == null) { - PS.debug("Error with PacketPlayOutMapChunk reflection."); + PlotSquared.debug("Error with PacketPlayOutMapChunk reflection."); } this.send.of(con).call(packet); } @@ -147,10 +148,11 @@ public class SendChunk { chunk.unload(true, false); } catch (Throwable ignored) { String worldName = chunk.getWorld().getName(); - PS.debug("$4Could not save chunk: " + worldName + ';' + chunk.getX() + ";" + PlotSquared + .debug("$4Could not save chunk: " + worldName + ';' + chunk.getX() + ";" + chunk.getZ()); - PS.debug("$3 - $4File may be open in another process (e.g. MCEdit)"); - PS.debug("$3 - $4" + worldName + "/level.dat or " + worldName + PlotSquared.debug("$3 - $4File may be open in another process (e.g. MCEdit)"); + PlotSquared.debug("$3 - $4" + worldName + "/level.dat or " + worldName + "/level_old.dat may be corrupt (try repairing or removing these)"); } } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/SetGenCB.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/SetGenCB.java index c20df4847..3266a8051 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/SetGenCB.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/SetGenCB.java @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.util; import com.github.intellectualsites.plotsquared.bukkit.generator.BukkitAugmentedGenerator; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.generator.GeneratorWrapper; import com.github.intellectualsites.plotsquared.plot.util.SetupUtils; import org.bukkit.World; @@ -16,7 +16,7 @@ public class SetGenCB { public static void setGenerator(World world) throws Exception { SetupUtils.manager.updateGenerators(); - PS.get().removePlotAreas(world.getName()); + PlotSquared.get().removePlotAreas(world.getName()); ChunkGenerator gen = world.getGenerator(); if (gen == null) { return; @@ -52,6 +52,6 @@ public class SetGenCB { } } } - PS.get().loadWorld(world.getName(), PS.get().IMP.getGenerator(world.getName(), null)); + PlotSquared.get().loadWorld(world.getName(), PlotSquared.get().IMP.getGenerator(world.getName(), null)); } } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/FileUUIDHandler.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/FileUUIDHandler.java index fd8843c77..1f021292b 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/FileUUIDHandler.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/FileUUIDHandler.java @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.uuid; import com.github.intellectualsites.plotsquared.bukkit.util.NbtFactory; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.C; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer; @@ -49,8 +49,8 @@ public class FileUUIDHandler extends UUIDHandlerImplementation { } TaskManager.runTaskAsync(new Runnable() { @Override public void run() { - PS.debug(C.PREFIX + "&6Starting player data caching for: " + world); - File uuidFile = new File(PS.get().IMP.getDirectory(), "uuids.txt"); + PlotSquared.debug(C.PREFIX + "&6Starting player data caching for: " + world); + File uuidFile = new File(PlotSquared.get().IMP.getDirectory(), "uuids.txt"); if (uuidFile.exists()) { try { List lines = @@ -85,7 +85,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation { HashBiMap.create(new HashMap()); if (Settings.UUID.NATIVE_UUID_PROVIDER) { HashSet all = UUIDHandler.getAllUUIDS(); - PS.debug("&aFast mode UUID caching enabled!"); + PlotSquared.debug("&aFast mode UUID caching enabled!"); File playerDataFolder = new File(container, world + File.separator + "playerdata"); String[] dat = playerDataFolder.list(new DatFileFilter()); @@ -101,7 +101,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation { .fromStream(new FileInputStream(file), NbtFactory.StreamOptions.GZIP_COMPRESSION); if (!compound.containsKey("bukkit")) { - PS.debug("ERROR: Player data (" + uuid.toString() + PlotSquared.debug("ERROR: Player data (" + uuid.toString() + ".dat) does not contain the the key \"bukkit\""); } else { NbtFactory.NbtCompound bukkit = @@ -118,7 +118,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation { } } catch (Exception e) { e.printStackTrace(); - PS.debug(C.PREFIX + "Invalid playerdata: " + current); + PlotSquared.debug(C.PREFIX + "Invalid playerdata: " + current); } } } @@ -129,7 +129,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation { } return; } else { - PS.debug("Failed to cache: " + all.size() + PlotSquared.debug("Failed to cache: " + all.size() + " uuids - slowly processing all files"); } } @@ -149,7 +149,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation { UUID uuid = UUID.fromString(s); uuids.add(uuid); } catch (Exception ignored) { - PS.debug(C.PREFIX + "Invalid PlayerData: " + current); + PlotSquared.debug(C.PREFIX + "Invalid PlayerData: " + current); } } break; @@ -175,7 +175,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation { .fromStream(new FileInputStream(file), NbtFactory.StreamOptions.GZIP_COMPRESSION); if (!compound.containsKey("bukkit")) { - PS.debug("ERROR: Player data (" + uuid.toString() + PlotSquared.debug("ERROR: Player data (" + uuid.toString() + ".dat) does not contain the the key \"bukkit\""); } else { NbtFactory.NbtCompound bukkit = @@ -203,7 +203,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation { } } } catch (Exception ignored) { - PS.debug(C.PREFIX + "&6Invalid PlayerData: " + uuid.toString() + ".dat"); + PlotSquared.debug(C.PREFIX + "&6Invalid PlayerData: " + uuid.toString() + ".dat"); } } for (String name : names) { diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/OfflineUUIDWrapper.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/OfflineUUIDWrapper.java index 3fb8f223d..c44fa6e72 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/OfflineUUIDWrapper.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/OfflineUUIDWrapper.java @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.uuid; import com.github.intellectualsites.plotsquared.bukkit.object.BukkitOfflinePlayer; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.object.StringWrapper; @@ -82,7 +82,7 @@ public class OfflineUUIDWrapper extends UUIDWrapper { return p.toArray(new Player[p.size()]); } } catch (IllegalAccessException | InvocationTargetException | IllegalArgumentException ignored) { - PS.debug("Failed to resolve online players"); + PlotSquared.debug("Failed to resolve online players"); this.getOnline = null; Collection onlinePlayers = Bukkit.getOnlinePlayers(); return onlinePlayers.toArray(new Player[onlinePlayers.size()]); diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/SQLUUIDHandler.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/SQLUUIDHandler.java index 2ef3c8ea7..72378eb6e 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/SQLUUIDHandler.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/uuid/SQLUUIDHandler.java @@ -1,6 +1,6 @@ package com.github.intellectualsites.plotsquared.bukkit.uuid; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.C; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.database.SQLite; @@ -43,7 +43,7 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation { public SQLUUIDHandler(UUIDWrapper wrapper) { super(wrapper); - this.sqlite = new SQLite(MainUtil.getFile(PS.get().IMP.getDirectory(), "usercache.db")); + this.sqlite = new SQLite(MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), "usercache.db")); try { this.sqlite.openConnection(); } catch (ClassNotFoundException | SQLException e) { @@ -139,7 +139,7 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation { connection.disconnect(); } } catch (IOException | ParseException e) { - PS.debug( + PlotSquared.debug( "Invalid response from Mojang: Some UUIDs will be cached later. (`unknown` until then or player joins)"); } try { @@ -166,7 +166,7 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation { } @Override public void fetchUUID(final String name, final RunnableVal ifFetch) { - PS.debug(C.PREFIX + "UUID for '" + name + PlotSquared.debug(C.PREFIX + "UUID for '" + name + "' was null. We'll cache this from the Mojang servers!"); if (ifFetch == null) { return; @@ -221,7 +221,7 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation { statement.setString(1, uuid.toString()); statement.setString(2, name.toString()); statement.execute(); - PS.debug(C.PREFIX + "&cAdded '&6" + uuid + "&c' - '&6" + name + "&c'"); + PlotSquared.debug(C.PREFIX + "&cAdded '&6" + uuid + "&c' - '&6" + name + "&c'"); } catch (SQLException e) { e.printStackTrace(); } @@ -244,7 +244,8 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation { statement.setString(1, name.value); statement.setString(2, uuid.toString()); statement.execute(); - PS.debug(C.PREFIX + "Name change for '" + uuid + "' to '" + name.value + '\''); + PlotSquared + .debug(C.PREFIX + "Name change for '" + uuid + "' to '" + name.value + '\''); } catch (SQLException e) { e.printStackTrace(); } diff --git a/Core/build.gradle b/Core/build.gradle index 9439abb26..f7d9f78eb 100644 --- a/Core/build.gradle +++ b/Core/build.gradle @@ -5,8 +5,8 @@ dependencies { compileOnly 'org.projectlombok:lombok:1.16.18' } -sourceCompatibility = 1.7 -targetCompatibility = 1.7 +sourceCompatibility = 1.8 +targetCompatibility = 1.8 processResources { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/api/PlotAPI.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/api/PlotAPI.java index 2d24cb6a0..973a6230f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/api/PlotAPI.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/api/PlotAPI.java @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.api; import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.C; import com.github.intellectualsites.plotsquared.plot.flag.Flag; import com.github.intellectualsites.plotsquared.plot.flag.Flags; @@ -29,7 +29,7 @@ import java.util.UUID; *
  • {@link Plot}
  • *
  • {@link com.github.intellectualsites.plotsquared.plot.object.Location}
  • *
  • {@link PlotArea}
  • - *
  • {@link PS}
  • + *
  • {@link PlotSquared}
  • * * * @version 3.3.3 @@ -42,10 +42,10 @@ public class PlotAPI { * Get all plots. * * @return all plots - * @see PS#getPlots() + * @see PlotSquared#getPlots() */ public Set getAllPlots() { - return PS.get().getPlots(); + return PlotSquared.get().getPlots(); } /** @@ -55,47 +55,47 @@ public class PlotAPI { * @return all plots that a player owns */ public Set getPlayerPlots(PlotPlayer player) { - return PS.get().getPlots(player); + return PlotSquared.get().getPlots(player); } /** * Add a plot world. * * @param plotArea Plot World Object - * @see PS#addPlotArea(PlotArea) + * @see PlotSquared#addPlotArea(PlotArea) */ public void addPlotArea(PlotArea plotArea) { - PS.get().addPlotArea(plotArea); + PlotSquared.get().addPlotArea(plotArea); } /** * Returns the PlotSquared configurations file. * * @return main configuration - * @see PS#config + * @see PlotSquared#config */ public YamlConfiguration getConfig() { - return PS.get().config; + return PlotSquared.get().config; } /** * Get the PlotSquared storage file. * * @return storage configuration - * @see PS#storage + * @see PlotSquared#storage */ public YamlConfiguration getStorage() { - return PS.get().storage; + return PlotSquared.get().storage; } /** * Get the main class for this plugin. Only use this if you really need it. * * @return PlotSquared PlotSquared Main Class - * @see PS + * @see PlotSquared */ - public PS getMain() { - return PS.get(); + public PlotSquared getMain() { + return PlotSquared.get(); } /** @@ -156,7 +156,7 @@ public class PlotAPI { if (world == null) { return Collections.emptySet(); } - return PS.get().getPlotAreas(world); + return PlotSquared.get().getPlotAreas(world); } /** @@ -166,7 +166,7 @@ public class PlotAPI { * @see MainUtil#sendConsoleMessage(C, String...) */ public void sendConsoleMessage(String message) { - PS.log(message); + PlotSquared.log(message); } /** @@ -193,10 +193,10 @@ public class PlotAPI { * Gets the PlotSquared class. * * @return PlotSquared Class - * @see PS + * @see PlotSquared */ - public PS getPlotSquared() { - return PS.get(); + public PlotSquared getPlotSquared() { + return PlotSquared.get(); } /** diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/commands/Command.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/commands/Command.java index 4651eed77..c07496697 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/commands/Command.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/commands/Command.java @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.commands; import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.commands.CommandCategory; import com.github.intellectualsites.plotsquared.plot.commands.MainCommand; import com.github.intellectualsites.plotsquared.plot.commands.RequiredType; @@ -166,7 +166,8 @@ public abstract class Command { options.put("usage", declaration.usage()); options.put("confirmation", declaration.confirmation()); boolean set = false; - YamlConfiguration commands = PS.get() == null ? new YamlConfiguration() : PS.get().commands; + YamlConfiguration commands = PlotSquared.get() == null ? new YamlConfiguration() : PlotSquared + .get().commands; for (Map.Entry entry : options.entrySet()) { String key = this.getFullId() + "." + entry.getKey(); if (!commands.contains(key)) { @@ -174,9 +175,9 @@ public abstract class Command { set = true; } } - if (set && PS.get() != null) { + if (set && PlotSquared.get() != null) { try { - commands.save(PS.get().commandsFile); + commands.save(PlotSquared.get().commandsFile); } catch (IOException e) { e.printStackTrace(); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlConfiguration.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlConfiguration.java index 15587bcf7..139547d31 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlConfiguration.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/configuration/file/YamlConfiguration.java @@ -3,7 +3,7 @@ package com.github.intellectualsites.plotsquared.configuration.file; import com.github.intellectualsites.plotsquared.configuration.Configuration; import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection; import com.github.intellectualsites.plotsquared.configuration.InvalidConfigurationException; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import org.yaml.snakeyaml.DumperOptions; import org.yaml.snakeyaml.Yaml; import org.yaml.snakeyaml.error.YAMLException; @@ -51,11 +51,11 @@ public class YamlConfiguration extends FileConfiguration { dest = new File(file.getAbsolutePath() + "_broken_" + i++); } Files.copy(file.toPath(), dest.toPath(), StandardCopyOption.REPLACE_EXISTING); - PS.debug("&dCould not read: &7" + file); - PS.debug("&dRenamed to: &7" + dest.getName()); - PS.debug("&c============ Full stacktrace ============"); + PlotSquared.debug("&dCould not read: &7" + file); + PlotSquared.debug("&dRenamed to: &7" + dest.getName()); + PlotSquared.debug("&c============ Full stacktrace ============"); ex.printStackTrace(); - PS.debug("&c========================================="); + PlotSquared.debug("&c========================================="); } catch (IOException e) { e.printStackTrace(); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PS.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotSquared.java similarity index 85% rename from Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PS.java rename to Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotSquared.java index 59705e674..651459897 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PS.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotSquared.java @@ -14,7 +14,6 @@ import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotWorld; import com.github.intellectualsites.plotsquared.plot.generator.HybridUtils; import com.github.intellectualsites.plotsquared.plot.generator.IndependentPlotGenerator; import com.github.intellectualsites.plotsquared.plot.listener.WESubscriber; -import com.github.intellectualsites.plotsquared.plot.logger.DelegateLogger; import com.github.intellectualsites.plotsquared.plot.logger.ILogger; import com.github.intellectualsites.plotsquared.plot.object.*; import com.github.intellectualsites.plotsquared.plot.object.worlds.DefaultPlotAreaManager; @@ -26,7 +25,11 @@ import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager; import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpiryTask; import com.sk89q.worldedit.WorldEdit; +import lombok.Getter; +import lombok.NonNull; +import lombok.Setter; +import javax.annotation.Nullable; import java.io.*; import java.net.MalformedURLException; import java.net.URISyntaxException; @@ -43,8 +46,10 @@ import java.util.zip.ZipInputStream; /** * An implementation of the core, with a static getter for easy access. */ -public class PS { - private static PS instance; +@SuppressWarnings({"unused", "WeakerAccess"}) public class PlotSquared { + private static final Set EMPTY_SET = + Collections.unmodifiableSet(Collections.emptySet()); + private static PlotSquared instance; // Implementation public final IPlotMain IMP; // Current thread @@ -65,14 +70,15 @@ public class PS { public HashMap> clusters_tmp; public HashMap> plots_tmp; // Implementation logger - private ILogger logger; + @Setter @Getter private ILogger logger; // Platform / Version / Update URL - private Updater updater; + @Getter private Updater updater; private PlotVersion version; // Files and configuration + @Getter private File jarFile = null; // This file private File storageFile; - private PlotAreaManager manager; + @Getter private PlotAreaManager plotAreaManager; /** * Initialize PlotSquared with the desired Implementation class. @@ -80,16 +86,21 @@ public class PS { * @param iPlotMain Implementation of {@link IPlotMain} used * @param platform The platform being used */ - public PS(IPlotMain iPlotMain, String platform) { - PS.instance = this; + public PlotSquared(final IPlotMain iPlotMain, final String platform) { + if (instance != null) { + throw new IllegalStateException("Cannot re-initialize the PlotSquared singleton"); + } + instance = this; + this.thread = Thread.currentThread(); this.IMP = iPlotMain; this.logger = iPlotMain; Settings.PLATFORM = platform; + try { new ReflectionUtils(this.IMP.getNMSPackage()); try { - URL url = PS.class.getProtectionDomain().getCodeSource().getLocation(); + URL url = PlotSquared.class.getProtectionDomain().getCodeSource().getLocation(); this.jarFile = new File( new URL(url.toURI().toString().split("\\!")[0].replaceAll("jar:file", "file")) .toURI().getPath()); @@ -102,7 +113,7 @@ public class PS { } } if (getJavaVersion() < 1.8) { - PS.log(C.CONSOLE_JAVA_OUTDATED.f(IMP.getPluginName())); + PlotSquared.log(C.CONSOLE_JAVA_OUTDATED.f(IMP.getPluginName())); } TaskManager.IMP = this.IMP.getTaskManager(); setupConfigs(); @@ -111,11 +122,11 @@ public class PS { + ".use_THIS.yml"); C.load(this.translationFile); - // Setup manager + // Setup plotAreaManager if (Settings.Enabled_Components.WORLDS) { - this.manager = new SinglePlotAreaManager(); + this.plotAreaManager = new SinglePlotAreaManager(); } else { - this.manager = new DefaultPlotAreaManager(); + this.plotAreaManager = new DefaultPlotAreaManager(); } // Database @@ -139,7 +150,7 @@ public class PS { if (Settings.Enabled_Components.METRICS) { this.IMP.startMetrics(); } else { - PS.log(C.CONSOLE_PLEASE_ENABLE_METRICS.f(IMP.getPluginName())); + PlotSquared.log(C.CONSOLE_PLEASE_ENABLE_METRICS.f(IMP.getPluginName())); } if (Settings.Enabled_Components.CHUNK_PROCESSOR) { this.IMP.registerChunkProcessor(); @@ -183,7 +194,7 @@ public class PS { if (Settings.Enabled_Components.WORLDEDIT_RESTRICTIONS) { try { if (this.IMP.initWorldEdit()) { - PS.debug(IMP.getPluginName() + " hooked into WorldEdit."); + PlotSquared.debug(IMP.getPluginName() + " hooked into WorldEdit."); this.worldedit = WorldEdit.getInstance(); WorldEdit.getInstance().getEventBus().register(new WESubscriber()); if (Settings.Enabled_Components.COMMANDS) { @@ -192,7 +203,7 @@ public class PS { } } catch (Throwable e) { - PS.debug( + PlotSquared.debug( "Incompatible version of WorldEdit, please upgrade: http://builds.enginehub.org/job/worldedit?branch=master"); } } @@ -200,7 +211,7 @@ public class PS { if (Settings.Enabled_Components.ECONOMY) { TaskManager.runTask(new Runnable() { @Override public void run() { - EconHandler.manager = PS.this.IMP.getEconomyHandler(); + EconHandler.manager = PlotSquared.this.IMP.getEconomyHandler(); } }); } @@ -244,7 +255,7 @@ public class PS { "&8 - &7Are you trying to delete this world? Remember to remove it from the settings.yml, bukkit.yml and multiverse worlds.yml"); debug( "&8 - &7Your world management plugin may be faulty (or non existent)"); - PS.this.IMP.setGenerator(world); + PlotSquared.this.IMP.setGenerator(world); } } } @@ -263,7 +274,8 @@ public class PS { } catch (Throwable e) { e.printStackTrace(); } - PS.log(C.ENABLED.f(IMP.getPluginName())); + + PlotSquared.log(C.ENABLED.f(IMP.getPluginName())); } /** @@ -271,8 +283,8 @@ public class PS { * * @return instance of PlotSquared */ - public static PS get() { - return PS.instance; + public static PlotSquared get() { + return PlotSquared.instance; } public static IPlotMain imp() { @@ -292,7 +304,7 @@ public class PS { if (message == null || message.toString().isEmpty()) { return; } - PS.get().getLogger().log(StringMan.getString(message)); + PlotSquared.get().getLogger().log(StringMan.getString(message)); } /** @@ -301,45 +313,12 @@ public class PS { * @param message Message to log * @see IPlotMain#log(String) */ - public static void debug(Object message) { + public static void debug(@Nullable Object message) { if (Settings.DEBUG) { - PS.log(message); + PlotSquared.log(message); } } - /** - * Get the current logger. - * - * @return The assigned logger - */ - public ILogger getLogger() { - return logger; - } - - /** - * Set the Logger. - * - * @param logger the logger the plugin should use - * @see DelegateLogger - * @see #getLogger() - */ - public void setLogger(ILogger logger) { - this.logger = logger; - } - - /** - * The plugin updater - * - * @return - */ - public Updater getUpdater() { - return updater; - } - - public PlotAreaManager getPlotAreaManager() { - return manager; - } - private void startUuidCatching() { TaskManager.runTaskLater(new Runnable() { @Override public void run() { @@ -379,14 +358,15 @@ public class PS { if (Settings.Enabled_Components.PLOTME_CONVERTER || Settings.PlotMe.CACHE_UUDS) { TaskManager.IMP.taskAsync(new Runnable() { @Override public void run() { - if (PS.this.IMP.initPlotMeConverter()) { - PS.log("&c=== IMPORTANT ==="); - PS.log( + if (PlotSquared.this.IMP.initPlotMeConverter()) { + PlotSquared.log("&c=== IMPORTANT ==="); + PlotSquared.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( + PlotSquared + .log("&c - Make sure 'UUID.read-from-disk' is disabled (false)!"); + PlotSquared.log( "&c - Sometimes the database can be locked, deleting PlotMe.jar beforehand will fix the issue!"); - PS.log( + PlotSquared.log( "&c - After the conversion is finished, please set 'plotme-converter' to false in the " + "'settings.yml'"); } @@ -403,8 +383,8 @@ public class PS { /** * Check if `version` is >= `version2`. * - * @param version - * @param version2 + * @param version First version + * @param version2 Second version * @return true if `version` is >= `version2` */ public boolean checkVersion(int[] version, int... version2) { @@ -490,7 +470,7 @@ public class PS { cluster.setArea(plotArea); } } - manager.addPlotArea(plotArea); + plotAreaManager.addPlotArea(plotArea); plotArea.setupBorder(); } @@ -500,7 +480,7 @@ public class PS { * @param area the {@code PlotArea} to remove */ public void removePlotArea(PlotArea area) { - manager.removePlotArea(area); + plotAreaManager.removePlotArea(area); setPlotsTmp(area); } @@ -531,11 +511,11 @@ public class PS { } public Set getClusters(String world) { - HashSet set = new HashSet<>(); + Set set = new HashSet<>(); for (PlotArea area : getPlotAreas(world)) { set.addAll(area.getClusters()); } - return set; + return Collections.unmodifiableSet(set); } @@ -558,7 +538,7 @@ public class PS { } } }); - return result; + return Collections.unmodifiableSet(result); } public List sortPlotsByTemp(Collection plots) { @@ -776,11 +756,11 @@ public class PS { HashMap> map = new HashMap<>(); int totalSize = getPlotCount(); if (plots.size() == totalSize) { - for (PlotArea area : manager.getAllPlotAreas()) { + for (PlotArea area : plotAreaManager.getAllPlotAreas()) { map.put(area, area.getPlots()); } } else { - for (PlotArea area : manager.getAllPlotAreas()) { + for (PlotArea area : plotAreaManager.getAllPlotAreas()) { map.put(area, new ArrayList(0)); } Collection lastList = null; @@ -795,7 +775,7 @@ public class PS { } } } - List areas = Arrays.asList(manager.getAllPlotAreas()); + List areas = Arrays.asList(plotAreaManager.getAllPlotAreas()); Collections.sort(areas, new Comparator() { @Override public int compare(PlotArea a, PlotArea b) { if (priorityArea != null && StringMan.isEqual(a.toString(), b.toString())) { @@ -904,7 +884,7 @@ public class PS { * @return Set of Plot */ public Set getPlots(String world, String player) { - UUID uuid = UUIDHandler.getUUID(player, null); + final UUID uuid = UUIDHandler.getUUID(player, null); return getPlots(world, uuid); } @@ -950,15 +930,13 @@ public class PS { * @return Set of plot */ public Set getPlots(String world, UUID uuid) { - ArrayList myPlots = new ArrayList<>(); - for (Plot plot : getPlots(world)) { - if (plot.hasOwner()) { - if (plot.isOwnerAbs(uuid)) { - myPlots.add(plot); - } + final Set plots = new HashSet<>(); + for (final Plot plot : getPlots(world)) { + if (plot.hasOwner() && plot.isOwnerAbs(uuid)) { + plots.add(plot); } } - return new HashSet<>(myPlots); + return Collections.unmodifiableSet(plots); } /** @@ -969,7 +947,7 @@ public class PS { * @return Set of plots */ public Set getPlots(PlotArea area, UUID uuid) { - final HashSet plots = new HashSet<>(); + final Set plots = new HashSet<>(); for (Plot plot : getPlots(area)) { if (plot.hasOwner() && plot.isOwnerAbs(uuid)) { plots.add(plot); @@ -986,11 +964,11 @@ public class PS { * @see #getPlotAreaByString(String) to get the PlotArea object */ public boolean hasPlotArea(String world) { - return manager.getPlotAreas(world, null).length != 0; + return plotAreaManager.getPlotAreas(world, null).length != 0; } public Collection getPlots(String world) { - final HashSet set = new HashSet<>(); + final Set set = new HashSet<>(); foreachPlotArea(world, new RunnableVal() { @Override public void run(PlotArea value) { set.addAll(value.getPlots()); @@ -1010,7 +988,7 @@ public class PS { } public Collection getPlots(PlotArea area) { - return area == null ? new HashSet() : area.getPlots(); + return area == null ? EMPTY_SET : area.getPlots(); } public Plot getPlot(PlotArea area, PlotId id) { @@ -1028,19 +1006,19 @@ public class PS { * @return Set of Plot's owned by the player */ public Set getPlots(final UUID uuid) { - final ArrayList myPlots = new ArrayList<>(); + final Set plots = new HashSet<>(); foreachPlot(new RunnableVal() { @Override public void run(Plot value) { if (value.isOwnerAbs(uuid)) { - myPlots.add(value); + plots.add(value); } } }); - return new HashSet<>(myPlots); + return Collections.unmodifiableSet(plots); } public boolean hasPlot(final UUID uuid) { - for (PlotArea area : manager.getAllPlotAreas()) { + for (final PlotArea area : plotAreaManager.getAllPlotAreas()) { if (area.hasPlot(uuid)) return true; } @@ -1048,15 +1026,15 @@ public class PS { } public Set getBasePlots(final UUID uuid) { - final ArrayList myplots = new ArrayList<>(); + final Set plots = new HashSet<>(); foreachBasePlot(new RunnableVal() { @Override public void run(Plot value) { if (value.isOwner(uuid)) { - myplots.add(value); + plots.add(value); } } }); - return new HashSet<>(myplots); + return Collections.unmodifiableSet(plots); } /** @@ -1066,15 +1044,15 @@ public class PS { * @return Set of Plot */ public Set getPlotsAbs(final UUID uuid) { - final ArrayList myPlots = new ArrayList<>(); + final Set plots = new HashSet<>(); foreachPlot(new RunnableVal() { @Override public void run(Plot value) { if (value.isOwnerAbs(uuid)) { - myPlots.add(value); + plots.add(value); } } }); - return new HashSet<>(myPlots); + return Collections.unmodifiableSet(plots); } /** @@ -1125,7 +1103,7 @@ public class PS { if (world.equals("CheckingPlotSquaredGenerator")) { return; } - this.manager.addWorld(world); + this.plotAreaManager.addWorld(world); Set worlds; if (this.worlds.contains("worlds")) { worlds = this.worlds.getConfigurationSection("worlds").getKeys(false); @@ -1141,7 +1119,7 @@ public class PS { type = 0; } if (type == 0) { - if (manager.getPlotAreas(world, null).length != 0) { + if (plotAreaManager.getPlotAreas(world, null).length != 0) { debug("World possibly already loaded: " + world); return; } @@ -1170,10 +1148,10 @@ public class PS { // Conventional plot generator PlotArea plotArea = plotGenerator.getNewPlotArea(world, null, null, null); PlotManager plotManager = plotGenerator.getNewPlotManager(); - PS.log(C.PREFIX + "&aDetected world load for '" + world + "'"); - PS.log(C.PREFIX + "&3 - generator: &7" + baseGenerator + ">" + plotGenerator); - PS.log(C.PREFIX + "&3 - plotworld: &7" + plotArea.getClass().getName()); - PS.log(C.PREFIX + "&3 - manager: &7" + plotManager.getClass().getName()); + PlotSquared.log(C.PREFIX + "&aDetected world load for '" + world + "'"); + PlotSquared.log(C.PREFIX + "&3 - generator: &7" + baseGenerator + ">" + plotGenerator); + PlotSquared.log(C.PREFIX + "&3 - plotworld: &7" + plotArea.getClass().getName()); + PlotSquared.log(C.PREFIX + "&3 - plotAreaManager: &7" + plotManager.getClass().getName()); if (!this.worlds.contains(path)) { this.worlds.createSection(path); worldSection = this.worlds.getConfigurationSection(path); @@ -1194,11 +1172,11 @@ public class PS { } ConfigurationSection areasSection = worldSection.getConfigurationSection("areas"); if (areasSection == null) { - if (manager.getPlotAreas(world, null).length != 0) { + if (plotAreaManager.getPlotAreas(world, null).length != 0) { debug("World possibly already loaded: " + world); return; } - PS.log(C.PREFIX + "&aDetected world load for '" + world + "'"); + PlotSquared.log(C.PREFIX + "&aDetected world load for '" + world + "'"); String gen_string = worldSection.getString("generator.plugin", IMP.getPluginName()); if (type == 2) { Set clusters = this.clusters_tmp != null ? @@ -1216,7 +1194,7 @@ public class PS { worldSection.createSection("areas." + fullId); DBFunc.replaceWorld(world, world + ";" + name, pos1, pos2); // NPE - PS.log(C.PREFIX + "&3 - " + name + "-" + pos1 + "-" + pos2); + PlotSquared.log(C.PREFIX + "&3 - " + name + "-" + pos1 + "-" + pos2); GeneratorWrapper areaGen = this.IMP.getGenerator(world, gen_string); if (areaGen == null) { throw new IllegalArgumentException("Invalid Generator: " + gen_string); @@ -1230,10 +1208,11 @@ public class PS { } catch (IOException e) { e.printStackTrace(); } - PS.log(C.PREFIX + "&c | &9generator: &7" + baseGenerator + ">" + areaGen); - PS.log(C.PREFIX + "&c | &9plotworld: &7" + pa); - PS.log(C.PREFIX + "&c | &9manager: &7" + pa); - PS.log(C.PREFIX + "&cNote: &7Area created for cluster:" + name + PlotSquared + .log(C.PREFIX + "&c | &9generator: &7" + baseGenerator + ">" + areaGen); + PlotSquared.log(C.PREFIX + "&c | &9plotworld: &7" + pa); + PlotSquared.log(C.PREFIX + "&c | &9manager: &7" + pa); + PlotSquared.log(C.PREFIX + "&cNote: &7Area created for cluster:" + name + " (invalid or old configuration?)"); areaGen.getPlotGenerator().initialize(pa); areaGen.augment(pa); @@ -1256,9 +1235,9 @@ public class PS { } catch (IOException e) { e.printStackTrace(); } - PS.log(C.PREFIX + "&3 - generator: &7" + baseGenerator + ">" + areaGen); - PS.log(C.PREFIX + "&3 - plotworld: &7" + pa); - PS.log(C.PREFIX + "&3 - manager: &7" + pa.getPlotManager()); + PlotSquared.log(C.PREFIX + "&3 - generator: &7" + baseGenerator + ">" + areaGen); + PlotSquared.log(C.PREFIX + "&3 - plotworld: &7" + pa); + PlotSquared.log(C.PREFIX + "&3 - plotAreaManager: &7" + pa.getPlotManager()); areaGen.getPlotGenerator().initialize(pa); areaGen.augment(pa); addPlotArea(pa); @@ -1269,7 +1248,7 @@ public class PS { "Invalid type for multi-area world. Expected `2`, got `" + 1 + "`"); } for (String areaId : areasSection.getKeys(false)) { - PS.log(C.PREFIX + "&3 - " + areaId); + PlotSquared.log(C.PREFIX + "&3 - " + areaId); String[] split = areaId.split("(?<=[^;-])-"); if (split.length != 3) { throw new IllegalArgumentException("Invalid Area identifier: " + areaId @@ -1331,10 +1310,10 @@ public class PS { } catch (IOException e) { e.printStackTrace(); } - PS.log(C.PREFIX + "&aDetected area load for '" + world + "'"); - PS.log(C.PREFIX + "&c | &9generator: &7" + baseGenerator + ">" + areaGen); - PS.log(C.PREFIX + "&c | &9plotworld: &7" + pa); - PS.log(C.PREFIX + "&c | &9manager: &7" + pa.getPlotManager()); + PlotSquared.log(C.PREFIX + "&aDetected area load for '" + world + "'"); + PlotSquared.log(C.PREFIX + "&c | &9generator: &7" + baseGenerator + ">" + areaGen); + PlotSquared.log(C.PREFIX + "&c | &9plotworld: &7" + pa); + PlotSquared.log(C.PREFIX + "&c | &9manager: &7" + pa.getPlotManager()); areaGen.getPlotGenerator().initialize(pa); areaGen.augment(pa); addPlotArea(pa); @@ -1361,7 +1340,7 @@ public class PS { for (String element : split) { String[] pair = element.split("="); if (pair.length != 2) { - PS.log("&cNo value provided for: &7" + element); + PlotSquared.log("&cNo value provided for: &7" + element); return false; } String key = pair[0].toLowerCase(); @@ -1411,12 +1390,12 @@ public class PS { Configuration.BLOCK.parseString(value).toString()); break; default: - PS.log("&cKey not found: &7" + element); + PlotSquared.log("&cKey not found: &7" + element); return false; } } catch (Exception e) { e.printStackTrace(); - PS.log("&cInvalid value: &7" + value + " in arg " + element); + PlotSquared.log("&cInvalid value: &7" + value + " in arg " + element); return false; } } @@ -1433,26 +1412,21 @@ public class PS { return true; } - public boolean canUpdate(String current, String other) { - String s1 = normalisedVersion(current); - String s2 = normalisedVersion(other); - int cmp = s1.compareTo(s2); - return cmp < 0; + public boolean canUpdate(@NonNull final String current, @NonNull final String other) { + final String s1 = normalisedVersion(current); + final String s2 = normalisedVersion(other); + return s1.compareTo(s2) < 0; } - public String normalisedVersion(String version) { - String[] split = Pattern.compile(".", Pattern.LITERAL).split(version); - StringBuilder sb = new StringBuilder(); - for (String s : split) { + public String normalisedVersion(@NonNull final String version) { + final String[] split = Pattern.compile(".", Pattern.LITERAL).split(version); + final StringBuilder sb = new StringBuilder(); + for (final String s : split) { sb.append(String.format("%" + 4 + 's', s)); } return sb.toString(); } - public File getJarFile() { - return jarFile; - } - public boolean update(PlotPlayer sender, URL url) { try { String name = this.jarFile.getName(); @@ -1478,9 +1452,9 @@ public class PS { } catch (IOException e) { MainUtil.sendMessage(sender, "Failed to update " + IMP.getPluginName() + ""); MainUtil.sendMessage(sender, " - Please update manually"); - PS.log("============ Stacktrace ============"); + PlotSquared.log("============ Stacktrace ============"); e.printStackTrace(); - PS.log("===================================="); + PlotSquared.log("===================================="); } return false; } @@ -1536,13 +1510,13 @@ public class PS { } } catch (IOException e) { e.printStackTrace(); - PS.log("&cCould not save " + file); + PlotSquared.log("&cCould not save " + file); } } private Map> getPlotsRaw() { HashMap> map = new HashMap<>(); - for (PlotArea area : this.manager.getAllPlotAreas()) { + for (PlotArea area : this.plotAreaManager.getAllPlotAreas()) { Map map2 = map.get(area.toString()); if (map2 == null) { map.put(area.toString(), area.getPlotsRaw()); @@ -1572,7 +1546,7 @@ public class PS { UUIDHandler.handleShutdown(); } catch (NullPointerException ignored) { ignored.printStackTrace(); - PS.log("&cCould not close database connection!"); + PlotSquared.log("&cCould not close database connection!"); } } @@ -1586,21 +1560,20 @@ public class PS { } Database database; if (Storage.MySQL.USE) { - database = new MySQL(Storage.MySQL.HOST, - Storage.MySQL.PORT, Storage.MySQL.DATABASE, Storage.MySQL.USER, - Storage.MySQL.PASSWORD); + 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"); database = new SQLite(file); } else { - PS.log(C.PREFIX + "&cNo storage type is set!"); + PlotSquared.log(C.PREFIX + "&cNo storage type is set!"); this.IMP.disable(); return; } DBFunc.dbManager = new SQLManager(database, Storage.PREFIX, false); this.plots_tmp = DBFunc.getPlots(); - if (manager instanceof SinglePlotAreaManager) { - SinglePlotArea area = ((SinglePlotAreaManager) manager).getArea(); + if (plotAreaManager instanceof SinglePlotAreaManager) { + SinglePlotArea area = ((SinglePlotAreaManager) plotAreaManager).getArea(); addPlotArea(area); ConfigurationSection section = worlds.getConfigurationSection("worlds.*"); if (section == null) { @@ -1611,17 +1584,18 @@ public class PS { } this.clusters_tmp = DBFunc.getClusters(); } catch (ClassNotFoundException | SQLException e) { - PS.log( + PlotSquared.log( C.PREFIX + "&cFailed to open DATABASE connection. The plugin will disable itself."); if (Storage.MySQL.USE) { - PS.log("$4MYSQL"); + PlotSquared.log("$4MYSQL"); } else if (Storage.SQLite.USE) { - PS.log("$4SQLITE"); + PlotSquared.log("$4SQLITE"); } - PS.log("&d==== Here is an ugly stacktrace, if you are interested in those things ==="); + PlotSquared.log( + "&d==== Here is an ugly stacktrace, if you are interested in those things ==="); e.printStackTrace(); - PS.log("&d==== End of stacktrace ===="); - PS.log("&6Please go to the " + IMP.getPluginName() + PlotSquared.log("&d==== End of stacktrace ===="); + PlotSquared.log("&6Please go to the " + IMP.getPluginName() + " 'storage.yml' and configure the database correctly."); this.IMP.disable(); } @@ -1646,7 +1620,7 @@ public class PS { try { worlds.save(worldsFile); } catch (IOException e) { - PS.debug("Failed to save " + IMP.getPluginName() + " worlds.yml"); + PlotSquared.debug("Failed to save " + IMP.getPluginName() + " worlds.yml"); e.printStackTrace(); } } @@ -1681,28 +1655,29 @@ public class PS { public void setupConfigs() { File folder = new File(this.IMP.getDirectory(), "config"); if (!folder.exists() && !folder.mkdirs()) { - PS.log(C.PREFIX + PlotSquared.log(C.PREFIX + "&cFailed to create the /plugins/config folder. Please create it manually."); } try { this.worldsFile = new File(folder, "worlds.yml"); if (!this.worldsFile.exists() && !this.worldsFile.createNewFile()) { - PS.log("Could not create the worlds file, please create \"worlds.yml\" manually."); + PlotSquared.log( + "Could not create the worlds file, please create \"worlds.yml\" manually."); } this.worlds = YamlConfiguration.loadConfiguration(this.worldsFile); } catch (IOException ignored) { - PS.log("Failed to save settings.yml"); + PlotSquared.log("Failed to save settings.yml"); } try { this.configFile = new File(folder, "settings.yml"); if (!this.configFile.exists() && !this.configFile.createNewFile()) { - PS.log( + PlotSquared.log( "Could not create the settings file, please create \"settings.yml\" manually."); } this.config = YamlConfiguration.loadConfiguration(this.configFile); setupConfig(); } catch (IOException ignored) { - PS.log("Failed to save settings.yml"); + PlotSquared.log("Failed to save settings.yml"); } try { this.styleFile = MainUtil.getFile(IMP.getDirectory(), @@ -1712,7 +1687,7 @@ public class PS { this.styleFile.getParentFile().mkdirs(); } if (!this.styleFile.createNewFile()) { - PS.log( + PlotSquared.log( "Could not create the style file, please create \"translations/style.yml\" manually"); } } @@ -1720,34 +1695,34 @@ public class PS { setupStyle(); } catch (IOException err) { err.printStackTrace(); - PS.log("failed to save style.yml"); + PlotSquared.log("failed to save style.yml"); } try { this.storageFile = new File(folder, "storage.yml"); if (!this.storageFile.exists() && !this.storageFile.createNewFile()) { - PS.log( + PlotSquared.log( "Could not the storage settings file, please create \"storage.yml\" manually."); } this.storage = YamlConfiguration.loadConfiguration(this.storageFile); setupStorage(); } catch (IOException ignored) { - PS.log("Failed to save storage.yml"); + PlotSquared.log("Failed to save storage.yml"); } try { this.commandsFile = new File(folder, "commands.yml"); if (!this.commandsFile.exists() && !this.commandsFile.createNewFile()) { - PS.log( + PlotSquared.log( "Could not the storage settings file, please create \"commands.yml\" manually."); } this.commands = YamlConfiguration.loadConfiguration(this.commandsFile); } catch (IOException ignored) { - PS.log("Failed to save commands.yml"); + PlotSquared.log("Failed to save commands.yml"); } try { this.style.save(this.styleFile); this.commands.save(this.commandsFile); } catch (IOException e) { - PS.log("Configuration file saving failed"); + PlotSquared.log("Configuration file saving failed"); e.printStackTrace(); } } @@ -1768,8 +1743,9 @@ public class PS { if (Settings.DEBUG) { 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())); + PlotSquared.log(C.PREFIX + String + .format("&cKey: &6%s&c, Value: &6%s", component.getKey(), + component.getValue())); } } } @@ -1802,83 +1778,71 @@ public class PS { return Double.parseDouble(System.getProperty("java.specification.version")); } - public void foreachPlotArea(RunnableVal runnable) { - for (PlotArea area : this.manager.getAllPlotAreas()) { + public void foreachPlotArea(@NonNull final RunnableVal runnable) { + for (final PlotArea area : this.plotAreaManager.getAllPlotAreas()) { runnable.run(area); } } - public void foreachPlotArea(String world, RunnableVal runnable) { - PlotArea[] array = this.manager.getPlotAreas(world, null); + public void foreachPlotArea(@NonNull final String world, @NonNull final RunnableVal runnable) { + final PlotArea[] array = this.plotAreaManager.getPlotAreas(world, null); if (array == null) { return; } - for (PlotArea area : array) { + for (final PlotArea area : array) { runnable.run(area); } } - public void foreachPlot(RunnableVal runnable) { - for (PlotArea area : this.manager.getAllPlotAreas()) { - for (Plot plot : area.getPlots()) { - runnable.run(plot); - } + public void foreachPlot(@NonNull final RunnableVal runnable) { + for (final PlotArea area : this.plotAreaManager.getAllPlotAreas()) { + area.getPlots().forEach(runnable::run); } } - public void foreachPlotRaw(RunnableVal runnable) { - for (PlotArea area : this.manager.getAllPlotAreas()) { - for (Plot plot : area.getPlots()) { - runnable.run(plot); - } + public void foreachPlotRaw(@NonNull final RunnableVal runnable) { + for (final PlotArea area : this.plotAreaManager.getAllPlotAreas()) { + area.getPlots().forEach(runnable::run); } if (this.plots_tmp != null) { - for (HashMap entry : this.plots_tmp.values()) { - for (Plot entry2 : entry.values()) { - runnable.run(entry2); - } + for (final HashMap entry : this.plots_tmp.values()) { + entry.values().forEach(runnable::run); } } } - public void foreachBasePlot(RunnableVal run) { - for (PlotArea area : this.manager.getAllPlotAreas()) { + public void foreachBasePlot(@NonNull final RunnableVal run) { + for (final PlotArea area : this.plotAreaManager.getAllPlotAreas()) { area.foreachBasePlot(run); } } public PlotArea getFirstPlotArea() { - PlotArea[] areas = manager.getAllPlotAreas(); + PlotArea[] areas = plotAreaManager.getAllPlotAreas(); return areas.length > 0 ? areas[0] : null; } public int getPlotAreaCount() { - return this.manager.getAllPlotAreas().length; + return this.plotAreaManager.getAllPlotAreas().length; } public int getPlotCount() { int count = 0; - for (PlotArea area : this.manager.getAllPlotAreas()) { + for (final PlotArea area : this.plotAreaManager.getAllPlotAreas()) { count += area.getPlotCount(); } return count; } public Set getPlotAreas() { - HashSet set = new HashSet<>(); - Collections.addAll(set, manager.getAllPlotAreas()); - return set; + final Set set = new HashSet<>(); + Collections.addAll(set, plotAreaManager.getAllPlotAreas()); + return Collections.unmodifiableSet(set); } - public boolean isAugmented(String world) { - PlotArea[] areas = manager.getPlotAreas(world, null); - if (areas == null) { - return false; - } - if (areas.length > 1) { - return true; - } - return areas[0].TYPE != 0; + public boolean isAugmented(@NonNull final String world) { + final PlotArea[] areas = plotAreaManager.getPlotAreas(world, null); + return areas != null && (areas.length > 1 || areas[0].TYPE != 0); } /** @@ -1887,9 +1851,9 @@ public class PS { * @param world the world * @return Collection of PlotArea objects */ - public Set getPlotAreas(String world) { - Set set = new HashSet<>(); - Collections.addAll(set, manager.getPlotAreas(world, null)); + public Set getPlotAreas(@NonNull final String world) { + final Set set = new HashSet<>(); + Collections.addAll(set, plotAreaManager.getPlotAreas(world, null)); return set; } @@ -1906,12 +1870,12 @@ public class PS { * @param location the location * @return */ - public PlotArea getApplicablePlotArea(Location location) { - return manager.getApplicablePlotArea(location); + public PlotArea getApplicablePlotArea(@NonNull final Location location) { + return plotAreaManager.getApplicablePlotArea(location); } - public PlotArea getPlotArea(String world, String id) { - return manager.getPlotArea(world, id); + public PlotArea getPlotArea(@NonNull final String world, @NonNull final String id) { + return plotAreaManager.getPlotArea(world, id); } /** @@ -1924,15 +1888,15 @@ public class PS { * @param location the location * @return the {@link PlotArea} in the location, null if non existent */ - public PlotArea getPlotAreaAbs(Location location) { - return manager.getPlotArea(location); + public PlotArea getPlotAreaAbs(@NonNull final Location location) { + return plotAreaManager.getPlotArea(location); } - public PlotArea getPlotAreaByString(String search) { - String[] split = search.split(";|,"); - PlotArea[] areas = manager.getPlotAreas(split[0], null); + public PlotArea getPlotAreaByString(@NonNull final String search) { + String[] split = search.split("[;,]"); + PlotArea[] areas = plotAreaManager.getPlotAreas(split[0], null); if (areas == null) { - for (PlotArea area : manager.getAllPlotAreas()) { + for (PlotArea area : plotAreaManager.getAllPlotAreas()) { if (area.worldname.equalsIgnoreCase(split[0])) { if (area.id == null || split.length == 2 && area.id .equalsIgnoreCase(split[1])) { @@ -1963,26 +1927,24 @@ public class PS { * @param worldname to filter alias to a specific world [optional] null means all worlds * @return Set<{@link Plot}> empty if nothing found */ - public Set getPlotsByAlias(String alias, String worldname) { - Set result = new HashSet<>(); - + public Set getPlotsByAlias(@Nullable final String alias, @NonNull final String worldname) { + final Set result = new HashSet<>(); if (alias != null) { - for (Plot plot : getPlots()) { + for (final Plot plot : getPlots()) { if (alias.equals(plot.getAlias()) && (worldname == null || worldname .equals(plot.getWorldName()))) { result.add(plot); } } } - - return result; + return Collections.unmodifiableSet(result); } - public Set getPlotAreas(String world, RegionWrapper region) { - PlotArea[] areas = manager.getPlotAreas(world, region); - Set set = new HashSet<>(); + public Set getPlotAreas(final String world, final RegionWrapper region) { + final PlotArea[] areas = plotAreaManager.getPlotAreas(world, region); + final Set set = new HashSet<>(); Collections.addAll(set, areas); - return set; + return Collections.unmodifiableSet(set); } public enum SortType { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/Updater.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/Updater.java index 7976ab319..d1d1f97cc 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/Updater.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/Updater.java @@ -18,7 +18,7 @@ public class Updater { public String getChanges() { if (changes == null) { try (Scanner scanner = new Scanner(new URL( - "http://empcraft.com/plots/cl?" + Integer.toHexString(PS.get().getVersion().hash)) + "http://empcraft.com/plots/cl?" + Integer.toHexString(PlotSquared.get().getVersion().hash)) .openStream(), "UTF-8")) { changes = scanner.useDelimiter("\\A").next(); } catch (IOException e) { @@ -50,7 +50,7 @@ public class Updater { URL download = new URL(downloadUrl.replaceAll("%platform%", platform) .replaceAll("%version%", versionString)); try (ReadableByteChannel rbc = Channels.newChannel(download.openStream())) { - File jarFile = PS.get().getJarFile(); + File jarFile = PlotSquared.get().getJarFile(); File finalFile = new File(jarFile.getParent(), "update" + File.separator + jarFile.getName()); @@ -69,7 +69,7 @@ public class Updater { fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); } outFile.renameTo(finalFile); - PS.debug("Updated PlotSquared to " + versionString); + PlotSquared.debug("Updated PlotSquared to " + versionString); MainUtil.sendAdmin( "&7Restart to update PlotSquared with these changes: &c/plot changelog &7or&c " + "http://empcraft.com/plots/cl?" + Integer diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Alias.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Alias.java index 1394297d8..a9c7bea2a 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Alias.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Alias.java @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.C; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; @@ -88,13 +88,13 @@ public class Alias extends SubCommand { C.NOT_VALID_VALUE.send(player); return false; } - for (Plot p : PS.get().getPlots(plot.getArea())) { + for (Plot p : PlotSquared.get().getPlots(plot.getArea())) { if (p.getAlias().equalsIgnoreCase(alias)) { MainUtil.sendMessage(player, C.ALIAS_IS_TAKEN); return false; } } - if (UUIDHandler.nameExists(new StringWrapper(alias)) || PS.get().hasPlotArea(alias)) { + if (UUIDHandler.nameExists(new StringWrapper(alias)) || PlotSquared.get().hasPlotArea(alias)) { MainUtil.sendMessage(player, C.ALIAS_IS_TAKEN); return false; } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Area.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Area.java index dec8ca5d2..ba7c4f046 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Area.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Area.java @@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.C; import com.github.intellectualsites.plotsquared.plot.config.Configuration; import com.github.intellectualsites.plotsquared.plot.generator.AugmentedUtils; @@ -81,7 +81,8 @@ public class Area extends SubCommand { final int offsetX = bx - (area.ROAD_WIDTH == 0 ? 0 : lower); final int offsetZ = bz - (area.ROAD_WIDTH == 0 ? 0 : lower); final RegionWrapper region = new RegionWrapper(bx, tx, bz, tz); - Set areas = PS.get().getPlotAreas(area.worldname, region); + Set areas = PlotSquared + .get().getPlotAreas(area.worldname, region); if (!areas.isEmpty()) { C.CLUSTER_INTERSECTION .send(player, areas.iterator().next().toString()); @@ -94,8 +95,8 @@ public class Area extends SubCommand { object.type = area.TYPE; object.min = new PlotId(1, 1); object.max = new PlotId(numX, numZ); - object.plotManager = PS.imp().getPluginName(); - object.setupGenerator = PS.imp().getPluginName(); + object.plotManager = PlotSquared.imp().getPluginName(); + object.setupGenerator = PlotSquared.imp().getPluginName(); object.step = area.getSettingNodes(); final String path = "worlds." + area.worldname + ".areas." + area.id + '-' @@ -103,14 +104,14 @@ public class Area extends SubCommand { Runnable run = new Runnable() { @Override public void run() { if (offsetX != 0) { - PS.get().worlds.set(path + ".road.offset.x", offsetX); + PlotSquared.get().worlds.set(path + ".road.offset.x", offsetX); } if (offsetZ != 0) { - PS.get().worlds.set(path + ".road.offset.z", offsetZ); + PlotSquared.get().worlds.set(path + ".road.offset.z", offsetZ); } final String world = SetupUtils.manager.setupWorld(object); if (WorldUtil.IMP.isWorld(world)) { - PS.get().loadWorld(world, null); + PlotSquared.get().loadWorld(world, null); C.SETUP_FINISHED.send(player); player.teleport(WorldUtil.IMP.getSpawn(world)); if (area.TERRAIN != 3) { @@ -149,13 +150,13 @@ public class Area extends SubCommand { } object.world = split[0]; final HybridPlotWorld pa = new HybridPlotWorld(object.world, id, - PS.get().IMP.getDefaultGenerator(), null, null); - PlotArea other = PS.get().getPlotArea(pa.worldname, id); + PlotSquared.get().IMP.getDefaultGenerator(), null, null); + PlotArea other = PlotSquared.get().getPlotArea(pa.worldname, id); if (other != null && Objects.equals(pa.id, other.id)) { C.SETUP_WORLD_TAKEN.send(player, pa.toString()); return false; } - Set areas = PS.get().getPlotAreas(pa.worldname); + Set areas = PlotSquared.get().getPlotAreas(pa.worldname); if (!areas.isEmpty()) { PlotArea area = areas.iterator().next(); pa.TYPE = area.TYPE; @@ -224,15 +225,15 @@ public class Area extends SubCommand { Runnable run = new Runnable() { @Override public void run() { String path = "worlds." + pa.worldname; - if (!PS.get().worlds.contains(path)) { - PS.get().worlds.createSection(path); + if (!PlotSquared.get().worlds.contains(path)) { + PlotSquared.get().worlds.createSection(path); } ConfigurationSection section = - PS.get().worlds.getConfigurationSection(path); + PlotSquared.get().worlds.getConfigurationSection(path); pa.saveConfiguration(section); pa.loadConfiguration(section); - object.plotManager = PS.imp().getPluginName(); - object.setupGenerator = PS.imp().getPluginName(); + object.plotManager = PlotSquared.imp().getPluginName(); + object.setupGenerator = PlotSquared.imp().getPluginName(); String world = SetupUtils.manager.setupWorld(object); if (WorldUtil.IMP.isWorld(world)) { C.SETUP_FINISHED.send(player); @@ -243,7 +244,7 @@ public class Area extends SubCommand { + pa.worldname); } try { - PS.get().worlds.save(PS.get().worldsFile); + PlotSquared.get().worlds.save(PlotSquared.get().worldsFile); } catch (IOException e) { e.printStackTrace(); } @@ -291,7 +292,7 @@ public class Area extends SubCommand { area = player.getApplicablePlotArea(); break; case 2: - area = PS.get().getPlotAreaByString(args[1]); + area = PlotSquared.get().getPlotAreaByString(args[1]); break; default: C.COMMAND_SYNTAX.send(player, getCommandString() + " info [area]"); @@ -351,7 +352,7 @@ public class Area extends SubCommand { C.COMMAND_SYNTAX.send(player, getCommandString() + " list [#]"); return false; } - ArrayList areas = new ArrayList<>(PS.get().getPlotAreas()); + ArrayList areas = new ArrayList<>(PlotSquared.get().getPlotAreas()); paginate(player, areas, 8, page, new RunnableVal3() { @Override public void run(Integer i, PlotArea area, PlotMessage message) { @@ -435,7 +436,7 @@ public class Area extends SubCommand { C.COMMAND_SYNTAX.send(player, "/plot visit [area]"); return false; } - PlotArea area = PS.get().getPlotAreaByString(args[1]); + PlotArea area = PlotSquared.get().getPlotAreaByString(args[1]); if (area == null) { C.NOT_VALID_PLOT_WORLD.send(player, args[1]); return false; @@ -457,7 +458,7 @@ public class Area extends SubCommand { case "remove": MainUtil.sendMessage(player, "$1World creation settings may be stored in multiple locations:" - + "\n$3 - $2Bukkit bukkit.yml" + "\n$3 - $2" + PS.imp().getPluginName() + + "\n$3 - $2Bukkit bukkit.yml" + "\n$3 - $2" + PlotSquared.imp().getPluginName() + " settings.yml" + "\n$3 - $2Multiverse worlds.yml (or any world management plugin)" + "\n$1Stop the server and delete it from these locations."); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Auto.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Auto.java index 050a0b30f..428b76b15 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Auto.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Auto.java @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.C; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; @@ -138,7 +138,7 @@ public class Auto extends SubCommand { PlotArea plotarea = player.getApplicablePlotArea(); if (plotarea == null) { if (EconHandler.manager != null) { - for (PlotArea area : PS.get().getPlotAreaManager().getAllPlotAreas()) { + for (PlotArea area : PlotSquared.get().getPlotAreaManager().getAllPlotAreas()) { if (EconHandler.manager .hasPermission(area.worldname, player.getName(), "plots.auto")) { if (plotarea != null) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Changelog.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Changelog.java index d26fe3da6..720bff1bf 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Changelog.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Changelog.java @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.Updater; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; @@ -15,11 +15,11 @@ import java.util.Scanner; @Override public boolean onCommand(PlotPlayer player, String[] args) { try { - Updater updater = PS.get().getUpdater(); + Updater updater = PlotSquared.get().getUpdater(); String changes = updater != null ? updater.getChanges() : null; if (changes == null) { try (Scanner scanner = new Scanner(new URL("http://empcraft.com/plots/cl?" + Integer - .toHexString(PS.get().getVersion().hash)).openStream(), "UTF-8")) { + .toHexString(PlotSquared.get().getVersion().hash)).openStream(), "UTF-8")) { changes = scanner.useDelimiter("\\A").next(); } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Cluster.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Cluster.java index 0525a04f7..cd605bf30 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Cluster.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Cluster.java @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.C; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; @@ -379,7 +379,7 @@ public class Cluster extends SubCommand { MainUtil.sendMessage(player2, C.CLUSTER_REMOVED, cluster.getName()); } for (Plot plot : new ArrayList<>( - PS.get().getPlots(player2.getLocation().getWorld(), uuid))) { + PlotSquared.get().getPlots(player2.getLocation().getWorld(), uuid))) { PlotCluster current = plot.getCluster(); if (current != null && current.equals(cluster)) { plot.unclaim(); @@ -433,7 +433,7 @@ public class Cluster extends SubCommand { DBFunc.removeInvited(cluster, uuid); MainUtil.sendMessage(player, C.CLUSTER_REMOVED, cluster.getName()); for (Plot plot : new ArrayList<>( - PS.get().getPlots(player.getLocation().getWorld(), uuid))) { + PlotSquared.get().getPlots(player.getLocation().getWorld(), uuid))) { PlotCluster current = plot.getCluster(); if (current != null && current.equals(cluster)) { player.getLocation().getWorld(); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Condense.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Condense.java index 045d9536d..94629e08d 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Condense.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Condense.java @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; import com.github.intellectualsites.plotsquared.plot.object.PlotId; @@ -25,7 +25,7 @@ public class Condense extends SubCommand { MainUtil.sendMessage(player, "/plot condense [radius]"); return false; } - PlotArea area = PS.get().getPlotAreaByString(args[0]); + PlotArea area = PlotSquared.get().getPlotAreaByString(args[0]); if (area == null || !WorldUtil.IMP.isWorld(area.worldname)) { MainUtil.sendMessage(player, "INVALID AREA"); return false; @@ -46,7 +46,7 @@ public class Condense extends SubCommand { return false; } int radius = Integer.parseInt(args[2]); - ArrayList plots = new ArrayList<>(PS.get().getPlots(area)); + ArrayList plots = new ArrayList<>(PlotSquared.get().getPlots(area)); // remove non base plots Iterator iterator = plots.iterator(); int maxSize = 0; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Database.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Database.java index b10b76a03..621efa920 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Database.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Database.java @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.database.MySQL; import com.github.intellectualsites.plotsquared.plot.database.SQLManager; @@ -57,12 +57,12 @@ public class Database extends SubCommand { return false; } List plots; - PlotArea area = PS.get().getPlotAreaByString(args[0]); + PlotArea area = PlotSquared.get().getPlotAreaByString(args[0]); if (area != null) { - plots = PS.get().sortPlotsByTemp(area.getPlots()); + plots = PlotSquared.get().sortPlotsByTemp(area.getPlots()); args = Arrays.copyOfRange(args, 1, args.length); } else { - plots = PS.get().sortPlotsByTemp(PS.get().getPlots()); + plots = PlotSquared.get().sortPlotsByTemp(PlotSquared.get().getPlots()); } if (args.length < 1) { MainUtil.sendMessage(player, "/plot database [world] "); @@ -79,7 +79,7 @@ public class Database extends SubCommand { .sendMessage(player, "/plot database import [prefix]"); return false; } - File file = MainUtil.getFile(PS.get().IMP.getDirectory(), + File file = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), args[1].endsWith(".db") ? args[1] : args[1] + ".db"); if (!file.exists()) { MainUtil.sendMessage(player, "&6Database does not exist: " + file); @@ -93,7 +93,7 @@ public class Database extends SubCommand { plots = new ArrayList<>(); for (Entry> entry : map.entrySet()) { String areaname = entry.getKey(); - PlotArea pa = PS.get().getPlotAreaByString(areaname); + PlotArea pa = PlotSquared.get().getPlotAreaByString(areaname); if (pa != null) { for (Entry entry2 : entry.getValue().entrySet()) { Plot plot = entry2.getValue(); @@ -103,11 +103,11 @@ public class Database extends SubCommand { if (newPlot != null) { PlotId newId = newPlot.getId(); PlotId id = plot.getId(); - File worldFile = new File(PS.imp().getWorldContainer(), + File worldFile = new File(PlotSquared.imp().getWorldContainer(), id.toCommaSeparatedString()); if (worldFile.exists()) { File newFile = - new File(PS.imp().getWorldContainer(), + new File(PlotSquared.imp().getWorldContainer(), newId.toCommaSeparatedString()); worldFile.renameTo(newFile); } @@ -127,10 +127,10 @@ public class Database extends SubCommand { plots.add(plot); } } else { - HashMap plotmap = PS.get().plots_tmp.get(areaname); + HashMap plotmap = PlotSquared.get().plots_tmp.get(areaname); if (plotmap == null) { plotmap = new HashMap<>(); - PS.get().plots_tmp.put(areaname, plotmap); + PlotSquared.get().plots_tmp.put(areaname, plotmap); } plotmap.putAll(entry.getValue()); } @@ -161,7 +161,7 @@ public class Database extends SubCommand { return MainUtil.sendMessage(player, "/plot database sqlite [file]"); } File sqliteFile = - MainUtil.getFile(PS.get().IMP.getDirectory(), args[1] + ".db"); + MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), args[1] + ".db"); implementation = new SQLite(sqliteFile); break; default: diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Debug.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Debug.java index 69831c90f..976e3683f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Debug.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Debug.java @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.C; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; @@ -26,8 +26,8 @@ public class Debug extends SubCommand { information.append(header); information.append(getSection(section, "PlotArea")); information - .append(getLine(line, "Plot Worlds", StringMan.join(PS.get().getPlotAreas(), ", "))); - information.append(getLine(line, "Owned Plots", PS.get().getPlots().size())); + .append(getLine(line, "Plot Worlds", StringMan.join(PlotSquared.get().getPlotAreas(), ", "))); + information.append(getLine(line, "Owned Plots", PlotSquared.get().getPlots().size())); information.append(getSection(section, "Messages")); information.append(getLine(line, "Total Messages", C.values().length)); information.append(getLine(line, "View all captions", "/plot debug msg")); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugClaimTest.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugClaimTest.java index 4444db0aa..e57a543ef 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugClaimTest.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugClaimTest.java @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.C; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.object.*; @@ -26,7 +26,7 @@ public class DebugClaimTest extends SubCommand { "If you accidentally delete your database, this command will attempt to restore all plots based on the data from the " + "plot signs. \n\n&cMissing world arg /plot debugclaimtest {world} {PlotId min} {PlotId max}"); } - PlotArea area = PS.get().getPlotAreaByString(args[0]); + PlotArea area = PlotSquared.get().getPlotAreaByString(args[0]); if (area == null || !WorldUtil.IMP.isWorld(area.worldname)) { C.NOT_VALID_PLOT_WORLD.send(player, args[0]); return false; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugExec.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugExec.java index 228f27ebc..87dab8b30 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugExec.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugExec.java @@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.C; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; @@ -31,13 +31,13 @@ import java.util.*; public DebugExec() { try { - if (PS.get() != null) { - File file = new File(PS.get().IMP.getDirectory(), + if (PlotSquared.get() != null) { + File file = new File(PlotSquared.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), + PlotSquared.get().IMP.getDirectory() + File.separator + Settings.Paths.SCRIPTS), "start.js"), StandardCharsets.UTF_8), System.getProperty("line.separator")); this.scope.put("THIS", this); this.scope.put("PlotPlayer", ConsolePlayer.getConsole()); @@ -87,10 +87,10 @@ import java.util.*; this.scope.put("RunnableVal", RunnableVal.class); // Instances - this.scope.put("PS", PS.get()); + this.scope.put("PS", PlotSquared.get()); this.scope.put("GlobalBlockQueue", GlobalBlockQueue.IMP); this.scope.put("ExpireManager", ExpireManager.IMP); - if (PS.get().worldedit != null) { + if (PlotSquared.get().worldedit != null) { this.scope.put("WEManager", new WEManager()); } this.scope.put("TaskManager", TaskManager.IMP); @@ -105,7 +105,7 @@ import java.util.*; this.scope.put("UUIDHandler", UUIDHandler.implementation); this.scope.put("DBFunc", DBFunc.dbManager); this.scope.put("HybridUtils", HybridUtils.manager); - this.scope.put("IMP", PS.get().IMP); + this.scope.put("IMP", PlotSquared.get().IMP); this.scope.put("MainCommand", MainCommand.getInstance()); // enums @@ -180,7 +180,7 @@ import java.util.*; return false; } String flag = args[1]; - for (Plot plot : PS.get().getBasePlots()) { + for (Plot plot : PlotSquared.get().getBasePlots()) { Flag flag1 = FlagManager.getFlag(flag); if (plot.getFlag(flag1).isPresent()) { plot.removeFlag(flag1); @@ -193,7 +193,7 @@ import java.util.*; "&cInvalid syntax: /plot debugexec start-rgar "); return false; } - PlotArea area = PS.get().getPlotAreaByString(args[1]); + PlotArea area = PlotSquared.get().getPlotAreaByString(args[1]); if (area == null) { MainUtil.sendMessage(player, C.NOT_VALID_PLOT_WORLD, args[1]); return false; @@ -261,7 +261,7 @@ import java.util.*; case "addcmd": try { final String cmd = StringMan.join(Files.readLines(MainUtil.getFile(new File( - PS.get().IMP.getDirectory() + File.separator + Settings.Paths.SCRIPTS), + PlotSquared.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, @@ -291,7 +291,7 @@ import java.util.*; case "run": try { script = StringMan.join(Files.readLines(MainUtil.getFile(new File( - PS.get().IMP.getDirectory() + File.separator + Settings.Paths.SCRIPTS), + PlotSquared.get().IMP.getDirectory() + File.separator + Settings.Paths.SCRIPTS), args[1]), StandardCharsets.UTF_8), System.getProperty("line.separator")); if (args.length > 2) { @@ -308,7 +308,7 @@ import java.util.*; break; case "list-scripts": String path = - PS.get().IMP.getDirectory() + File.separator + Settings.Paths.SCRIPTS; + PlotSquared.get().IMP.getDirectory() + File.separator + Settings.Paths.SCRIPTS; File folder = new File(path); File[] filesArray = folder.listFiles(); @@ -350,7 +350,7 @@ import java.util.*; if ("true".equals(args[1])) { Location loc = player.getMeta("location"); Plot plot = player.getMeta("lastplot"); - for (Plot current : PS.get().getBasePlots()) { + for (Plot current : PlotSquared.get().getBasePlots()) { player.setMeta("location", current.getBottomAbs()); player.setMeta("lastplot", current); cmd.execute(player, params, null, null); @@ -398,7 +398,7 @@ import java.util.*; } init(); this.scope.put("PlotPlayer", player); - PS.debug("> " + script); + PlotSquared.debug("> " + script); try { if (async) { final String toExec = script; @@ -411,13 +411,13 @@ import java.util.*; } catch (ScriptException e) { e.printStackTrace(); } - PS.log("> " + (System.currentTimeMillis() - start) + "ms -> " + result); + PlotSquared.log("> " + (System.currentTimeMillis() - start) + "ms -> " + result); } }); } else { long start = System.currentTimeMillis(); Object result = this.engine.eval(script, this.scope); - PS.log("> " + (System.currentTimeMillis() - start) + "ms -> " + result); + PlotSquared.log("> " + (System.currentTimeMillis() - start) + "ms -> " + result); } return true; } catch (ScriptException e) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugFixFlags.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugFixFlags.java index 03fdf12c2..eaea2ad82 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugFixFlags.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugFixFlags.java @@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.Argument; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.C; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.flag.Flag; @@ -24,7 +24,7 @@ public class DebugFixFlags extends SubCommand { } @Override public boolean onCommand(PlotPlayer player, String[] args) { - PlotArea area = PS.get().getPlotAreaByString(args[0]); + PlotArea area = PlotSquared.get().getPlotAreaByString(args[0]); if (area == null || !WorldUtil.IMP.isWorld(area.worldname)) { MainUtil.sendMessage(player, C.NOT_VALID_PLOT_WORLD, args[0]); return false; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugImportWorlds.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugImportWorlds.java index bc4299d68..7a8d92744 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugImportWorlds.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugImportWorlds.java @@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.PlotId; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2; @@ -27,14 +27,14 @@ public class DebugImportWorlds extends Command { RunnableVal3 confirm, RunnableVal2 whenDone) throws CommandException { // UUID.nameUUIDFromBytes(("OfflinePlayer:" + player.getName()).getBytes(Charsets.UTF_8)) - PlotAreaManager pam = PS.get().getPlotAreaManager(); + PlotAreaManager pam = PlotSquared.get().getPlotAreaManager(); if (!(pam instanceof SinglePlotAreaManager)) { player.sendMessage("Must be a single plot area!"); return; } SinglePlotArea area = ((SinglePlotAreaManager) pam).getArea(); PlotId id = new PlotId(0, 0); - File container = PS.imp().getWorldContainer(); + File container = PlotSquared.imp().getWorldContainer(); for (File folder : container.listFiles()) { String name = folder.getName(); if (!WorldUtil.IMP.isWorld(name) && PlotId.fromString(name) == null) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugLoadTest.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugLoadTest.java index 7327fa4a5..bbc972438 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugLoadTest.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugLoadTest.java @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; @@ -9,7 +9,7 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; public class DebugLoadTest extends SubCommand { @Override public boolean onCommand(PlotPlayer player, String[] args) { - PS.get().plots_tmp = DBFunc.getPlots(); + PlotSquared.get().plots_tmp = DBFunc.getPlots(); return true; } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java index 568d94228..c2b23598c 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugPaste.java @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.C; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; @@ -20,13 +20,13 @@ public class DebugPaste extends SubCommand { TaskManager.runTaskAsync(new Runnable() { @Override public void run() { try { - String settingsYML = HastebinUtility.upload(PS.get().configFile); - String worldsYML = HastebinUtility.upload(PS.get().worldsFile); - String commandsYML = HastebinUtility.upload(PS.get().commandsFile); + String settingsYML = HastebinUtility.upload(PlotSquared.get().configFile); + String worldsYML = HastebinUtility.upload(PlotSquared.get().worldsFile); + String commandsYML = HastebinUtility.upload(PlotSquared.get().commandsFile); String latestLOG; try { latestLOG = HastebinUtility - .upload(new File(PS.get().IMP.getDirectory(), "../../logs/latest.log")); + .upload(new File(PlotSquared.get().IMP.getDirectory(), "../../logs/latest.log")); } catch (IOException ignored) { MainUtil.sendMessage(player, "&clatest.log is too big to be pasted, will ignore"); @@ -41,13 +41,13 @@ public class DebugPaste extends SubCommand { b.append("links.commands_yml: ").append(commandsYML).append('\n'); b.append("links.latest_log: ").append(latestLOG).append('\n'); b.append("\n# Server Information\n"); - int[] sVersion = PS.get().IMP.getServerVersion(); + int[] sVersion = PlotSquared.get().IMP.getServerVersion(); b.append("version.server: ").append(sVersion[0]).append('.').append(sVersion[1]) .append('.').append(sVersion[2]).append('\n'); b.append("online_mode: ").append(UUIDHandler.getUUIDWrapper()).append(';') .append(!Settings.UUID.OFFLINE).append('\n'); b.append("plugins:"); - for (String id : PS.get().IMP.getPluginIds()) { + for (String id : PlotSquared.get().IMP.getPluginIds()) { String[] split = id.split(":"); String[] split2 = split[0].split(";"); String enabled = split.length == 2 ? split[1] : "unknown"; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugSaveTest.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugSaveTest.java index e102eb3ce..f90a5b1d6 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugSaveTest.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugSaveTest.java @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; @@ -14,7 +14,7 @@ public class DebugSaveTest extends SubCommand { @Override public boolean onCommand(final PlotPlayer player, String[] args) { ArrayList plots = new ArrayList(); - plots.addAll(PS.get().getPlots()); + plots.addAll(PlotSquared.get().getPlots()); MainUtil.sendMessage(player, "&6Starting `DEBUGSAVETEST`"); DBFunc.createPlotsAndData(plots, new Runnable() { @Override public void run() { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Deny.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Deny.java index 5531158d4..1fe41541c 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Deny.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Deny.java @@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.Argument; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.C; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.object.Location; @@ -99,7 +99,7 @@ public class Deny extends SubCommand { MainUtil.sendMessage(player, C.YOU_GOT_DENIED); if (plot.equals(spawn.getPlot())) { Location newSpawn = - WorldUtil.IMP.getSpawn(PS.get().getPlotAreaManager().getAllWorlds()[0]); + WorldUtil.IMP.getSpawn(PlotSquared.get().getPlotAreaManager().getAllWorlds()[0]); if (plot.equals(newSpawn.getPlot())) { // Kick from server if you can't be teleported to spawn player.kick(C.YOU_GOT_DENIED.s()); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Download.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Download.java index 0ae530f09..650ff9d93 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Download.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Download.java @@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.jnbt.CompoundTag; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.C; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.flag.Flags; @@ -19,7 +19,7 @@ public class Download extends SubCommand { @Override public boolean onCommand(final PlotPlayer player, String[] args) { String world = player.getLocation().getWorld(); - if (!PS.get().hasPlotArea(world)) { + if (!PlotSquared.get().hasPlotArea(world)) { return !sendMessage(player, C.NOT_IN_PLOT_WORLD); } final Plot plot = player.getCurrentPlot(); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/FlagCmd.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/FlagCmd.java index 66f9e74be..35ccf7a4e 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/FlagCmd.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/FlagCmd.java @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.C; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; @@ -27,7 +27,7 @@ public class FlagCmd extends SubCommand { int numeric = Integer.parseInt(value); perm = perm.substring(0, perm.length() - value.length() - 1); if (numeric > 0) { - int checkRange = PS.get().getPlatform().equalsIgnoreCase("bukkit") ? + int checkRange = PlotSquared.get().getPlatform().equalsIgnoreCase("bukkit") ? numeric : Settings.Limit.MAX_PLOTS; return player.hasPermissionRange(perm, checkRange) >= numeric; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Kick.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Kick.java index ce8e784c1..a8af942a6 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Kick.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Kick.java @@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.Argument; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.C; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.object.Location; @@ -76,7 +76,7 @@ public class Kick extends SubCommand { C.YOU_GOT_KICKED.send(player2); if (plot.equals(spawn.getPlot())) { Location newSpawn = - WorldUtil.IMP.getSpawn(PS.get().getPlotAreaManager().getAllWorlds()[0]); + WorldUtil.IMP.getSpawn(PlotSquared.get().getPlotAreaManager().getAllWorlds()[0]); if (plot.equals(newSpawn.getPlot())) { // Kick from server if you can't be teleported to spawn player2.kick(C.YOU_GOT_KICKED.s()); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/ListCmd.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/ListCmd.java index fdc03f77f..29a1defb2 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/ListCmd.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/ListCmd.java @@ -1,8 +1,8 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.PS; -import com.github.intellectualsites.plotsquared.plot.PS.SortType; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; +import com.github.intellectualsites.plotsquared.plot.PlotSquared.SortType; import com.github.intellectualsites.plotsquared.plot.config.C; import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.object.*; @@ -98,7 +98,7 @@ public class ListCmd extends SubCommand { return false; } sort = false; - plots = PS.get().sortPlotsByTemp(PS.get().getBasePlots(player)); + plots = PlotSquared.get().sortPlotsByTemp(PlotSquared.get().getBasePlots(player)); break; case "shared": if (!Permissions.hasPermission(player, C.PERMISSION_LIST_SHARED)) { @@ -106,7 +106,7 @@ public class ListCmd extends SubCommand { return false; } plots = new ArrayList<>(); - for (Plot plot : PS.get().getPlots()) { + for (Plot plot : PlotSquared.get().getPlots()) { if (plot.getTrusted().contains(player.getUUID()) || plot.getMembers() .contains(player.getUUID())) { plots.add(plot); @@ -123,7 +123,7 @@ public class ListCmd extends SubCommand { C.PERMISSION_LIST_WORLD_NAME.f(world)); return false; } - plots = new ArrayList<>(PS.get().getPlots(world)); + plots = new ArrayList<>(PlotSquared.get().getPlots(world)); break; case "expired": if (!Permissions.hasPermission(player, C.PERMISSION_LIST_EXPIRED)) { @@ -151,7 +151,7 @@ public class ListCmd extends SubCommand { MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_ALL); return false; } - plots = new ArrayList<>(PS.get().getPlots()); + plots = new ArrayList<>(PlotSquared.get().getPlots()); break; case "done": if (!Permissions.hasPermission(player, C.PERMISSION_LIST_DONE)) { @@ -159,7 +159,7 @@ public class ListCmd extends SubCommand { return false; } plots = new ArrayList<>(); - for (Plot plot : PS.get().getPlots()) { + for (Plot plot : PlotSquared.get().getPlots()) { Optional flag = plot.getFlag(Flags.DONE); if (!flag.isPresent()) { continue; @@ -186,7 +186,7 @@ public class ListCmd extends SubCommand { MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_TOP); return false; } - plots = new ArrayList<>(PS.get().getPlots()); + plots = new ArrayList<>(PlotSquared.get().getPlots()); Collections.sort(plots, new Comparator() { @Override public int compare(Plot p1, Plot p2) { double v1 = 0; @@ -226,7 +226,7 @@ public class ListCmd extends SubCommand { break; } plots = new ArrayList<>(); - for (Plot plot : PS.get().getPlots()) { + for (Plot plot : PlotSquared.get().getPlots()) { Optional price = plot.getFlag(Flags.PRICE); if (price.isPresent()) { plots.add(plot); @@ -239,7 +239,7 @@ public class ListCmd extends SubCommand { return false; } plots = new ArrayList<>(); - for (Plot plot : PS.get().getPlots()) { + for (Plot plot : PlotSquared.get().getPlots()) { if (plot.owner == null) { plots.add(plot); } @@ -251,7 +251,7 @@ public class ListCmd extends SubCommand { return false; } plots = new ArrayList<>(); - for (Plot plot : PS.get().getPlots()) { + for (Plot plot : PlotSquared.get().getPlots()) { if (plot.owner == null) { continue; } @@ -279,7 +279,7 @@ public class ListCmd extends SubCommand { sort = false; break; default: - if (PS.get().hasPlotArea(args[0])) { + if (PlotSquared.get().hasPlotArea(args[0])) { if (!Permissions.hasPermission(player, C.PERMISSION_LIST_WORLD)) { MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_WORLD); return false; @@ -290,7 +290,7 @@ public class ListCmd extends SubCommand { C.PERMISSION_LIST_WORLD_NAME.f(args[0])); return false; } - plots = new ArrayList<>(PS.get().getPlots(args[0])); + plots = new ArrayList<>(PlotSquared.get().getPlots(args[0])); break; } UUID uuid = UUIDHandler.getUUID(args[0], null); @@ -306,7 +306,7 @@ public class ListCmd extends SubCommand { return false; } sort = false; - plots = PS.get().sortPlotsByTemp(PS.get().getPlots(uuid)); + plots = PlotSquared.get().sortPlotsByTemp(PlotSquared.get().getPlots(uuid)); break; } } @@ -336,7 +336,7 @@ public class ListCmd extends SubCommand { } } if (sort) { - plots = PS.get().sortPlots(plots, SortType.CREATION_DATE, area); + plots = PlotSquared.get().sortPlots(plots, SortType.CREATION_DATE, area); } this.paginate(player, plots, pageSize, page, new RunnableVal3() { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Load.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Load.java index 4c75b527a..769241809 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Load.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Load.java @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.C; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.object.*; @@ -20,7 +20,7 @@ public class Load extends SubCommand { @Override public boolean onCommand(final PlotPlayer player, String[] args) { String world = player.getLocation().getWorld(); - if (!PS.get().hasPlotArea(world)) { + if (!PlotSquared.get().hasPlotArea(world)) { return !sendMessage(player, C.NOT_IN_PLOT_WORLD); } final Plot plot = player.getCurrentPlot(); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/MainCommand.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/MainCommand.java index 2606c5f6f..053eec4d7 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/MainCommand.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/MainCommand.java @@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.C; import com.github.intellectualsites.plotsquared.plot.object.*; import com.github.intellectualsites.plotsquared.plot.util.CmdConfirm; @@ -185,7 +185,7 @@ import java.util.Arrays; /** * @Deprecated legacy */ public void addCommand(SubCommand command) { - PS.debug("Command registration is now done during instantiation"); + PlotSquared.debug("Command registration is now done during instantiation"); } @Override public void execute(final PlotPlayer player, String[] args, diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Move.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Move.java index 05031f8f3..725ce3a25 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Move.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Move.java @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.C; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; @@ -34,7 +34,7 @@ public class Move extends SubCommand { C.COMMAND_SYNTAX.send(player, getUsage()); return false; } - PlotArea area = PS.get().getPlotAreaByString(args[0]); + PlotArea area = PlotSquared.get().getPlotAreaByString(args[0]); Plot plot2; if (area == null) { plot2 = MainUtil.getPlotFromString(player, args[0], true); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/PluginCmd.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/PluginCmd.java index 991ce6dee..e15b887f3 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/PluginCmd.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/PluginCmd.java @@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.json.JSONObject; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.util.HttpUtil; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; @@ -15,8 +15,8 @@ public class PluginCmd extends SubCommand { TaskManager.IMP.taskAsync(new Runnable() { @Override public void run() { MainUtil.sendMessage(player, String - .format("$2>> $1&l" + PS.imp().getPluginName() + " $2($1Version$2: $1%s$2)", - PS.get().getVersion())); + .format("$2>> $1&l" + PlotSquared.imp().getPluginName() + " $2($1Version$2: $1%s$2)", + PlotSquared.get().getVersion())); MainUtil.sendMessage(player, "$2>> $1&lAuthors$2: $1Citymonstret $2& $1Empire92 $2& $1MattBDev"); MainUtil.sendMessage(player, diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Purge.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Purge.java index fe274e8ec..2b41c5a9f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Purge.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Purge.java @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.C; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.listener.PlotListener; @@ -45,7 +45,7 @@ public class Purge extends SubCommand { break; case "area": case "a": - area = PS.get().getPlotAreaByString(split[1]); + area = PlotSquared.get().getPlotAreaByString(split[1]); if (area == null) { C.NOT_VALID_PLOT_WORLD.send(player, split[1]); return false; @@ -86,7 +86,7 @@ public class Purge extends SubCommand { } } final HashSet toDelete = new HashSet<>(); - for (Plot plot : PS.get().getBasePlots()) { + for (Plot plot : PlotSquared.get().getBasePlots()) { if (world != null && !plot.getWorldName().equalsIgnoreCase(world)) { continue; } @@ -109,8 +109,8 @@ public class Purge extends SubCommand { toDelete.add(current); } } - if (PS.get().plots_tmp != null) { - for (Entry> entry : PS.get().plots_tmp.entrySet()) { + if (PlotSquared.get().plots_tmp != null) { + for (Entry> entry : PlotSquared.get().plots_tmp.entrySet()) { String worldName = entry.getKey(); if (world != null && !world.equalsIgnoreCase(worldName)) { continue; @@ -141,7 +141,7 @@ public class Purge extends SubCommand { "/plot purge " + StringMan.join(args, " ") + " (" + toDelete.size() + " plots)"; Runnable run = new Runnable() { @Override public void run() { - PS.debug("Calculating plots to purge, please wait..."); + PlotSquared.debug("Calculating plots to purge, please wait..."); HashSet ids = new HashSet<>(); for (Plot plot : toDelete) { if (plot.temp != Integer.MAX_VALUE) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Rate.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Rate.java index 16a8f0f16..dd6954520 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Rate.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Rate.java @@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.Command; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.C; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; @@ -20,7 +20,7 @@ public class Rate extends SubCommand { if (args.length == 1) { switch (args[0].toLowerCase()) { case "next": { - ArrayList plots = new ArrayList<>(PS.get().getBasePlots()); + ArrayList plots = new ArrayList<>(PlotSquared.get().getBasePlots()); Collections.sort(plots, new Comparator() { @Override public int compare(Plot p1, Plot p2) { double v1 = 0; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/RegenAllRoads.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/RegenAllRoads.java index 0e82a5c0d..e149a077f 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/RegenAllRoads.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/RegenAllRoads.java @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.C; import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotManager; import com.github.intellectualsites.plotsquared.plot.generator.HybridUtils; @@ -33,7 +33,7 @@ public class RegenAllRoads extends SubCommand { MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot regenallroads [height]"); return false; } - PlotArea area = PS.get().getPlotAreaByString(args[0]); + PlotArea area = PlotSquared.get().getPlotAreaByString(args[0]); if (area == null) { C.NOT_VALID_PLOT_WORLD.send(player, args[0]); return false; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Reload.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Reload.java index f7ac1bd62..ab7416fd7 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Reload.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Reload.java @@ -4,7 +4,7 @@ import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection; import com.github.intellectualsites.plotsquared.configuration.MemorySection; import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.C; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; @@ -21,12 +21,12 @@ public class Reload extends SubCommand { try { // The following won't affect world generation, as that has to be // loaded during startup unfortunately. - PS.get().setupConfigs(); - C.load(PS.get().translationFile); - PS.get().foreachPlotArea(new RunnableVal() { + PlotSquared.get().setupConfigs(); + C.load(PlotSquared.get().translationFile); + PlotSquared.get().foreachPlotArea(new RunnableVal() { @Override public void run(PlotArea area) { ConfigurationSection worldSection = - PS.get().worlds.getConfigurationSection("worlds." + area.worldname); + PlotSquared.get().worlds.getConfigurationSection("worlds." + area.worldname); if (worldSection == null) { return; } @@ -72,7 +72,7 @@ public class Reload extends SubCommand { } } }); - PS.get().worlds.save(PS.get().worldsFile); + PlotSquared.get().worlds.save(PlotSquared.get().worldsFile); MainUtil.sendMessage(player, C.RELOADED_CONFIGS); } catch (IOException e) { e.printStackTrace(); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Save.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Save.java index 95e168a6b..9f7dc6d27 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Save.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Save.java @@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.jnbt.CompoundTag; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.C; import com.github.intellectualsites.plotsquared.plot.object.*; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; @@ -20,7 +20,7 @@ public class Save extends SubCommand { @Override public boolean onCommand(final PlotPlayer player, String[] args) { String world = player.getLocation().getWorld(); - if (!PS.get().hasPlotArea(world)) { + if (!PlotSquared.get().hasPlotArea(world)) { return !sendMessage(player, C.NOT_IN_PLOT_WORLD); } final Plot plot = player.getCurrentPlot(); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SchematicCmd.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SchematicCmd.java index 6a30fbf39..b69f7f82b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SchematicCmd.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SchematicCmd.java @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.C; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.object.*; @@ -141,7 +141,7 @@ public class SchematicCmd extends SubCommand { "&cNeed world argument. Use &7/plot sch exportall "); return false; } - PlotArea area = PS.get().getPlotAreaByString(args[1]); + PlotArea area = PlotSquared.get().getPlotAreaByString(args[1]); if (area == null) { C.NOT_VALID_PLOT_WORLD.send(player, args[1]); return false; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Setup.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Setup.java index d973b5de1..9c5e89a93 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Setup.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Setup.java @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.C; import com.github.intellectualsites.plotsquared.plot.config.ConfigurationNode; import com.github.intellectualsites.plotsquared.plot.generator.GeneratorWrapper; @@ -26,7 +26,7 @@ import java.util.Map.Entry; StringBuilder message = new StringBuilder(); message.append("&6What generator do you want?"); for (Entry> entry : SetupUtils.generators.entrySet()) { - if (entry.getKey().equals(PS.imp().getPluginName())) { + if (entry.getKey().equals(PlotSquared.imp().getPluginName())) { message.append("\n&8 - &2").append(entry.getKey()).append(" (Default Generator)"); } else if (entry.getValue().isFull()) { message.append("\n&8 - &7").append(entry.getKey()).append(" (Plot Generator)"); @@ -74,7 +74,7 @@ import java.util.Map.Entry; MainUtil.sendMessage(player, "&cYou must choose a generator!" + prefix + StringMan .join(SetupUtils.generators.keySet(), prefix) - .replaceAll(PS.imp().getPluginName(), "&2" + PS.imp().getPluginName())); + .replaceAll(PlotSquared.imp().getPluginName(), "&2" + PlotSquared.imp().getPluginName())); sendMessage(player, C.SETUP_INIT); return false; } @@ -142,7 +142,7 @@ import java.util.Map.Entry; SetupUtils.generators.get(object.plotManager).getPlotGenerator() .processSetup(object); } else { - object.plotManager = PS.imp().getPluginName(); + object.plotManager = PlotSquared.imp().getPluginName(); MainUtil.sendMessage(player, "&c[WARNING] The specified generator does not identify as BukkitPlotGenerator"); MainUtil.sendMessage(player, @@ -170,7 +170,7 @@ import java.util.Map.Entry; MainUtil.sendMessage(player, "&cThe area id must be alphanumerical!"); return false; } - for (PlotArea area : PS.get().getPlotAreas()) { + for (PlotArea area : PlotSquared.get().getPlotAreas()) { if (area.id != null && area.id.equalsIgnoreCase(args[0])) { MainUtil.sendMessage(player, "&cYou must choose an area id that is not in use!"); @@ -270,13 +270,13 @@ import java.util.Map.Entry; return false; } if (WorldUtil.IMP.isWorld(args[0])) { - if (PS.get().hasPlotArea(args[0])) { + if (PlotSquared.get().hasPlotArea(args[0])) { MainUtil.sendMessage(player, "&cThat world name is already taken!"); return false; } MainUtil.sendMessage(player, "&cThe world you specified already exists. After restarting, new terrain will use " - + PS.imp().getPluginName() + ", however you may need to " + + PlotSquared.imp().getPluginName() + ", however you may need to " + "reset the world for it to generate correctly!"); } object.world = args[0]; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Target.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Target.java index 272e5895c..b378f9be4 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Target.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Target.java @@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.commands; import com.github.intellectualsites.plotsquared.commands.Argument; import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.C; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; @@ -26,7 +26,7 @@ public class Target extends SubCommand { Plot target = null; if (StringMan.isEqualIgnoreCaseToAny(args[0], "near", "nearest")) { int distance = Integer.MAX_VALUE; - for (Plot plot : PS.get().getPlots(location.getWorld())) { + for (Plot plot : PlotSquared.get().getPlots(location.getWorld())) { double current = plot.getCenter().getEuclideanDistanceSquared(location); if (current < distance) { distance = (int) current; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Template.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Template.java index 4431162a1..28f824296 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Template.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Template.java @@ -4,7 +4,7 @@ import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection; import com.github.intellectualsites.plotsquared.configuration.InvalidConfigurationException; import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration; -import com.github.intellectualsites.plotsquared.plot.PS; +import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.C; import com.github.intellectualsites.plotsquared.plot.config.ConfigurationNode; import com.github.intellectualsites.plotsquared.plot.config.Settings; @@ -26,12 +26,12 @@ 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(PlotSquared.get().IMP.getDirectory(), Settings.Paths.TEMPLATES); if (!folder.exists()) { return false; } File input = new File(folder + File.separator + template + ".template"); - File output = PS.get().IMP.getDirectory(); + File output = PlotSquared.get().IMP.getDirectory(); if (!output.exists()) { output.mkdirs(); } @@ -71,7 +71,7 @@ public class Template extends SubCommand { public static byte[] getBytes(PlotArea plotArea) { ConfigurationSection section = - PS.get().worlds.getConfigurationSection("worlds." + plotArea.worldname); + PlotSquared.get().worlds.getConfigurationSection("worlds." + plotArea.worldname); YamlConfiguration config = new YamlConfiguration(); String generator = SetupUtils.manager.getGenerator(plotArea); if (generator != null) { @@ -84,7 +84,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(PlotSquared.get().IMP.getDirectory(), Settings.Paths.TEMPLATES); output.mkdirs(); try (FileOutputStream fos = new FileOutputStream( output + File.separator + world + ".template"); @@ -123,7 +123,7 @@ public class Template extends SubCommand { "/plot template import