From d76c9dad5215a120d5802a5faae4a52a0cf86d4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20S=C3=B6derberg?= Date: Tue, 7 Jul 2020 12:56:43 +0200 Subject: [PATCH] Remove access to PlotSquared#IMP and rename IPlotMain to PlotPlatform, then rename PlotSquared#imp() to PlotSquared#platform() --- .../{BukkitMain.java => BukkitPlatform.java} | 18 +-- .../bukkit/entity/TeleportEntityWrapper.java | 6 +- .../generator/DelegatePlotGenerator.java | 2 +- .../bukkit/listener/ChunkListener.java | 2 +- .../bukkit/listener/EntitySpawnListener.java | 4 +- .../bukkit/listener/PlayerEvents.java | 20 +-- .../bukkit/placeholder/Placeholders.java | 2 +- .../bukkit/player/BukkitPlayer.java | 2 +- .../bukkit/util/BukkitEconHandler.java | 4 +- .../bukkit/util/BukkitRegionManager.java | 4 +- .../bukkit/util/BukkitSetupUtils.java | 4 +- .../bukkit/util/BukkitTaskManager.java | 6 +- .../plotsquared/bukkit/util/BukkitUtil.java | 10 +- .../com/plotsquared/bukkit/util/SetGenCB.java | 2 +- .../bukkit/uuid/SQLiteUUIDService.java | 2 +- Bukkit/src/main/resources/plugin.yml | 2 +- .../{IPlotMain.java => PlotPlatform.java} | 2 +- .../com/plotsquared/core/PlotSquared.java | 116 +++++++++--------- .../core/backup/BackupManager.java | 2 +- .../core/backup/NullBackupManager.java | 2 +- .../core/backup/SimpleBackupManager.java | 2 +- .../com/plotsquared/core/command/Area.java | 20 +-- .../com/plotsquared/core/command/Backup.java | 8 +- .../com/plotsquared/core/command/Buy.java | 4 +- .../com/plotsquared/core/command/Cluster.java | 4 +- .../com/plotsquared/core/command/Comment.java | 2 +- .../core/command/DatabaseCommand.java | 8 +- .../plotsquared/core/command/DebugExec.java | 12 +- .../core/command/DebugImportWorlds.java | 2 +- .../plotsquared/core/command/DebugPaste.java | 8 +- .../com/plotsquared/core/command/Deny.java | 2 +- .../com/plotsquared/core/command/Grant.java | 2 +- .../com/plotsquared/core/command/Kick.java | 2 +- .../com/plotsquared/core/command/ListCmd.java | 4 +- .../com/plotsquared/core/command/Merge.java | 4 +- .../com/plotsquared/core/command/Owner.java | 2 +- .../plotsquared/core/command/PluginCmd.java | 2 +- .../com/plotsquared/core/command/Setup.java | 2 +- .../plotsquared/core/command/Template.java | 10 +- .../com/plotsquared/core/command/Trim.java | 2 +- .../components/ComponentPresetManager.java | 2 +- .../com/plotsquared/core/database/SQLite.java | 4 +- .../plotsquared/core/generator/HybridGen.java | 2 +- .../core/generator/HybridPlotManager.java | 6 +- .../core/generator/HybridPlotWorld.java | 4 +- .../generator/IndependentPlotGenerator.java | 3 +- .../core/listener/PlotListener.java | 4 +- .../core/player/ConsolePlayer.java | 2 +- .../plotsquared/core/player/PlotPlayer.java | 6 +- .../java/com/plotsquared/core/plot/Plot.java | 8 +- .../core/plot/expiration/ExpireManager.java | 10 +- .../core/plot/message/PlotMessage.java | 4 +- .../core/plot/world/SinglePlotArea.java | 2 +- .../core/plot/world/SinglePlotManager.java | 2 +- .../core/queue/LocalBlockQueue.java | 2 +- .../core/setup/CommonSetupSteps.java | 8 +- .../core/setup/PlotAreaBuilder.java | 2 +- .../plotsquared/core/util/EconHandler.java | 14 +-- .../com/plotsquared/core/util/MainUtil.java | 2 +- .../plotsquared/core/util/RegionManager.java | 4 +- .../core/util/SchematicHandler.java | 10 +- .../plotsquared/core/util/TabCompletions.java | 2 +- .../com/plotsquared/core/util/WorldUtil.java | 4 +- 63 files changed, 211 insertions(+), 210 deletions(-) rename Bukkit/src/main/java/com/plotsquared/bukkit/{BukkitMain.java => BukkitPlatform.java} (98%) rename Core/src/main/java/com/plotsquared/core/{IPlotMain.java => PlotPlatform.java} (99%) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java similarity index 98% rename from Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java rename to Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java index 39a763d24..7e4b9605d 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java @@ -59,7 +59,7 @@ import com.plotsquared.bukkit.uuid.OfflinePlayerUUIDService; import com.plotsquared.bukkit.uuid.PaperUUIDService; import com.plotsquared.bukkit.uuid.SQLiteUUIDService; import com.plotsquared.bukkit.uuid.SquirrelIdUUIDService; -import com.plotsquared.core.IPlotMain; +import com.plotsquared.core.PlotPlatform; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.backup.BackupManager; import com.plotsquared.core.backup.NullBackupManager; @@ -159,7 +159,7 @@ import static com.plotsquared.core.util.PremiumVerification.getResourceID; import static com.plotsquared.core.util.PremiumVerification.getUserID; import static com.plotsquared.core.util.ReflectionUtils.getRefClass; -public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain { +public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPlatform { private static final int BSTATS_ID = 1404; @Getter private static WorldEdit worldEdit; @@ -214,7 +214,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain< new PlotSquared(this, "Bukkit"); - if (PlotSquared.get().IMP.getServerVersion()[1] < 13) { + if (PlotSquared.platform().getServerVersion()[1] < 13) { System.out.println( "You can't use this version of PlotSquared on a server less than Minecraft 1.13.2."); System.out @@ -267,7 +267,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain< final SQLiteUUIDService legacyUUIDService; if (Settings.UUID.LEGACY_DATABASE_SUPPORT && MainUtil - .getFile(PlotSquared.get().IMP.getDirectory(), "usercache.db").exists()) { + .getFile(PlotSquared.platform().getDirectory(), "usercache.db").exists()) { legacyUUIDService = new SQLiteUUIDService("usercache.db"); } else { legacyUUIDService = null; @@ -758,7 +758,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain< if (currentPlotId != null) { entity.setMetadata("shulkerPlot", new FixedMetadataValue( - (Plugin) PlotSquared.get().IMP, currentPlotId)); + (Plugin) PlotSquared.platform(), currentPlotId)); } } } @@ -884,7 +884,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain< if (id != null && id.equalsIgnoreCase("single")) { result = new SingleWorldGenerator(); } else { - result = PlotSquared.get().IMP.getDefaultGenerator(); + result = PlotSquared.platform().getDefaultGenerator(); if (!PlotSquared.get().setupPlotWorld(worldName, id, result)) { return null; } @@ -983,7 +983,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain< } return new BukkitPlotGenerator(world, gen); } else { - return new BukkitPlotGenerator(world, PlotSquared.get().IMP.getDefaultGenerator()); + return new BukkitPlotGenerator(world, PlotSquared.platform().getDefaultGenerator()); } } @@ -1118,11 +1118,11 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain< return BukkitUtil.getPlayer((OfflinePlayer) player); } if (player instanceof String) { - return (PlotPlayer) PlotSquared.imp().getPlayerManager() + return (PlotPlayer) PlotSquared.platform().getPlayerManager() .getPlayerIfExists((String) player); } if (player instanceof UUID) { - return (PlotPlayer) PlotSquared.imp().getPlayerManager() + return (PlotPlayer) PlotSquared.platform().getPlayerManager() .getPlayerIfExists((UUID) player); } return null; diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/entity/TeleportEntityWrapper.java b/Bukkit/src/main/java/com/plotsquared/bukkit/entity/TeleportEntityWrapper.java index 45613a751..6a37571a3 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/entity/TeleportEntityWrapper.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/entity/TeleportEntityWrapper.java @@ -25,7 +25,7 @@ */ package com.plotsquared.bukkit.entity; -import com.plotsquared.bukkit.BukkitMain; +import com.plotsquared.bukkit.BukkitPlatform; import org.bukkit.Chunk; import org.bukkit.Location; import org.bukkit.World; @@ -53,7 +53,7 @@ public class TeleportEntityWrapper extends EntityWrapper { getEntity().setInvulnerable(invulnerableOld); getEntity().setFireTicks(fireTicksOld); getEntity().setTicksLived(livingTicksOld); - getEntity().removeMetadata("ps-tmp-teleport", BukkitMain.getPlugin(BukkitMain.class)); + getEntity().removeMetadata("ps-tmp-teleport", BukkitPlatform.getPlugin(BukkitPlatform.class)); } return getEntity(); } @@ -78,7 +78,7 @@ public class TeleportEntityWrapper extends EntityWrapper { this.fireTicksOld = this.getEntity().getFireTicks(); this.livingTicksOld = this.getEntity().getTicksLived(); this.getEntity().setMetadata("ps-tmp-teleport", - new FixedMetadataValue(BukkitMain.getPlugin(BukkitMain.class), oldLocation)); + new FixedMetadataValue(BukkitPlatform.getPlugin(BukkitPlatform.class), oldLocation)); final Chunk newChunk = getNewChunk(); this.getEntity().teleport( new Location(newChunk.getWorld(), newChunk.getX() << 4, 5000, newChunk.getZ() << 4)); diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/generator/DelegatePlotGenerator.java b/Bukkit/src/main/java/com/plotsquared/bukkit/generator/DelegatePlotGenerator.java index d5086b06d..bb6a46041 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/generator/DelegatePlotGenerator.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/generator/DelegatePlotGenerator.java @@ -61,7 +61,7 @@ final class DelegatePlotGenerator extends IndependentPlotGenerator { } @Override public PlotArea getNewPlotArea(String world, String id, PlotId min, PlotId max) { - return PlotSquared.get().IMP.getDefaultGenerator().getNewPlotArea(world, id, min, max); + return PlotSquared.platform().getDefaultGenerator().getNewPlotArea(world, id, min, max); } @Override public void generateChunk(final ScopedLocalBlockQueue result, PlotArea settings) { diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ChunkListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ChunkListener.java index 1cfc897d4..19a892c43 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ChunkListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ChunkListener.java @@ -73,7 +73,7 @@ public class ChunkListener implements Listener { this.mustSave = classChunk.getField("mustSave"); this.methodGetHandleChunk = classCraftChunk.getMethod("getHandle"); } catch (Throwable ignored) { - PlotSquared.debug(PlotSquared.get().IMP.getPluginName() + PlotSquared.debug(PlotSquared.platform().getPluginName() + "/Server not compatible for chunk processor trim/gc"); Settings.Chunk_Processor.AUTO_TRIM = false; diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntitySpawnListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntitySpawnListener.java index 0bf5e75e8..8b70143b1 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntitySpawnListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntitySpawnListener.java @@ -92,7 +92,7 @@ public class EntitySpawnListener implements Listener { if (meta.isEmpty()) { if (PlotSquared.get().hasPlotArea(world.getName())) { entity.setMetadata(KEY, - new FixedMetadataValue((Plugin) PlotSquared.get().IMP, entity.getLocation())); + new FixedMetadataValue((Plugin) PlotSquared.platform(), entity.getLocation())); } } else { org.bukkit.Location origin = (org.bukkit.Location) meta.get(0).value(); @@ -161,7 +161,7 @@ public class EntitySpawnListener implements Listener { case SHULKER: if (!entity.hasMetadata("shulkerPlot")) { entity.setMetadata("shulkerPlot", - new FixedMetadataValue((Plugin) PlotSquared.get().IMP, plot.getId())); + new FixedMetadataValue((Plugin) PlotSquared.platform(), plot.getId())); } } } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEvents.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEvents.java index c8c16a4c6..b10370cfc 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEvents.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEvents.java @@ -253,7 +253,7 @@ public class PlayerEvents extends PlotListener implements Listener { int z = bloc.getBlockZ(); int distance = Bukkit.getViewDistance() * 16; - for (final PlotPlayer player : PlotSquared.imp().getPlayerManager().getPlayers()) { + for (final PlotPlayer player : PlotSquared.platform().getPlayerManager().getPlayers()) { Location location = player.getLocation(); if (location.getWorld().equals(world)) { if (16 * Math.abs(location.getX() - x) / 16 > distance @@ -355,18 +355,18 @@ public class PlayerEvents extends PlotListener implements Listener { if (plot.isMerged()) { disable = true; for (UUID owner : plot.getOwners()) { - if (PlotSquared.imp().getPlayerManager().getPlayerIfExists(owner) != null) { + if (PlotSquared.platform().getPlayerManager().getPlayerIfExists(owner) != null) { disable = false; break; } } } else { - disable = PlotSquared.imp().getPlayerManager().getPlayerIfExists(plot.getOwnerAbs()) == null; + disable = PlotSquared.platform().getPlayerManager().getPlayerIfExists(plot.getOwnerAbs()) == null; } } if (disable) { for (UUID trusted : plot.getTrusted()) { - if (PlotSquared.imp().getPlayerManager().getPlayerIfExists(trusted) != null) { + if (PlotSquared.platform().getPlayerManager().getPlayerIfExists(trusted) != null) { disable = false; break; } @@ -379,7 +379,7 @@ public class PlayerEvents extends PlotListener implements Listener { } } if (Settings.Redstone.DISABLE_UNOCCUPIED) { - for (final PlotPlayer player : PlotSquared.imp().getPlayerManager().getPlayers()) { + for (final PlotPlayer player : PlotSquared.platform().getPlayerManager().getPlayers()) { if (plot.equals(player.getCurrentPlot())) { return; } @@ -794,7 +794,7 @@ public class PlayerEvents extends PlotListener implements Listener { } } else if (toPlot != null) { vehicle.setMetadata("plot", - new FixedMetadataValue((Plugin) PlotSquared.get().IMP, toPlot)); + new FixedMetadataValue((Plugin) PlotSquared.platform(), toPlot)); } } } @@ -960,7 +960,7 @@ public class PlayerEvents extends PlotListener implements Listener { Set recipients = event.getRecipients(); recipients.clear(); Set spies = new HashSet<>(); - for (final PlotPlayer pp : PlotSquared.imp().getPlayerManager().getPlayers()) { + for (final PlotPlayer pp : PlotSquared.platform().getPlayerManager().getPlayers()) { if (pp.getAttribute("chatspy")) { spies.add(((BukkitPlayer) pp).player); } else { @@ -1092,7 +1092,7 @@ public class PlayerEvents extends PlotListener implements Listener { .equals(EntityType.MINECART_TNT)) { if (!near.hasMetadata("plot")) { near.setMetadata("plot", - new FixedMetadataValue((Plugin) PlotSquared.get().IMP, plot)); + new FixedMetadataValue((Plugin) PlotSquared.platform(), plot)); } } } @@ -2185,7 +2185,7 @@ public class PlayerEvents extends PlotListener implements Listener { } } else if (event.getTo() == Material.AIR) { event.getEntity() - .setMetadata("plot", new FixedMetadataValue((Plugin) PlotSquared.get().IMP, plot)); + .setMetadata("plot", new FixedMetadataValue((Plugin) PlotSquared.platform(), plot)); } } @@ -2426,7 +2426,7 @@ public class PlayerEvents extends PlotListener implements Listener { } if (Settings.Enabled_Components.KILL_ROAD_VEHICLES) { entity - .setMetadata("plot", new FixedMetadataValue((Plugin) PlotSquared.get().IMP, plot)); + .setMetadata("plot", new FixedMetadataValue((Plugin) PlotSquared.platform(), plot)); } } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/placeholder/Placeholders.java b/Bukkit/src/main/java/com/plotsquared/bukkit/placeholder/Placeholders.java index 5457dbe0f..b0f428e8b 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/placeholder/Placeholders.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/placeholder/Placeholders.java @@ -65,7 +65,7 @@ public class Placeholders extends PlaceholderExpansion { } @Override public String onPlaceholderRequest(Player p, String identifier) { - final PlotPlayer pl = PlotSquared.imp().getPlayerManager().getPlayerIfExists(p.getUniqueId()); + final PlotPlayer pl = PlotSquared.platform().getPlayerManager().getPlayerIfExists(p.getUniqueId()); if (pl == null) { return ""; diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitPlayer.java b/Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitPlayer.java index 643039600..6f7284e5a 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitPlayer.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitPlayer.java @@ -143,7 +143,7 @@ public class BukkitPlayer extends PlotPlayer { private void callEvent(@NotNull final Event event) { final RegisteredListener[] listeners = event.getHandlers().getRegisteredListeners(); for (final RegisteredListener listener : listeners) { - if (listener.getPlugin().getName().equals(PlotSquared.imp().getPluginName())) { + if (listener.getPlugin().getName().equals(PlotSquared.platform().getPluginName())) { continue; } try { diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitEconHandler.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitEconHandler.java index e71c48158..60f574357 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitEconHandler.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitEconHandler.java @@ -83,8 +83,8 @@ public class BukkitEconHandler extends EconHandler { * @deprecated Use {@link PermHandler#hasPermission(String, String, String)} instead */ @Deprecated @Override public boolean hasPermission(String world, String player, String perm) { - if (PlotSquared.imp().getPermissionHandler() != null) { - return PlotSquared.imp().getPermissionHandler().hasPermission(world, player, perm); + if (PlotSquared.platform().getPermissionHandler() != null) { + return PlotSquared.platform().getPermissionHandler().hasPermission(world, player, perm); } else { return false; } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitRegionManager.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitRegionManager.java index fc71c9d31..0f32ba37a 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitRegionManager.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitRegionManager.java @@ -25,7 +25,7 @@ */ package com.plotsquared.bukkit.util; -import com.plotsquared.bukkit.BukkitMain; +import com.plotsquared.bukkit.BukkitPlatform; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.generator.AugmentedUtils; import com.plotsquared.core.location.Location; @@ -94,7 +94,7 @@ public class BukkitRegionManager extends RegionManager { PlotSquared.debug("Attempting to make an asynchronous call to getLoadedChunks." + " Will halt the calling thread until completed."); semaphore.acquire(); - Bukkit.getScheduler().runTask(BukkitMain.getPlugin(BukkitMain.class), () -> { + Bukkit.getScheduler().runTask(BukkitPlatform.getPlugin(BukkitPlatform.class), () -> { for (Chunk chunk : Objects.requireNonNull(Bukkit.getWorld(world)) .getLoadedChunks()) { BlockVector2 loc = BlockVector2.at(chunk.getX() >> 5, chunk.getZ() >> 5); diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitSetupUtils.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitSetupUtils.java index 53185b608..b79e82250 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitSetupUtils.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitSetupUtils.java @@ -200,7 +200,7 @@ public class BukkitSetupUtils extends SetupUtils { e.printStackTrace(); } - Objects.requireNonNull(PlotSquared.imp()).getWorldManager() + Objects.requireNonNull(PlotSquared.platform()).getWorldManager() .handleWorldCreation(object.world, object.setupGenerator); if (Bukkit.getWorld(world) != null) { @@ -313,7 +313,7 @@ public class BukkitSetupUtils extends SetupUtils { e.printStackTrace(); } - Objects.requireNonNull(PlotSquared.imp()).getWorldManager() + Objects.requireNonNull(PlotSquared.platform()).getWorldManager() .handleWorldCreation(builder.worldName(), builder.generatorName()); if (Bukkit.getWorld(world) != null) { diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitTaskManager.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitTaskManager.java index b797708f2..cf85fa92c 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitTaskManager.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitTaskManager.java @@ -25,15 +25,15 @@ */ package com.plotsquared.bukkit.util; -import com.plotsquared.bukkit.BukkitMain; +import com.plotsquared.bukkit.BukkitPlatform; import com.plotsquared.core.util.task.TaskManager; import org.bukkit.Bukkit; public class BukkitTaskManager extends TaskManager { - private final BukkitMain bukkitMain; + private final BukkitPlatform bukkitMain; - public BukkitTaskManager(BukkitMain bukkitMain) { + public BukkitTaskManager(BukkitPlatform bukkitMain) { this.bukkitMain = bukkitMain; } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java index 5acdde298..6c35a542f 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java @@ -25,7 +25,7 @@ */ package com.plotsquared.bukkit.util; -import com.plotsquared.bukkit.BukkitMain; +import com.plotsquared.bukkit.BukkitPlatform; import com.plotsquared.bukkit.player.BukkitPlayer; import com.plotsquared.bukkit.player.BukkitPlayerManager; import com.plotsquared.core.PlotSquared; @@ -120,7 +120,7 @@ public class BukkitUtil extends WorldUtil { lastPlayer = null; lastPlotPlayer = null; // Make sure that it's removed internally - PlotSquared.imp().getPlayerManager().removePlayer(uuid); + PlotSquared.platform().getPlayerManager().removePlayer(uuid); } public static PlotPlayer getPlayer(@NonNull final OfflinePlayer op) { @@ -271,7 +271,7 @@ public class BukkitUtil extends WorldUtil { if (player == lastPlayer) { return lastPlotPlayer; } - final PlayerManager playerManager = PlotSquared.imp().getPlayerManager(); + final PlayerManager playerManager = PlotSquared.platform().getPlayerManager(); return ((BukkitPlayerManager) playerManager).getPlayer(player); } @@ -458,7 +458,7 @@ public class BukkitUtil extends WorldUtil { } else if (world.getBlockAt(x, y, z - 1).getType().isSolid()) { facing = BlockFace.SOUTH; } - if (PlotSquared.get().IMP.getServerVersion()[1] == 13) { + if (PlotSquared.platform().getServerVersion()[1] == 13) { block.setType(Material.valueOf("WALL_SIGN"), false); } else { block.setType(Material.valueOf("OAK_WALL_SIGN"), false); @@ -688,7 +688,7 @@ public class BukkitUtil extends WorldUtil { consumer.accept(value); } else { Bukkit.getScheduler() - .runTask(BukkitMain.getPlugin(BukkitMain.class), () -> consumer.accept(value)); + .runTask(BukkitPlatform.getPlugin(BukkitPlatform.class), () -> consumer.accept(value)); } } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/SetGenCB.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/SetGenCB.java index bd77fe27d..f7c588bf4 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/SetGenCB.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/SetGenCB.java @@ -72,6 +72,6 @@ public class SetGenCB { .removeIf(blockPopulator -> blockPopulator instanceof BukkitAugmentedGenerator); } PlotSquared.get() - .loadWorld(world.getName(), PlotSquared.get().IMP.getGenerator(world.getName(), null)); + .loadWorld(world.getName(), PlotSquared.platform().getGenerator(world.getName(), null)); } } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/SQLiteUUIDService.java b/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/SQLiteUUIDService.java index 16b3abff5..730d6c010 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/SQLiteUUIDService.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/SQLiteUUIDService.java @@ -51,7 +51,7 @@ public class SQLiteUUIDService implements UUIDService, Consumer Player type */ -public interface IPlotMain

