Remove access to PlotSquared#IMP and rename IPlotMain to PlotPlatform, then rename PlotSquared#imp() to PlotSquared#platform()

This commit is contained in:
Alexander Söderberg 2020-07-07 12:56:43 +02:00
parent b5818bfefc
commit d76c9dad52
No known key found for this signature in database
GPG Key ID: C0207FF7EA146678
63 changed files with 211 additions and 210 deletions

View File

@ -59,7 +59,7 @@ import com.plotsquared.bukkit.uuid.OfflinePlayerUUIDService;
import com.plotsquared.bukkit.uuid.PaperUUIDService; import com.plotsquared.bukkit.uuid.PaperUUIDService;
import com.plotsquared.bukkit.uuid.SQLiteUUIDService; import com.plotsquared.bukkit.uuid.SQLiteUUIDService;
import com.plotsquared.bukkit.uuid.SquirrelIdUUIDService; 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.PlotSquared;
import com.plotsquared.core.backup.BackupManager; import com.plotsquared.core.backup.BackupManager;
import com.plotsquared.core.backup.NullBackupManager; 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.PremiumVerification.getUserID;
import static com.plotsquared.core.util.ReflectionUtils.getRefClass; import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain<Player> { public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPlatform<Player> {
private static final int BSTATS_ID = 1404; private static final int BSTATS_ID = 1404;
@Getter private static WorldEdit worldEdit; @Getter private static WorldEdit worldEdit;
@ -214,7 +214,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain<
new PlotSquared(this, "Bukkit"); new PlotSquared(this, "Bukkit");
if (PlotSquared.get().IMP.getServerVersion()[1] < 13) { if (PlotSquared.platform().getServerVersion()[1] < 13) {
System.out.println( System.out.println(
"You can't use this version of PlotSquared on a server less than Minecraft 1.13.2."); "You can't use this version of PlotSquared on a server less than Minecraft 1.13.2.");
System.out System.out
@ -267,7 +267,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain<
final SQLiteUUIDService legacyUUIDService; final SQLiteUUIDService legacyUUIDService;
if (Settings.UUID.LEGACY_DATABASE_SUPPORT && MainUtil 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"); legacyUUIDService = new SQLiteUUIDService("usercache.db");
} else { } else {
legacyUUIDService = null; legacyUUIDService = null;
@ -758,7 +758,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain<
if (currentPlotId != null) { if (currentPlotId != null) {
entity.setMetadata("shulkerPlot", entity.setMetadata("shulkerPlot",
new FixedMetadataValue( 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")) { if (id != null && id.equalsIgnoreCase("single")) {
result = new SingleWorldGenerator(); result = new SingleWorldGenerator();
} else { } else {
result = PlotSquared.get().IMP.getDefaultGenerator(); result = PlotSquared.platform().getDefaultGenerator();
if (!PlotSquared.get().setupPlotWorld(worldName, id, result)) { if (!PlotSquared.get().setupPlotWorld(worldName, id, result)) {
return null; return null;
} }
@ -983,7 +983,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain<
} }
return new BukkitPlotGenerator(world, gen); return new BukkitPlotGenerator(world, gen);
} else { } 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); return BukkitUtil.getPlayer((OfflinePlayer) player);
} }
if (player instanceof String) { if (player instanceof String) {
return (PlotPlayer<Player>) PlotSquared.imp().getPlayerManager() return (PlotPlayer<Player>) PlotSquared.platform().getPlayerManager()
.getPlayerIfExists((String) player); .getPlayerIfExists((String) player);
} }
if (player instanceof UUID) { if (player instanceof UUID) {
return (PlotPlayer<Player>) PlotSquared.imp().getPlayerManager() return (PlotPlayer<Player>) PlotSquared.platform().getPlayerManager()
.getPlayerIfExists((UUID) player); .getPlayerIfExists((UUID) player);
} }
return null; return null;

View File

@ -25,7 +25,7 @@
*/ */
package com.plotsquared.bukkit.entity; package com.plotsquared.bukkit.entity;
import com.plotsquared.bukkit.BukkitMain; import com.plotsquared.bukkit.BukkitPlatform;
import org.bukkit.Chunk; import org.bukkit.Chunk;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.World; import org.bukkit.World;
@ -53,7 +53,7 @@ public class TeleportEntityWrapper extends EntityWrapper {
getEntity().setInvulnerable(invulnerableOld); getEntity().setInvulnerable(invulnerableOld);
getEntity().setFireTicks(fireTicksOld); getEntity().setFireTicks(fireTicksOld);
getEntity().setTicksLived(livingTicksOld); getEntity().setTicksLived(livingTicksOld);
getEntity().removeMetadata("ps-tmp-teleport", BukkitMain.getPlugin(BukkitMain.class)); getEntity().removeMetadata("ps-tmp-teleport", BukkitPlatform.getPlugin(BukkitPlatform.class));
} }
return getEntity(); return getEntity();
} }
@ -78,7 +78,7 @@ public class TeleportEntityWrapper extends EntityWrapper {
this.fireTicksOld = this.getEntity().getFireTicks(); this.fireTicksOld = this.getEntity().getFireTicks();
this.livingTicksOld = this.getEntity().getTicksLived(); this.livingTicksOld = this.getEntity().getTicksLived();
this.getEntity().setMetadata("ps-tmp-teleport", this.getEntity().setMetadata("ps-tmp-teleport",
new FixedMetadataValue(BukkitMain.getPlugin(BukkitMain.class), oldLocation)); new FixedMetadataValue(BukkitPlatform.getPlugin(BukkitPlatform.class), oldLocation));
final Chunk newChunk = getNewChunk(); final Chunk newChunk = getNewChunk();
this.getEntity().teleport( this.getEntity().teleport(
new Location(newChunk.getWorld(), newChunk.getX() << 4, 5000, newChunk.getZ() << 4)); new Location(newChunk.getWorld(), newChunk.getX() << 4, 5000, newChunk.getZ() << 4));

View File

@ -61,7 +61,7 @@ final class DelegatePlotGenerator extends IndependentPlotGenerator {
} }
@Override public PlotArea getNewPlotArea(String world, String id, PlotId min, PlotId max) { @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) { @Override public void generateChunk(final ScopedLocalBlockQueue result, PlotArea settings) {

View File

@ -73,7 +73,7 @@ public class ChunkListener implements Listener {
this.mustSave = classChunk.getField("mustSave"); this.mustSave = classChunk.getField("mustSave");
this.methodGetHandleChunk = classCraftChunk.getMethod("getHandle"); this.methodGetHandleChunk = classCraftChunk.getMethod("getHandle");
} catch (Throwable ignored) { } catch (Throwable ignored) {
PlotSquared.debug(PlotSquared.get().IMP.getPluginName() PlotSquared.debug(PlotSquared.platform().getPluginName()
+ "/Server not compatible for chunk processor trim/gc"); + "/Server not compatible for chunk processor trim/gc");
Settings.Chunk_Processor.AUTO_TRIM = false; Settings.Chunk_Processor.AUTO_TRIM = false;

View File

@ -92,7 +92,7 @@ public class EntitySpawnListener implements Listener {
if (meta.isEmpty()) { if (meta.isEmpty()) {
if (PlotSquared.get().hasPlotArea(world.getName())) { if (PlotSquared.get().hasPlotArea(world.getName())) {
entity.setMetadata(KEY, entity.setMetadata(KEY,
new FixedMetadataValue((Plugin) PlotSquared.get().IMP, entity.getLocation())); new FixedMetadataValue((Plugin) PlotSquared.platform(), entity.getLocation()));
} }
} else { } else {
org.bukkit.Location origin = (org.bukkit.Location) meta.get(0).value(); org.bukkit.Location origin = (org.bukkit.Location) meta.get(0).value();
@ -161,7 +161,7 @@ public class EntitySpawnListener implements Listener {
case SHULKER: case SHULKER:
if (!entity.hasMetadata("shulkerPlot")) { if (!entity.hasMetadata("shulkerPlot")) {
entity.setMetadata("shulkerPlot", entity.setMetadata("shulkerPlot",
new FixedMetadataValue((Plugin) PlotSquared.get().IMP, plot.getId())); new FixedMetadataValue((Plugin) PlotSquared.platform(), plot.getId()));
} }
} }
} }

View File

@ -253,7 +253,7 @@ public class PlayerEvents extends PlotListener implements Listener {
int z = bloc.getBlockZ(); int z = bloc.getBlockZ();
int distance = Bukkit.getViewDistance() * 16; 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(); Location location = player.getLocation();
if (location.getWorld().equals(world)) { if (location.getWorld().equals(world)) {
if (16 * Math.abs(location.getX() - x) / 16 > distance if (16 * Math.abs(location.getX() - x) / 16 > distance
@ -355,18 +355,18 @@ public class PlayerEvents extends PlotListener implements Listener {
if (plot.isMerged()) { if (plot.isMerged()) {
disable = true; disable = true;
for (UUID owner : plot.getOwners()) { for (UUID owner : plot.getOwners()) {
if (PlotSquared.imp().getPlayerManager().getPlayerIfExists(owner) != null) { if (PlotSquared.platform().getPlayerManager().getPlayerIfExists(owner) != null) {
disable = false; disable = false;
break; break;
} }
} }
} else { } else {
disable = PlotSquared.imp().getPlayerManager().getPlayerIfExists(plot.getOwnerAbs()) == null; disable = PlotSquared.platform().getPlayerManager().getPlayerIfExists(plot.getOwnerAbs()) == null;
} }
} }
if (disable) { if (disable) {
for (UUID trusted : plot.getTrusted()) { for (UUID trusted : plot.getTrusted()) {
if (PlotSquared.imp().getPlayerManager().getPlayerIfExists(trusted) != null) { if (PlotSquared.platform().getPlayerManager().getPlayerIfExists(trusted) != null) {
disable = false; disable = false;
break; break;
} }
@ -379,7 +379,7 @@ public class PlayerEvents extends PlotListener implements Listener {
} }
} }
if (Settings.Redstone.DISABLE_UNOCCUPIED) { 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())) { if (plot.equals(player.getCurrentPlot())) {
return; return;
} }
@ -794,7 +794,7 @@ public class PlayerEvents extends PlotListener implements Listener {
} }
} else if (toPlot != null) { } else if (toPlot != null) {
vehicle.setMetadata("plot", 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<Player> recipients = event.getRecipients(); Set<Player> recipients = event.getRecipients();
recipients.clear(); recipients.clear();
Set<Player> spies = new HashSet<>(); Set<Player> spies = new HashSet<>();
for (final PlotPlayer<?> pp : PlotSquared.imp().getPlayerManager().getPlayers()) { for (final PlotPlayer<?> pp : PlotSquared.platform().getPlayerManager().getPlayers()) {
if (pp.getAttribute("chatspy")) { if (pp.getAttribute("chatspy")) {
spies.add(((BukkitPlayer) pp).player); spies.add(((BukkitPlayer) pp).player);
} else { } else {
@ -1092,7 +1092,7 @@ public class PlayerEvents extends PlotListener implements Listener {
.equals(EntityType.MINECART_TNT)) { .equals(EntityType.MINECART_TNT)) {
if (!near.hasMetadata("plot")) { if (!near.hasMetadata("plot")) {
near.setMetadata("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) { } else if (event.getTo() == Material.AIR) {
event.getEntity() 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) { if (Settings.Enabled_Components.KILL_ROAD_VEHICLES) {
entity entity
.setMetadata("plot", new FixedMetadataValue((Plugin) PlotSquared.get().IMP, plot)); .setMetadata("plot", new FixedMetadataValue((Plugin) PlotSquared.platform(), plot));
} }
} }

View File

@ -65,7 +65,7 @@ public class Placeholders extends PlaceholderExpansion {
} }
@Override public String onPlaceholderRequest(Player p, String identifier) { @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) { if (pl == null) {
return ""; return "";

View File

@ -143,7 +143,7 @@ public class BukkitPlayer extends PlotPlayer<Player> {
private void callEvent(@NotNull final Event event) { private void callEvent(@NotNull final Event event) {
final RegisteredListener[] listeners = event.getHandlers().getRegisteredListeners(); final RegisteredListener[] listeners = event.getHandlers().getRegisteredListeners();
for (final RegisteredListener listener : listeners) { for (final RegisteredListener listener : listeners) {
if (listener.getPlugin().getName().equals(PlotSquared.imp().getPluginName())) { if (listener.getPlugin().getName().equals(PlotSquared.platform().getPluginName())) {
continue; continue;
} }
try { try {

View File

@ -83,8 +83,8 @@ public class BukkitEconHandler extends EconHandler {
* @deprecated Use {@link PermHandler#hasPermission(String, String, String)} instead * @deprecated Use {@link PermHandler#hasPermission(String, String, String)} instead
*/ */
@Deprecated @Override public boolean hasPermission(String world, String player, String perm) { @Deprecated @Override public boolean hasPermission(String world, String player, String perm) {
if (PlotSquared.imp().getPermissionHandler() != null) { if (PlotSquared.platform().getPermissionHandler() != null) {
return PlotSquared.imp().getPermissionHandler().hasPermission(world, player, perm); return PlotSquared.platform().getPermissionHandler().hasPermission(world, player, perm);
} else { } else {
return false; return false;
} }

View File

@ -25,7 +25,7 @@
*/ */
package com.plotsquared.bukkit.util; package com.plotsquared.bukkit.util;
import com.plotsquared.bukkit.BukkitMain; import com.plotsquared.bukkit.BukkitPlatform;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.generator.AugmentedUtils; import com.plotsquared.core.generator.AugmentedUtils;
import com.plotsquared.core.location.Location; 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." PlotSquared.debug("Attempting to make an asynchronous call to getLoadedChunks."
+ " Will halt the calling thread until completed."); + " Will halt the calling thread until completed.");
semaphore.acquire(); semaphore.acquire();
Bukkit.getScheduler().runTask(BukkitMain.getPlugin(BukkitMain.class), () -> { Bukkit.getScheduler().runTask(BukkitPlatform.getPlugin(BukkitPlatform.class), () -> {
for (Chunk chunk : Objects.requireNonNull(Bukkit.getWorld(world)) for (Chunk chunk : Objects.requireNonNull(Bukkit.getWorld(world))
.getLoadedChunks()) { .getLoadedChunks()) {
BlockVector2 loc = BlockVector2.at(chunk.getX() >> 5, chunk.getZ() >> 5); BlockVector2 loc = BlockVector2.at(chunk.getX() >> 5, chunk.getZ() >> 5);

View File

@ -200,7 +200,7 @@ public class BukkitSetupUtils extends SetupUtils {
e.printStackTrace(); e.printStackTrace();
} }
Objects.requireNonNull(PlotSquared.imp()).getWorldManager() Objects.requireNonNull(PlotSquared.platform()).getWorldManager()
.handleWorldCreation(object.world, object.setupGenerator); .handleWorldCreation(object.world, object.setupGenerator);
if (Bukkit.getWorld(world) != null) { if (Bukkit.getWorld(world) != null) {
@ -313,7 +313,7 @@ public class BukkitSetupUtils extends SetupUtils {
e.printStackTrace(); e.printStackTrace();
} }
Objects.requireNonNull(PlotSquared.imp()).getWorldManager() Objects.requireNonNull(PlotSquared.platform()).getWorldManager()
.handleWorldCreation(builder.worldName(), builder.generatorName()); .handleWorldCreation(builder.worldName(), builder.generatorName());
if (Bukkit.getWorld(world) != null) { if (Bukkit.getWorld(world) != null) {

View File

@ -25,15 +25,15 @@
*/ */
package com.plotsquared.bukkit.util; package com.plotsquared.bukkit.util;
import com.plotsquared.bukkit.BukkitMain; import com.plotsquared.bukkit.BukkitPlatform;
import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.task.TaskManager;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
public class BukkitTaskManager extends TaskManager { public class BukkitTaskManager extends TaskManager {
private final BukkitMain bukkitMain; private final BukkitPlatform bukkitMain;
public BukkitTaskManager(BukkitMain bukkitMain) { public BukkitTaskManager(BukkitPlatform bukkitMain) {
this.bukkitMain = bukkitMain; this.bukkitMain = bukkitMain;
} }

View File

@ -25,7 +25,7 @@
*/ */
package com.plotsquared.bukkit.util; 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.BukkitPlayer;
import com.plotsquared.bukkit.player.BukkitPlayerManager; import com.plotsquared.bukkit.player.BukkitPlayerManager;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
@ -120,7 +120,7 @@ public class BukkitUtil extends WorldUtil {
lastPlayer = null; lastPlayer = null;
lastPlotPlayer = null; lastPlotPlayer = null;
// Make sure that it's removed internally // Make sure that it's removed internally
PlotSquared.imp().getPlayerManager().removePlayer(uuid); PlotSquared.platform().getPlayerManager().removePlayer(uuid);
} }
public static PlotPlayer<Player> getPlayer(@NonNull final OfflinePlayer op) { public static PlotPlayer<Player> getPlayer(@NonNull final OfflinePlayer op) {
@ -271,7 +271,7 @@ public class BukkitUtil extends WorldUtil {
if (player == lastPlayer) { if (player == lastPlayer) {
return lastPlotPlayer; return lastPlotPlayer;
} }
final PlayerManager<?, ?> playerManager = PlotSquared.imp().getPlayerManager(); final PlayerManager<?, ?> playerManager = PlotSquared.platform().getPlayerManager();
return ((BukkitPlayerManager) playerManager).getPlayer(player); return ((BukkitPlayerManager) playerManager).getPlayer(player);
} }
@ -458,7 +458,7 @@ public class BukkitUtil extends WorldUtil {
} else if (world.getBlockAt(x, y, z - 1).getType().isSolid()) { } else if (world.getBlockAt(x, y, z - 1).getType().isSolid()) {
facing = BlockFace.SOUTH; facing = BlockFace.SOUTH;
} }
if (PlotSquared.get().IMP.getServerVersion()[1] == 13) { if (PlotSquared.platform().getServerVersion()[1] == 13) {
block.setType(Material.valueOf("WALL_SIGN"), false); block.setType(Material.valueOf("WALL_SIGN"), false);
} else { } else {
block.setType(Material.valueOf("OAK_WALL_SIGN"), false); block.setType(Material.valueOf("OAK_WALL_SIGN"), false);
@ -688,7 +688,7 @@ public class BukkitUtil extends WorldUtil {
consumer.accept(value); consumer.accept(value);
} else { } else {
Bukkit.getScheduler() Bukkit.getScheduler()
.runTask(BukkitMain.getPlugin(BukkitMain.class), () -> consumer.accept(value)); .runTask(BukkitPlatform.getPlugin(BukkitPlatform.class), () -> consumer.accept(value));
} }
} }

View File

@ -72,6 +72,6 @@ public class SetGenCB {
.removeIf(blockPopulator -> blockPopulator instanceof BukkitAugmentedGenerator); .removeIf(blockPopulator -> blockPopulator instanceof BukkitAugmentedGenerator);
} }
PlotSquared.get() PlotSquared.get()
.loadWorld(world.getName(), PlotSquared.get().IMP.getGenerator(world.getName(), null)); .loadWorld(world.getName(), PlotSquared.platform().getGenerator(world.getName(), null));
} }
} }

View File

@ -51,7 +51,7 @@ public class SQLiteUUIDService implements UUIDService, Consumer<List<UUIDMapping
public SQLiteUUIDService(final String fileName) { public SQLiteUUIDService(final String fileName) {
this.sqlite = this.sqlite =
new SQLite(MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), fileName)); new SQLite(MainUtil.getFile(PlotSquared.platform().getDirectory(), fileName));
try { try {
this.sqlite.openConnection(); this.sqlite.openConnection();
} catch (ClassNotFoundException | SQLException e) { } catch (ClassNotFoundException | SQLException e) {

View File

@ -1,5 +1,5 @@
name: ${name} name: ${name}
main: com.plotsquared.bukkit.BukkitMain main: com.plotsquared.bukkit.BukkitPlatform
api-version: "1.13" api-version: "1.13"
version: "${version}" version: "${version}"
load: STARTUP load: STARTUP

View File

@ -57,7 +57,7 @@ import java.util.Map;
* *
* @param <P> Player type * @param <P> Player type
*/ */
public interface IPlotMain<P> extends ILogger { public interface PlotPlatform<P> extends ILogger {
/** /**
* Logs a message to console. * Logs a message to console.

View File

@ -137,11 +137,13 @@ import java.util.zip.ZipInputStream;
* An implementation of the core, with a static getter for easy access. * An implementation of the core, with a static getter for easy access.
*/ */
@SuppressWarnings({"unused", "WeakerAccess"}) @SuppressWarnings({"unused", "WeakerAccess"})
public class PlotSquared { public class PlotSquared<P> {
private static final Set<Plot> EMPTY_SET = Collections.unmodifiableSet(Collections.emptySet()); private static final Set<Plot> EMPTY_SET = Collections.unmodifiableSet(Collections.emptySet());
private static PlotSquared instance; private static PlotSquared<?> instance;
// Implementation // Implementation
public final IPlotMain<?> IMP; private final PlotPlatform<P> platform;
// Current thread // Current thread
private final Thread thread; private final Thread thread;
// UUID pipelines // UUID pipelines
@ -177,17 +179,17 @@ public class PlotSquared {
/** /**
* Initialize PlotSquared with the desired Implementation class. * 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 * @param platform The platform being used
*/ */
public PlotSquared(final IPlotMain iPlotMain, final String platform) { public PlotSquared(final PlotPlatform<P> iPlotMain, final String platform) {
if (instance != null) { if (instance != null) {
throw new IllegalStateException("Cannot re-initialize the PlotSquared singleton"); throw new IllegalStateException("Cannot re-initialize the PlotSquared singleton");
} }
instance = this; instance = this;
this.thread = Thread.currentThread(); this.thread = Thread.currentThread();
this.IMP = iPlotMain; this.platform = iPlotMain;
this.logger = iPlotMain; this.logger = iPlotMain;
Settings.PLATFORM = platform; Settings.PLATFORM = platform;
@ -197,7 +199,7 @@ public class PlotSquared {
ConfigurationSerialization.registerClass(BlockBucket.class, "BlockBucket"); ConfigurationSerialization.registerClass(BlockBucket.class, "BlockBucket");
try { try {
new ReflectionUtils(this.IMP.getNMSPackage()); new ReflectionUtils(this.platform.getNMSPackage());
try { try {
URL url = PlotSquared.class.getProtectionDomain().getCodeSource().getLocation(); URL url = PlotSquared.class.getProtectionDomain().getCodeSource().getLocation();
this.jarFile = new File( this.jarFile = new File(
@ -205,22 +207,22 @@ public class PlotSquared {
.toURI().getPath()); .toURI().getPath());
} catch (MalformedURLException | URISyntaxException | SecurityException e) { } catch (MalformedURLException | URISyntaxException | SecurityException e) {
e.printStackTrace(); 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()) { if (!this.jarFile.exists()) {
this.jarFile = new File(this.IMP.getDirectory().getParentFile(), this.jarFile = new File(this.platform.getDirectory().getParentFile(),
"PlotSquared-" + platform + ".jar"); "PlotSquared-" + platform + ".jar");
} }
} }
TaskManager.IMP = this.IMP.getTaskManager(); TaskManager.IMP = this.platform.getTaskManager();
// World Util. Has to be done before config files are loaded // World Util. Has to be done before config files are loaded
WorldUtil.IMP = this.IMP.initWorldUtil(); WorldUtil.IMP = this.platform.initWorldUtil();
if (!setupConfigs()) { if (!setupConfigs()) {
return; return;
} }
this.translationFile = MainUtil.getFile(this.IMP.getDirectory(), this.translationFile = MainUtil.getFile(this.platform.getDirectory(),
Settings.Paths.TRANSLATIONS + File.separator + IMP.getPluginName() Settings.Paths.TRANSLATIONS + File.separator + this.platform.getPluginName()
+ ".use_THIS.yml"); + ".use_THIS.yml");
Captions.load(this.translationFile); Captions.load(this.translationFile);
@ -251,44 +253,44 @@ public class PlotSquared {
// Kill entities // Kill entities
if (Settings.Enabled_Components.KILL_ROAD_MOBS if (Settings.Enabled_Components.KILL_ROAD_MOBS
|| Settings.Enabled_Components.KILL_ROAD_VEHICLES) { || Settings.Enabled_Components.KILL_ROAD_VEHICLES) {
this.IMP.runEntityTask(); this.platform.runEntityTask();
} }
if (Settings.Enabled_Components.EVENTS) { if (Settings.Enabled_Components.EVENTS) {
this.IMP.registerPlayerEvents(); this.platform.registerPlayerEvents();
} }
// Required // Required
this.IMP.registerWorldEvents(); this.platform.registerWorldEvents();
if (Settings.Enabled_Components.CHUNK_PROCESSOR) { if (Settings.Enabled_Components.CHUNK_PROCESSOR) {
this.IMP.registerChunkProcessor(); this.platform.registerChunkProcessor();
} }
// Create Event utility class // Create Event utility class
eventDispatcher = new EventDispatcher(); eventDispatcher = new EventDispatcher();
// create Hybrid utility class // create Hybrid utility class
HybridUtils.manager = this.IMP.initHybridUtils(); HybridUtils.manager = this.platform.initHybridUtils();
// Inventory utility class // Inventory utility class
InventoryUtil.manager = this.IMP.initInventoryUtil(); InventoryUtil.manager = this.platform.initInventoryUtil();
// create setup util class // create setup util class
SetupUtils.manager = this.IMP.initSetupUtils(); SetupUtils.manager = this.platform.initSetupUtils();
// Set block // Set block
GlobalBlockQueue.IMP = GlobalBlockQueue.IMP =
new GlobalBlockQueue(IMP.initBlockQueue(), 1, Settings.QUEUE.TARGET_TIME); new GlobalBlockQueue(this.platform.initBlockQueue(), 1, Settings.QUEUE.TARGET_TIME);
GlobalBlockQueue.IMP.runTask(); GlobalBlockQueue.IMP.runTask();
// Set chunk // Set chunk
ChunkManager.manager = this.IMP.initChunkManager(); ChunkManager.manager = this.platform.initChunkManager();
RegionManager.manager = this.IMP.initRegionManager(); RegionManager.manager = this.platform.initRegionManager();
// Schematic handler // Schematic handler
SchematicHandler.manager = this.IMP.initSchematicHandler(); SchematicHandler.manager = this.platform.initSchematicHandler();
// Chat // Chat
ChatManager.manager = this.IMP.initChatManager(); ChatManager.manager = this.platform.initChatManager();
// Commands // Commands
if (Settings.Enabled_Components.COMMANDS) { if (Settings.Enabled_Components.COMMANDS) {
this.IMP.registerCommands(); this.platform.registerCommands();
} }
// WorldEdit // WorldEdit
if (Settings.Enabled_Components.WORLDEDIT_RESTRICTIONS) { if (Settings.Enabled_Components.WORLDEDIT_RESTRICTIONS) {
try { try {
if (this.IMP.initWorldEdit()) { if (this.platform.initWorldEdit()) {
PlotSquared.log(Captions.PREFIX.getTranslated() + "&6" + IMP.getPluginName() PlotSquared.log(Captions.PREFIX.getTranslated() + "&6" + this.platform.getPluginName()
+ " hooked into WorldEdit."); + " hooked into WorldEdit.");
this.worldedit = WorldEdit.getInstance(); this.worldedit = WorldEdit.getInstance();
WorldEdit.getInstance().getEventBus().register(new WESubscriber()); WorldEdit.getInstance().getEventBus().register(new WESubscriber());
@ -324,7 +326,7 @@ public class PlotSquared {
continue; continue;
} }
if (WorldUtil.IMP.isWorld(world)) { if (WorldUtil.IMP.isWorld(world)) {
this.IMP.setGenerator(world); this.platform.setGenerator(world);
} }
} }
TaskManager.runTaskLater(() -> { TaskManager.runTaskLater(() -> {
@ -333,7 +335,7 @@ public class PlotSquared {
continue; continue;
} }
if (!WorldUtil.IMP.isWorld(world) && !world.equals("*")) { 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: "); + " will now try to load it properly: ");
debug( debug(
" - Are you trying to delete this world? Remember to remove it from the worlds.yml, bukkit.yml and multiverse worlds.yml"); " - 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)"); " - Your world management plugin may be faulty (or non existent)");
debug( debug(
" This message may also be a false positive and could be ignored."); " This message may also be a false positive and could be ignored.");
PlotSquared.this.IMP.setGenerator(world); PlotSquared.this.platform.setGenerator(world);
} }
} }
}, 1); }, 1);
@ -373,7 +375,7 @@ public class PlotSquared {
PlotSquared.log(Captions.PREFIX + CaptionUtility PlotSquared.log(Captions.PREFIX + CaptionUtility
.format(ConsolePlayer.getConsole(), Captions.ENABLED.getTranslated(), .format(ConsolePlayer.getConsole(), Captions.ENABLED.getTranslated(),
IMP.getPluginName())); this.platform.getPluginName()));
} }
/** /**
@ -381,13 +383,13 @@ public class PlotSquared {
* *
* @return instance of PlotSquared * @return instance of PlotSquared
*/ */
public static PlotSquared get() { public static PlotSquared<?> get() {
return PlotSquared.instance; return PlotSquared.instance;
} }
@NotNull public static IPlotMain<?> imp() { @NotNull public static PlotPlatform<?> platform() {
if (instance != null && instance.IMP != null) { if (instance != null && instance.platform != null) {
return instance.IMP; return instance.platform;
} }
throw new IllegalStateException("Plot main implementation is missing"); throw new IllegalStateException("Plot main implementation is missing");
} }
@ -396,7 +398,7 @@ public class PlotSquared {
* Log a message to the IPlotMain logger. * Log a message to the IPlotMain logger.
* *
* @param message Message to log * @param message Message to log
* @see IPlotMain#log(String) * @see PlotPlatform#log(String)
*/ */
public static void log(Object message) { public static void log(Object message) {
if (message == null || (message instanceof Caption ? if (message == null || (message instanceof Caption ?
@ -415,7 +417,7 @@ public class PlotSquared {
* Log a message to the IPlotMain logger. * Log a message to the IPlotMain logger.
* *
* @param message Message to log * @param message Message to log
* @see IPlotMain#log(String) * @see PlotPlatform#log(String)
*/ */
public static void debug(@Nullable Object message) { public static void debug(@Nullable Object message) {
if (Settings.DEBUG) { if (Settings.DEBUG) {
@ -539,7 +541,7 @@ public class PlotSquared {
return; return;
} }
File file = new File( 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()); + "_" + plotArea.getWorldName());
if (!file.exists()) { if (!file.exists()) {
return; return;
@ -1137,13 +1139,13 @@ public class PlotSquared {
} else if (worldSection != null) { } else if (worldSection != null) {
String secondaryGeneratorName = worldSection.getString("generator.plugin"); String secondaryGeneratorName = worldSection.getString("generator.plugin");
GeneratorWrapper<?> secondaryGenerator = GeneratorWrapper<?> secondaryGenerator =
this.IMP.getGenerator(world, secondaryGeneratorName); this.platform.getGenerator(world, secondaryGeneratorName);
if (secondaryGenerator != null && secondaryGenerator.isFull()) { if (secondaryGenerator != null && secondaryGenerator.isFull()) {
plotGenerator = secondaryGenerator.getPlotGenerator(); plotGenerator = secondaryGenerator.getPlotGenerator();
} else { } else {
String primaryGeneratorName = worldSection.getString("generator.init"); String primaryGeneratorName = worldSection.getString("generator.init");
GeneratorWrapper<?> primaryGenerator = GeneratorWrapper<?> primaryGenerator =
this.IMP.getGenerator(world, primaryGeneratorName); this.platform.getGenerator(world, primaryGeneratorName);
if (primaryGenerator != null && primaryGenerator.isFull()) { if (primaryGenerator != null && primaryGenerator.isFull()) {
plotGenerator = primaryGenerator.getPlotGenerator(); plotGenerator = primaryGenerator.getPlotGenerator();
} else { } else {
@ -1187,7 +1189,7 @@ public class PlotSquared {
return; return;
} }
PlotSquared.log(Captions.PREFIX + "&aDetected world load for '" + world + "'"); 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) { if (type == PlotAreaType.PARTIAL) {
Set<PlotCluster> clusters = Set<PlotCluster> clusters =
this.clusters_tmp != null ? this.clusters_tmp.get(world) : new HashSet<>(); 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 DBFunc.replaceWorld(world, world + ";" + name, pos1, pos2); // NPE
PlotSquared.log(Captions.PREFIX + "&3 - " + name + "-" + pos1 + "-" + pos2); 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) { if (areaGen == null) {
throw new IllegalArgumentException("Invalid Generator: " + gen_string); throw new IllegalArgumentException("Invalid Generator: " + gen_string);
} }
@ -1234,7 +1236,7 @@ public class PlotSquared {
} }
return; return;
} }
GeneratorWrapper<?> areaGen = this.IMP.getGenerator(world, gen_string); GeneratorWrapper<?> areaGen = this.platform.getGenerator(world, gen_string);
if (areaGen == null) { if (areaGen == null) {
throw new IllegalArgumentException("Invalid Generator: " + gen_string); throw new IllegalArgumentException("Invalid Generator: " + gen_string);
} }
@ -1296,8 +1298,8 @@ public class PlotSquared {
clone.set(key, worldSection.get(key)); clone.set(key, worldSection.get(key));
} }
} }
String gen_string = clone.getString("generator.plugin", IMP.getPluginName()); String gen_string = clone.getString("generator.plugin", platform.getPluginName());
GeneratorWrapper<?> areaGen = this.IMP.getGenerator(world, gen_string); GeneratorWrapper<?> areaGen = this.platform.getGenerator(world, gen_string);
if (areaGen == null) { if (areaGen == null) {
throw new IllegalArgumentException("Invalid Generator: " + gen_string); throw new IllegalArgumentException("Invalid Generator: " + gen_string);
} }
@ -1485,7 +1487,7 @@ public class PlotSquared {
*/ */
public void copyFile(String file, String folder) { public void copyFile(String file, String folder) {
try { try {
File output = this.IMP.getDirectory(); File output = this.platform.getDirectory();
if (!output.exists()) { if (!output.exists()) {
output.mkdirs(); output.mkdirs();
} }
@ -1493,7 +1495,7 @@ public class PlotSquared {
if (newFile.exists()) { if (newFile.exists()) {
return; return;
} }
try (InputStream stream = this.IMP.getClass().getResourceAsStream(file)) { try (InputStream stream = this.platform.getClass().getResourceAsStream(file)) {
byte[] buffer = new byte[2048]; byte[] buffer = new byte[2048];
if (stream == null) { if (stream == null) {
try (ZipInputStream zis = new ZipInputStream( try (ZipInputStream zis = new ZipInputStream(
@ -1593,7 +1595,7 @@ public class PlotSquared {
list.add(chunks); list.add(chunks);
list.add(HybridUtils.height); list.add(HybridUtils.height);
File file = new File( 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()); .getId() + "_" + HybridUtils.area.getWorldName());
if (file.exists() && !file.delete()) { if (file.exists() && !file.delete()) {
PlotSquared.log(Captions.PREFIX PlotSquared.log(Captions.PREFIX
@ -1622,11 +1624,11 @@ public class PlotSquared {
database = new MySQL(Storage.MySQL.HOST, Storage.MySQL.PORT, Storage.MySQL.DATABASE, database = new MySQL(Storage.MySQL.HOST, Storage.MySQL.PORT, Storage.MySQL.DATABASE,
Storage.MySQL.USER, Storage.MySQL.PASSWORD); Storage.MySQL.USER, Storage.MySQL.PASSWORD);
} else if (Storage.SQLite.USE) { } 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); database = new SQLite(file);
} else { } else {
PlotSquared.log(Captions.PREFIX + "&cNo storage type is set!"); 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; return;
} }
DBFunc.dbManager = new SQLManager(database, Storage.PREFIX, false); 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 ==="); "&d==== Here is an ugly stacktrace, if you are interested in those things ===");
e.printStackTrace(); e.printStackTrace();
PlotSquared.log("&d==== End of stacktrace ===="); 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."); + " '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 { try {
worlds.save(worldsFile); worlds.save(worldsFile);
} catch (IOException e) { } catch (IOException e) {
PlotSquared.debug("Failed to save " + IMP.getPluginName() + " worlds.yml"); PlotSquared.debug("Failed to save " + platform.getPluginName() + " worlds.yml");
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -1711,7 +1713,7 @@ public class PlotSquared {
* - Translation: PlotSquared.use_THIS.yml, style.yml<br> * - Translation: PlotSquared.use_THIS.yml, style.yml<br>
*/ */
public boolean setupConfigs() { public boolean setupConfigs() {
File folder = new File(this.IMP.getDirectory(), "config"); File folder = new File(this.platform.getDirectory(), "config");
if (!folder.exists() && !folder.mkdirs()) { if (!folder.exists() && !folder.mkdirs()) {
PlotSquared.log(Captions.PREFIX PlotSquared.log(Captions.PREFIX
+ "&cFailed to create the /plugins/config folder. Please create it manually."); + "&cFailed to create the /plugins/config folder. Please create it manually.");
@ -1747,7 +1749,7 @@ public class PlotSquared {
e.printStackTrace(); e.printStackTrace();
} }
// Disable plugin // Disable plugin
this.IMP.shutdown(); this.platform.shutdown();
return false; return false;
} }
} else { } else {
@ -1768,7 +1770,7 @@ public class PlotSquared {
PlotSquared.log("Failed to save settings.yml"); PlotSquared.log("Failed to save settings.yml");
} }
try { try {
this.styleFile = MainUtil.getFile(IMP.getDirectory(), this.styleFile = MainUtil.getFile(platform.getDirectory(),
Settings.Paths.TRANSLATIONS + File.separator + "style.yml"); Settings.Paths.TRANSLATIONS + File.separator + "style.yml");
if (!this.styleFile.exists()) { if (!this.styleFile.exists()) {
if (!this.styleFile.getParentFile().exists()) { if (!this.styleFile.getParentFile().exists()) {

View File

@ -46,7 +46,7 @@ public interface BackupManager {
* @param whenDone Action that runs when the automatic backup has been completed * @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) { 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);
} }
/** /**

View File

@ -49,7 +49,7 @@ public class NullBackupManager implements BackupManager {
} }
@Override @NotNull public Path getBackupPath() { @Override @NotNull public Path getBackupPath() {
return Objects.requireNonNull(PlotSquared.imp()).getDirectory().toPath(); return Objects.requireNonNull(PlotSquared.platform()).getDirectory().toPath();
} }
@Override public int getBackupLimit() { @Override public int getBackupLimit() {

View File

@ -57,7 +57,7 @@ import java.util.concurrent.TimeUnit;
.expireAfterAccess(3, TimeUnit.MINUTES).build(); .expireAfterAccess(3, TimeUnit.MINUTES).build();
public SimpleBackupManager() throws Exception { 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)) { if (!Files.exists(backupPath)) {
Files.createDirectory(backupPath); Files.createDirectory(backupPath);
} }

View File

@ -138,7 +138,7 @@ public class Area extends SubCommand {
// There's only one plot in the area... // There's only one plot in the area...
final PlotId plotId = new PlotId(1, 1); final PlotId plotId = new PlotId(1, 1);
final HybridPlotWorld hybridPlotWorld = new HybridPlotWorld(player.getLocation().getWorld(), args[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 // Plot size is the same as the region width
hybridPlotWorld.PLOT_WIDTH = hybridPlotWorld.SIZE = (short) selectedRegion.getWidth(); hybridPlotWorld.PLOT_WIDTH = hybridPlotWorld.SIZE = (short) selectedRegion.getWidth();
// We use a schematic generator // 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(); hybridPlotWorld.PLOT_HEIGHT = hybridPlotWorld.ROAD_HEIGHT = hybridPlotWorld.WALL_HEIGHT = playerSelectionMin.getBlockY();
// No sign plz // No sign plz
hybridPlotWorld.setAllowSigns(false); 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 + "GEN_ROAD_SCHEMATIC" + File.separator + hybridPlotWorld.getWorldName() + File.separator +
hybridPlotWorld.getId()); hybridPlotWorld.getId());
if (!parentFile.exists() && !parentFile.mkdirs()) { if (!parentFile.exists() && !parentFile.mkdirs()) {
@ -187,8 +187,8 @@ public class Area extends SubCommand {
// Now the schematic is saved, which is wonderful! // Now the schematic is saved, which is wonderful!
PlotAreaBuilder singleBuilder = PlotAreaBuilder.ofPlotArea(hybridPlotWorld) PlotAreaBuilder singleBuilder = PlotAreaBuilder.ofPlotArea(hybridPlotWorld)
.plotManager(PlotSquared.imp().getPluginName()) .plotManager(PlotSquared.platform().getPluginName())
.generatorName(PlotSquared.imp().getPluginName()) .generatorName(PlotSquared.platform().getPluginName())
.maximumId(plotId) .maximumId(plotId)
.minimumId(plotId); .minimumId(plotId);
Runnable singleRun = () -> { Runnable singleRun = () -> {
@ -282,8 +282,8 @@ public class Area extends SubCommand {
return false; return false;
} }
PlotAreaBuilder builder = PlotAreaBuilder.ofPlotArea(area) PlotAreaBuilder builder = PlotAreaBuilder.ofPlotArea(area)
.plotManager(PlotSquared.imp().getPluginName()) .plotManager(PlotSquared.platform().getPluginName())
.generatorName(PlotSquared.imp().getPluginName()) .generatorName(PlotSquared.platform().getPluginName())
.minimumId(new PlotId(1, 1)) .minimumId(new PlotId(1, 1))
.maximumId(new PlotId(numX, numZ)); .maximumId(new PlotId(numX, numZ));
final String path = final String path =
@ -339,7 +339,7 @@ public class Area extends SubCommand {
PlotAreaBuilder builder = new PlotAreaBuilder(); PlotAreaBuilder builder = new PlotAreaBuilder();
builder.worldName(split[0]); builder.worldName(split[0]);
final HybridPlotWorld pa = new HybridPlotWorld(builder.worldName(), id, 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); PlotArea other = PlotSquared.get().getPlotArea(pa.getWorldName(), id);
if (other != null && Objects.equals(pa.getId(), other.getId())) { if (other != null && Objects.equals(pa.getId(), other.getId())) {
Captions.SETUP_WORLD_TAKEN.send(player, pa.toString()); Captions.SETUP_WORLD_TAKEN.send(player, pa.toString());
@ -428,8 +428,8 @@ public class Area extends SubCommand {
PlotSquared.get().worlds.getConfigurationSection(path); PlotSquared.get().worlds.getConfigurationSection(path);
pa.saveConfiguration(section); pa.saveConfiguration(section);
pa.loadConfiguration(section); pa.loadConfiguration(section);
builder.plotManager(PlotSquared.imp().getPluginName()); builder.plotManager(PlotSquared.platform().getPluginName());
builder.generatorName(PlotSquared.imp().getPluginName()); builder.generatorName(PlotSquared.platform().getPluginName());
String world = SetupUtils.manager.setupWorld(builder); String world = SetupUtils.manager.setupWorld(builder);
if (WorldUtil.IMP.isWorld(world)) { if (WorldUtil.IMP.isWorld(world)) {
Captions.SETUP_FINISHED.send(player); Captions.SETUP_FINISHED.send(player);
@ -661,7 +661,7 @@ public class Area extends SubCommand {
case "remove": case "remove":
MainUtil.sendMessage(player, MainUtil.sendMessage(player,
"$1World creation settings may be stored in multiple locations:" "$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" .getPluginName() + " settings.yml"
+ "\n$3 - $2Multiverse worlds.yml (or any world management plugin)" + "\n$3 - $2Multiverse worlds.yml (or any world management plugin)"
+ "\n$1Stop the server and delete it from these locations."); + "\n$1Stop the server and delete it from these locations.");

View File

@ -91,7 +91,7 @@ public final class Backup extends Command {
final Plot plot = player.getCurrentPlot(); final Plot plot = player.getCurrentPlot();
if (plot != null) { if (plot != null) {
final BackupProfile backupProfile = final BackupProfile backupProfile =
Objects.requireNonNull(PlotSquared.imp()).getBackupManager().getProfile(plot); Objects.requireNonNull(PlotSquared.platform()).getBackupManager().getProfile(plot);
if (backupProfile instanceof PlayerBackupProfile) { if (backupProfile instanceof PlayerBackupProfile) {
final CompletableFuture<List<com.plotsquared.core.backup.Backup>> backupList = final CompletableFuture<List<com.plotsquared.core.backup.Backup>> backupList =
backupProfile.listBackups(); backupProfile.listBackups();
@ -136,7 +136,7 @@ public final class Backup extends Command {
sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_ADMIN_BACKUP_OTHER); sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_ADMIN_BACKUP_OTHER);
} else { } else {
final BackupProfile backupProfile = final BackupProfile backupProfile =
Objects.requireNonNull(PlotSquared.imp()).getBackupManager().getProfile(plot); Objects.requireNonNull(PlotSquared.platform()).getBackupManager().getProfile(plot);
if (backupProfile instanceof NullBackupProfile) { if (backupProfile instanceof NullBackupProfile) {
sendMessage(player, Captions.BACKUP_IMPOSSIBLE, sendMessage(player, Captions.BACKUP_IMPOSSIBLE,
Captions.GENERIC_OTHER.getTranslated()); Captions.GENERIC_OTHER.getTranslated());
@ -176,7 +176,7 @@ public final class Backup extends Command {
sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_ADMIN_BACKUP_OTHER); sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_ADMIN_BACKUP_OTHER);
} else { } else {
final BackupProfile backupProfile = final BackupProfile backupProfile =
Objects.requireNonNull(PlotSquared.imp()).getBackupManager().getProfile(plot); Objects.requireNonNull(PlotSquared.platform()).getBackupManager().getProfile(plot);
if (backupProfile instanceof NullBackupProfile) { if (backupProfile instanceof NullBackupProfile) {
sendMessage(player, Captions.BACKUP_IMPOSSIBLE, sendMessage(player, Captions.BACKUP_IMPOSSIBLE,
Captions.GENERIC_OTHER.getTranslated()); Captions.GENERIC_OTHER.getTranslated());
@ -238,7 +238,7 @@ public final class Backup extends Command {
return; return;
} }
final BackupProfile backupProfile = final BackupProfile backupProfile =
Objects.requireNonNull(PlotSquared.imp()).getBackupManager().getProfile(plot); Objects.requireNonNull(PlotSquared.platform()).getBackupManager().getProfile(plot);
if (backupProfile instanceof NullBackupProfile) { if (backupProfile instanceof NullBackupProfile) {
sendMessage(player, Captions.BACKUP_IMPOSSIBLE, sendMessage(player, Captions.BACKUP_IMPOSSIBLE,
Captions.GENERIC_OTHER.getTranslated()); Captions.GENERIC_OTHER.getTranslated());

View File

@ -82,9 +82,9 @@ public class Buy extends Command {
confirm.run(this, () -> { confirm.run(this, () -> {
Captions.REMOVED_BALANCE.send(player, price); 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) { if (owner != null) {
Captions.PLOT_SOLD.send(owner, plot.getId(), player.getName(), price); Captions.PLOT_SOLD.send(owner, plot.getId(), player.getName(), price);
} }

View File

@ -385,7 +385,7 @@ public class Cluster extends SubCommand {
DBFunc.setInvited(cluster, uuid); DBFunc.setInvited(cluster, uuid);
final PlotPlayer otherPlayer = final PlotPlayer otherPlayer =
PlotSquared.imp().getPlayerManager().getPlayerIfExists(uuid); PlotSquared.platform().getPlayerManager().getPlayerIfExists(uuid);
if (otherPlayer != null) { if (otherPlayer != null) {
MainUtil.sendMessage(otherPlayer, Captions.CLUSTER_INVITED, MainUtil.sendMessage(otherPlayer, Captions.CLUSTER_INVITED,
cluster.getName()); cluster.getName());
@ -448,7 +448,7 @@ public class Cluster extends SubCommand {
DBFunc.removeInvited(cluster, uuid); DBFunc.removeInvited(cluster, uuid);
final PlotPlayer player2 = final PlotPlayer player2 =
PlotSquared.imp().getPlayerManager().getPlayerIfExists(uuid); PlotSquared.platform().getPlayerManager().getPlayerIfExists(uuid);
if (player2 != null) { if (player2 != null) {
MainUtil.sendMessage(player2, Captions.CLUSTER_REMOVED, MainUtil.sendMessage(player2, Captions.CLUSTER_REMOVED,
cluster.getName()); cluster.getName());

View File

@ -96,7 +96,7 @@ public class Comment extends SubCommand {
return false; return false;
} }
for (final PlotPlayer pp : PlotSquared.imp().getPlayerManager().getPlayers()) { for (final PlotPlayer pp : PlotSquared.platform().getPlayerManager().getPlayers()) {
if (pp.getAttribute("chatspy")) { if (pp.getAttribute("chatspy")) {
MainUtil.sendMessage(pp, "/plot comment " + StringMan.join(args, " ")); MainUtil.sendMessage(pp, "/plot comment " + StringMan.join(args, " "));
} }

View File

@ -102,7 +102,7 @@ public class DatabaseCommand extends SubCommand {
.sendMessage(player, "/plot database import <sqlite file> [prefix]"); .sendMessage(player, "/plot database import <sqlite file> [prefix]");
return false; 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"); args[1].endsWith(".db") ? args[1] : args[1] + ".db");
if (!file.exists()) { if (!file.exists()) {
MainUtil.sendMessage(player, "&6Database does not exist: " + file); MainUtil.sendMessage(player, "&6Database does not exist: " + file);
@ -127,11 +127,11 @@ public class DatabaseCommand extends SubCommand {
PlotId newId = newPlot.getId(); PlotId newId = newPlot.getId();
PlotId id = plot.getId(); PlotId id = plot.getId();
File worldFile = File worldFile =
new File(PlotSquared.imp().getWorldContainer(), new File(PlotSquared.platform().getWorldContainer(),
id.toCommaSeparatedString()); id.toCommaSeparatedString());
if (worldFile.exists()) { if (worldFile.exists()) {
File newFile = File newFile =
new File(PlotSquared.imp().getWorldContainer(), new File(PlotSquared.platform().getWorldContainer(),
newId.toCommaSeparatedString()); newId.toCommaSeparatedString());
worldFile.renameTo(newFile); worldFile.renameTo(newFile);
} }
@ -179,7 +179,7 @@ public class DatabaseCommand extends SubCommand {
return MainUtil.sendMessage(player, "/plot database sqlite [file]"); return MainUtil.sendMessage(player, "/plot database sqlite [file]");
} }
File sqliteFile = File sqliteFile =
MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), args[1] + ".db"); MainUtil.getFile(PlotSquared.platform().getDirectory(), args[1] + ".db");
implementation = new SQLite(sqliteFile); implementation = new SQLite(sqliteFile);
break; break;
default: default:

View File

@ -89,12 +89,12 @@ public class DebugExec extends SubCommand {
/* /*
try { try {
if (PlotSquared.get() != null) { 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"); Settings.Paths.SCRIPTS + File.separator + "start.js");
if (file.exists()) { if (file.exists()) {
init(); init();
String script = StringMan.join(Files.readLines(new File(new File( 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), + Settings.Paths.SCRIPTS), "start.js"), StandardCharsets.UTF_8),
System.getProperty("line.separator")); System.getProperty("line.separator"));
this.scope.put("THIS", this); this.scope.put("THIS", this);
@ -169,7 +169,7 @@ public class DebugExec extends SubCommand {
this.scope.put("EconHandler", EconHandler.getEconHandler()); this.scope.put("EconHandler", EconHandler.getEconHandler());
this.scope.put("DBFunc", DBFunc.dbManager); this.scope.put("DBFunc", DBFunc.dbManager);
this.scope.put("HybridUtils", HybridUtils.manager); 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()); this.scope.put("MainCommand", MainCommand.getInstance());
// enums // enums
@ -306,7 +306,7 @@ public class DebugExec extends SubCommand {
case "addcmd": case "addcmd":
try { try {
final String cmd = StringMan.join(Files.readLines(MainUtil.getFile(new File( 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), + Settings.Paths.SCRIPTS), args[1]), StandardCharsets.UTF_8),
System.getProperty("line.separator")); System.getProperty("line.separator"));
new Command(MainCommand.getInstance(), true, args[1].split("\\.")[0], null, new Command(MainCommand.getInstance(), true, args[1].split("\\.")[0], null,
@ -338,7 +338,7 @@ public class DebugExec extends SubCommand {
case "run": case "run":
try { try {
script = StringMan.join(Files.readLines(MainUtil.getFile(new File( 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), + Settings.Paths.SCRIPTS), args[1]), StandardCharsets.UTF_8),
System.getProperty("line.separator")); System.getProperty("line.separator"));
if (args.length > 2) { if (args.length > 2) {
@ -354,7 +354,7 @@ public class DebugExec extends SubCommand {
} }
break; break;
case "list-scripts": case "list-scripts":
String path = PlotSquared.get().IMP.getDirectory() + File.separator String path = PlotSquared.platform().getDirectory() + File.separator
+ Settings.Paths.SCRIPTS; + Settings.Paths.SCRIPTS;
File folder = new File(path); File folder = new File(path);
File[] filesArray = folder.listFiles(); File[] filesArray = folder.listFiles();

View File

@ -63,7 +63,7 @@ public class DebugImportWorlds extends Command {
} }
SinglePlotArea area = ((SinglePlotAreaManager) pam).getArea(); SinglePlotArea area = ((SinglePlotAreaManager) pam).getArea();
PlotId id = new PlotId(0, 0); PlotId id = new PlotId(0, 0);
File container = PlotSquared.imp().getWorldContainer(); File container = PlotSquared.platform().getWorldContainer();
if (container.equals(new File("."))) { if (container.equals(new File("."))) {
player.sendMessage( player.sendMessage(
"World container must be configured to be a separate directory to your base files!"); "World container must be configured to be a separate directory to your base files!");

View File

@ -87,13 +87,13 @@ public class DebugPaste extends SubCommand {
b.append("This PlotSquared version is licensed to the spigot user ") b.append("This PlotSquared version is licensed to the spigot user ")
.append(PremiumVerification.getUserID()).append("\n\n"); .append(PremiumVerification.getUserID()).append("\n\n");
b.append("# Server Information\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"); .append("\n");
b.append("online_mode: ").append(!Settings.UUID.OFFLINE).append(';') b.append("online_mode: ").append(!Settings.UUID.OFFLINE).append(';')
.append(!Settings.UUID.OFFLINE).append('\n'); .append(!Settings.UUID.OFFLINE).append('\n');
b.append("Plugins:"); b.append("Plugins:");
for (Map.Entry<Map.Entry<String, String>, Boolean> pluginInfo : PlotSquared for (Map.Entry<Map.Entry<String, String>, Boolean> pluginInfo : PlotSquared
.get().IMP.getPluginIds()) { .platform().getPluginIds()) {
Map.Entry<String, String> nameVersion = pluginInfo.getKey(); Map.Entry<String, String> nameVersion = pluginInfo.getKey();
String name = nameVersion.getKey(); String name = nameVersion.getKey();
String version = nameVersion.getValue(); String version = nameVersion.getValue();
@ -129,7 +129,7 @@ public class DebugPaste extends SubCommand {
try { try {
final File logFile = 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) { if (Files.size(logFile.toPath()) > 14_000_000) {
throw new IOException("Too big..."); throw new IOException("Too big...");
} }
@ -161,7 +161,7 @@ public class DebugPaste extends SubCommand {
} }
try { try {
final File MultiverseWorlds = new File(PlotSquared.get().IMP.getDirectory(), final File MultiverseWorlds = new File(PlotSquared.platform().getDirectory(),
"../Multiverse-Core/worlds.yml"); "../Multiverse-Core/worlds.yml");
incendoPaster.addFile(new IncendoPaster.PasteFile("MultiverseCore/worlds.yml", incendoPaster.addFile(new IncendoPaster.PasteFile("MultiverseCore/worlds.yml",
readFile(MultiverseWorlds))); readFile(MultiverseWorlds)));

View File

@ -96,7 +96,7 @@ public class Deny extends SubCommand {
plot.addDenied(uuid); plot.addDenied(uuid);
PlotSquared.get().getEventDispatcher().callDenied(player, plot, uuid, true); PlotSquared.get().getEventDispatcher().callDenied(player, plot, uuid, true);
if (!uuid.equals(DBFunc.EVERYONE)) { if (!uuid.equals(DBFunc.EVERYONE)) {
handleKick(PlotSquared.imp().getPlayerManager().getPlayerIfExists(uuid), plot); handleKick(PlotSquared.platform().getPlayerManager().getPlayerIfExists(uuid), plot);
} else { } else {
for (PlotPlayer plotPlayer : plot.getPlayersInPlot()) { for (PlotPlayer plotPlayer : plot.getPlayersInPlot()) {
// Ignore plot-owners // Ignore plot-owners

View File

@ -99,7 +99,7 @@ public class Grant extends Command {
String key = "grantedPlots"; String key = "grantedPlots";
byte[] rawData = Ints.toByteArray(amount); byte[] rawData = Ints.toByteArray(amount);
PlotPlayer online = PlotSquared.imp().getPlayerManager().getPlayerIfExists(uuid); PlotPlayer online = PlotSquared.platform().getPlayerManager().getPlayerIfExists(uuid);
if (online != null) { if (online != null) {
online.setPersistentMeta(key, rawData); online.setPersistentMeta(key, rawData);
} else { } else {

View File

@ -86,7 +86,7 @@ public class Kick extends SubCommand {
} }
continue; continue;
} }
PlotPlayer<?> pp = PlotSquared.imp().getPlayerManager().getPlayerIfExists(uuid); PlotPlayer<?> pp = PlotSquared.platform().getPlayerManager().getPlayerIfExists(uuid);
if (pp != null) { if (pp != null) {
players.add(pp); players.add(pp);
} }

View File

@ -383,7 +383,7 @@ public class ListCmd extends SubCommand {
final List<UUIDMapping> names = PlotSquared.get().getImpromptuUUIDPipeline() final List<UUIDMapping> names = PlotSquared.get().getImpromptuUUIDPipeline()
.getNames(plot.getOwners()).get(Settings.UUID.BLOCKING_TIMEOUT, TimeUnit.MILLISECONDS); .getNames(plot.getOwners()).get(Settings.UUID.BLOCKING_TIMEOUT, TimeUnit.MILLISECONDS);
for (final UUIDMapping uuidMapping : names) { for (final UUIDMapping uuidMapping : names) {
PlotPlayer pp = PlotSquared.imp().getPlayerManager().getPlayerIfExists(uuidMapping.getUuid()); PlotPlayer pp = PlotSquared.platform().getPlayerManager().getPlayerIfExists(uuidMapping.getUuid());
if (pp != null) { if (pp != null) {
message = message.text(prefix).color("$4").text(uuidMapping.getUsername()).color("$1") message = message.text(prefix).color("$4").text(uuidMapping.getUsername()).color("$1")
.tooltip(new PlotMessage("Online").color("$4")); .tooltip(new PlotMessage("Online").color("$4"));
@ -415,7 +415,7 @@ public class ListCmd extends SubCommand {
completions.add("shared"); completions.add("shared");
} }
if (Permissions.hasPermission(player, Captions.PERMISSION_LIST_WORLD)) { 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)) { if (Permissions.hasPermission(player, Captions.PERMISSION_LIST_TOP)) {
completions.add("top"); completions.add("top");

View File

@ -212,7 +212,7 @@ public class Merge extends SubCommand {
java.util.Set<UUID> uuids = adjacent.getOwners(); java.util.Set<UUID> uuids = adjacent.getOwners();
boolean isOnline = false; boolean isOnline = false;
for (final UUID owner : uuids) { 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) { if (!force && accepter == null) {
continue; continue;
} }
@ -221,7 +221,7 @@ public class Merge extends SubCommand {
Runnable run = () -> { Runnable run = () -> {
MainUtil.sendMessage(accepter, Captions.MERGE_ACCEPTED); MainUtil.sendMessage(accepter, Captions.MERGE_ACCEPTED);
plot.autoMerge(dir, maxSize - size, owner, terrain); 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) { if (plotPlayer == null) {
sendMessage(accepter, Captions.MERGE_NOT_VALID); sendMessage(accepter, Captions.MERGE_NOT_VALID);
return; return;

View File

@ -95,7 +95,7 @@ public class Owner extends SetCommand {
MainUtil.sendMessage(player, Captions.SET_OWNER); MainUtil.sendMessage(player, Captions.SET_OWNER);
return; return;
} }
final PlotPlayer other = PlotSquared.imp().getPlayerManager().getPlayerIfExists(uuid); final PlotPlayer other = PlotSquared.platform().getPlayerManager().getPlayerIfExists(uuid);
if (plot.isOwner(uuid)) { if (plot.isOwner(uuid)) {
Captions.ALREADY_OWNER.send(player, MainUtil.getName(uuid)); Captions.ALREADY_OWNER.send(player, MainUtil.getName(uuid));
return; return;

View File

@ -42,7 +42,7 @@ public class PluginCmd extends SubCommand {
@Override public boolean onCommand(final PlotPlayer<?> player, String[] args) { @Override public boolean onCommand(final PlotPlayer<?> player, String[] args) {
TaskManager.IMP.taskAsync(() -> { TaskManager.IMP.taskAsync(() -> {
MainUtil.sendMessage(player, String.format( 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())); PlotSquared.get().getVersion()));
MainUtil.sendMessage(player, MainUtil.sendMessage(player,
"$2>> $1&lAuthors$2: $1Citymonstret $2& $1Empire92 $2& $1MattBDev $2& $1dordsor21 $2& $1NotMyFault $2& $1SirYwell"); "$2>> $1&lAuthors$2: $1Citymonstret $2& $1Empire92 $2& $1MattBDev $2& $1dordsor21 $2& $1NotMyFault $2& $1SirYwell");

View File

@ -52,7 +52,7 @@ public class Setup extends SubCommand {
StringBuilder message = new StringBuilder(); StringBuilder message = new StringBuilder();
message.append("&6What generator do you want?"); message.append("&6What generator do you want?");
for (Entry<String, GeneratorWrapper<?>> entry : SetupUtils.generators.entrySet()) { for (Entry<String, GeneratorWrapper<?>> 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)"); message.append("\n&8 - &2").append(entry.getKey()).append(" (Default Generator)");
} else if (entry.getValue().isFull()) { } else if (entry.getValue().isFull()) {
message.append("\n&8 - &7").append(entry.getKey()).append(" (Plot Generator)"); message.append("\n&8 - &7").append(entry.getKey()).append(" (Plot Generator)");

View File

@ -64,11 +64,11 @@ public class Template extends SubCommand {
public static boolean extractAllFiles(String world, String template) { public static boolean extractAllFiles(String world, String template) {
try { try {
File folder = File folder =
MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), Settings.Paths.TEMPLATES); MainUtil.getFile(PlotSquared.platform().getDirectory(), Settings.Paths.TEMPLATES);
if (!folder.exists()) { if (!folder.exists()) {
return false; return false;
} }
File output = PlotSquared.get().IMP.getDirectory(); File output = PlotSquared.platform().getDirectory();
if (!output.exists()) { if (!output.exists()) {
output.mkdirs(); output.mkdirs();
} }
@ -120,7 +120,7 @@ public class Template extends SubCommand {
public static void zipAll(String world, Set<FileBytes> files) throws IOException { public static void zipAll(String world, Set<FileBytes> files) throws IOException {
File output = File output =
MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), Settings.Paths.TEMPLATES); MainUtil.getFile(PlotSquared.platform().getDirectory(), Settings.Paths.TEMPLATES);
output.mkdirs(); output.mkdirs();
try (FileOutputStream fos = new FileOutputStream( try (FileOutputStream fos = new FileOutputStream(
output + File.separator + world + ".template"); output + File.separator + world + ".template");
@ -169,7 +169,7 @@ public class Template extends SubCommand {
.sendMessage(player, "&cInvalid template file: " + args[2] + ".template"); .sendMessage(player, "&cInvalid template file: " + args[2] + ".template");
return false; 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"); Settings.Paths.TEMPLATES + File.separator + "tmp-data.yml");
YamlConfiguration worldConfig = YamlConfiguration.loadConfiguration(worldFile); YamlConfiguration worldConfig = YamlConfiguration.loadConfiguration(worldFile);
PlotSquared.get().worlds.set("worlds." + world, worldConfig.get("")); PlotSquared.get().worlds.set("worlds." + world, worldConfig.get(""));
@ -180,7 +180,7 @@ public class Template extends SubCommand {
e.printStackTrace(); e.printStackTrace();
} }
String manager = String manager =
worldConfig.getString("generator.plugin", PlotSquared.imp().getPluginName()); worldConfig.getString("generator.plugin", PlotSquared.platform().getPluginName());
String generator = worldConfig.getString("generator.init", manager); String generator = worldConfig.getString("generator.init", manager);
PlotAreaBuilder builder = new PlotAreaBuilder() PlotAreaBuilder builder = new PlotAreaBuilder()
.plotAreaType(MainUtil.getType(worldConfig)) .plotAreaType(MainUtil.getType(worldConfig))

View File

@ -73,7 +73,7 @@ public class Trim extends SubCommand {
TaskManager.runTaskAsync(new Runnable() { TaskManager.runTaskAsync(new Runnable() {
@Override public void run() { @Override public void run() {
String directory = world + File.separator + "region"; 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(); File[] regionFiles = folder.listFiles();
for (File file : regionFiles) { for (File file : regionFiles) {
String name = file.getName(); String name = file.getName();

View File

@ -61,7 +61,7 @@ public class ComponentPresetManager {
private final String guiName; private final String guiName;
public ComponentPresetManager() { 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()) { if (!file.exists()) {
boolean created = false; boolean created = false;
try { try {

View File

@ -56,8 +56,8 @@ public class SQLite extends Database {
if (checkConnection()) { if (checkConnection()) {
return this.connection; return this.connection;
} }
if (!PlotSquared.get().IMP.getDirectory().exists()) { if (!PlotSquared.platform().getDirectory().exists()) {
PlotSquared.get().IMP.getDirectory().mkdirs(); PlotSquared.platform().getDirectory().mkdirs();
} }
File file = new File(this.dbLocation); File file = new File(this.dbLocation);
if (!file.exists()) { if (!file.exists()) {

View File

@ -41,7 +41,7 @@ import org.jetbrains.annotations.NotNull;
public class HybridGen extends IndependentPlotGenerator { public class HybridGen extends IndependentPlotGenerator {
@Override public String getName() { @Override public String getName() {
return PlotSquared.imp().getPluginName(); return PlotSquared.platform().getPluginName();
} }
private void placeSchem(HybridPlotWorld world, ScopedLocalBlockQueue result, short relativeX, private void placeSchem(HybridPlotWorld world, ScopedLocalBlockQueue result, short relativeX,

View File

@ -74,7 +74,7 @@ public class HybridPlotManager extends ClassicPlotManager {
.getWorldName() + File.separator; .getWorldName() + File.separator;
try { try {
File sideRoad = 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 String newDir = "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator
+ "__TEMP_DIR__" + File.separator; + "__TEMP_DIR__" + File.separator;
if (sideRoad.exists()) { if (sideRoad.exists()) {
@ -82,12 +82,12 @@ public class HybridPlotManager extends ClassicPlotManager {
Files.readAllBytes(sideRoad.toPath()))); Files.readAllBytes(sideRoad.toPath())));
} }
File intersection = File intersection =
MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), dir + "intersection.schem"); MainUtil.getFile(PlotSquared.platform().getDirectory(), dir + "intersection.schem");
if (intersection.exists()) { if (intersection.exists()) {
files.add(new FileBytes(newDir + "intersection.schem", files.add(new FileBytes(newDir + "intersection.schem",
Files.readAllBytes(intersection.toPath()))); 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()) { if (plot.exists()) {
files.add(new FileBytes(newDir + "plot.schem", Files.readAllBytes(plot.toPath()))); files.add(new FileBytes(newDir + "plot.schem", Files.readAllBytes(plot.toPath())));
} }

View File

@ -200,9 +200,9 @@ public class HybridPlotWorld extends ClassicPlotWorld {
// Try to determine root. This means that plot areas can have separate schematic // Try to determine root. This means that plot areas can have separate schematic
// directories // 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()) { this.getWorldName() + "/" + this.getId())).exists()) {
root = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), root = MainUtil.getFile(PlotSquared.platform().getDirectory(),
"schematics/GEN_ROAD_SCHEMATIC/" + this.getWorldName()); "schematics/GEN_ROAD_SCHEMATIC/" + this.getWorldName());
} }

View File

@ -31,7 +31,6 @@ import com.plotsquared.core.plot.PlotId;
import com.plotsquared.core.plot.SetupObject; import com.plotsquared.core.plot.SetupObject;
import com.plotsquared.core.queue.ScopedLocalBlockQueue; import com.plotsquared.core.queue.ScopedLocalBlockQueue;
import com.plotsquared.core.setup.PlotAreaBuilder; import com.plotsquared.core.setup.PlotAreaBuilder;
import com.plotsquared.core.setup.SetupProcess;
/** /**
* This class allows for implementation independent world generation. * This class allows for implementation independent world generation.
@ -104,7 +103,7 @@ public abstract class IndependentPlotGenerator {
* @return * @return
*/ */
public <T> GeneratorWrapper<T> specify(String world) { public <T> GeneratorWrapper<T> specify(String world) {
return (GeneratorWrapper<T>) PlotSquared.get().IMP.wrapPlotGenerator(world, this); return (GeneratorWrapper<T>) PlotSquared.platform().wrapPlotGenerator(world, this);
} }
@Override public String toString() { @Override public String toString() {

View File

@ -160,7 +160,7 @@ public class PlotListener {
if (plot.getFlag(NotifyEnterFlag.class)) { if (plot.getFlag(NotifyEnterFlag.class)) {
if (!Permissions.hasPermission(player, "plots.flag.notify-enter.bypass")) { if (!Permissions.hasPermission(player, "plots.flag.notify-enter.bypass")) {
for (UUID uuid : plot.getOwners()) { 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())) { if (owner != null && !owner.getUUID().equals(player.getUUID())) {
MainUtil.sendMessage(owner, Captions.NOTIFY_ENTER.getTranslated() MainUtil.sendMessage(owner, Captions.NOTIFY_ENTER.getTranslated()
.replace("%player", player.getName()) .replace("%player", player.getName())
@ -336,7 +336,7 @@ public class PlotListener {
if (plot.getFlag(NotifyLeaveFlag.class)) { if (plot.getFlag(NotifyLeaveFlag.class)) {
if (!Permissions.hasPermission(player, "plots.flag.notify-enter.bypass")) { if (!Permissions.hasPermission(player, "plots.flag.notify-enter.bypass")) {
for (UUID uuid : plot.getOwners()) { 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())) { if ((owner != null) && !owner.getUUID().equals(player.getUUID())) {
MainUtil.sendMessage(owner, Captions.NOTIFY_LEAVE.getTranslated() MainUtil.sendMessage(owner, Captions.NOTIFY_LEAVE.getTranslated()
.replace("%player", player.getName()) .replace("%player", player.getName())

View File

@ -68,7 +68,7 @@ public class ConsolePlayer extends PlotPlayer<Actor> {
} }
@Override public Actor toActor() { @Override public Actor toActor() {
return PlotSquared.get().IMP.getConsole(); return PlotSquared.platform().getConsole();
} }
@Override public Actor getPlatformPlayer() { @Override public Actor getPlatformPlayer() {

View File

@ -129,7 +129,7 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer
* @return Wrapped player * @return Wrapped player
*/ */
public static PlotPlayer<?> wrap(Object player) { public static PlotPlayer<?> wrap(Object player) {
return PlotSquared.get().IMP.wrapPlayer(player); return PlotSquared.platform().wrapPlayer(player);
} }
public abstract Actor toActor(); public abstract Actor toActor();
@ -588,8 +588,8 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer
if (ExpireManager.IMP != null) { if (ExpireManager.IMP != null) {
ExpireManager.IMP.storeDate(getUUID(), System.currentTimeMillis()); ExpireManager.IMP.storeDate(getUUID(), System.currentTimeMillis());
} }
PlotSquared.imp().getPlayerManager().removePlayer(this); PlotSquared.platform().getPlayerManager().removePlayer(this);
PlotSquared.get().IMP.unregister(this); PlotSquared.platform().unregister(this);
debugModeEnabled.remove(this); debugModeEnabled.remove(this);
} }

View File

@ -401,7 +401,7 @@ public class Plot {
*/ */
public List<PlotPlayer<?>> getPlayersInPlot() { public List<PlotPlayer<?>> getPlayersInPlot() {
final List<PlotPlayer<?>> players = new ArrayList<>(); final List<PlotPlayer<?>> players = new ArrayList<>();
for (final PlotPlayer<?> player : PlotSquared.imp().getPlayerManager().getPlayers()) { for (final PlotPlayer<?> player : PlotSquared.platform().getPlayerManager().getPlayers()) {
if (this.equals(player.getCurrentPlot())) { if (this.equals(player.getCurrentPlot())) {
players.add(player); players.add(player);
} }
@ -1330,7 +1330,7 @@ public class Plot {
if (Settings.Backup.DELETE_ON_UNCLAIM) { if (Settings.Backup.DELETE_ON_UNCLAIM) {
// Destroy all backups when the plot is unclaimed // Destroy all backups when the plot is unclaimed
Objects.requireNonNull(PlotSquared.imp()).getBackupManager().getProfile(current) Objects.requireNonNull(PlotSquared.platform()).getBackupManager().getProfile(current)
.destroy(); .destroy();
} }
@ -3039,11 +3039,11 @@ public class Plot {
return false; return false;
} }
if (!isMerged()) { if (!isMerged()) {
return PlotSquared.imp().getPlayerManager() return PlotSquared.platform().getPlayerManager()
.getPlayerIfExists(Objects.requireNonNull(this.getOwnerAbs())) != null; .getPlayerIfExists(Objects.requireNonNull(this.getOwnerAbs())) != null;
} }
for (final Plot current : getConnectedPlots()) { for (final Plot current : getConnectedPlots()) {
if (current.hasOwner() && PlotSquared.imp().getPlayerManager() if (current.hasOwner() && PlotSquared.platform().getPlayerManager()
.getPlayerIfExists(Objects.requireNonNull(current.getOwnerAbs())) != null) { .getPlayerIfExists(Objects.requireNonNull(current.getOwnerAbs())) != null) {
return true; return true;
} }

View File

@ -409,13 +409,13 @@ public class ExpireManager {
} }
} }
for (UUID helper : plot.getTrusted()) { for (UUID helper : plot.getTrusted()) {
PlotPlayer player = PlotSquared.imp().getPlayerManager().getPlayerIfExists(helper); PlotPlayer player = PlotSquared.platform().getPlayerManager().getPlayerIfExists(helper);
if (player != null) { if (player != null) {
MainUtil.sendMessage(player, Captions.PLOT_REMOVED_USER, plot.toString()); MainUtil.sendMessage(player, Captions.PLOT_REMOVED_USER, plot.toString());
} }
} }
for (UUID helper : plot.getMembers()) { for (UUID helper : plot.getMembers()) {
PlotPlayer player = PlotSquared.imp().getPlayerManager().getPlayerIfExists(helper); PlotPlayer player = PlotSquared.platform().getPlayerManager().getPlayerIfExists(helper);
if (player != null) { if (player != null) {
MainUtil.sendMessage(player, Captions.PLOT_REMOVED_USER, plot.toString()); MainUtil.sendMessage(player, Captions.PLOT_REMOVED_USER, plot.toString());
} }
@ -438,12 +438,12 @@ public class ExpireManager {
} }
public long getAge(UUID uuid) { public long getAge(UUID uuid) {
if (PlotSquared.imp().getPlayerManager().getPlayerIfExists(uuid) != null) { if (PlotSquared.platform().getPlayerManager().getPlayerIfExists(uuid) != null) {
return 0; return 0;
} }
Long last = this.dates_cache.get(uuid); Long last = this.dates_cache.get(uuid);
if (last == null) { if (last == null) {
OfflinePlotPlayer opp = PlotSquared.imp().getPlayerManager().getOfflinePlayer(uuid); OfflinePlotPlayer opp = PlotSquared.platform().getPlayerManager().getOfflinePlayer(uuid);
if (opp != null && (last = opp.getLastPlayed()) != 0) { if (opp != null && (last = opp.getLastPlayed()) != 0) {
this.dates_cache.put(uuid, last); this.dates_cache.put(uuid, last);
} else { } else {
@ -458,7 +458,7 @@ public class ExpireManager {
public long getAge(Plot plot) { public long getAge(Plot plot) {
if (!plot.hasOwner() || Objects.equals(DBFunc.EVERYONE, plot.getOwner()) 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; return 0;
} }

View File

@ -39,8 +39,8 @@ public class PlotMessage {
reset(ChatManager.manager); reset(ChatManager.manager);
} catch (Throwable e) { } catch (Throwable e) {
PlotSquared.debug( PlotSquared.debug(
PlotSquared.imp().getPluginName() + " doesn't support fancy chat for " + PlotSquared PlotSquared.platform().getPluginName() + " doesn't support fancy chat for " + PlotSquared
.get().IMP.getServerVersion()); .platform().getServerVersion());
ChatManager.manager = new PlainChatManager(); ChatManager.manager = new PlainChatManager();
reset(ChatManager.manager); reset(ChatManager.manager);
} }

View File

@ -87,7 +87,7 @@ public class SinglePlotArea extends GridPlotWorld {
.settingsNodesWrapper(new SettingsNodesWrapper(new ConfigurationNode[0], null)) .settingsNodesWrapper(new SettingsNodesWrapper(new ConfigurationNode[0], null))
.worldName(worldName); .worldName(worldName);
File container = PlotSquared.imp().getWorldContainer(); File container = PlotSquared.platform().getWorldContainer();
File destination = new File(container, worldName); File destination = new File(container, worldName);
{// convert old {// convert old

View File

@ -63,7 +63,7 @@ public class SinglePlotManager extends PlotManager {
@Override public boolean clearPlot(Plot plot, final Runnable whenDone) { @Override public boolean clearPlot(Plot plot, final Runnable whenDone) {
SetupUtils.manager.unload(plot.getWorldName(), false); SetupUtils.manager.unload(plot.getWorldName(), false);
final File worldFolder = final File worldFolder =
new File(PlotSquared.get().IMP.getWorldContainer(), plot.getWorldName()); new File(PlotSquared.platform().getWorldContainer(), plot.getWorldName());
TaskManager.IMP.taskAsync(() -> { TaskManager.IMP.taskAsync(() -> {
MainUtil.deleteDirectory(worldFolder); MainUtil.deleteDirectory(worldFolder);
if (whenDone != null) { if (whenDone != null) {

View File

@ -123,7 +123,7 @@ public abstract class LocalBlockQueue {
fixChunkLighting(x, z); fixChunkLighting(x, z);
BlockVector2 loc = BlockVector2.at(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(); Location pLoc = pp.getLocation();
if (!StringMan.isEqual(getWorld(), pLoc.getWorld()) || !pLoc.getBlockVector2() if (!StringMan.isEqual(getWorld(), pLoc.getWorld()) || !pLoc.getBlockVector2()
.equals(loc)) { .equals(loc)) {

View File

@ -59,8 +59,8 @@ public enum CommonSetupSteps implements SetupStep {
String prefix = "\n&8 - &7"; String prefix = "\n&8 - &7";
sendMessage(plotPlayer, Captions.SETUP_WORLD_GENERATOR_ERROR + prefix + StringMan sendMessage(plotPlayer, Captions.SETUP_WORLD_GENERATOR_ERROR + prefix + StringMan
.join(SetupUtils.generators.keySet(), prefix) .join(SetupUtils.generators.keySet(), prefix)
.replaceAll(PlotSquared.imp().getPluginName(), .replaceAll(PlotSquared.platform().getPluginName(),
"&2" + PlotSquared.imp().getPluginName())); "&2" + PlotSquared.platform().getPluginName()));
return this; // invalid input -> same setup step return this; // invalid input -> same setup step
} }
builder.generatorName(arg); builder.generatorName(arg);
@ -72,7 +72,7 @@ public enum CommonSetupSteps implements SetupStep {
} }
@Nullable @Override public String getDefaultValue() { @Nullable @Override public String getDefaultValue() {
return PlotSquared.imp().getPluginName(); return PlotSquared.platform().getPluginName();
} }
}, },
CHOOSE_PLOT_AREA_TYPE(PlotAreaType.class, Captions.SETUP_WORLD_TYPE) { 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() SetupUtils.generators.get(builder.plotManager()).getPlotGenerator()
.processAreaSetup(builder); .processAreaSetup(builder);
} else { } else {
builder.plotManager(PlotSquared.imp().getPluginName()); builder.plotManager(PlotSquared.platform().getPluginName());
MainUtil.sendMessage(plotPlayer, Captions.SETUP_WRONG_GENERATOR); MainUtil.sendMessage(plotPlayer, Captions.SETUP_WRONG_GENERATOR);
builder.settingsNodesWrapper(CommonSetupSteps.wrap(builder.plotManager())); builder.settingsNodesWrapper(CommonSetupSteps.wrap(builder.plotManager()));
// TODO why is processSetup not called here? // TODO why is processSetup not called here?

View File

@ -56,7 +56,7 @@ public class PlotAreaBuilder {
.plotAreaType(area.getType()) .plotAreaType(area.getType())
.terrainType(area.getTerrain()) .terrainType(area.getTerrain())
.generatorName(area.getGenerator().getName()) .generatorName(area.getGenerator().getName())
.plotManager(PlotSquared.imp().getPluginName()) .plotManager(PlotSquared.platform().getPluginName())
.minimumId(area.getMin()) .minimumId(area.getMin())
.maximumId(area.getMax()) .maximumId(area.getMax())
.settingsNodesWrapper(new SettingsNodesWrapper(area.getSettingNodes(), null)); .settingsNodesWrapper(new SettingsNodesWrapper(area.getSettingNodes(), null));

View File

@ -25,7 +25,7 @@
*/ */
package com.plotsquared.core.util; package com.plotsquared.core.util;
import com.plotsquared.core.IPlotMain; import com.plotsquared.core.PlotPlatform;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.player.ConsolePlayer; import com.plotsquared.core.player.ConsolePlayer;
import com.plotsquared.core.player.OfflinePlotPlayer; import com.plotsquared.core.player.OfflinePlotPlayer;
@ -36,27 +36,27 @@ public abstract class EconHandler {
/** /**
* @deprecated This will be removed in the future, * @deprecated This will be removed in the future,
* call {@link IPlotMain#getEconomyHandler()} instead. * call {@link PlotPlatform#getEconomyHandler()} instead.
*/ */
@Deprecated @Nullable public static EconHandler manager; @Deprecated @Nullable public static EconHandler manager;
/** /**
* Initialize the economy handler using {@link IPlotMain#getEconomyHandler()} * Initialize the economy handler using {@link PlotPlatform#getEconomyHandler()}
* @deprecated Call {@link #init} instead or use {@link IPlotMain#getEconomyHandler()} * @deprecated Call {@link #init} instead or use {@link PlotPlatform#getEconomyHandler()}
* which does this already. * which does this already.
*/ */
@Deprecated public static void initializeEconHandler() { @Deprecated public static void initializeEconHandler() {
manager = PlotSquared.get().IMP.getEconomyHandler(); manager = PlotSquared.platform().getEconomyHandler();
} }
/** /**
* Return the econ handler instance, if one exists * Return the econ handler instance, if one exists
* *
* @return Economy handler instance * @return Economy handler instance
* @deprecated Call {@link IPlotMain#getEconomyHandler()} instead * @deprecated Call {@link PlotPlatform#getEconomyHandler()} instead
*/ */
@Deprecated @Nullable public static EconHandler getEconHandler() { @Deprecated @Nullable public static EconHandler getEconHandler() {
manager = PlotSquared.get().IMP.getEconomyHandler(); manager = PlotSquared.platform().getEconomyHandler();
return manager; return manager;
} }

View File

@ -969,7 +969,7 @@ public class MainUtil {
public static void getPersistentMeta(UUID uuid, final String key, public static void getPersistentMeta(UUID uuid, final String key,
final RunnableVal<byte[]> result) { final RunnableVal<byte[]> result) {
PlotPlayer player = PlotSquared.imp().getPlayerManager().getPlayerIfExists(uuid); PlotPlayer player = PlotSquared.platform().getPlayerManager().getPlayerIfExists(uuid);
if (player != null) { if (player != null) {
result.run(player.getPersistentMeta(key)); result.run(player.getPersistentMeta(key));
} else { } else {

View File

@ -107,7 +107,7 @@ public abstract class RegionManager {
public Set<BlockVector2> getChunkChunks(String world) { public Set<BlockVector2> getChunkChunks(String world) {
File folder = 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(); File[] regionFiles = folder.listFiles();
if (regionFiles == null) { if (regionFiles == null) {
throw new RuntimeException( throw new RuntimeException(
@ -141,7 +141,7 @@ public abstract class RegionManager {
String directory = String directory =
world + File.separator + "region" + File.separator + "r." + loc.getX() + "." world + File.separator + "region" + File.separator + "r." + loc.getX() + "."
+ loc.getZ() + ".mca"; + 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)"); PlotSquared.log("&6 - Deleting file: " + file.getName() + " (max 1024 chunks)");
if (file.exists()) { if (file.exists()) {
file.delete(); file.delete();

View File

@ -314,7 +314,7 @@ public abstract class SchematicHandler {
*/ */
public Schematic getSchematic(String name) throws UnsupportedFormatException { public Schematic getSchematic(String name) throws UnsupportedFormatException {
File parent = File parent =
MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), Settings.Paths.SCHEMATICS); MainUtil.getFile(PlotSquared.platform().getDirectory(), Settings.Paths.SCHEMATICS);
if (!parent.exists()) { if (!parent.exists()) {
if (!parent.mkdir()) { if (!parent.mkdir()) {
throw new RuntimeException("Could not create schematic parent directory"); throw new RuntimeException("Could not create schematic parent directory");
@ -323,10 +323,10 @@ public abstract class SchematicHandler {
if (!name.endsWith(".schem") && !name.endsWith(".schematic")) { if (!name.endsWith(".schem") && !name.endsWith(".schematic")) {
name = name + ".schem"; name = name + ".schem";
} }
File file = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), File file = MainUtil.getFile(PlotSquared.platform().getDirectory(),
Settings.Paths.SCHEMATICS + File.separator + name); Settings.Paths.SCHEMATICS + File.separator + name);
if (!file.exists()) { if (!file.exists()) {
file = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), file = MainUtil.getFile(PlotSquared.platform().getDirectory(),
Settings.Paths.SCHEMATICS + File.separator + name); Settings.Paths.SCHEMATICS + File.separator + name);
} }
return getSchematic(file); return getSchematic(file);
@ -339,7 +339,7 @@ public abstract class SchematicHandler {
*/ */
public Collection<String> getSchematicNames() { public Collection<String> getSchematicNames() {
final File parent = final File parent =
MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), Settings.Paths.SCHEMATICS); MainUtil.getFile(PlotSquared.platform().getDirectory(), Settings.Paths.SCHEMATICS);
final List<String> names = new ArrayList<>(); final List<String> names = new ArrayList<>();
if (parent.exists()) { if (parent.exists()) {
final String[] rawNames = final String[] rawNames =
@ -467,7 +467,7 @@ public abstract class SchematicHandler {
return false; return false;
} }
try { try {
File tmp = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), path); File tmp = MainUtil.getFile(PlotSquared.platform().getDirectory(), path);
tmp.getParentFile().mkdirs(); tmp.getParentFile().mkdirs();
try (NBTOutputStream nbtStream = new NBTOutputStream( try (NBTOutputStream nbtStream = new NBTOutputStream(
new GZIPOutputStream(new FileOutputStream(tmp)))) { new GZIPOutputStream(new FileOutputStream(tmp)))) {

View File

@ -161,7 +161,7 @@ public class TabCompletions {
cachedCompletionValues.put(cacheIdentifier, players); cachedCompletionValues.put(cacheIdentifier, players);
} }
} else { } else {
final Collection<? extends PlotPlayer<?>> onlinePlayers = PlotSquared.imp().getPlayerManager().getPlayers(); final Collection<? extends PlotPlayer<?>> onlinePlayers = PlotSquared.platform().getPlayerManager().getPlayers();
players = new ArrayList<>(onlinePlayers.size()); players = new ArrayList<>(onlinePlayers.size());
for (final PlotPlayer<?> player : onlinePlayers) { for (final PlotPlayer<?> player : onlinePlayers) {
if (uuidFilter.test(player.getUUID())) { if (uuidFilter.test(player.getUUID())) {

View File

@ -187,7 +187,7 @@ public abstract class WorldUtil {
public File getDat(String world) { public File getDat(String world) {
File file = new File( File file = new File(
PlotSquared.get().IMP.getWorldContainer() + File.separator + world + File.separator PlotSquared.platform().getWorldContainer() + File.separator + world + File.separator
+ "level.dat"); + "level.dat");
if (file.exists()) { if (file.exists()) {
return file; return file;
@ -196,7 +196,7 @@ public abstract class WorldUtil {
} }
public File getMcr(String world, int x, int z) { 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"); world + File.separator + "region" + File.separator + "r." + x + '.' + z + ".mca");
if (file.exists()) { if (file.exists()) {
return file; return file;