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
63 changed files with 211 additions and 210 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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