extends ILogger { +public interface PlotPlatform

extends ILogger { /** * Logs a message to console. diff --git a/Core/src/main/java/com/plotsquared/core/PlotSquared.java b/Core/src/main/java/com/plotsquared/core/PlotSquared.java index 30d738afc..20a74ac94 100644 --- a/Core/src/main/java/com/plotsquared/core/PlotSquared.java +++ b/Core/src/main/java/com/plotsquared/core/PlotSquared.java @@ -137,11 +137,13 @@ import java.util.zip.ZipInputStream; * An implementation of the core, with a static getter for easy access. */ @SuppressWarnings({"unused", "WeakerAccess"}) -public class PlotSquared { +public class PlotSquared

{ + private static final Set EMPTY_SET = Collections.unmodifiableSet(Collections.emptySet()); - private static PlotSquared instance; + private static PlotSquared instance; + // Implementation - public final IPlotMain IMP; + private final PlotPlatform

platform; // Current thread private final Thread thread; // UUID pipelines @@ -177,17 +179,17 @@ public class PlotSquared { /** * Initialize PlotSquared with the desired Implementation class. * - * @param iPlotMain Implementation of {@link IPlotMain} used + * @param iPlotMain Implementation of {@link PlotPlatform} used * @param platform The platform being used */ - public PlotSquared(final IPlotMain iPlotMain, final String platform) { + public PlotSquared(final PlotPlatform

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.platform = iPlotMain; this.logger = iPlotMain; Settings.PLATFORM = platform; @@ -197,7 +199,7 @@ public class PlotSquared { ConfigurationSerialization.registerClass(BlockBucket.class, "BlockBucket"); try { - new ReflectionUtils(this.IMP.getNMSPackage()); + new ReflectionUtils(this.platform.getNMSPackage()); try { URL url = PlotSquared.class.getProtectionDomain().getCodeSource().getLocation(); this.jarFile = new File( @@ -205,22 +207,22 @@ public class PlotSquared { .toURI().getPath()); } catch (MalformedURLException | URISyntaxException | SecurityException e) { e.printStackTrace(); - this.jarFile = new File(this.IMP.getDirectory().getParentFile(), "PlotSquared.jar"); + this.jarFile = new File(this.platform.getDirectory().getParentFile(), "PlotSquared.jar"); if (!this.jarFile.exists()) { - this.jarFile = new File(this.IMP.getDirectory().getParentFile(), + this.jarFile = new File(this.platform.getDirectory().getParentFile(), "PlotSquared-" + platform + ".jar"); } } - TaskManager.IMP = this.IMP.getTaskManager(); + TaskManager.IMP = this.platform.getTaskManager(); // World Util. Has to be done before config files are loaded - WorldUtil.IMP = this.IMP.initWorldUtil(); + WorldUtil.IMP = this.platform.initWorldUtil(); if (!setupConfigs()) { return; } - this.translationFile = MainUtil.getFile(this.IMP.getDirectory(), - Settings.Paths.TRANSLATIONS + File.separator + IMP.getPluginName() + this.translationFile = MainUtil.getFile(this.platform.getDirectory(), + Settings.Paths.TRANSLATIONS + File.separator + this.platform.getPluginName() + ".use_THIS.yml"); Captions.load(this.translationFile); @@ -251,44 +253,44 @@ public class PlotSquared { // Kill entities if (Settings.Enabled_Components.KILL_ROAD_MOBS || Settings.Enabled_Components.KILL_ROAD_VEHICLES) { - this.IMP.runEntityTask(); + this.platform.runEntityTask(); } if (Settings.Enabled_Components.EVENTS) { - this.IMP.registerPlayerEvents(); + this.platform.registerPlayerEvents(); } // Required - this.IMP.registerWorldEvents(); + this.platform.registerWorldEvents(); if (Settings.Enabled_Components.CHUNK_PROCESSOR) { - this.IMP.registerChunkProcessor(); + this.platform.registerChunkProcessor(); } // Create Event utility class eventDispatcher = new EventDispatcher(); // create Hybrid utility class - HybridUtils.manager = this.IMP.initHybridUtils(); + HybridUtils.manager = this.platform.initHybridUtils(); // Inventory utility class - InventoryUtil.manager = this.IMP.initInventoryUtil(); + InventoryUtil.manager = this.platform.initInventoryUtil(); // create setup util class - SetupUtils.manager = this.IMP.initSetupUtils(); + SetupUtils.manager = this.platform.initSetupUtils(); // Set block GlobalBlockQueue.IMP = - new GlobalBlockQueue(IMP.initBlockQueue(), 1, Settings.QUEUE.TARGET_TIME); + new GlobalBlockQueue(this.platform.initBlockQueue(), 1, Settings.QUEUE.TARGET_TIME); GlobalBlockQueue.IMP.runTask(); // Set chunk - ChunkManager.manager = this.IMP.initChunkManager(); - RegionManager.manager = this.IMP.initRegionManager(); + ChunkManager.manager = this.platform.initChunkManager(); + RegionManager.manager = this.platform.initRegionManager(); // Schematic handler - SchematicHandler.manager = this.IMP.initSchematicHandler(); + SchematicHandler.manager = this.platform.initSchematicHandler(); // Chat - ChatManager.manager = this.IMP.initChatManager(); + ChatManager.manager = this.platform.initChatManager(); // Commands if (Settings.Enabled_Components.COMMANDS) { - this.IMP.registerCommands(); + this.platform.registerCommands(); } // WorldEdit if (Settings.Enabled_Components.WORLDEDIT_RESTRICTIONS) { try { - if (this.IMP.initWorldEdit()) { - PlotSquared.log(Captions.PREFIX.getTranslated() + "&6" + IMP.getPluginName() + if (this.platform.initWorldEdit()) { + PlotSquared.log(Captions.PREFIX.getTranslated() + "&6" + this.platform.getPluginName() + " hooked into WorldEdit."); this.worldedit = WorldEdit.getInstance(); WorldEdit.getInstance().getEventBus().register(new WESubscriber()); @@ -324,7 +326,7 @@ public class PlotSquared { continue; } if (WorldUtil.IMP.isWorld(world)) { - this.IMP.setGenerator(world); + this.platform.setGenerator(world); } } TaskManager.runTaskLater(() -> { @@ -333,7 +335,7 @@ public class PlotSquared { continue; } if (!WorldUtil.IMP.isWorld(world) && !world.equals("*")) { - debug("`" + world + "` was not properly loaded - " + IMP.getPluginName() + debug("`" + world + "` was not properly loaded - " + this.platform.getPluginName() + " will now try to load it properly: "); debug( " - Are you trying to delete this world? Remember to remove it from the worlds.yml, bukkit.yml and multiverse worlds.yml"); @@ -341,7 +343,7 @@ public class PlotSquared { " - Your world management plugin may be faulty (or non existent)"); debug( " This message may also be a false positive and could be ignored."); - PlotSquared.this.IMP.setGenerator(world); + PlotSquared.this.platform.setGenerator(world); } } }, 1); @@ -373,7 +375,7 @@ public class PlotSquared { PlotSquared.log(Captions.PREFIX + CaptionUtility .format(ConsolePlayer.getConsole(), Captions.ENABLED.getTranslated(), - IMP.getPluginName())); + this.platform.getPluginName())); } /** @@ -381,13 +383,13 @@ public class PlotSquared { * * @return instance of PlotSquared */ - public static PlotSquared get() { + public static PlotSquared get() { return PlotSquared.instance; } - @NotNull public static IPlotMain imp() { - if (instance != null && instance.IMP != null) { - return instance.IMP; + @NotNull public static PlotPlatform platform() { + if (instance != null && instance.platform != null) { + return instance.platform; } throw new IllegalStateException("Plot main implementation is missing"); } @@ -396,7 +398,7 @@ public class PlotSquared { * Log a message to the IPlotMain logger. * * @param message Message to log - * @see IPlotMain#log(String) + * @see PlotPlatform#log(String) */ public static void log(Object message) { if (message == null || (message instanceof Caption ? @@ -415,7 +417,7 @@ public class PlotSquared { * Log a message to the IPlotMain logger. * * @param message Message to log - * @see IPlotMain#log(String) + * @see PlotPlatform#log(String) */ public static void debug(@Nullable Object message) { if (Settings.DEBUG) { @@ -539,7 +541,7 @@ public class PlotSquared { return; } File file = new File( - this.IMP.getDirectory() + File.separator + "persistent_regen_data_" + plotArea.getId() + this.platform.getDirectory() + File.separator + "persistent_regen_data_" + plotArea.getId() + "_" + plotArea.getWorldName()); if (!file.exists()) { return; @@ -1137,13 +1139,13 @@ public class PlotSquared { } else if (worldSection != null) { String secondaryGeneratorName = worldSection.getString("generator.plugin"); GeneratorWrapper secondaryGenerator = - this.IMP.getGenerator(world, secondaryGeneratorName); + this.platform.getGenerator(world, secondaryGeneratorName); if (secondaryGenerator != null && secondaryGenerator.isFull()) { plotGenerator = secondaryGenerator.getPlotGenerator(); } else { String primaryGeneratorName = worldSection.getString("generator.init"); GeneratorWrapper primaryGenerator = - this.IMP.getGenerator(world, primaryGeneratorName); + this.platform.getGenerator(world, primaryGeneratorName); if (primaryGenerator != null && primaryGenerator.isFull()) { plotGenerator = primaryGenerator.getPlotGenerator(); } else { @@ -1187,7 +1189,7 @@ public class PlotSquared { return; } PlotSquared.log(Captions.PREFIX + "&aDetected world load for '" + world + "'"); - String gen_string = worldSection.getString("generator.plugin", IMP.getPluginName()); + String gen_string = worldSection.getString("generator.plugin", platform.getPluginName()); if (type == PlotAreaType.PARTIAL) { Set clusters = this.clusters_tmp != null ? this.clusters_tmp.get(world) : new HashSet<>(); @@ -1204,7 +1206,7 @@ public class PlotSquared { DBFunc.replaceWorld(world, world + ";" + name, pos1, pos2); // NPE PlotSquared.log(Captions.PREFIX + "&3 - " + name + "-" + pos1 + "-" + pos2); - GeneratorWrapper areaGen = this.IMP.getGenerator(world, gen_string); + GeneratorWrapper areaGen = this.platform.getGenerator(world, gen_string); if (areaGen == null) { throw new IllegalArgumentException("Invalid Generator: " + gen_string); } @@ -1234,7 +1236,7 @@ public class PlotSquared { } return; } - GeneratorWrapper areaGen = this.IMP.getGenerator(world, gen_string); + GeneratorWrapper areaGen = this.platform.getGenerator(world, gen_string); if (areaGen == null) { throw new IllegalArgumentException("Invalid Generator: " + gen_string); } @@ -1296,8 +1298,8 @@ public class PlotSquared { clone.set(key, worldSection.get(key)); } } - String gen_string = clone.getString("generator.plugin", IMP.getPluginName()); - GeneratorWrapper areaGen = this.IMP.getGenerator(world, gen_string); + String gen_string = clone.getString("generator.plugin", platform.getPluginName()); + GeneratorWrapper areaGen = this.platform.getGenerator(world, gen_string); if (areaGen == null) { throw new IllegalArgumentException("Invalid Generator: " + gen_string); } @@ -1485,7 +1487,7 @@ public class PlotSquared { */ public void copyFile(String file, String folder) { try { - File output = this.IMP.getDirectory(); + File output = this.platform.getDirectory(); if (!output.exists()) { output.mkdirs(); } @@ -1493,7 +1495,7 @@ public class PlotSquared { if (newFile.exists()) { return; } - try (InputStream stream = this.IMP.getClass().getResourceAsStream(file)) { + try (InputStream stream = this.platform.getClass().getResourceAsStream(file)) { byte[] buffer = new byte[2048]; if (stream == null) { try (ZipInputStream zis = new ZipInputStream( @@ -1593,7 +1595,7 @@ public class PlotSquared { list.add(chunks); list.add(HybridUtils.height); File file = new File( - this.IMP.getDirectory() + File.separator + "persistent_regen_data_" + HybridUtils.area + this.platform.getDirectory() + File.separator + "persistent_regen_data_" + HybridUtils.area .getId() + "_" + HybridUtils.area.getWorldName()); if (file.exists() && !file.delete()) { PlotSquared.log(Captions.PREFIX @@ -1622,11 +1624,11 @@ public class PlotSquared { 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"); + File file = MainUtil.getFile(platform.getDirectory(), Storage.SQLite.DB + ".db"); database = new SQLite(file); } else { PlotSquared.log(Captions.PREFIX + "&cNo storage type is set!"); - this.IMP.shutdown(); //shutdown used instead of disable because no database is set + this.platform.shutdown(); //shutdown used instead of disable because no database is set return; } DBFunc.dbManager = new SQLManager(database, Storage.PREFIX, false); @@ -1654,9 +1656,9 @@ public class PlotSquared { "&d==== Here is an ugly stacktrace, if you are interested in those things ==="); e.printStackTrace(); PlotSquared.log("&d==== End of stacktrace ===="); - PlotSquared.log("&6Please go to the " + IMP.getPluginName() + PlotSquared.log("&6Please go to the " + platform.getPluginName() + " 'storage.yml' and configure the database correctly."); - this.IMP.shutdown(); //shutdown used instead of disable because of database error + this.platform.shutdown(); //shutdown used instead of disable because of database error } } @@ -1680,7 +1682,7 @@ public class PlotSquared { try { worlds.save(worldsFile); } catch (IOException e) { - PlotSquared.debug("Failed to save " + IMP.getPluginName() + " worlds.yml"); + PlotSquared.debug("Failed to save " + platform.getPluginName() + " worlds.yml"); e.printStackTrace(); } } @@ -1711,7 +1713,7 @@ public class PlotSquared { * - Translation: PlotSquared.use_THIS.yml, style.yml
*/ public boolean setupConfigs() { - File folder = new File(this.IMP.getDirectory(), "config"); + File folder = new File(this.platform.getDirectory(), "config"); if (!folder.exists() && !folder.mkdirs()) { PlotSquared.log(Captions.PREFIX + "&cFailed to create the /plugins/config folder. Please create it manually."); @@ -1747,7 +1749,7 @@ public class PlotSquared { e.printStackTrace(); } // Disable plugin - this.IMP.shutdown(); + this.platform.shutdown(); return false; } } else { @@ -1768,7 +1770,7 @@ public class PlotSquared { PlotSquared.log("Failed to save settings.yml"); } try { - this.styleFile = MainUtil.getFile(IMP.getDirectory(), + this.styleFile = MainUtil.getFile(platform.getDirectory(), Settings.Paths.TRANSLATIONS + File.separator + "style.yml"); if (!this.styleFile.exists()) { if (!this.styleFile.getParentFile().exists()) { diff --git a/Core/src/main/java/com/plotsquared/core/backup/BackupManager.java b/Core/src/main/java/com/plotsquared/core/backup/BackupManager.java index 4ba4a44f4..1a2aa5e9b 100644 --- a/Core/src/main/java/com/plotsquared/core/backup/BackupManager.java +++ b/Core/src/main/java/com/plotsquared/core/backup/BackupManager.java @@ -46,7 +46,7 @@ public interface BackupManager { * @param whenDone Action that runs when the automatic backup has been completed */ static void backup(@Nullable PlotPlayer player, @NotNull final Plot plot, @NotNull Runnable whenDone) { - Objects.requireNonNull(PlotSquared.imp()).getBackupManager().automaticBackup(player, plot, whenDone); + Objects.requireNonNull(PlotSquared.platform()).getBackupManager().automaticBackup(player, plot, whenDone); } /** diff --git a/Core/src/main/java/com/plotsquared/core/backup/NullBackupManager.java b/Core/src/main/java/com/plotsquared/core/backup/NullBackupManager.java index 2d8c04a76..9ffc223c9 100644 --- a/Core/src/main/java/com/plotsquared/core/backup/NullBackupManager.java +++ b/Core/src/main/java/com/plotsquared/core/backup/NullBackupManager.java @@ -49,7 +49,7 @@ public class NullBackupManager implements BackupManager { } @Override @NotNull public Path getBackupPath() { - return Objects.requireNonNull(PlotSquared.imp()).getDirectory().toPath(); + return Objects.requireNonNull(PlotSquared.platform()).getDirectory().toPath(); } @Override public int getBackupLimit() { diff --git a/Core/src/main/java/com/plotsquared/core/backup/SimpleBackupManager.java b/Core/src/main/java/com/plotsquared/core/backup/SimpleBackupManager.java index 57cbea1d8..468ee23ac 100644 --- a/Core/src/main/java/com/plotsquared/core/backup/SimpleBackupManager.java +++ b/Core/src/main/java/com/plotsquared/core/backup/SimpleBackupManager.java @@ -57,7 +57,7 @@ import java.util.concurrent.TimeUnit; .expireAfterAccess(3, TimeUnit.MINUTES).build(); public SimpleBackupManager() throws Exception { - this.backupPath = Objects.requireNonNull(PlotSquared.imp()).getDirectory().toPath().resolve("backups"); + this.backupPath = Objects.requireNonNull(PlotSquared.platform()).getDirectory().toPath().resolve("backups"); if (!Files.exists(backupPath)) { Files.createDirectory(backupPath); } diff --git a/Core/src/main/java/com/plotsquared/core/command/Area.java b/Core/src/main/java/com/plotsquared/core/command/Area.java index 383076f0d..514030d6b 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Area.java +++ b/Core/src/main/java/com/plotsquared/core/command/Area.java @@ -138,7 +138,7 @@ public class Area extends SubCommand { // There's only one plot in the area... final PlotId plotId = new PlotId(1, 1); final HybridPlotWorld hybridPlotWorld = new HybridPlotWorld(player.getLocation().getWorld(), args[1], - Objects.requireNonNull(PlotSquared.imp()).getDefaultGenerator(), plotId, plotId); + Objects.requireNonNull(PlotSquared.platform()).getDefaultGenerator(), plotId, plotId); // Plot size is the same as the region width hybridPlotWorld.PLOT_WIDTH = hybridPlotWorld.SIZE = (short) selectedRegion.getWidth(); // We use a schematic generator @@ -153,7 +153,7 @@ public class Area extends SubCommand { hybridPlotWorld.PLOT_HEIGHT = hybridPlotWorld.ROAD_HEIGHT = hybridPlotWorld.WALL_HEIGHT = playerSelectionMin.getBlockY(); // No sign plz hybridPlotWorld.setAllowSigns(false); - final File parentFile = MainUtil.getFile(PlotSquared.imp().getDirectory(), "schematics" + File.separator + + final File parentFile = MainUtil.getFile(PlotSquared.platform().getDirectory(), "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + hybridPlotWorld.getWorldName() + File.separator + hybridPlotWorld.getId()); if (!parentFile.exists() && !parentFile.mkdirs()) { @@ -187,8 +187,8 @@ public class Area extends SubCommand { // Now the schematic is saved, which is wonderful! PlotAreaBuilder singleBuilder = PlotAreaBuilder.ofPlotArea(hybridPlotWorld) - .plotManager(PlotSquared.imp().getPluginName()) - .generatorName(PlotSquared.imp().getPluginName()) + .plotManager(PlotSquared.platform().getPluginName()) + .generatorName(PlotSquared.platform().getPluginName()) .maximumId(plotId) .minimumId(plotId); Runnable singleRun = () -> { @@ -282,8 +282,8 @@ public class Area extends SubCommand { return false; } PlotAreaBuilder builder = PlotAreaBuilder.ofPlotArea(area) - .plotManager(PlotSquared.imp().getPluginName()) - .generatorName(PlotSquared.imp().getPluginName()) + .plotManager(PlotSquared.platform().getPluginName()) + .generatorName(PlotSquared.platform().getPluginName()) .minimumId(new PlotId(1, 1)) .maximumId(new PlotId(numX, numZ)); final String path = @@ -339,7 +339,7 @@ public class Area extends SubCommand { PlotAreaBuilder builder = new PlotAreaBuilder(); builder.worldName(split[0]); final HybridPlotWorld pa = new HybridPlotWorld(builder.worldName(), id, - PlotSquared.get().IMP.getDefaultGenerator(), null, null); + PlotSquared.platform().getDefaultGenerator(), null, null); PlotArea other = PlotSquared.get().getPlotArea(pa.getWorldName(), id); if (other != null && Objects.equals(pa.getId(), other.getId())) { Captions.SETUP_WORLD_TAKEN.send(player, pa.toString()); @@ -428,8 +428,8 @@ public class Area extends SubCommand { PlotSquared.get().worlds.getConfigurationSection(path); pa.saveConfiguration(section); pa.loadConfiguration(section); - builder.plotManager(PlotSquared.imp().getPluginName()); - builder.generatorName(PlotSquared.imp().getPluginName()); + builder.plotManager(PlotSquared.platform().getPluginName()); + builder.generatorName(PlotSquared.platform().getPluginName()); String world = SetupUtils.manager.setupWorld(builder); if (WorldUtil.IMP.isWorld(world)) { Captions.SETUP_FINISHED.send(player); @@ -661,7 +661,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" + PlotSquared.imp() + + "\n$3 - $2Bukkit bukkit.yml" + "\n$3 - $2" + PlotSquared.platform() .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/plotsquared/core/command/Backup.java b/Core/src/main/java/com/plotsquared/core/command/Backup.java index 944eaaf6b..66af54666 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Backup.java +++ b/Core/src/main/java/com/plotsquared/core/command/Backup.java @@ -91,7 +91,7 @@ public final class Backup extends Command { final Plot plot = player.getCurrentPlot(); if (plot != null) { final BackupProfile backupProfile = - Objects.requireNonNull(PlotSquared.imp()).getBackupManager().getProfile(plot); + Objects.requireNonNull(PlotSquared.platform()).getBackupManager().getProfile(plot); if (backupProfile instanceof PlayerBackupProfile) { final CompletableFuture> backupList = backupProfile.listBackups(); @@ -136,7 +136,7 @@ public final class Backup extends Command { sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_ADMIN_BACKUP_OTHER); } else { final BackupProfile backupProfile = - Objects.requireNonNull(PlotSquared.imp()).getBackupManager().getProfile(plot); + Objects.requireNonNull(PlotSquared.platform()).getBackupManager().getProfile(plot); if (backupProfile instanceof NullBackupProfile) { sendMessage(player, Captions.BACKUP_IMPOSSIBLE, Captions.GENERIC_OTHER.getTranslated()); @@ -176,7 +176,7 @@ public final class Backup extends Command { sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_ADMIN_BACKUP_OTHER); } else { final BackupProfile backupProfile = - Objects.requireNonNull(PlotSquared.imp()).getBackupManager().getProfile(plot); + Objects.requireNonNull(PlotSquared.platform()).getBackupManager().getProfile(plot); if (backupProfile instanceof NullBackupProfile) { sendMessage(player, Captions.BACKUP_IMPOSSIBLE, Captions.GENERIC_OTHER.getTranslated()); @@ -238,7 +238,7 @@ public final class Backup extends Command { return; } final BackupProfile backupProfile = - Objects.requireNonNull(PlotSquared.imp()).getBackupManager().getProfile(plot); + Objects.requireNonNull(PlotSquared.platform()).getBackupManager().getProfile(plot); if (backupProfile instanceof NullBackupProfile) { sendMessage(player, Captions.BACKUP_IMPOSSIBLE, Captions.GENERIC_OTHER.getTranslated()); diff --git a/Core/src/main/java/com/plotsquared/core/command/Buy.java b/Core/src/main/java/com/plotsquared/core/command/Buy.java index 337801385..1d599d408 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Buy.java +++ b/Core/src/main/java/com/plotsquared/core/command/Buy.java @@ -82,9 +82,9 @@ public class Buy extends Command { confirm.run(this, () -> { Captions.REMOVED_BALANCE.send(player, price); - EconHandler.getEconHandler().depositMoney(PlotSquared.imp().getPlayerManager().getOfflinePlayer(plot.getOwnerAbs()), price); + EconHandler.getEconHandler().depositMoney(PlotSquared.platform().getPlayerManager().getOfflinePlayer(plot.getOwnerAbs()), price); - PlotPlayer owner = PlotSquared.imp().getPlayerManager().getPlayerIfExists(plot.getOwnerAbs()); + PlotPlayer owner = PlotSquared.platform().getPlayerManager().getPlayerIfExists(plot.getOwnerAbs()); if (owner != null) { Captions.PLOT_SOLD.send(owner, plot.getId(), player.getName(), price); } diff --git a/Core/src/main/java/com/plotsquared/core/command/Cluster.java b/Core/src/main/java/com/plotsquared/core/command/Cluster.java index 557ba084b..060efdf3d 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Cluster.java +++ b/Core/src/main/java/com/plotsquared/core/command/Cluster.java @@ -385,7 +385,7 @@ public class Cluster extends SubCommand { DBFunc.setInvited(cluster, uuid); final PlotPlayer otherPlayer = - PlotSquared.imp().getPlayerManager().getPlayerIfExists(uuid); + PlotSquared.platform().getPlayerManager().getPlayerIfExists(uuid); if (otherPlayer != null) { MainUtil.sendMessage(otherPlayer, Captions.CLUSTER_INVITED, cluster.getName()); @@ -448,7 +448,7 @@ public class Cluster extends SubCommand { DBFunc.removeInvited(cluster, uuid); final PlotPlayer player2 = - PlotSquared.imp().getPlayerManager().getPlayerIfExists(uuid); + PlotSquared.platform().getPlayerManager().getPlayerIfExists(uuid); if (player2 != null) { MainUtil.sendMessage(player2, Captions.CLUSTER_REMOVED, cluster.getName()); diff --git a/Core/src/main/java/com/plotsquared/core/command/Comment.java b/Core/src/main/java/com/plotsquared/core/command/Comment.java index a5615533f..c9e3031ac 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Comment.java +++ b/Core/src/main/java/com/plotsquared/core/command/Comment.java @@ -96,7 +96,7 @@ public class Comment extends SubCommand { return false; } - for (final PlotPlayer pp : PlotSquared.imp().getPlayerManager().getPlayers()) { + for (final PlotPlayer pp : PlotSquared.platform().getPlayerManager().getPlayers()) { if (pp.getAttribute("chatspy")) { MainUtil.sendMessage(pp, "/plot comment " + StringMan.join(args, " ")); } diff --git a/Core/src/main/java/com/plotsquared/core/command/DatabaseCommand.java b/Core/src/main/java/com/plotsquared/core/command/DatabaseCommand.java index 41690b5af..413aa35bd 100644 --- a/Core/src/main/java/com/plotsquared/core/command/DatabaseCommand.java +++ b/Core/src/main/java/com/plotsquared/core/command/DatabaseCommand.java @@ -102,7 +102,7 @@ public class DatabaseCommand extends SubCommand { .sendMessage(player, "/plot database import [prefix]"); return false; } - File file = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), + File file = MainUtil.getFile(PlotSquared.platform().getDirectory(), args[1].endsWith(".db") ? args[1] : args[1] + ".db"); if (!file.exists()) { MainUtil.sendMessage(player, "&6Database does not exist: " + file); @@ -127,11 +127,11 @@ public class DatabaseCommand extends SubCommand { PlotId newId = newPlot.getId(); PlotId id = plot.getId(); File worldFile = - new File(PlotSquared.imp().getWorldContainer(), + new File(PlotSquared.platform().getWorldContainer(), id.toCommaSeparatedString()); if (worldFile.exists()) { File newFile = - new File(PlotSquared.imp().getWorldContainer(), + new File(PlotSquared.platform().getWorldContainer(), newId.toCommaSeparatedString()); worldFile.renameTo(newFile); } @@ -179,7 +179,7 @@ public class DatabaseCommand extends SubCommand { return MainUtil.sendMessage(player, "/plot database sqlite [file]"); } File sqliteFile = - MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), args[1] + ".db"); + MainUtil.getFile(PlotSquared.platform().getDirectory(), args[1] + ".db"); implementation = new SQLite(sqliteFile); break; default: diff --git a/Core/src/main/java/com/plotsquared/core/command/DebugExec.java b/Core/src/main/java/com/plotsquared/core/command/DebugExec.java index 3d6af68f1..036e5ed2a 100644 --- a/Core/src/main/java/com/plotsquared/core/command/DebugExec.java +++ b/Core/src/main/java/com/plotsquared/core/command/DebugExec.java @@ -89,12 +89,12 @@ public class DebugExec extends SubCommand { /* try { if (PlotSquared.get() != null) { - File file = new File(PlotSquared.get().IMP.getDirectory(), + File file = new File(PlotSquared.imp().getDirectory(), Settings.Paths.SCRIPTS + File.separator + "start.js"); if (file.exists()) { init(); String script = StringMan.join(Files.readLines(new File(new File( - PlotSquared.get().IMP.getDirectory() + File.separator + PlotSquared.imp().getDirectory() + File.separator + Settings.Paths.SCRIPTS), "start.js"), StandardCharsets.UTF_8), System.getProperty("line.separator")); this.scope.put("THIS", this); @@ -169,7 +169,7 @@ public class DebugExec extends SubCommand { this.scope.put("EconHandler", EconHandler.getEconHandler()); this.scope.put("DBFunc", DBFunc.dbManager); this.scope.put("HybridUtils", HybridUtils.manager); - this.scope.put("IMP", PlotSquared.get().IMP); + this.scope.put("IMP", PlotSquared.platform()); this.scope.put("MainCommand", MainCommand.getInstance()); // enums @@ -306,7 +306,7 @@ public class DebugExec extends SubCommand { case "addcmd": try { final String cmd = StringMan.join(Files.readLines(MainUtil.getFile(new File( - PlotSquared.get().IMP.getDirectory() + File.separator + PlotSquared.platform().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, @@ -338,7 +338,7 @@ public class DebugExec extends SubCommand { case "run": try { script = StringMan.join(Files.readLines(MainUtil.getFile(new File( - PlotSquared.get().IMP.getDirectory() + File.separator + PlotSquared.platform().getDirectory() + File.separator + Settings.Paths.SCRIPTS), args[1]), StandardCharsets.UTF_8), System.getProperty("line.separator")); if (args.length > 2) { @@ -354,7 +354,7 @@ public class DebugExec extends SubCommand { } break; case "list-scripts": - String path = PlotSquared.get().IMP.getDirectory() + File.separator + String path = PlotSquared.platform().getDirectory() + File.separator + Settings.Paths.SCRIPTS; File folder = new File(path); File[] filesArray = folder.listFiles(); diff --git a/Core/src/main/java/com/plotsquared/core/command/DebugImportWorlds.java b/Core/src/main/java/com/plotsquared/core/command/DebugImportWorlds.java index bdb5a13b2..832a8d5ea 100644 --- a/Core/src/main/java/com/plotsquared/core/command/DebugImportWorlds.java +++ b/Core/src/main/java/com/plotsquared/core/command/DebugImportWorlds.java @@ -63,7 +63,7 @@ public class DebugImportWorlds extends Command { } SinglePlotArea area = ((SinglePlotAreaManager) pam).getArea(); PlotId id = new PlotId(0, 0); - File container = PlotSquared.imp().getWorldContainer(); + File container = PlotSquared.platform().getWorldContainer(); if (container.equals(new File("."))) { player.sendMessage( "World container must be configured to be a separate directory to your base files!"); diff --git a/Core/src/main/java/com/plotsquared/core/command/DebugPaste.java b/Core/src/main/java/com/plotsquared/core/command/DebugPaste.java index 441fbdd84..be5754cdb 100644 --- a/Core/src/main/java/com/plotsquared/core/command/DebugPaste.java +++ b/Core/src/main/java/com/plotsquared/core/command/DebugPaste.java @@ -87,13 +87,13 @@ public class DebugPaste extends SubCommand { b.append("This PlotSquared version is licensed to the spigot user ") .append(PremiumVerification.getUserID()).append("\n\n"); b.append("# Server Information\n"); - b.append("Server Version: ").append(PlotSquared.get().IMP.getServerImplementation()) + b.append("Server Version: ").append(PlotSquared.platform().getServerImplementation()) .append("\n"); b.append("online_mode: ").append(!Settings.UUID.OFFLINE).append(';') .append(!Settings.UUID.OFFLINE).append('\n'); b.append("Plugins:"); for (Map.Entry, Boolean> pluginInfo : PlotSquared - .get().IMP.getPluginIds()) { + .platform().getPluginIds()) { Map.Entry nameVersion = pluginInfo.getKey(); String name = nameVersion.getKey(); String version = nameVersion.getValue(); @@ -129,7 +129,7 @@ public class DebugPaste extends SubCommand { try { final File logFile = - new File(PlotSquared.get().IMP.getDirectory(), "../../logs/latest.log"); + new File(PlotSquared.platform().getDirectory(), "../../logs/latest.log"); if (Files.size(logFile.toPath()) > 14_000_000) { throw new IOException("Too big..."); } @@ -161,7 +161,7 @@ public class DebugPaste extends SubCommand { } try { - final File MultiverseWorlds = new File(PlotSquared.get().IMP.getDirectory(), + final File MultiverseWorlds = new File(PlotSquared.platform().getDirectory(), "../Multiverse-Core/worlds.yml"); incendoPaster.addFile(new IncendoPaster.PasteFile("MultiverseCore/worlds.yml", readFile(MultiverseWorlds))); diff --git a/Core/src/main/java/com/plotsquared/core/command/Deny.java b/Core/src/main/java/com/plotsquared/core/command/Deny.java index 1cb862304..edbdab068 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Deny.java +++ b/Core/src/main/java/com/plotsquared/core/command/Deny.java @@ -96,7 +96,7 @@ public class Deny extends SubCommand { plot.addDenied(uuid); PlotSquared.get().getEventDispatcher().callDenied(player, plot, uuid, true); if (!uuid.equals(DBFunc.EVERYONE)) { - handleKick(PlotSquared.imp().getPlayerManager().getPlayerIfExists(uuid), plot); + handleKick(PlotSquared.platform().getPlayerManager().getPlayerIfExists(uuid), plot); } else { for (PlotPlayer plotPlayer : plot.getPlayersInPlot()) { // Ignore plot-owners diff --git a/Core/src/main/java/com/plotsquared/core/command/Grant.java b/Core/src/main/java/com/plotsquared/core/command/Grant.java index 2d41da2e3..59c1453a8 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Grant.java +++ b/Core/src/main/java/com/plotsquared/core/command/Grant.java @@ -99,7 +99,7 @@ public class Grant extends Command { String key = "grantedPlots"; byte[] rawData = Ints.toByteArray(amount); - PlotPlayer online = PlotSquared.imp().getPlayerManager().getPlayerIfExists(uuid); + PlotPlayer online = PlotSquared.platform().getPlayerManager().getPlayerIfExists(uuid); if (online != null) { online.setPersistentMeta(key, rawData); } else { diff --git a/Core/src/main/java/com/plotsquared/core/command/Kick.java b/Core/src/main/java/com/plotsquared/core/command/Kick.java index 911ea9810..978aeec29 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Kick.java +++ b/Core/src/main/java/com/plotsquared/core/command/Kick.java @@ -86,7 +86,7 @@ public class Kick extends SubCommand { } continue; } - PlotPlayer pp = PlotSquared.imp().getPlayerManager().getPlayerIfExists(uuid); + PlotPlayer pp = PlotSquared.platform().getPlayerManager().getPlayerIfExists(uuid); if (pp != null) { players.add(pp); } diff --git a/Core/src/main/java/com/plotsquared/core/command/ListCmd.java b/Core/src/main/java/com/plotsquared/core/command/ListCmd.java index a08de0cd0..0f5564055 100644 --- a/Core/src/main/java/com/plotsquared/core/command/ListCmd.java +++ b/Core/src/main/java/com/plotsquared/core/command/ListCmd.java @@ -383,7 +383,7 @@ public class ListCmd extends SubCommand { final List names = PlotSquared.get().getImpromptuUUIDPipeline() .getNames(plot.getOwners()).get(Settings.UUID.BLOCKING_TIMEOUT, TimeUnit.MILLISECONDS); for (final UUIDMapping uuidMapping : names) { - PlotPlayer pp = PlotSquared.imp().getPlayerManager().getPlayerIfExists(uuidMapping.getUuid()); + PlotPlayer pp = PlotSquared.platform().getPlayerManager().getPlayerIfExists(uuidMapping.getUuid()); if (pp != null) { message = message.text(prefix).color("$4").text(uuidMapping.getUsername()).color("$1") .tooltip(new PlotMessage("Online").color("$4")); @@ -415,7 +415,7 @@ public class ListCmd extends SubCommand { completions.add("shared"); } if (Permissions.hasPermission(player, Captions.PERMISSION_LIST_WORLD)) { - completions.addAll(PlotSquared.imp().getWorldManager().getWorlds()); + completions.addAll(PlotSquared.platform().getWorldManager().getWorlds()); } if (Permissions.hasPermission(player, Captions.PERMISSION_LIST_TOP)) { completions.add("top"); diff --git a/Core/src/main/java/com/plotsquared/core/command/Merge.java b/Core/src/main/java/com/plotsquared/core/command/Merge.java index 33754c4b8..395f49704 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Merge.java +++ b/Core/src/main/java/com/plotsquared/core/command/Merge.java @@ -212,7 +212,7 @@ public class Merge extends SubCommand { java.util.Set uuids = adjacent.getOwners(); boolean isOnline = false; for (final UUID owner : uuids) { - final PlotPlayer accepter = PlotSquared.imp().getPlayerManager().getPlayerIfExists(owner); + final PlotPlayer accepter = PlotSquared.platform().getPlayerManager().getPlayerIfExists(owner); if (!force && accepter == null) { continue; } @@ -221,7 +221,7 @@ public class Merge extends SubCommand { Runnable run = () -> { MainUtil.sendMessage(accepter, Captions.MERGE_ACCEPTED); plot.autoMerge(dir, maxSize - size, owner, terrain); - PlotPlayer plotPlayer = PlotSquared.imp().getPlayerManager().getPlayerIfExists(player.getUUID()); + PlotPlayer plotPlayer = PlotSquared.platform().getPlayerManager().getPlayerIfExists(player.getUUID()); if (plotPlayer == null) { sendMessage(accepter, Captions.MERGE_NOT_VALID); return; diff --git a/Core/src/main/java/com/plotsquared/core/command/Owner.java b/Core/src/main/java/com/plotsquared/core/command/Owner.java index f19790dc5..4176c312f 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Owner.java +++ b/Core/src/main/java/com/plotsquared/core/command/Owner.java @@ -95,7 +95,7 @@ public class Owner extends SetCommand { MainUtil.sendMessage(player, Captions.SET_OWNER); return; } - final PlotPlayer other = PlotSquared.imp().getPlayerManager().getPlayerIfExists(uuid); + final PlotPlayer other = PlotSquared.platform().getPlayerManager().getPlayerIfExists(uuid); if (plot.isOwner(uuid)) { Captions.ALREADY_OWNER.send(player, MainUtil.getName(uuid)); return; diff --git a/Core/src/main/java/com/plotsquared/core/command/PluginCmd.java b/Core/src/main/java/com/plotsquared/core/command/PluginCmd.java index b0bf24d40..67f498c67 100644 --- a/Core/src/main/java/com/plotsquared/core/command/PluginCmd.java +++ b/Core/src/main/java/com/plotsquared/core/command/PluginCmd.java @@ -42,7 +42,7 @@ public class PluginCmd extends SubCommand { @Override public boolean onCommand(final PlotPlayer player, String[] args) { TaskManager.IMP.taskAsync(() -> { MainUtil.sendMessage(player, String.format( - "$2>> $1&l" + PlotSquared.imp().getPluginName() + " $2($1Version$2: $1%s$2)", + "$2>> $1&l" + PlotSquared.platform().getPluginName() + " $2($1Version$2: $1%s$2)", PlotSquared.get().getVersion())); MainUtil.sendMessage(player, "$2>> $1&lAuthors$2: $1Citymonstret $2& $1Empire92 $2& $1MattBDev $2& $1dordsor21 $2& $1NotMyFault $2& $1SirYwell"); diff --git a/Core/src/main/java/com/plotsquared/core/command/Setup.java b/Core/src/main/java/com/plotsquared/core/command/Setup.java index bdcd20697..d61fd02da 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Setup.java +++ b/Core/src/main/java/com/plotsquared/core/command/Setup.java @@ -52,7 +52,7 @@ public class Setup extends SubCommand { StringBuilder message = new StringBuilder(); message.append("&6What generator do you want?"); for (Entry> entry : SetupUtils.generators.entrySet()) { - if (entry.getKey().equals(PlotSquared.imp().getPluginName())) { + if (entry.getKey().equals(PlotSquared.platform().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)"); diff --git a/Core/src/main/java/com/plotsquared/core/command/Template.java b/Core/src/main/java/com/plotsquared/core/command/Template.java index 02bc7af4d..5e5f9675b 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Template.java +++ b/Core/src/main/java/com/plotsquared/core/command/Template.java @@ -64,11 +64,11 @@ public class Template extends SubCommand { public static boolean extractAllFiles(String world, String template) { try { File folder = - MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), Settings.Paths.TEMPLATES); + MainUtil.getFile(PlotSquared.platform().getDirectory(), Settings.Paths.TEMPLATES); if (!folder.exists()) { return false; } - File output = PlotSquared.get().IMP.getDirectory(); + File output = PlotSquared.platform().getDirectory(); if (!output.exists()) { output.mkdirs(); } @@ -120,7 +120,7 @@ public class Template extends SubCommand { public static void zipAll(String world, Set files) throws IOException { File output = - MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), Settings.Paths.TEMPLATES); + MainUtil.getFile(PlotSquared.platform().getDirectory(), Settings.Paths.TEMPLATES); output.mkdirs(); try (FileOutputStream fos = new FileOutputStream( output + File.separator + world + ".template"); @@ -169,7 +169,7 @@ public class Template extends SubCommand { .sendMessage(player, "&cInvalid template file: " + args[2] + ".template"); return false; } - File worldFile = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), + File worldFile = MainUtil.getFile(PlotSquared.platform().getDirectory(), Settings.Paths.TEMPLATES + File.separator + "tmp-data.yml"); YamlConfiguration worldConfig = YamlConfiguration.loadConfiguration(worldFile); PlotSquared.get().worlds.set("worlds." + world, worldConfig.get("")); @@ -180,7 +180,7 @@ public class Template extends SubCommand { e.printStackTrace(); } String manager = - worldConfig.getString("generator.plugin", PlotSquared.imp().getPluginName()); + worldConfig.getString("generator.plugin", PlotSquared.platform().getPluginName()); String generator = worldConfig.getString("generator.init", manager); PlotAreaBuilder builder = new PlotAreaBuilder() .plotAreaType(MainUtil.getType(worldConfig)) diff --git a/Core/src/main/java/com/plotsquared/core/command/Trim.java b/Core/src/main/java/com/plotsquared/core/command/Trim.java index ad5e5c0fe..3a9124662 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Trim.java +++ b/Core/src/main/java/com/plotsquared/core/command/Trim.java @@ -73,7 +73,7 @@ public class Trim extends SubCommand { TaskManager.runTaskAsync(new Runnable() { @Override public void run() { String directory = world + File.separator + "region"; - File folder = new File(PlotSquared.get().IMP.getWorldContainer(), directory); + File folder = new File(PlotSquared.platform().getWorldContainer(), directory); File[] regionFiles = folder.listFiles(); for (File file : regionFiles) { String name = file.getName(); diff --git a/Core/src/main/java/com/plotsquared/core/components/ComponentPresetManager.java b/Core/src/main/java/com/plotsquared/core/components/ComponentPresetManager.java index fb10eff9b..915a30bf1 100644 --- a/Core/src/main/java/com/plotsquared/core/components/ComponentPresetManager.java +++ b/Core/src/main/java/com/plotsquared/core/components/ComponentPresetManager.java @@ -61,7 +61,7 @@ public class ComponentPresetManager { private final String guiName; public ComponentPresetManager() { - final File file = new File(Objects.requireNonNull(PlotSquared.imp()).getDirectory(), "components.yml"); + final File file = new File(Objects.requireNonNull(PlotSquared.platform()).getDirectory(), "components.yml"); if (!file.exists()) { boolean created = false; try { diff --git a/Core/src/main/java/com/plotsquared/core/database/SQLite.java b/Core/src/main/java/com/plotsquared/core/database/SQLite.java index 501033184..7c6ea7d49 100644 --- a/Core/src/main/java/com/plotsquared/core/database/SQLite.java +++ b/Core/src/main/java/com/plotsquared/core/database/SQLite.java @@ -56,8 +56,8 @@ public class SQLite extends Database { if (checkConnection()) { return this.connection; } - if (!PlotSquared.get().IMP.getDirectory().exists()) { - PlotSquared.get().IMP.getDirectory().mkdirs(); + if (!PlotSquared.platform().getDirectory().exists()) { + PlotSquared.platform().getDirectory().mkdirs(); } File file = new File(this.dbLocation); if (!file.exists()) { diff --git a/Core/src/main/java/com/plotsquared/core/generator/HybridGen.java b/Core/src/main/java/com/plotsquared/core/generator/HybridGen.java index e661e4c5f..5a8ace19e 100644 --- a/Core/src/main/java/com/plotsquared/core/generator/HybridGen.java +++ b/Core/src/main/java/com/plotsquared/core/generator/HybridGen.java @@ -41,7 +41,7 @@ import org.jetbrains.annotations.NotNull; public class HybridGen extends IndependentPlotGenerator { @Override public String getName() { - return PlotSquared.imp().getPluginName(); + return PlotSquared.platform().getPluginName(); } private void placeSchem(HybridPlotWorld world, ScopedLocalBlockQueue result, short relativeX, diff --git a/Core/src/main/java/com/plotsquared/core/generator/HybridPlotManager.java b/Core/src/main/java/com/plotsquared/core/generator/HybridPlotManager.java index 67ad6eb8b..04c6ad9bd 100644 --- a/Core/src/main/java/com/plotsquared/core/generator/HybridPlotManager.java +++ b/Core/src/main/java/com/plotsquared/core/generator/HybridPlotManager.java @@ -74,7 +74,7 @@ public class HybridPlotManager extends ClassicPlotManager { .getWorldName() + File.separator; try { File sideRoad = - MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), dir + "sideroad.schem"); + MainUtil.getFile(PlotSquared.platform().getDirectory(), dir + "sideroad.schem"); String newDir = "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + "__TEMP_DIR__" + File.separator; if (sideRoad.exists()) { @@ -82,12 +82,12 @@ public class HybridPlotManager extends ClassicPlotManager { Files.readAllBytes(sideRoad.toPath()))); } File intersection = - MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), dir + "intersection.schem"); + MainUtil.getFile(PlotSquared.platform().getDirectory(), dir + "intersection.schem"); if (intersection.exists()) { files.add(new FileBytes(newDir + "intersection.schem", Files.readAllBytes(intersection.toPath()))); } - File plot = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), dir + "plot.schem"); + File plot = MainUtil.getFile(PlotSquared.platform().getDirectory(), dir + "plot.schem"); if (plot.exists()) { files.add(new FileBytes(newDir + "plot.schem", Files.readAllBytes(plot.toPath()))); } diff --git a/Core/src/main/java/com/plotsquared/core/generator/HybridPlotWorld.java b/Core/src/main/java/com/plotsquared/core/generator/HybridPlotWorld.java index a561a9ac3..e746e90ea 100644 --- a/Core/src/main/java/com/plotsquared/core/generator/HybridPlotWorld.java +++ b/Core/src/main/java/com/plotsquared/core/generator/HybridPlotWorld.java @@ -200,9 +200,9 @@ public class HybridPlotWorld extends ClassicPlotWorld { // Try to determine root. This means that plot areas can have separate schematic // directories - if (!(root = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), "schematics/GEN_ROAD_SCHEMATIC/" + + if (!(root = MainUtil.getFile(PlotSquared.platform().getDirectory(), "schematics/GEN_ROAD_SCHEMATIC/" + this.getWorldName() + "/" + this.getId())).exists()) { - root = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), + root = MainUtil.getFile(PlotSquared.platform().getDirectory(), "schematics/GEN_ROAD_SCHEMATIC/" + this.getWorldName()); } diff --git a/Core/src/main/java/com/plotsquared/core/generator/IndependentPlotGenerator.java b/Core/src/main/java/com/plotsquared/core/generator/IndependentPlotGenerator.java index 324f6d8d4..c42e54546 100644 --- a/Core/src/main/java/com/plotsquared/core/generator/IndependentPlotGenerator.java +++ b/Core/src/main/java/com/plotsquared/core/generator/IndependentPlotGenerator.java @@ -31,7 +31,6 @@ import com.plotsquared.core.plot.PlotId; import com.plotsquared.core.plot.SetupObject; import com.plotsquared.core.queue.ScopedLocalBlockQueue; import com.plotsquared.core.setup.PlotAreaBuilder; -import com.plotsquared.core.setup.SetupProcess; /** * This class allows for implementation independent world generation. @@ -104,7 +103,7 @@ public abstract class IndependentPlotGenerator { * @return */ public GeneratorWrapper specify(String world) { - return (GeneratorWrapper) PlotSquared.get().IMP.wrapPlotGenerator(world, this); + return (GeneratorWrapper) PlotSquared.platform().wrapPlotGenerator(world, this); } @Override public String toString() { diff --git a/Core/src/main/java/com/plotsquared/core/listener/PlotListener.java b/Core/src/main/java/com/plotsquared/core/listener/PlotListener.java index 361a71b28..055c2e689 100644 --- a/Core/src/main/java/com/plotsquared/core/listener/PlotListener.java +++ b/Core/src/main/java/com/plotsquared/core/listener/PlotListener.java @@ -160,7 +160,7 @@ public class PlotListener { if (plot.getFlag(NotifyEnterFlag.class)) { if (!Permissions.hasPermission(player, "plots.flag.notify-enter.bypass")) { for (UUID uuid : plot.getOwners()) { - final PlotPlayer owner = PlotSquared.imp().getPlayerManager().getPlayerIfExists(uuid); + final PlotPlayer owner = PlotSquared.platform().getPlayerManager().getPlayerIfExists(uuid); if (owner != null && !owner.getUUID().equals(player.getUUID())) { MainUtil.sendMessage(owner, Captions.NOTIFY_ENTER.getTranslated() .replace("%player", player.getName()) @@ -336,7 +336,7 @@ public class PlotListener { if (plot.getFlag(NotifyLeaveFlag.class)) { if (!Permissions.hasPermission(player, "plots.flag.notify-enter.bypass")) { for (UUID uuid : plot.getOwners()) { - final PlotPlayer owner = PlotSquared.imp().getPlayerManager().getPlayerIfExists(uuid); + final PlotPlayer owner = PlotSquared.platform().getPlayerManager().getPlayerIfExists(uuid); if ((owner != null) && !owner.getUUID().equals(player.getUUID())) { MainUtil.sendMessage(owner, Captions.NOTIFY_LEAVE.getTranslated() .replace("%player", player.getName()) diff --git a/Core/src/main/java/com/plotsquared/core/player/ConsolePlayer.java b/Core/src/main/java/com/plotsquared/core/player/ConsolePlayer.java index 9a97800e7..e51552729 100644 --- a/Core/src/main/java/com/plotsquared/core/player/ConsolePlayer.java +++ b/Core/src/main/java/com/plotsquared/core/player/ConsolePlayer.java @@ -68,7 +68,7 @@ public class ConsolePlayer extends PlotPlayer { } @Override public Actor toActor() { - return PlotSquared.get().IMP.getConsole(); + return PlotSquared.platform().getConsole(); } @Override public Actor getPlatformPlayer() { diff --git a/Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java b/Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java index 13efa6bfb..e18877739 100644 --- a/Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java +++ b/Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java @@ -129,7 +129,7 @@ public abstract class PlotPlayer

implements CommandCaller, OfflinePlotPlayer * @return Wrapped player */ public static PlotPlayer wrap(Object player) { - return PlotSquared.get().IMP.wrapPlayer(player); + return PlotSquared.platform().wrapPlayer(player); } public abstract Actor toActor(); @@ -588,8 +588,8 @@ public abstract class PlotPlayer

implements CommandCaller, OfflinePlotPlayer if (ExpireManager.IMP != null) { ExpireManager.IMP.storeDate(getUUID(), System.currentTimeMillis()); } - PlotSquared.imp().getPlayerManager().removePlayer(this); - PlotSquared.get().IMP.unregister(this); + PlotSquared.platform().getPlayerManager().removePlayer(this); + PlotSquared.platform().unregister(this); debugModeEnabled.remove(this); } diff --git a/Core/src/main/java/com/plotsquared/core/plot/Plot.java b/Core/src/main/java/com/plotsquared/core/plot/Plot.java index 46ce9f24c..450835c25 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/Plot.java +++ b/Core/src/main/java/com/plotsquared/core/plot/Plot.java @@ -401,7 +401,7 @@ public class Plot { */ public List> getPlayersInPlot() { final List> players = new ArrayList<>(); - for (final PlotPlayer player : PlotSquared.imp().getPlayerManager().getPlayers()) { + for (final PlotPlayer player : PlotSquared.platform().getPlayerManager().getPlayers()) { if (this.equals(player.getCurrentPlot())) { players.add(player); } @@ -1330,7 +1330,7 @@ public class Plot { if (Settings.Backup.DELETE_ON_UNCLAIM) { // Destroy all backups when the plot is unclaimed - Objects.requireNonNull(PlotSquared.imp()).getBackupManager().getProfile(current) + Objects.requireNonNull(PlotSquared.platform()).getBackupManager().getProfile(current) .destroy(); } @@ -3039,11 +3039,11 @@ public class Plot { return false; } if (!isMerged()) { - return PlotSquared.imp().getPlayerManager() + return PlotSquared.platform().getPlayerManager() .getPlayerIfExists(Objects.requireNonNull(this.getOwnerAbs())) != null; } for (final Plot current : getConnectedPlots()) { - if (current.hasOwner() && PlotSquared.imp().getPlayerManager() + if (current.hasOwner() && PlotSquared.platform().getPlayerManager() .getPlayerIfExists(Objects.requireNonNull(current.getOwnerAbs())) != null) { return true; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/expiration/ExpireManager.java b/Core/src/main/java/com/plotsquared/core/plot/expiration/ExpireManager.java index 532134536..cb6c21fa1 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/expiration/ExpireManager.java +++ b/Core/src/main/java/com/plotsquared/core/plot/expiration/ExpireManager.java @@ -409,13 +409,13 @@ public class ExpireManager { } } for (UUID helper : plot.getTrusted()) { - PlotPlayer player = PlotSquared.imp().getPlayerManager().getPlayerIfExists(helper); + PlotPlayer player = PlotSquared.platform().getPlayerManager().getPlayerIfExists(helper); if (player != null) { MainUtil.sendMessage(player, Captions.PLOT_REMOVED_USER, plot.toString()); } } for (UUID helper : plot.getMembers()) { - PlotPlayer player = PlotSquared.imp().getPlayerManager().getPlayerIfExists(helper); + PlotPlayer player = PlotSquared.platform().getPlayerManager().getPlayerIfExists(helper); if (player != null) { MainUtil.sendMessage(player, Captions.PLOT_REMOVED_USER, plot.toString()); } @@ -438,12 +438,12 @@ public class ExpireManager { } public long getAge(UUID uuid) { - if (PlotSquared.imp().getPlayerManager().getPlayerIfExists(uuid) != null) { + if (PlotSquared.platform().getPlayerManager().getPlayerIfExists(uuid) != null) { return 0; } Long last = this.dates_cache.get(uuid); if (last == null) { - OfflinePlotPlayer opp = PlotSquared.imp().getPlayerManager().getOfflinePlayer(uuid); + OfflinePlotPlayer opp = PlotSquared.platform().getPlayerManager().getOfflinePlayer(uuid); if (opp != null && (last = opp.getLastPlayed()) != 0) { this.dates_cache.put(uuid, last); } else { @@ -458,7 +458,7 @@ public class ExpireManager { public long getAge(Plot plot) { if (!plot.hasOwner() || Objects.equals(DBFunc.EVERYONE, plot.getOwner()) - || PlotSquared.imp().getPlayerManager().getPlayerIfExists(plot.getOwner()) != null || plot.getRunning() > 0) { + || PlotSquared.platform().getPlayerManager().getPlayerIfExists(plot.getOwner()) != null || plot.getRunning() > 0) { return 0; } diff --git a/Core/src/main/java/com/plotsquared/core/plot/message/PlotMessage.java b/Core/src/main/java/com/plotsquared/core/plot/message/PlotMessage.java index 95ae8e953..608974bc9 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/message/PlotMessage.java +++ b/Core/src/main/java/com/plotsquared/core/plot/message/PlotMessage.java @@ -39,8 +39,8 @@ public class PlotMessage { reset(ChatManager.manager); } catch (Throwable e) { PlotSquared.debug( - PlotSquared.imp().getPluginName() + " doesn't support fancy chat for " + PlotSquared - .get().IMP.getServerVersion()); + PlotSquared.platform().getPluginName() + " doesn't support fancy chat for " + PlotSquared + .platform().getServerVersion()); ChatManager.manager = new PlainChatManager(); reset(ChatManager.manager); } diff --git a/Core/src/main/java/com/plotsquared/core/plot/world/SinglePlotArea.java b/Core/src/main/java/com/plotsquared/core/plot/world/SinglePlotArea.java index a212a0506..09c1f3859 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/world/SinglePlotArea.java +++ b/Core/src/main/java/com/plotsquared/core/plot/world/SinglePlotArea.java @@ -87,7 +87,7 @@ public class SinglePlotArea extends GridPlotWorld { .settingsNodesWrapper(new SettingsNodesWrapper(new ConfigurationNode[0], null)) .worldName(worldName); - File container = PlotSquared.imp().getWorldContainer(); + File container = PlotSquared.platform().getWorldContainer(); File destination = new File(container, worldName); {// convert old diff --git a/Core/src/main/java/com/plotsquared/core/plot/world/SinglePlotManager.java b/Core/src/main/java/com/plotsquared/core/plot/world/SinglePlotManager.java index 0e014baba..6083434a8 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/world/SinglePlotManager.java +++ b/Core/src/main/java/com/plotsquared/core/plot/world/SinglePlotManager.java @@ -63,7 +63,7 @@ public class SinglePlotManager extends PlotManager { @Override public boolean clearPlot(Plot plot, final Runnable whenDone) { SetupUtils.manager.unload(plot.getWorldName(), false); final File worldFolder = - new File(PlotSquared.get().IMP.getWorldContainer(), plot.getWorldName()); + new File(PlotSquared.platform().getWorldContainer(), plot.getWorldName()); TaskManager.IMP.taskAsync(() -> { MainUtil.deleteDirectory(worldFolder); if (whenDone != null) { diff --git a/Core/src/main/java/com/plotsquared/core/queue/LocalBlockQueue.java b/Core/src/main/java/com/plotsquared/core/queue/LocalBlockQueue.java index 76fa5e28a..9f270ff32 100644 --- a/Core/src/main/java/com/plotsquared/core/queue/LocalBlockQueue.java +++ b/Core/src/main/java/com/plotsquared/core/queue/LocalBlockQueue.java @@ -123,7 +123,7 @@ public abstract class LocalBlockQueue { fixChunkLighting(x, z); BlockVector2 loc = BlockVector2.at(x, z); - for (final PlotPlayer pp : PlotSquared.imp().getPlayerManager().getPlayers()) { + for (final PlotPlayer pp : PlotSquared.platform().getPlayerManager().getPlayers()) { Location pLoc = pp.getLocation(); if (!StringMan.isEqual(getWorld(), pLoc.getWorld()) || !pLoc.getBlockVector2() .equals(loc)) { diff --git a/Core/src/main/java/com/plotsquared/core/setup/CommonSetupSteps.java b/Core/src/main/java/com/plotsquared/core/setup/CommonSetupSteps.java index 0a8c7ba9a..73ab84cb9 100644 --- a/Core/src/main/java/com/plotsquared/core/setup/CommonSetupSteps.java +++ b/Core/src/main/java/com/plotsquared/core/setup/CommonSetupSteps.java @@ -59,8 +59,8 @@ public enum CommonSetupSteps implements SetupStep { String prefix = "\n&8 - &7"; sendMessage(plotPlayer, Captions.SETUP_WORLD_GENERATOR_ERROR + prefix + StringMan .join(SetupUtils.generators.keySet(), prefix) - .replaceAll(PlotSquared.imp().getPluginName(), - "&2" + PlotSquared.imp().getPluginName())); + .replaceAll(PlotSquared.platform().getPluginName(), + "&2" + PlotSquared.platform().getPluginName())); return this; // invalid input -> same setup step } builder.generatorName(arg); @@ -72,7 +72,7 @@ public enum CommonSetupSteps implements SetupStep { } @Nullable @Override public String getDefaultValue() { - return PlotSquared.imp().getPluginName(); + return PlotSquared.platform().getPluginName(); } }, CHOOSE_PLOT_AREA_TYPE(PlotAreaType.class, Captions.SETUP_WORLD_TYPE) { @@ -110,7 +110,7 @@ public enum CommonSetupSteps implements SetupStep { SetupUtils.generators.get(builder.plotManager()).getPlotGenerator() .processAreaSetup(builder); } else { - builder.plotManager(PlotSquared.imp().getPluginName()); + builder.plotManager(PlotSquared.platform().getPluginName()); MainUtil.sendMessage(plotPlayer, Captions.SETUP_WRONG_GENERATOR); builder.settingsNodesWrapper(CommonSetupSteps.wrap(builder.plotManager())); // TODO why is processSetup not called here? diff --git a/Core/src/main/java/com/plotsquared/core/setup/PlotAreaBuilder.java b/Core/src/main/java/com/plotsquared/core/setup/PlotAreaBuilder.java index d59e2d8f0..549c41b55 100644 --- a/Core/src/main/java/com/plotsquared/core/setup/PlotAreaBuilder.java +++ b/Core/src/main/java/com/plotsquared/core/setup/PlotAreaBuilder.java @@ -56,7 +56,7 @@ public class PlotAreaBuilder { .plotAreaType(area.getType()) .terrainType(area.getTerrain()) .generatorName(area.getGenerator().getName()) - .plotManager(PlotSquared.imp().getPluginName()) + .plotManager(PlotSquared.platform().getPluginName()) .minimumId(area.getMin()) .maximumId(area.getMax()) .settingsNodesWrapper(new SettingsNodesWrapper(area.getSettingNodes(), null)); diff --git a/Core/src/main/java/com/plotsquared/core/util/EconHandler.java b/Core/src/main/java/com/plotsquared/core/util/EconHandler.java index a593e0cb0..6557bc1c5 100644 --- a/Core/src/main/java/com/plotsquared/core/util/EconHandler.java +++ b/Core/src/main/java/com/plotsquared/core/util/EconHandler.java @@ -25,7 +25,7 @@ */ package com.plotsquared.core.util; -import com.plotsquared.core.IPlotMain; +import com.plotsquared.core.PlotPlatform; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.player.ConsolePlayer; import com.plotsquared.core.player.OfflinePlotPlayer; @@ -36,27 +36,27 @@ public abstract class EconHandler { /** * @deprecated This will be removed in the future, - * call {@link IPlotMain#getEconomyHandler()} instead. + * call {@link PlotPlatform#getEconomyHandler()} instead. */ @Deprecated @Nullable public static EconHandler manager; /** - * Initialize the economy handler using {@link IPlotMain#getEconomyHandler()} - * @deprecated Call {@link #init} instead or use {@link IPlotMain#getEconomyHandler()} + * Initialize the economy handler using {@link PlotPlatform#getEconomyHandler()} + * @deprecated Call {@link #init} instead or use {@link PlotPlatform#getEconomyHandler()} * which does this already. */ @Deprecated public static void initializeEconHandler() { - manager = PlotSquared.get().IMP.getEconomyHandler(); + manager = PlotSquared.platform().getEconomyHandler(); } /** * Return the econ handler instance, if one exists * * @return Economy handler instance - * @deprecated Call {@link IPlotMain#getEconomyHandler()} instead + * @deprecated Call {@link PlotPlatform#getEconomyHandler()} instead */ @Deprecated @Nullable public static EconHandler getEconHandler() { - manager = PlotSquared.get().IMP.getEconomyHandler(); + manager = PlotSquared.platform().getEconomyHandler(); return manager; } diff --git a/Core/src/main/java/com/plotsquared/core/util/MainUtil.java b/Core/src/main/java/com/plotsquared/core/util/MainUtil.java index 9e2a78853..25797755d 100644 --- a/Core/src/main/java/com/plotsquared/core/util/MainUtil.java +++ b/Core/src/main/java/com/plotsquared/core/util/MainUtil.java @@ -969,7 +969,7 @@ public class MainUtil { public static void getPersistentMeta(UUID uuid, final String key, final RunnableVal result) { - PlotPlayer player = PlotSquared.imp().getPlayerManager().getPlayerIfExists(uuid); + PlotPlayer player = PlotSquared.platform().getPlayerManager().getPlayerIfExists(uuid); if (player != null) { result.run(player.getPersistentMeta(key)); } else { diff --git a/Core/src/main/java/com/plotsquared/core/util/RegionManager.java b/Core/src/main/java/com/plotsquared/core/util/RegionManager.java index 1349e6c9a..8e8316862 100644 --- a/Core/src/main/java/com/plotsquared/core/util/RegionManager.java +++ b/Core/src/main/java/com/plotsquared/core/util/RegionManager.java @@ -107,7 +107,7 @@ public abstract class RegionManager { public Set getChunkChunks(String world) { File folder = - new File(PlotSquared.get().IMP.getWorldContainer(), world + File.separator + "region"); + new File(PlotSquared.platform().getWorldContainer(), world + File.separator + "region"); File[] regionFiles = folder.listFiles(); if (regionFiles == null) { throw new RuntimeException( @@ -141,7 +141,7 @@ public abstract class RegionManager { String directory = world + File.separator + "region" + File.separator + "r." + loc.getX() + "." + loc.getZ() + ".mca"; - File file = new File(PlotSquared.get().IMP.getWorldContainer(), directory); + File file = new File(PlotSquared.platform().getWorldContainer(), directory); PlotSquared.log("&6 - Deleting file: " + file.getName() + " (max 1024 chunks)"); if (file.exists()) { file.delete(); diff --git a/Core/src/main/java/com/plotsquared/core/util/SchematicHandler.java b/Core/src/main/java/com/plotsquared/core/util/SchematicHandler.java index 92b1b2ef4..22ae0ff9f 100644 --- a/Core/src/main/java/com/plotsquared/core/util/SchematicHandler.java +++ b/Core/src/main/java/com/plotsquared/core/util/SchematicHandler.java @@ -314,7 +314,7 @@ public abstract class SchematicHandler { */ public Schematic getSchematic(String name) throws UnsupportedFormatException { File parent = - MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), Settings.Paths.SCHEMATICS); + MainUtil.getFile(PlotSquared.platform().getDirectory(), Settings.Paths.SCHEMATICS); if (!parent.exists()) { if (!parent.mkdir()) { throw new RuntimeException("Could not create schematic parent directory"); @@ -323,10 +323,10 @@ public abstract class SchematicHandler { if (!name.endsWith(".schem") && !name.endsWith(".schematic")) { name = name + ".schem"; } - File file = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), + File file = MainUtil.getFile(PlotSquared.platform().getDirectory(), Settings.Paths.SCHEMATICS + File.separator + name); if (!file.exists()) { - file = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), + file = MainUtil.getFile(PlotSquared.platform().getDirectory(), Settings.Paths.SCHEMATICS + File.separator + name); } return getSchematic(file); @@ -339,7 +339,7 @@ public abstract class SchematicHandler { */ public Collection getSchematicNames() { final File parent = - MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), Settings.Paths.SCHEMATICS); + MainUtil.getFile(PlotSquared.platform().getDirectory(), Settings.Paths.SCHEMATICS); final List names = new ArrayList<>(); if (parent.exists()) { final String[] rawNames = @@ -467,7 +467,7 @@ public abstract class SchematicHandler { return false; } try { - File tmp = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), path); + File tmp = MainUtil.getFile(PlotSquared.platform().getDirectory(), path); tmp.getParentFile().mkdirs(); try (NBTOutputStream nbtStream = new NBTOutputStream( new GZIPOutputStream(new FileOutputStream(tmp)))) { diff --git a/Core/src/main/java/com/plotsquared/core/util/TabCompletions.java b/Core/src/main/java/com/plotsquared/core/util/TabCompletions.java index 56a3ff8fa..ebff5c94f 100644 --- a/Core/src/main/java/com/plotsquared/core/util/TabCompletions.java +++ b/Core/src/main/java/com/plotsquared/core/util/TabCompletions.java @@ -161,7 +161,7 @@ public class TabCompletions { cachedCompletionValues.put(cacheIdentifier, players); } } else { - final Collection> onlinePlayers = PlotSquared.imp().getPlayerManager().getPlayers(); + final Collection> onlinePlayers = PlotSquared.platform().getPlayerManager().getPlayers(); players = new ArrayList<>(onlinePlayers.size()); for (final PlotPlayer player : onlinePlayers) { if (uuidFilter.test(player.getUUID())) { diff --git a/Core/src/main/java/com/plotsquared/core/util/WorldUtil.java b/Core/src/main/java/com/plotsquared/core/util/WorldUtil.java index 4d733d5eb..29cb707fd 100644 --- a/Core/src/main/java/com/plotsquared/core/util/WorldUtil.java +++ b/Core/src/main/java/com/plotsquared/core/util/WorldUtil.java @@ -187,7 +187,7 @@ public abstract class WorldUtil { public File getDat(String world) { File file = new File( - PlotSquared.get().IMP.getWorldContainer() + File.separator + world + File.separator + PlotSquared.platform().getWorldContainer() + File.separator + world + File.separator + "level.dat"); if (file.exists()) { return file; @@ -196,7 +196,7 @@ public abstract class WorldUtil { } public File getMcr(String world, int x, int z) { - File file = new File(PlotSquared.get().IMP.getWorldContainer(), + File file = new File(PlotSquared.platform().getWorldContainer(), world + File.separator + "region" + File.separator + "r." + x + '.' + z + ".mca"); if (file.exists()) { return file;