mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 12:25:46 +01:00
Clean up PlotPlatform a bit and make the placeholder registry injectible
This commit is contained in:
parent
60b5f5fe48
commit
c8ad936d26
@ -197,7 +197,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
@Inject private PlatformWorldManager<World> worldManager;
|
@Inject private PlatformWorldManager<World> worldManager;
|
||||||
private Locale serverLocale;
|
private Locale serverLocale;
|
||||||
|
|
||||||
@Override public int[] getServerVersion() {
|
@Override @Nonnull public int[] serverVersion() {
|
||||||
if (this.version == null) {
|
if (this.version == null) {
|
||||||
try {
|
try {
|
||||||
this.version = new int[3];
|
this.version = new int[3];
|
||||||
@ -215,7 +215,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
return this.version;
|
return this.version;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public String getServerImplementation() {
|
@Override @Nonnull public String serverImplementation() {
|
||||||
return Bukkit.getVersion();
|
return Bukkit.getVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,7 +235,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
|
|
||||||
final PlotSquared plotSquared = new PlotSquared(this, "Bukkit");
|
final PlotSquared plotSquared = new PlotSquared(this, "Bukkit");
|
||||||
|
|
||||||
if (PlotSquared.platform().getServerVersion()[1] < 13) {
|
if (PlotSquared.platform().serverVersion()[1] < 13) {
|
||||||
logger.error("You can't use this version of PlotSquared on a server less than Minecraft 1.13.2.");
|
logger.error("You can't use this version of PlotSquared on a server less than Minecraft 1.13.2.");
|
||||||
logger.error("Please check the download page for the link to the legacy versions.");
|
logger.error("Please check the download page for the link to the legacy versions.");
|
||||||
logger.error("The server will now be shutdown to prevent any corruption.");
|
logger.error("The server will now be shutdown to prevent any corruption.");
|
||||||
@ -298,8 +298,8 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
// WorldEdit
|
// WorldEdit
|
||||||
if (Settings.Enabled_Components.WORLDEDIT_RESTRICTIONS) {
|
if (Settings.Enabled_Components.WORLDEDIT_RESTRICTIONS) {
|
||||||
try {
|
try {
|
||||||
logger.info("{} hooked into WorldEdit", this.getPluginName());
|
logger.info("{} hooked into WorldEdit", this.pluginName());
|
||||||
WorldEdit.getInstance().getEventBus().register(this.getInjector().getInstance(WESubscriber.class));
|
WorldEdit.getInstance().getEventBus().register(this.injector().getInstance(WESubscriber.class));
|
||||||
if (Settings.Enabled_Components.COMMANDS) {
|
if (Settings.Enabled_Components.COMMANDS) {
|
||||||
new WE_Anywhere();
|
new WE_Anywhere();
|
||||||
}
|
}
|
||||||
@ -309,26 +309,26 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Settings.Enabled_Components.EVENTS) {
|
if (Settings.Enabled_Components.EVENTS) {
|
||||||
getServer().getPluginManager().registerEvents(getInjector().getInstance(PlayerEventListener.class), this);
|
getServer().getPluginManager().registerEvents(injector().getInstance(PlayerEventListener.class), this);
|
||||||
getServer().getPluginManager().registerEvents(getInjector().getInstance(BlockEventListener.class), this);
|
getServer().getPluginManager().registerEvents(injector().getInstance(BlockEventListener.class), this);
|
||||||
getServer().getPluginManager().registerEvents(getInjector().getInstance(EntityEventListener.class), this);
|
getServer().getPluginManager().registerEvents(injector().getInstance(EntityEventListener.class), this);
|
||||||
getServer().getPluginManager().registerEvents(getInjector().getInstance(ProjectileEventListener.class), this);
|
getServer().getPluginManager().registerEvents(injector().getInstance(ProjectileEventListener.class), this);
|
||||||
getServer().getPluginManager().registerEvents(getInjector().getInstance(ServerListener.class), this);
|
getServer().getPluginManager().registerEvents(injector().getInstance(ServerListener.class), this);
|
||||||
getServer().getPluginManager().registerEvents(getInjector().getInstance(EntitySpawnListener.class), this);
|
getServer().getPluginManager().registerEvents(injector().getInstance(EntitySpawnListener.class), this);
|
||||||
if (PaperLib.isPaper() && Settings.Paper_Components.PAPER_LISTENERS) {
|
if (PaperLib.isPaper() && Settings.Paper_Components.PAPER_LISTENERS) {
|
||||||
if (getServerVersion()[1] == 13) {
|
if (serverVersion()[1] == 13) {
|
||||||
getServer().getPluginManager().registerEvents(getInjector().getInstance(PaperListener113.class), this);
|
getServer().getPluginManager().registerEvents(injector().getInstance(PaperListener113.class), this);
|
||||||
} else {
|
} else {
|
||||||
getServer().getPluginManager().registerEvents(getInjector().getInstance(PaperListener.class), this);
|
getServer().getPluginManager().registerEvents(injector().getInstance(PaperListener.class), this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.plotListener.startRunnable();
|
this.plotListener.startRunnable();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Required
|
// Required
|
||||||
getServer().getPluginManager().registerEvents(getInjector().getInstance(WorldEvents.class), this);
|
getServer().getPluginManager().registerEvents(injector().getInstance(WorldEvents.class), this);
|
||||||
if (Settings.Enabled_Components.CHUNK_PROCESSOR) {
|
if (Settings.Enabled_Components.CHUNK_PROCESSOR) {
|
||||||
getServer().getPluginManager().registerEvents(getInjector().getInstance(ChunkListener.class), this);
|
getServer().getPluginManager().registerEvents(injector().getInstance(ChunkListener.class), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Commands
|
// Commands
|
||||||
@ -339,15 +339,15 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
// Economy
|
// Economy
|
||||||
if (Settings.Enabled_Components.ECONOMY) {
|
if (Settings.Enabled_Components.ECONOMY) {
|
||||||
TaskManager.runTask(() -> {
|
TaskManager.runTask(() -> {
|
||||||
this.getPermissionHandler().initialize();
|
this.permissionHandler().initialize();
|
||||||
final EconHandler econHandler = getInjector().getInstance(EconHandler.class);
|
final EconHandler econHandler = injector().getInstance(EconHandler.class);
|
||||||
econHandler.init();
|
econHandler.init();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Settings.Enabled_Components.COMPONENT_PRESETS) {
|
if (Settings.Enabled_Components.COMPONENT_PRESETS) {
|
||||||
try {
|
try {
|
||||||
getInjector().getInstance(ComponentPresetManager.class);
|
injector().getInstance(ComponentPresetManager.class);
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
logger.error("Failed to initialize the preset system", e);
|
logger.error("Failed to initialize the preset system", e);
|
||||||
}
|
}
|
||||||
@ -355,7 +355,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
|
|
||||||
// World generators:
|
// World generators:
|
||||||
final ConfigurationSection section = this.worldConfiguration.getConfigurationSection("worlds");
|
final ConfigurationSection section = this.worldConfiguration.getConfigurationSection("worlds");
|
||||||
final WorldUtil worldUtil = getInjector().getInstance(WorldUtil.class);
|
final WorldUtil worldUtil = injector().getInstance(WorldUtil.class);
|
||||||
|
|
||||||
if (section != null) {
|
if (section != null) {
|
||||||
for (String world : section.getKeys(false)) {
|
for (String world : section.getKeys(false)) {
|
||||||
@ -372,7 +372,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!worldUtil.isWorld(world) && !world.equals("*")) {
|
if (!worldUtil.isWorld(world) && !world.equals("*")) {
|
||||||
logger.warn("`{}` was not properly loaded - {} will now try to load it properly", world, this.getPluginName());
|
logger.warn("`{}` was not properly loaded - {} will now try to load it properly", world, this.pluginName());
|
||||||
logger.warn(
|
logger.warn(
|
||||||
" - 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");
|
||||||
logger.warn(" - Your world management plugin may be faulty (or non existent)");
|
logger.warn(" - Your world management plugin may be faulty (or non existent)");
|
||||||
@ -484,7 +484,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
|
if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
|
||||||
injector.getInstance(PAPIPlaceholders.class).register();
|
injector.getInstance(PAPIPlaceholders.class).register();
|
||||||
if (Settings.Enabled_Components.EXTERNAL_PLACEHOLDERS) {
|
if (Settings.Enabled_Components.EXTERNAL_PLACEHOLDERS) {
|
||||||
ChatFormatter.formatters.add(getInjector().getInstance(PlaceholderFormatter.class));
|
ChatFormatter.formatters.add(injector().getInstance(PlaceholderFormatter.class));
|
||||||
}
|
}
|
||||||
logger.info("PlotSquared hooked into PlaceholderAPI");
|
logger.info("PlotSquared hooked into PlaceholderAPI");
|
||||||
}
|
}
|
||||||
@ -494,7 +494,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
if (Settings.Enabled_Components.WORLDS) {
|
if (Settings.Enabled_Components.WORLDS) {
|
||||||
TaskManager.getPlatformImplementation().taskRepeat(this::unload, TaskTime.seconds(1L));
|
TaskManager.getPlatformImplementation().taskRepeat(this::unload, TaskTime.seconds(1L));
|
||||||
try {
|
try {
|
||||||
singleWorldListener = getInjector().getInstance(SingleWorldListener.class);
|
singleWorldListener = injector().getInstance(SingleWorldListener.class);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -503,9 +503,9 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
// Clean up potential memory leak
|
// Clean up potential memory leak
|
||||||
Bukkit.getScheduler().runTaskTimer(this, () -> {
|
Bukkit.getScheduler().runTaskTimer(this, () -> {
|
||||||
try {
|
try {
|
||||||
for (final PlotPlayer<? extends Player> player : this.getPlayerManager().getPlayers()) {
|
for (final PlotPlayer<? extends Player> player : this.playerManager().getPlayers()) {
|
||||||
if (player.getPlatformPlayer() == null || !player.getPlatformPlayer().isOnline()) {
|
if (player.getPlatformPlayer() == null || !player.getPlatformPlayer().isOnline()) {
|
||||||
this.getPlayerManager().removePlayer(player);
|
this.playerManager().removePlayer(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
@ -553,7 +553,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
}
|
}
|
||||||
final Plot plot = area.getOwnedPlot(id);
|
final Plot plot = area.getOwnedPlot(id);
|
||||||
if (plot != null) {
|
if (plot != null) {
|
||||||
if (!plot.getFlag(ServerPlotFlag.class) || PlotSquared.platform().getPlayerManager().getPlayerIfExists(plot.getOwner()) == null) {
|
if (!plot.getFlag(ServerPlotFlag.class) || PlotSquared.platform().playerManager().getPlayerIfExists(plot.getOwner()) == null) {
|
||||||
if (world.getKeepSpawnInMemory()) {
|
if (world.getKeepSpawnInMemory()) {
|
||||||
world.setKeepSpawnInMemory(false);
|
world.setKeepSpawnInMemory(false);
|
||||||
return;
|
return;
|
||||||
@ -679,11 +679,11 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public File getDirectory() {
|
@Override @Nonnull public File getDirectory() {
|
||||||
return getDataFolder();
|
return getDataFolder();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public File getWorldContainer() {
|
@Override @Nonnull public File worldContainer() {
|
||||||
return Bukkit.getWorldContainer();
|
return Bukkit.getWorldContainer();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -934,9 +934,9 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
@Override @Nullable public final ChunkGenerator getDefaultWorldGenerator(@Nonnull final String worldName, final String id) {
|
@Override @Nullable public final ChunkGenerator getDefaultWorldGenerator(@Nonnull final String worldName, final String id) {
|
||||||
final IndependentPlotGenerator result;
|
final IndependentPlotGenerator result;
|
||||||
if (id != null && id.equalsIgnoreCase("single")) {
|
if (id != null && id.equalsIgnoreCase("single")) {
|
||||||
result = getInjector().getInstance(SingleWorldGenerator.class);
|
result = injector().getInstance(SingleWorldGenerator.class);
|
||||||
} else {
|
} else {
|
||||||
result = getInjector().getInstance(Key.get(IndependentPlotGenerator.class, DefaultGenerator.class));
|
result = injector().getInstance(Key.get(IndependentPlotGenerator.class, DefaultGenerator.class));
|
||||||
if (!PlotSquared.get().setupPlotWorld(worldName, id, result)) {
|
if (!PlotSquared.get().setupPlotWorld(worldName, id, result)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -956,7 +956,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
}
|
}
|
||||||
return new BukkitPlotGenerator(world, gen, this.plotAreaManager);
|
return new BukkitPlotGenerator(world, gen, this.plotAreaManager);
|
||||||
} else {
|
} else {
|
||||||
return new BukkitPlotGenerator(world, getInjector().getInstance(Key.get(IndependentPlotGenerator.class, DefaultGenerator.class)),
|
return new BukkitPlotGenerator(world, injector().getInstance(Key.get(IndependentPlotGenerator.class, DefaultGenerator.class)),
|
||||||
this.plotAreaManager);
|
this.plotAreaManager);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -988,7 +988,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override public void unregister(@Nonnull final PlotPlayer<?> player) {
|
@Override public void unregister(@Nonnull final PlotPlayer<?> player) {
|
||||||
PlotSquared.platform().getPlayerManager().removePlayer(player.getUUID());
|
PlotSquared.platform().playerManager().removePlayer(player.getUUID());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void setGenerator(@Nonnull final String worldName) {
|
@Override public void setGenerator(@Nonnull final String worldName) {
|
||||||
@ -996,12 +996,12 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
if (world == null) {
|
if (world == null) {
|
||||||
// create world
|
// create world
|
||||||
ConfigurationSection worldConfig = this.worldConfiguration.getConfigurationSection("worlds." + worldName);
|
ConfigurationSection worldConfig = this.worldConfiguration.getConfigurationSection("worlds." + worldName);
|
||||||
String manager = worldConfig.getString("generator.plugin", getPluginName());
|
String manager = worldConfig.getString("generator.plugin", pluginName());
|
||||||
PlotAreaBuilder builder =
|
PlotAreaBuilder builder =
|
||||||
PlotAreaBuilder.newBuilder().plotManager(manager).generatorName(worldConfig.getString("generator.init", manager))
|
PlotAreaBuilder.newBuilder().plotManager(manager).generatorName(worldConfig.getString("generator.init", manager))
|
||||||
.plotAreaType(ConfigurationUtil.getType(worldConfig)).terrainType(ConfigurationUtil.getTerrain(worldConfig))
|
.plotAreaType(ConfigurationUtil.getType(worldConfig)).terrainType(ConfigurationUtil.getTerrain(worldConfig))
|
||||||
.settingsNodesWrapper(new SettingsNodesWrapper(new ConfigurationNode[0], null)).worldName(worldName);
|
.settingsNodesWrapper(new SettingsNodesWrapper(new ConfigurationNode[0], null)).worldName(worldName);
|
||||||
getInjector().getInstance(SetupUtils.class).setupWorld(builder);
|
injector().getInstance(SetupUtils.class).setupWorld(builder);
|
||||||
world = Bukkit.getWorld(worldName);
|
world = Bukkit.getWorld(worldName);
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
@ -1025,16 +1025,16 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public String getNMSPackage() {
|
@Override @Nonnull public String serverNativePackage() {
|
||||||
final String name = Bukkit.getServer().getClass().getPackage().getName();
|
final String name = Bukkit.getServer().getClass().getPackage().getName();
|
||||||
return name.substring(name.lastIndexOf('.') + 1);
|
return name.substring(name.lastIndexOf('.') + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public GeneratorWrapper<?> wrapPlotGenerator(@Nullable final String world, @Nonnull final IndependentPlotGenerator generator) {
|
@Override @Nonnull public GeneratorWrapper<?> wrapPlotGenerator(@Nullable final String world, @Nonnull final IndependentPlotGenerator generator) {
|
||||||
return new BukkitPlotGenerator(world, generator, this.plotAreaManager);
|
return new BukkitPlotGenerator(world, generator, this.plotAreaManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public String getPluginList() {
|
@Override @Nonnull public String pluginsFormatted() {
|
||||||
StringBuilder msg = new StringBuilder();
|
StringBuilder msg = new StringBuilder();
|
||||||
Plugin[] plugins = Bukkit.getServer().getPluginManager().getPlugins();
|
Plugin[] plugins = Bukkit.getServer().getPluginManager().getPlugins();
|
||||||
msg.append("Plugins (").append(plugins.length).append("): \n");
|
msg.append("Plugins (").append(plugins.length).append("): \n");
|
||||||
@ -1055,11 +1055,11 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
return BukkitWorld.of(worldName);
|
return BukkitWorld.of(worldName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override @Nonnull public Audience getConsoleAudience() {
|
@Override @Nonnull public Audience consoleAudience() {
|
||||||
return BukkitUtil.BUKKIT_AUDIENCES.console();
|
return BukkitUtil.BUKKIT_AUDIENCES.console();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public String getPluginName() {
|
@Override @Nonnull public String pluginName() {
|
||||||
return this.pluginName;
|
return this.pluginName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1067,7 +1067,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
return this.singleWorldListener;
|
return this.singleWorldListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public Injector getInjector() {
|
@Override @Nonnull public Injector injector() {
|
||||||
return this.injector;
|
return this.injector;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1079,13 +1079,13 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
throw new UnsupportedOperationException("Cannot replace server locale");
|
throw new UnsupportedOperationException("Cannot replace server locale");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override @Nonnull public PlatformWorldManager<?> getWorldManager() {
|
@Override @Nonnull public PlatformWorldManager<?> worldManager() {
|
||||||
return getInjector().getInstance(Key.get(new TypeLiteral<PlatformWorldManager<World>>() {
|
return injector().getInstance(Key.get(new TypeLiteral<PlatformWorldManager<World>>() {
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override @Nonnull @SuppressWarnings("ALL") public PlayerManager<? extends PlotPlayer<Player>, ? extends Player> getPlayerManager() {
|
@Override @Nonnull @SuppressWarnings("ALL") public PlayerManager<? extends PlotPlayer<Player>, ? extends Player> playerManager() {
|
||||||
return (PlayerManager<BukkitPlayer, Player>) getInjector().getInstance(PlayerManager.class);
|
return (PlayerManager<BukkitPlayer, Player>) injector().getInstance(PlayerManager.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void copyCaptionMaps() {
|
@Override public void copyCaptionMaps() {
|
||||||
|
@ -54,7 +54,7 @@ final class BlockStatePopulator extends BlockPopulator {
|
|||||||
|
|
||||||
@Override public void populate(@Nonnull final World world, @Nonnull final Random random, @Nonnull final Chunk source) {
|
@Override public void populate(@Nonnull final World world, @Nonnull final Random random, @Nonnull final Chunk source) {
|
||||||
if (this.queue == null) {
|
if (this.queue == null) {
|
||||||
this.queue = PlotSquared.platform().getGlobalBlockQueue().getNewQueue(new BukkitWorld(world));
|
this.queue = PlotSquared.platform().globalBlockQueue().getNewQueue(new BukkitWorld(world));
|
||||||
}
|
}
|
||||||
final PlotArea area = this.plotAreaManager.getPlotArea(world.getName(), null);
|
final PlotArea area = this.plotAreaManager.getPlotArea(world.getName(), null);
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
|
@ -60,7 +60,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.platform().getDefaultGenerator().getNewPlotArea(world, id, min, max);
|
return PlotSquared.platform().defaultGenerator().getNewPlotArea(world, id, min, max);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void generateChunk(final ScopedQueueCoordinator result, PlotArea settings) {
|
@Override public void generateChunk(final ScopedQueueCoordinator result, PlotArea settings) {
|
||||||
|
@ -58,7 +58,6 @@ import com.plotsquared.core.plot.flag.implementations.SoilDryFlag;
|
|||||||
import com.plotsquared.core.plot.flag.implementations.VineGrowFlag;
|
import com.plotsquared.core.plot.flag.implementations.VineGrowFlag;
|
||||||
import com.plotsquared.core.plot.flag.types.BlockTypeWrapper;
|
import com.plotsquared.core.plot.flag.types.BlockTypeWrapper;
|
||||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||||
import com.plotsquared.core.util.MainUtil;
|
|
||||||
import com.plotsquared.core.util.Permissions;
|
import com.plotsquared.core.util.Permissions;
|
||||||
import com.plotsquared.core.util.task.TaskManager;
|
import com.plotsquared.core.util.task.TaskManager;
|
||||||
import com.plotsquared.core.util.task.TaskTime;
|
import com.plotsquared.core.util.task.TaskTime;
|
||||||
@ -126,7 +125,7 @@ public class BlockEventListener 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.platform().getPlayerManager().getPlayers()) {
|
for (final PlotPlayer<?> player : PlotSquared.platform().playerManager().getPlayers()) {
|
||||||
Location location = player.getLocation();
|
Location location = player.getLocation();
|
||||||
if (location.getWorldName().equals(world)) {
|
if (location.getWorldName().equals(world)) {
|
||||||
if (16 * Math.abs(location.getX() - x) / 16 > distance || 16 * Math.abs(location.getZ() - z) / 16 > distance) {
|
if (16 * Math.abs(location.getX() - x) / 16 > distance || 16 * Math.abs(location.getZ() - z) / 16 > distance) {
|
||||||
@ -163,18 +162,18 @@ public class BlockEventListener implements Listener {
|
|||||||
if (plot.isMerged()) {
|
if (plot.isMerged()) {
|
||||||
disable = true;
|
disable = true;
|
||||||
for (UUID owner : plot.getOwners()) {
|
for (UUID owner : plot.getOwners()) {
|
||||||
if (PlotSquared.platform().getPlayerManager().getPlayerIfExists(owner) != null) {
|
if (PlotSquared.platform().playerManager().getPlayerIfExists(owner) != null) {
|
||||||
disable = false;
|
disable = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
disable = PlotSquared.platform().getPlayerManager().getPlayerIfExists(plot.getOwnerAbs()) == null;
|
disable = PlotSquared.platform().playerManager().getPlayerIfExists(plot.getOwnerAbs()) == null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (disable) {
|
if (disable) {
|
||||||
for (UUID trusted : plot.getTrusted()) {
|
for (UUID trusted : plot.getTrusted()) {
|
||||||
if (PlotSquared.platform().getPlayerManager().getPlayerIfExists(trusted) != null) {
|
if (PlotSquared.platform().playerManager().getPlayerIfExists(trusted) != null) {
|
||||||
disable = false;
|
disable = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -187,7 +186,7 @@ public class BlockEventListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Settings.Redstone.DISABLE_UNOCCUPIED) {
|
if (Settings.Redstone.DISABLE_UNOCCUPIED) {
|
||||||
for (final PlotPlayer<?> player : PlotSquared.platform().getPlayerManager().getPlayers()) {
|
for (final PlotPlayer<?> player : PlotSquared.platform().playerManager().getPlayers()) {
|
||||||
if (plot.equals(player.getCurrentPlot())) {
|
if (plot.equals(player.getCurrentPlot())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,6 @@ import com.plotsquared.core.plot.flag.implementations.VillagerInteractFlag;
|
|||||||
import com.plotsquared.core.plot.flag.types.BlockTypeWrapper;
|
import com.plotsquared.core.plot.flag.types.BlockTypeWrapper;
|
||||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||||
import com.plotsquared.core.util.EventDispatcher;
|
import com.plotsquared.core.util.EventDispatcher;
|
||||||
import com.plotsquared.core.util.MainUtil;
|
|
||||||
import com.plotsquared.core.util.MathMan;
|
import com.plotsquared.core.util.MathMan;
|
||||||
import com.plotsquared.core.util.Permissions;
|
import com.plotsquared.core.util.Permissions;
|
||||||
import com.plotsquared.core.util.PremiumVerification;
|
import com.plotsquared.core.util.PremiumVerification;
|
||||||
@ -83,7 +82,6 @@ import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
|||||||
import com.sk89q.worldedit.world.block.BlockType;
|
import com.sk89q.worldedit.world.block.BlockType;
|
||||||
import io.papermc.lib.PaperLib;
|
import io.papermc.lib.PaperLib;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.TextComponent;
|
|
||||||
import net.kyori.adventure.text.minimessage.Template;
|
import net.kyori.adventure.text.minimessage.Template;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -324,7 +322,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onConnect(PlayerJoinEvent event) {
|
public void onConnect(PlayerJoinEvent event) {
|
||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
PlotSquared.platform().getPlayerManager().removePlayer(player.getUniqueId());
|
PlotSquared.platform().playerManager().removePlayer(player.getUniqueId());
|
||||||
final PlotPlayer<Player> pp = BukkitUtil.adapt(player);
|
final PlotPlayer<Player> pp = BukkitUtil.adapt(player);
|
||||||
|
|
||||||
Location location = pp.getLocation();
|
Location location = pp.getLocation();
|
||||||
@ -660,7 +658,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
|||||||
recipients.clear();
|
recipients.clear();
|
||||||
Set<PlotPlayer<?>> spies = new HashSet<>();
|
Set<PlotPlayer<?>> spies = new HashSet<>();
|
||||||
Set<PlotPlayer<?>> plotRecipients = new HashSet<>();
|
Set<PlotPlayer<?>> plotRecipients = new HashSet<>();
|
||||||
for (final PlotPlayer<?> pp : PlotSquared.platform().getPlayerManager().getPlayers()) {
|
for (final PlotPlayer<?> pp : PlotSquared.platform().playerManager().getPlayers()) {
|
||||||
if (pp.getAttribute("chatspy")) {
|
if (pp.getAttribute("chatspy")) {
|
||||||
spies.add(pp);
|
spies.add(pp);
|
||||||
} else {
|
} else {
|
||||||
|
@ -28,10 +28,9 @@ package com.plotsquared.bukkit.listener;
|
|||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.plotsquared.bukkit.BukkitPlatform;
|
import com.plotsquared.bukkit.BukkitPlatform;
|
||||||
import com.plotsquared.bukkit.placeholder.MVdWPlaceholders;
|
import com.plotsquared.bukkit.placeholder.MVdWPlaceholders;
|
||||||
import com.plotsquared.core.PlotSquared;
|
import com.plotsquared.core.configuration.Settings;
|
||||||
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||||
import com.plotsquared.core.player.ConsolePlayer;
|
import com.plotsquared.core.player.ConsolePlayer;
|
||||||
import com.plotsquared.core.configuration.Settings;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
@ -49,7 +48,7 @@ public class ServerListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler public void onServerLoad(ServerLoadEvent event) {
|
@EventHandler public void onServerLoad(ServerLoadEvent event) {
|
||||||
if (Bukkit.getPluginManager().getPlugin("MVdWPlaceholderAPI") != null && Settings.Enabled_Components.USE_MVDWAPI) {
|
if (Bukkit.getPluginManager().getPlugin("MVdWPlaceholderAPI") != null && Settings.Enabled_Components.USE_MVDWAPI) {
|
||||||
new MVdWPlaceholders(this.plugin, PlotSquared.get().getPlaceholderRegistry());
|
new MVdWPlaceholders(this.plugin, this.plugin.placeholderRegistry());
|
||||||
ConsolePlayer.getConsole().sendMessage(TranslatableCaption.of("placeholder.hooked"));
|
ConsolePlayer.getConsole().sendMessage(TranslatableCaption.of("placeholder.hooked"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ public class PAPIPlaceholders extends PlaceholderExpansion {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override public String onPlaceholderRequest(Player p, String identifier) {
|
@Override public String onPlaceholderRequest(Player p, String identifier) {
|
||||||
final PlotPlayer<?> pl = PlotSquared.platform().getPlayerManager().getPlayerIfExists(p.getUniqueId());
|
final PlotPlayer<?> pl = PlotSquared.platform().playerManager().getPlayerIfExists(p.getUniqueId());
|
||||||
|
|
||||||
if (pl == null) {
|
if (pl == null) {
|
||||||
return "";
|
return "";
|
||||||
@ -83,7 +83,7 @@ public class PAPIPlaceholders extends PlaceholderExpansion {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// PlotSquared placeholders
|
// PlotSquared placeholders
|
||||||
return PlotSquared.get().getPlaceholderRegistry().getPlaceholderValue(identifier, pl);
|
return PlotSquared.platform().placeholderRegistry().getPlaceholderValue(identifier, pl);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -140,7 +140,7 @@ public class BukkitPlayer extends PlotPlayer<Player> {
|
|||||||
private void callEvent(@Nonnull final Event event) {
|
private void callEvent(@Nonnull 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.platform().getPluginName())) {
|
if (listener.getPlugin().getName().equals(PlotSquared.platform().pluginName())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
@ -220,7 +220,7 @@ import java.util.Objects;
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
Objects.requireNonNull(PlotSquared.platform()).getWorldManager()
|
Objects.requireNonNull(PlotSquared.platform()).worldManager()
|
||||||
.handleWorldCreation(builder.worldName(), builder.generatorName());
|
.handleWorldCreation(builder.worldName(), builder.generatorName());
|
||||||
|
|
||||||
if (Bukkit.getWorld(world) != null) {
|
if (Bukkit.getWorld(world) != null) {
|
||||||
|
@ -128,7 +128,7 @@ public class BukkitUtil extends WorldUtil {
|
|||||||
* @return PlotSquared player
|
* @return PlotSquared player
|
||||||
*/
|
*/
|
||||||
@Nonnull public static BukkitPlayer adapt(@Nonnull final Player player) {
|
@Nonnull public static BukkitPlayer adapt(@Nonnull final Player player) {
|
||||||
final PlayerManager<?, ?> playerManager = PlotSquared.platform().getPlayerManager();
|
final PlayerManager<?, ?> playerManager = PlotSquared.platform().playerManager();
|
||||||
return ((BukkitPlayerManager) playerManager).getPlayer(player);
|
return ((BukkitPlayerManager) playerManager).getPlayer(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -317,7 +317,7 @@ public class BukkitUtil extends WorldUtil {
|
|||||||
} else if (world.getBlockAt(location.getX(), location.getY(), location.getZ() - 1).getType().isSolid()) {
|
} else if (world.getBlockAt(location.getX(), location.getY(), location.getZ() - 1).getType().isSolid()) {
|
||||||
facing = BlockFace.SOUTH;
|
facing = BlockFace.SOUTH;
|
||||||
}
|
}
|
||||||
if (PlotSquared.platform().getServerVersion()[1] == 13) {
|
if (PlotSquared.platform().serverVersion()[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);
|
||||||
|
@ -38,7 +38,7 @@ import java.util.ArrayList;
|
|||||||
public class SetGenCB {
|
public class SetGenCB {
|
||||||
|
|
||||||
public static void setGenerator(World world) throws Exception {
|
public static void setGenerator(World world) throws Exception {
|
||||||
PlotSquared.platform().getSetupUtils().updateGenerators();
|
PlotSquared.platform().setupUtils().updateGenerators();
|
||||||
PlotSquared.get().removePlotAreas(world.getName());
|
PlotSquared.get().removePlotAreas(world.getName());
|
||||||
ChunkGenerator gen = world.getGenerator();
|
ChunkGenerator gen = world.getGenerator();
|
||||||
if (gen == null) {
|
if (gen == null) {
|
||||||
|
@ -107,7 +107,7 @@ import java.util.UUID;
|
|||||||
* @see ChunkManager
|
* @see ChunkManager
|
||||||
*/
|
*/
|
||||||
public ChunkManager getChunkManager() {
|
public ChunkManager getChunkManager() {
|
||||||
return PlotSquared.platform().getInjector().getInstance(ChunkManager.class);
|
return PlotSquared.platform().injector().getInstance(ChunkManager.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -116,7 +116,7 @@ import java.util.UUID;
|
|||||||
* @return GlobalBlockQueue.IMP
|
* @return GlobalBlockQueue.IMP
|
||||||
*/
|
*/
|
||||||
public GlobalBlockQueue getBlockQueue() {
|
public GlobalBlockQueue getBlockQueue() {
|
||||||
return PlotSquared.platform().getGlobalBlockQueue();
|
return PlotSquared.platform().globalBlockQueue();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -127,7 +127,7 @@ import java.util.UUID;
|
|||||||
* @see SchematicHandler
|
* @see SchematicHandler
|
||||||
*/
|
*/
|
||||||
public SchematicHandler getSchematicHandler() {
|
public SchematicHandler getSchematicHandler() {
|
||||||
return PlotSquared.platform().getInjector().getInstance(SchematicHandler.class);
|
return PlotSquared.platform().injector().getInstance(SchematicHandler.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -185,7 +185,7 @@ import java.util.UUID;
|
|||||||
* @return a {@code PlotPlayer}
|
* @return a {@code PlotPlayer}
|
||||||
*/
|
*/
|
||||||
@Nullable public PlotPlayer<?> wrapPlayer(@Nonnull final UUID uuid) {
|
@Nullable public PlotPlayer<?> wrapPlayer(@Nonnull final UUID uuid) {
|
||||||
return PlotSquared.platform().getPlayerManager().getPlayerIfExists(uuid);
|
return PlotSquared.platform().playerManager().getPlayerIfExists(uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -195,7 +195,7 @@ import java.util.UUID;
|
|||||||
* @return a {@code PlotPlayer}
|
* @return a {@code PlotPlayer}
|
||||||
*/
|
*/
|
||||||
@Nullable public PlotPlayer<?> wrapPlayer(@Nonnull final String player) {
|
@Nullable public PlotPlayer<?> wrapPlayer(@Nonnull final String player) {
|
||||||
return PlotSquared.platform().getPlayerManager().getPlayerIfExists(player);
|
return PlotSquared.platform().playerManager().getPlayerIfExists(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -46,13 +46,12 @@ import com.plotsquared.core.util.PlayerManager;
|
|||||||
import com.plotsquared.core.util.RegionManager;
|
import com.plotsquared.core.util.RegionManager;
|
||||||
import com.plotsquared.core.util.SetupUtils;
|
import com.plotsquared.core.util.SetupUtils;
|
||||||
import com.plotsquared.core.util.WorldUtil;
|
import com.plotsquared.core.util.WorldUtil;
|
||||||
|
import com.plotsquared.core.util.placeholders.PlaceholderRegistry;
|
||||||
import net.kyori.adventure.audience.Audience;
|
import net.kyori.adventure.audience.Audience;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PlotSquared main utility class
|
* PlotSquared main utility class
|
||||||
@ -66,42 +65,49 @@ public interface PlotPlatform<P> extends LocaleHolder {
|
|||||||
*
|
*
|
||||||
* @return the PlotSquared directory
|
* @return the PlotSquared directory
|
||||||
*/
|
*/
|
||||||
File getDirectory();
|
@Nonnull File getDirectory();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the folder where all world data is stored.
|
* Gets the folder where all world data is stored.
|
||||||
*
|
*
|
||||||
* @return the world folder
|
* @return the world folder
|
||||||
*/
|
*/
|
||||||
File getWorldContainer();
|
@Nonnull File worldContainer();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Completely shuts down the plugin.
|
* Completely shuts down the plugin.
|
||||||
*/
|
*/
|
||||||
void shutdown();
|
void shutdown();
|
||||||
|
|
||||||
default String getPluginName() {
|
/**
|
||||||
|
* Get the name of the plugin
|
||||||
|
*
|
||||||
|
* @return Plugin name
|
||||||
|
*/
|
||||||
|
@Nonnull default String pluginName() {
|
||||||
return "PlotSquared";
|
return "PlotSquared";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the version of Minecraft that is running.
|
* Gets the version of Minecraft that is running
|
||||||
|
*
|
||||||
* @return server version as array of numbers
|
* @return server version as array of numbers
|
||||||
*/
|
*/
|
||||||
int[] getServerVersion();
|
@Nonnull int[] serverVersion();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the server implementation name and version
|
* Gets the server implementation name and version
|
||||||
* @return server implementationa and version as string
|
*
|
||||||
|
* @return server implementation and version as string
|
||||||
*/
|
*/
|
||||||
String getServerImplementation();
|
@Nonnull String serverImplementation();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the NMS package prefix.
|
* Gets the native server code package prefix.
|
||||||
*
|
*
|
||||||
* @return The NMS package prefix
|
* @return The package prefix
|
||||||
*/
|
*/
|
||||||
String getNMSPackage();
|
@Nonnull String serverNativePackage();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start Metrics.
|
* Start Metrics.
|
||||||
@ -125,21 +131,28 @@ public interface PlotPlatform<P> extends LocaleHolder {
|
|||||||
/**
|
/**
|
||||||
* Gets the generator wrapper for a world (world) and generator (name).
|
* Gets the generator wrapper for a world (world) and generator (name).
|
||||||
*
|
*
|
||||||
* @param world the world to get the generator from
|
* @param world The world to get the generator from
|
||||||
* @param name the name of the generator
|
* @param name The name of the generator
|
||||||
* @return the generator being used for the provided world
|
* @return The generator being used for the provided world
|
||||||
*/
|
*/
|
||||||
GeneratorWrapper<?> getGenerator(String world, String name);
|
@Nullable GeneratorWrapper<?> getGenerator(@Nonnull String world, @Nullable String name);
|
||||||
|
|
||||||
GeneratorWrapper<?> wrapPlotGenerator(String world, IndependentPlotGenerator generator);
|
/**
|
||||||
|
* Create a platform generator from a plot generator
|
||||||
|
*
|
||||||
|
* @param world World name
|
||||||
|
* @param generator Plot generator
|
||||||
|
* @return Platform generator wrapper
|
||||||
|
*/
|
||||||
|
@Nonnull GeneratorWrapper<?> wrapPlotGenerator(@Nonnull String world, @Nonnull IndependentPlotGenerator generator);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Usually HybridGen
|
* Usually HybridGen
|
||||||
*
|
*
|
||||||
* @return Default implementation generator
|
* @return Default implementation generator
|
||||||
*/
|
*/
|
||||||
@Nonnull default IndependentPlotGenerator getDefaultGenerator() {
|
@Nonnull default IndependentPlotGenerator defaultGenerator() {
|
||||||
return getInjector().getInstance(Key.get(IndependentPlotGenerator.class, DefaultGenerator.class));
|
return injector().getInstance(Key.get(IndependentPlotGenerator.class, DefaultGenerator.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -147,8 +160,8 @@ public interface PlotPlatform<P> extends LocaleHolder {
|
|||||||
*
|
*
|
||||||
* @return Backup manager
|
* @return Backup manager
|
||||||
*/
|
*/
|
||||||
@Nonnull default BackupManager getBackupManager() {
|
@Nonnull default BackupManager backupManager() {
|
||||||
return getInjector().getInstance(BackupManager.class);
|
return injector().getInstance(BackupManager.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -156,8 +169,8 @@ public interface PlotPlatform<P> extends LocaleHolder {
|
|||||||
*
|
*
|
||||||
* @return World manager
|
* @return World manager
|
||||||
*/
|
*/
|
||||||
@Nonnull default PlatformWorldManager<?> getWorldManager() {
|
@Nonnull default PlatformWorldManager<?> worldManager() {
|
||||||
return getInjector().getInstance(PlatformWorldManager.class);
|
return injector().getInstance(PlatformWorldManager.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -165,8 +178,8 @@ public interface PlotPlatform<P> extends LocaleHolder {
|
|||||||
*
|
*
|
||||||
* @return Player manager
|
* @return Player manager
|
||||||
*/
|
*/
|
||||||
@Nonnull default PlayerManager<? extends PlotPlayer<P>, ? extends P> getPlayerManager() {
|
@Nonnull default PlayerManager<? extends PlotPlayer<P>, ? extends P> playerManager() {
|
||||||
return getInjector().getInstance(Key.get(new TypeLiteral<PlayerManager<? extends PlotPlayer<P>, ? extends P>>() {}));
|
return injector().getInstance(Key.get(new TypeLiteral<PlayerManager<? extends PlotPlayer<P>, ? extends P>>() {}));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -182,15 +195,15 @@ public interface PlotPlatform<P> extends LocaleHolder {
|
|||||||
*
|
*
|
||||||
* @return Injector instance
|
* @return Injector instance
|
||||||
*/
|
*/
|
||||||
@Nonnull Injector getInjector();
|
@Nonnull Injector injector();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the world utility implementation
|
* Get the world utility implementation
|
||||||
*
|
*
|
||||||
* @return World utility
|
* @return World utility
|
||||||
*/
|
*/
|
||||||
@Nonnull default WorldUtil getWorldUtil() {
|
@Nonnull default WorldUtil worldUtil() {
|
||||||
return getInjector().getInstance(WorldUtil.class);
|
return injector().getInstance(WorldUtil.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -198,8 +211,8 @@ public interface PlotPlatform<P> extends LocaleHolder {
|
|||||||
*
|
*
|
||||||
* @return Global block queue implementation
|
* @return Global block queue implementation
|
||||||
*/
|
*/
|
||||||
@Nonnull default GlobalBlockQueue getGlobalBlockQueue() {
|
@Nonnull default GlobalBlockQueue globalBlockQueue() {
|
||||||
return getInjector().getInstance(GlobalBlockQueue.class);
|
return injector().getInstance(GlobalBlockQueue.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -207,8 +220,8 @@ public interface PlotPlatform<P> extends LocaleHolder {
|
|||||||
*
|
*
|
||||||
* @return Hybrid utils
|
* @return Hybrid utils
|
||||||
*/
|
*/
|
||||||
@Nonnull default HybridUtils getHybridUtils() {
|
@Nonnull default HybridUtils hybridUtils() {
|
||||||
return getInjector().getInstance(HybridUtils.class);
|
return injector().getInstance(HybridUtils.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -216,8 +229,8 @@ public interface PlotPlatform<P> extends LocaleHolder {
|
|||||||
*
|
*
|
||||||
* @return Setup utils
|
* @return Setup utils
|
||||||
*/
|
*/
|
||||||
@Nonnull default SetupUtils getSetupUtils() {
|
@Nonnull default SetupUtils setupUtils() {
|
||||||
return getInjector().getInstance(SetupUtils.class);
|
return injector().getInstance(SetupUtils.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -225,8 +238,8 @@ public interface PlotPlatform<P> extends LocaleHolder {
|
|||||||
* *
|
* *
|
||||||
* @return Econ handler
|
* @return Econ handler
|
||||||
*/
|
*/
|
||||||
@Nonnull default EconHandler getEconHandler() {
|
@Nonnull default EconHandler econHandler() {
|
||||||
return getInjector().getInstance(EconHandler.class);
|
return injector().getInstance(EconHandler.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -234,8 +247,8 @@ public interface PlotPlatform<P> extends LocaleHolder {
|
|||||||
*
|
*
|
||||||
* @return Region manager
|
* @return Region manager
|
||||||
*/
|
*/
|
||||||
@Nonnull default RegionManager getRegionManager() {
|
@Nonnull default RegionManager regionManager() {
|
||||||
return getInjector().getInstance(RegionManager.class);
|
return injector().getInstance(RegionManager.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -243,8 +256,8 @@ public interface PlotPlatform<P> extends LocaleHolder {
|
|||||||
*
|
*
|
||||||
* @return Region manager
|
* @return Region manager
|
||||||
*/
|
*/
|
||||||
@Nonnull default ChunkManager getChunkManager() {
|
@Nonnull default ChunkManager chunkManager() {
|
||||||
return getInjector().getInstance(ChunkManager.class);
|
return injector().getInstance(ChunkManager.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -252,9 +265,15 @@ public interface PlotPlatform<P> extends LocaleHolder {
|
|||||||
*
|
*
|
||||||
* @return Console audience
|
* @return Console audience
|
||||||
*/
|
*/
|
||||||
@Nonnull Audience getConsoleAudience();
|
@Nonnull Audience consoleAudience();
|
||||||
|
|
||||||
String getPluginList();
|
/**
|
||||||
|
* Get a formatted string containing all plugins on the server together
|
||||||
|
* with plugin metadata. Mainly for use in debug pastes
|
||||||
|
*
|
||||||
|
* @return Formatted string
|
||||||
|
*/
|
||||||
|
@Nonnull String pluginsFormatted();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load the caption maps
|
* Load the caption maps
|
||||||
@ -266,8 +285,8 @@ public interface PlotPlatform<P> extends LocaleHolder {
|
|||||||
*
|
*
|
||||||
* @return Permission handler
|
* @return Permission handler
|
||||||
*/
|
*/
|
||||||
@Nonnull default PermissionHandler getPermissionHandler() {
|
@Nonnull default PermissionHandler permissionHandler() {
|
||||||
return getInjector().getInstance(PermissionHandler.class);
|
return injector().getInstance(PermissionHandler.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -275,8 +294,17 @@ public interface PlotPlatform<P> extends LocaleHolder {
|
|||||||
*
|
*
|
||||||
* @return Service pipeline
|
* @return Service pipeline
|
||||||
*/
|
*/
|
||||||
@Nonnull default ServicePipeline getServicePipeline() {
|
@Nonnull default ServicePipeline servicePipeline() {
|
||||||
return getInjector().getInstance(ServicePipeline.class);
|
return injector().getInstance(ServicePipeline.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the {@link PlaceholderRegistry} implementation
|
||||||
|
*
|
||||||
|
* @return Placeholder registry
|
||||||
|
*/
|
||||||
|
@Nonnull default PlaceholderRegistry placeholderRegistry() {
|
||||||
|
return injector().getInstance(PlaceholderRegistry.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,6 @@ import com.plotsquared.core.util.FileUtils;
|
|||||||
import com.plotsquared.core.util.LegacyConverter;
|
import com.plotsquared.core.util.LegacyConverter;
|
||||||
import com.plotsquared.core.util.MathMan;
|
import com.plotsquared.core.util.MathMan;
|
||||||
import com.plotsquared.core.util.ReflectionUtils;
|
import com.plotsquared.core.util.ReflectionUtils;
|
||||||
import com.plotsquared.core.util.placeholders.PlaceholderRegistry;
|
|
||||||
import com.plotsquared.core.util.task.TaskManager;
|
import com.plotsquared.core.util.task.TaskManager;
|
||||||
import com.plotsquared.core.uuid.UUIDPipeline;
|
import com.plotsquared.core.uuid.UUIDPipeline;
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
@ -148,7 +147,7 @@ public class PlotSquared {
|
|||||||
private File storageFile;
|
private File storageFile;
|
||||||
private EventDispatcher eventDispatcher;
|
private EventDispatcher eventDispatcher;
|
||||||
private PlotListener plotListener;
|
private PlotListener plotListener;
|
||||||
private PlaceholderRegistry placeholderRegistry;
|
|
||||||
/**
|
/**
|
||||||
* Initialize PlotSquared with the desired Implementation class.
|
* Initialize PlotSquared with the desired Implementation class.
|
||||||
*
|
*
|
||||||
@ -184,7 +183,7 @@ public class PlotSquared {
|
|||||||
GlobalFlagContainer.setup();
|
GlobalFlagContainer.setup();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
new ReflectionUtils(this.platform.getNMSPackage());
|
new ReflectionUtils(this.platform.serverNativePackage());
|
||||||
try {
|
try {
|
||||||
URL logurl = PlotSquared.class.getProtectionDomain().getCodeSource().getLocation();
|
URL logurl = PlotSquared.class.getProtectionDomain().getCodeSource().getLocation();
|
||||||
this.jarFile = new File(
|
this.jarFile = new File(
|
||||||
@ -209,8 +208,6 @@ public class PlotSquared {
|
|||||||
this.eventDispatcher = new EventDispatcher(this.worldedit);
|
this.eventDispatcher = new EventDispatcher(this.worldedit);
|
||||||
// Create plot listener
|
// Create plot listener
|
||||||
this.plotListener = new PlotListener(this.eventDispatcher);
|
this.plotListener = new PlotListener(this.eventDispatcher);
|
||||||
// Create placeholder registry
|
|
||||||
placeholderRegistry = new PlaceholderRegistry(eventDispatcher);
|
|
||||||
|
|
||||||
// Copy files
|
// Copy files
|
||||||
copyFile("addplots.js", Settings.Paths.SCRIPTS);
|
copyFile("addplots.js", Settings.Paths.SCRIPTS);
|
||||||
@ -251,7 +248,7 @@ public class PlotSquared {
|
|||||||
* @return Plot area manager
|
* @return Plot area manager
|
||||||
*/
|
*/
|
||||||
@Nonnull public PlotAreaManager getPlotAreaManager() {
|
@Nonnull public PlotAreaManager getPlotAreaManager() {
|
||||||
return this.platform.getInjector().getInstance(PlotAreaManager.class);
|
return this.platform.injector().getInstance(PlotAreaManager.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -397,7 +394,7 @@ public class PlotSquared {
|
|||||||
logger.info(" - Regions: {}", regions.size());
|
logger.info(" - Regions: {}", regions.size());
|
||||||
logger.info(" - Chunks: {}", chunks.size());
|
logger.info(" - Chunks: {}", chunks.size());
|
||||||
HybridUtils.UPDATE = true;
|
HybridUtils.UPDATE = true;
|
||||||
PlotSquared.platform().getHybridUtils().scheduleRoadUpdate(plotArea, regions, height, chunks);
|
PlotSquared.platform().hybridUtils().scheduleRoadUpdate(plotArea, regions, height, chunks);
|
||||||
} catch (IOException | ClassNotFoundException e) {
|
} catch (IOException | ClassNotFoundException e) {
|
||||||
logger.error("Error restarting road regeneration", e);
|
logger.error("Error restarting road regeneration", e);
|
||||||
} finally {
|
} finally {
|
||||||
@ -833,7 +830,7 @@ public class PlotSquared {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
logger.info("Detected world load for '{}'", world);
|
logger.info("Detected world load for '{}'", world);
|
||||||
String gen_string = worldSection.getString("generator.plugin", platform.getPluginName());
|
String gen_string = worldSection.getString("generator.plugin", platform.pluginName());
|
||||||
if (type == PlotAreaType.PARTIAL) {
|
if (type == PlotAreaType.PARTIAL) {
|
||||||
Set<PlotCluster> clusters =
|
Set<PlotCluster> clusters =
|
||||||
this.clustersTmp != null ? this.clustersTmp.get(world) : new HashSet<>();
|
this.clustersTmp != null ? this.clustersTmp.get(world) : new HashSet<>();
|
||||||
@ -936,7 +933,7 @@ public class PlotSquared {
|
|||||||
clone.set(key, worldSection.get(key));
|
clone.set(key, worldSection.get(key));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String gen_string = clone.getString("generator.plugin", platform.getPluginName());
|
String gen_string = clone.getString("generator.plugin", platform.pluginName());
|
||||||
GeneratorWrapper<?> areaGen = this.platform.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);
|
||||||
@ -1031,7 +1028,7 @@ public class PlotSquared {
|
|||||||
split = combinedArgs;
|
split = combinedArgs;
|
||||||
}
|
}
|
||||||
|
|
||||||
final HybridPlotWorldFactory hybridPlotWorldFactory = this.platform.getInjector().getInstance(HybridPlotWorldFactory.class);
|
final HybridPlotWorldFactory hybridPlotWorldFactory = this.platform.injector().getInstance(HybridPlotWorldFactory.class);
|
||||||
final HybridPlotWorld plotWorld = hybridPlotWorldFactory.create(world, null, generator, null, null);
|
final HybridPlotWorld plotWorld = hybridPlotWorldFactory.create(world, null, generator, null, null);
|
||||||
|
|
||||||
for (String element : split) {
|
for (String element : split) {
|
||||||
@ -1262,7 +1259,7 @@ public class PlotSquared {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
logger.error("==== End of stacktrace ====");
|
logger.error("==== End of stacktrace ====");
|
||||||
logger.error("Please go to the {} 'storage.yml' and configure the database correctly",
|
logger.error("Please go to the {} 'storage.yml' and configure the database correctly",
|
||||||
platform.getPluginName());
|
platform.pluginName());
|
||||||
this.platform.shutdown(); //shutdown used instead of disable because of database error
|
this.platform.shutdown(); //shutdown used instead of disable because of database error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1454,7 +1451,7 @@ public class PlotSquared {
|
|||||||
return this.backgroundUUIDPipeline;
|
return this.backgroundUUIDPipeline;
|
||||||
}
|
}
|
||||||
|
|
||||||
public WorldEdit getWorldedit() {
|
public WorldEdit getWorldEdit() {
|
||||||
return this.worldedit;
|
return this.worldedit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1496,10 +1493,6 @@ public class PlotSquared {
|
|||||||
this.captionMaps.put(namespace.toLowerCase(Locale.ENGLISH), captionMap);
|
this.captionMaps.put(namespace.toLowerCase(Locale.ENGLISH), captionMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
public File getJarFile() {
|
|
||||||
return this.jarFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
public EventDispatcher getEventDispatcher() {
|
public EventDispatcher getEventDispatcher() {
|
||||||
return this.eventDispatcher;
|
return this.eventDispatcher;
|
||||||
}
|
}
|
||||||
@ -1508,10 +1501,6 @@ public class PlotSquared {
|
|||||||
return this.plotListener;
|
return this.plotListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlaceholderRegistry getPlaceholderRegistry() {
|
|
||||||
return this.placeholderRegistry;
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum SortType {
|
public enum SortType {
|
||||||
CREATION_DATE, CREATION_DATE_TIMESTAMP, LAST_MODIFIED, DISTANCE_FROM_ORIGIN
|
CREATION_DATE, CREATION_DATE_TIMESTAMP, LAST_MODIFIED, DISTANCE_FROM_ORIGIN
|
||||||
}
|
}
|
||||||
|
@ -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, @Nonnull final Plot plot, @Nonnull Runnable whenDone) {
|
static void backup(@Nullable PlotPlayer player, @Nonnull final Plot plot, @Nonnull Runnable whenDone) {
|
||||||
Objects.requireNonNull(PlotSquared.platform()).getBackupManager().automaticBackup(player, plot, whenDone);
|
Objects.requireNonNull(PlotSquared.platform()).backupManager().automaticBackup(player, plot, whenDone);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -187,7 +187,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 = PlotId.of(1, 1);
|
final PlotId plotId = PlotId.of(1, 1);
|
||||||
final HybridPlotWorld hybridPlotWorld = this.hybridPlotWorldFactory
|
final HybridPlotWorld hybridPlotWorld = this.hybridPlotWorldFactory
|
||||||
.create(player.getLocation().getWorldName(), args[1], Objects.requireNonNull(PlotSquared.platform()).getDefaultGenerator(),
|
.create(player.getLocation().getWorldName(), args[1], Objects.requireNonNull(PlotSquared.platform()).defaultGenerator(),
|
||||||
plotId, plotId);
|
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();
|
||||||
@ -237,8 +237,8 @@ public class Area extends SubCommand {
|
|||||||
final BlockVector3 singlePos1 = selectedRegion.getMinimumPoint();
|
final BlockVector3 singlePos1 = selectedRegion.getMinimumPoint();
|
||||||
|
|
||||||
// Now the schematic is saved, which is wonderful!
|
// Now the schematic is saved, which is wonderful!
|
||||||
PlotAreaBuilder singleBuilder = PlotAreaBuilder.ofPlotArea(hybridPlotWorld).plotManager(PlotSquared.platform().getPluginName())
|
PlotAreaBuilder singleBuilder = PlotAreaBuilder.ofPlotArea(hybridPlotWorld).plotManager(PlotSquared.platform().pluginName())
|
||||||
.generatorName(PlotSquared.platform().getPluginName()).maximumId(plotId).minimumId(plotId);
|
.generatorName(PlotSquared.platform().pluginName()).maximumId(plotId).minimumId(plotId);
|
||||||
Runnable singleRun = () -> {
|
Runnable singleRun = () -> {
|
||||||
final String path =
|
final String path =
|
||||||
"worlds." + hybridPlotWorld.getWorldName() + ".areas." + hybridPlotWorld.getId() + '-' + singleBuilder.minimumId() + '-'
|
"worlds." + hybridPlotWorld.getWorldName() + ".areas." + hybridPlotWorld.getId() + '-' + singleBuilder.minimumId() + '-'
|
||||||
@ -322,8 +322,8 @@ public class Area extends SubCommand {
|
|||||||
Template.of("cluster", areas.iterator().next().toString()));
|
Template.of("cluster", areas.iterator().next().toString()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlotAreaBuilder builder = PlotAreaBuilder.ofPlotArea(area).plotManager(PlotSquared.platform().getPluginName())
|
PlotAreaBuilder builder = PlotAreaBuilder.ofPlotArea(area).plotManager(PlotSquared.platform().pluginName())
|
||||||
.generatorName(PlotSquared.platform().getPluginName()).minimumId(PlotId.of(1, 1))
|
.generatorName(PlotSquared.platform().pluginName()).minimumId(PlotId.of(1, 1))
|
||||||
.maximumId(PlotId.of(numX, numZ));
|
.maximumId(PlotId.of(numX, numZ));
|
||||||
final String path =
|
final String path =
|
||||||
"worlds." + area.getWorldName() + ".areas." + area.getId() + '-' + builder.minimumId() + '-' + builder
|
"worlds." + area.getWorldName() + ".areas." + area.getId() + '-' + builder.minimumId() + '-' + builder
|
||||||
@ -368,7 +368,7 @@ public class Area extends SubCommand {
|
|||||||
PlotAreaBuilder builder = PlotAreaBuilder.newBuilder();
|
PlotAreaBuilder builder = PlotAreaBuilder.newBuilder();
|
||||||
builder.worldName(split[0]);
|
builder.worldName(split[0]);
|
||||||
final HybridPlotWorld pa =
|
final HybridPlotWorld pa =
|
||||||
this.hybridPlotWorldFactory.create(builder.worldName(), id, PlotSquared.platform().getDefaultGenerator(), null, null);
|
this.hybridPlotWorldFactory.create(builder.worldName(), id, PlotSquared.platform().defaultGenerator(), null, null);
|
||||||
PlotArea other = this.plotAreaManager.getPlotArea(pa.getWorldName(), id);
|
PlotArea other = this.plotAreaManager.getPlotArea(pa.getWorldName(), id);
|
||||||
if (other != null && Objects.equals(pa.getId(), other.getId())) {
|
if (other != null && Objects.equals(pa.getId(), other.getId())) {
|
||||||
player.sendMessage(TranslatableCaption.of("setup.setup_world_taken"), Template.of("value", pa.toString()));
|
player.sendMessage(TranslatableCaption.of("setup.setup_world_taken"), Template.of("value", pa.toString()));
|
||||||
@ -452,8 +452,8 @@ public class Area extends SubCommand {
|
|||||||
ConfigurationSection section = this.worldConfiguration.getConfigurationSection(path);
|
ConfigurationSection section = this.worldConfiguration.getConfigurationSection(path);
|
||||||
pa.saveConfiguration(section);
|
pa.saveConfiguration(section);
|
||||||
pa.loadConfiguration(section);
|
pa.loadConfiguration(section);
|
||||||
builder.plotManager(PlotSquared.platform().getPluginName());
|
builder.plotManager(PlotSquared.platform().pluginName());
|
||||||
builder.generatorName(PlotSquared.platform().getPluginName());
|
builder.generatorName(PlotSquared.platform().pluginName());
|
||||||
String world = this.setupUtils.setupWorld(builder);
|
String world = this.setupUtils.setupWorld(builder);
|
||||||
if (this.worldUtil.isWorld(world)) {
|
if (this.worldUtil.isWorld(world)) {
|
||||||
player.sendMessage(TranslatableCaption.of("setup.setup_finished"));
|
player.sendMessage(TranslatableCaption.of("setup.setup_finished"));
|
||||||
|
@ -167,7 +167,7 @@ public class Auto extends SubCommand {
|
|||||||
@Override public boolean onCommand(final PlotPlayer<?> player, String[] args) {
|
@Override public boolean onCommand(final PlotPlayer<?> player, String[] args) {
|
||||||
PlotArea plotarea = player.getApplicablePlotArea();
|
PlotArea plotarea = player.getApplicablePlotArea();
|
||||||
if (plotarea == null) {
|
if (plotarea == null) {
|
||||||
final PermissionHandler permissionHandler = PlotSquared.platform().getPermissionHandler();
|
final PermissionHandler permissionHandler = PlotSquared.platform().permissionHandler();
|
||||||
if (permissionHandler.hasCapability(
|
if (permissionHandler.hasCapability(
|
||||||
PermissionHandler.PermissionHandlerCapability.PER_WORLD_PERMISSIONS)) {
|
PermissionHandler.PermissionHandlerCapability.PER_WORLD_PERMISSIONS)) {
|
||||||
for (final PlotArea area : this.plotAreaManager.getAllPlotAreas()) {
|
for (final PlotArea area : this.plotAreaManager.getAllPlotAreas()) {
|
||||||
|
@ -35,8 +35,6 @@ import com.plotsquared.core.plot.Plot;
|
|||||||
import com.plotsquared.core.plot.PlotArea;
|
import com.plotsquared.core.plot.PlotArea;
|
||||||
import com.plotsquared.core.plot.flag.PlotFlag;
|
import com.plotsquared.core.plot.flag.PlotFlag;
|
||||||
import com.plotsquared.core.plot.flag.implementations.PriceFlag;
|
import com.plotsquared.core.plot.flag.implementations.PriceFlag;
|
||||||
import com.plotsquared.core.synchronization.LockKey;
|
|
||||||
import com.plotsquared.core.synchronization.LockRepository;
|
|
||||||
import com.plotsquared.core.util.EconHandler;
|
import com.plotsquared.core.util.EconHandler;
|
||||||
import com.plotsquared.core.util.EventDispatcher;
|
import com.plotsquared.core.util.EventDispatcher;
|
||||||
import com.plotsquared.core.util.task.RunnableVal2;
|
import com.plotsquared.core.util.task.RunnableVal2;
|
||||||
@ -44,7 +42,6 @@ import com.plotsquared.core.util.task.RunnableVal3;
|
|||||||
import net.kyori.adventure.text.minimessage.Template;
|
import net.kyori.adventure.text.minimessage.Template;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
@ -106,9 +103,9 @@ public class Buy extends Command {
|
|||||||
Template.of("money", String.valueOf(price))
|
Template.of("money", String.valueOf(price))
|
||||||
);
|
);
|
||||||
|
|
||||||
this.econHandler.depositMoney(PlotSquared.platform().getPlayerManager().getOfflinePlayer(plot.getOwnerAbs()), price);
|
this.econHandler.depositMoney(PlotSquared.platform().playerManager().getOfflinePlayer(plot.getOwnerAbs()), price);
|
||||||
|
|
||||||
PlotPlayer<?> owner = PlotSquared.platform().getPlayerManager().getPlayerIfExists(plot.getOwnerAbs());
|
PlotPlayer<?> owner = PlotSquared.platform().playerManager().getPlayerIfExists(plot.getOwnerAbs());
|
||||||
if (owner != null) {
|
if (owner != null) {
|
||||||
owner.sendMessage(
|
owner.sendMessage(
|
||||||
TranslatableCaption.of("economy.plot_sold"),
|
TranslatableCaption.of("economy.plot_sold"),
|
||||||
|
@ -452,7 +452,7 @@ public class Cluster extends SubCommand {
|
|||||||
cluster.invited.add(uuid);
|
cluster.invited.add(uuid);
|
||||||
DBFunc.setInvited(cluster, uuid);
|
DBFunc.setInvited(cluster, uuid);
|
||||||
final PlotPlayer otherPlayer =
|
final PlotPlayer otherPlayer =
|
||||||
PlotSquared.platform().getPlayerManager().getPlayerIfExists(uuid);
|
PlotSquared.platform().playerManager().getPlayerIfExists(uuid);
|
||||||
if (otherPlayer != null) {
|
if (otherPlayer != null) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("cluster.cluster_invited"),
|
TranslatableCaption.of("cluster.cluster_invited"),
|
||||||
@ -528,7 +528,7 @@ public class Cluster extends SubCommand {
|
|||||||
DBFunc.removeInvited(cluster, uuid);
|
DBFunc.removeInvited(cluster, uuid);
|
||||||
|
|
||||||
final PlotPlayer player2 =
|
final PlotPlayer player2 =
|
||||||
PlotSquared.platform().getPlayerManager().getPlayerIfExists(uuid);
|
PlotSquared.platform().playerManager().getPlayerIfExists(uuid);
|
||||||
if (player2 != null) {
|
if (player2 != null) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("cluster.cluster_removed"),
|
TranslatableCaption.of("cluster.cluster_removed"),
|
||||||
|
@ -108,7 +108,7 @@ public class Comment extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (final PlotPlayer pp : PlotSquared.platform().getPlayerManager().getPlayers()) {
|
for (final PlotPlayer pp : PlotSquared.platform().playerManager().getPlayers()) {
|
||||||
if (pp.getAttribute("chatspy")) {
|
if (pp.getAttribute("chatspy")) {
|
||||||
pp.sendMessage(StaticCaption.of("/plot comment " + StringMan.join(args, " ")));
|
pp.sendMessage(StaticCaption.of("/plot comment " + StringMan.join(args, " ")));
|
||||||
}
|
}
|
||||||
|
@ -162,11 +162,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.platform().getWorldContainer(),
|
new File(PlotSquared.platform().worldContainer(),
|
||||||
id.toCommaSeparatedString());
|
id.toCommaSeparatedString());
|
||||||
if (worldFile.exists()) {
|
if (worldFile.exists()) {
|
||||||
File newFile =
|
File newFile =
|
||||||
new File(PlotSquared.platform().getWorldContainer(),
|
new File(PlotSquared.platform().worldContainer(),
|
||||||
newId.toCommaSeparatedString());
|
newId.toCommaSeparatedString());
|
||||||
worldFile.renameTo(newFile);
|
worldFile.renameTo(newFile);
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ public class DebugImportWorlds extends Command {
|
|||||||
}
|
}
|
||||||
SinglePlotArea area = ((SinglePlotAreaManager) this.plotAreaManager).getArea();
|
SinglePlotArea area = ((SinglePlotAreaManager) this.plotAreaManager).getArea();
|
||||||
PlotId id = PlotId.of(0, 0);
|
PlotId id = PlotId.of(0, 0);
|
||||||
File container = PlotSquared.platform().getWorldContainer();
|
File container = PlotSquared.platform().worldContainer();
|
||||||
if (container.equals(new File("."))) {
|
if (container.equals(new File("."))) {
|
||||||
player.sendMessage(TranslatableCaption.of("debugimportworlds.world_container"));
|
player.sendMessage(TranslatableCaption.of("debugimportworlds.world_container"));
|
||||||
return CompletableFuture.completedFuture(false);
|
return CompletableFuture.completedFuture(false);
|
||||||
|
@ -30,7 +30,6 @@ import com.google.gson.JsonParser;
|
|||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.plotsquared.core.PlotSquared;
|
import com.plotsquared.core.PlotSquared;
|
||||||
import com.plotsquared.core.configuration.Settings;
|
import com.plotsquared.core.configuration.Settings;
|
||||||
import com.plotsquared.core.configuration.caption.StaticCaption;
|
|
||||||
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||||
import com.plotsquared.core.inject.annotations.ConfigFile;
|
import com.plotsquared.core.inject.annotations.ConfigFile;
|
||||||
import com.plotsquared.core.inject.annotations.WorldFile;
|
import com.plotsquared.core.inject.annotations.WorldFile;
|
||||||
@ -49,7 +48,6 @@ import java.lang.management.ManagementFactory;
|
|||||||
import java.lang.management.RuntimeMXBean;
|
import java.lang.management.RuntimeMXBean;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@ -99,11 +97,11 @@ 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.platform().getServerImplementation())
|
b.append("Server Version: ").append(PlotSquared.platform().serverImplementation())
|
||||||
.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(PlotSquared.platform().getPluginList());
|
b.append(PlotSquared.platform().pluginsFormatted());
|
||||||
b.append("\n\n# YAY! Now, let's see what we can find in your JVM\n");
|
b.append("\n\n# YAY! Now, let's see what we can find in your JVM\n");
|
||||||
Runtime runtime = Runtime.getRuntime();
|
Runtime runtime = Runtime.getRuntime();
|
||||||
RuntimeMXBean rb = ManagementFactory.getRuntimeMXBean();
|
RuntimeMXBean rb = ManagementFactory.getRuntimeMXBean();
|
||||||
|
@ -125,7 +125,7 @@ public class Deny extends SubCommand {
|
|||||||
plot.addDenied(uuid);
|
plot.addDenied(uuid);
|
||||||
this.eventDispatcher.callDenied(player, plot, uuid, true);
|
this.eventDispatcher.callDenied(player, plot, uuid, true);
|
||||||
if (!uuid.equals(DBFunc.EVERYONE)) {
|
if (!uuid.equals(DBFunc.EVERYONE)) {
|
||||||
handleKick(PlotSquared.platform().getPlayerManager().getPlayerIfExists(uuid), plot);
|
handleKick(PlotSquared.platform().playerManager().getPlayerIfExists(uuid), plot);
|
||||||
} else {
|
} else {
|
||||||
for (PlotPlayer plotPlayer : plot.getPlayersInPlot()) {
|
for (PlotPlayer plotPlayer : plot.getPlayersInPlot()) {
|
||||||
// Ignore plot-owners
|
// Ignore plot-owners
|
||||||
|
@ -89,7 +89,7 @@ public class Grant extends Command {
|
|||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
final UUIDMapping uuid = uuids.toArray(new UUIDMapping[0])[0];
|
final UUIDMapping uuid = uuids.toArray(new UUIDMapping[0])[0];
|
||||||
PlotPlayer<?> pp = PlotSquared.platform().getPlayerManager().getPlayerIfExists(uuid.getUuid());
|
PlotPlayer<?> pp = PlotSquared.platform().playerManager().getPlayerIfExists(uuid.getUuid());
|
||||||
if (pp != null) {
|
if (pp != null) {
|
||||||
try (final MetaDataAccess<Integer> access = pp.accessPersistentMetaData(
|
try (final MetaDataAccess<Integer> access = pp.accessPersistentMetaData(
|
||||||
PlayerMetaDataKeys.PERSISTENT_GRANTED_PLOTS)) {
|
PlayerMetaDataKeys.PERSISTENT_GRANTED_PLOTS)) {
|
||||||
|
@ -100,7 +100,7 @@ public class Kick extends SubCommand {
|
|||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
PlotPlayer<?> pp = PlotSquared.platform().getPlayerManager().getPlayerIfExists(uuid);
|
PlotPlayer<?> pp = PlotSquared.platform().playerManager().getPlayerIfExists(uuid);
|
||||||
if (pp != null) {
|
if (pp != null) {
|
||||||
players.add(pp);
|
players.add(pp);
|
||||||
}
|
}
|
||||||
|
@ -371,7 +371,7 @@ public class ListCmd extends SubCommand {
|
|||||||
final List<UUIDMapping> names = PlotSquared.get().getImpromptuUUIDPipeline().getNames(plot.getOwners())
|
final List<UUIDMapping> names = PlotSquared.get().getImpromptuUUIDPipeline().getNames(plot.getOwners())
|
||||||
.get(Settings.UUID.BLOCKING_TIMEOUT, TimeUnit.MILLISECONDS);
|
.get(Settings.UUID.BLOCKING_TIMEOUT, TimeUnit.MILLISECONDS);
|
||||||
for (final UUIDMapping uuidMapping : names) {
|
for (final UUIDMapping uuidMapping : names) {
|
||||||
PlotPlayer<?> pp = PlotSquared.platform().getPlayerManager().getPlayerIfExists(uuidMapping.getUuid());
|
PlotPlayer<?> pp = PlotSquared.platform().playerManager().getPlayerIfExists(uuidMapping.getUuid());
|
||||||
Template prefixTemplate = Template.of("prefix", prefix);
|
Template prefixTemplate = Template.of("prefix", prefix);
|
||||||
Template playerTemplate = Template.of("player", uuidMapping.getUsername());
|
Template playerTemplate = Template.of("player", uuidMapping.getUsername());
|
||||||
if (pp != null) {
|
if (pp != null) {
|
||||||
@ -414,7 +414,7 @@ public class ListCmd extends SubCommand {
|
|||||||
completions.add("shared");
|
completions.add("shared");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_LIST_WORLD)) {
|
if (Permissions.hasPermission(player, Permission.PERMISSION_LIST_WORLD)) {
|
||||||
completions.addAll(PlotSquared.platform().getWorldManager().getWorlds());
|
completions.addAll(PlotSquared.platform().worldManager().getWorlds());
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_LIST_TOP)) {
|
if (Permissions.hasPermission(player, Permission.PERMISSION_LIST_TOP)) {
|
||||||
completions.add("top");
|
completions.add("top");
|
||||||
|
@ -72,7 +72,7 @@ public class MainCommand extends Command {
|
|||||||
if (instance == null) {
|
if (instance == null) {
|
||||||
instance = new MainCommand();
|
instance = new MainCommand();
|
||||||
|
|
||||||
final Injector injector = PlotSquared.platform().getInjector();
|
final Injector injector = PlotSquared.platform().injector();
|
||||||
final List<Class<? extends Command>> commands = new LinkedList<>();
|
final List<Class<? extends Command>> commands = new LinkedList<>();
|
||||||
commands.add(Caps.class);
|
commands.add(Caps.class);
|
||||||
commands.add(Buy.class);
|
commands.add(Buy.class);
|
||||||
@ -164,7 +164,7 @@ public class MainCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean onCommand(final PlotPlayer<?> player, String... args) {
|
public static boolean onCommand(final PlotPlayer<?> player, String... args) {
|
||||||
final EconHandler econHandler = PlotSquared.platform().getEconHandler();
|
final EconHandler econHandler = PlotSquared.platform().econHandler();
|
||||||
if (args.length >= 1 && args[0].contains(":")) {
|
if (args.length >= 1 && args[0].contains(":")) {
|
||||||
String[] split2 = args[0].split(":");
|
String[] split2 = args[0].split(":");
|
||||||
if (split2.length == 2) {
|
if (split2.length == 2) {
|
||||||
@ -275,14 +275,14 @@ public class MainCommand extends Command {
|
|||||||
if ("f".equals(args[0].substring(1))) {
|
if ("f".equals(args[0].substring(1))) {
|
||||||
confirm = new RunnableVal3<Command, Runnable, Runnable>() {
|
confirm = new RunnableVal3<Command, Runnable, Runnable>() {
|
||||||
@Override public void run(Command cmd, Runnable success, Runnable failure) {
|
@Override public void run(Command cmd, Runnable success, Runnable failure) {
|
||||||
if (PlotSquared.platform().getEconHandler() != null) {
|
if (PlotSquared.platform().econHandler() != null) {
|
||||||
PlotArea area = player.getApplicablePlotArea();
|
PlotArea area = player.getApplicablePlotArea();
|
||||||
if (area != null) {
|
if (area != null) {
|
||||||
Expression<Double> priceEval =
|
Expression<Double> priceEval =
|
||||||
area.getPrices().get(cmd.getFullId());
|
area.getPrices().get(cmd.getFullId());
|
||||||
Double price = priceEval != null ? priceEval.evaluate(0d) : 0d;
|
Double price = priceEval != null ? priceEval.evaluate(0d) : 0d;
|
||||||
if (price != 0d
|
if (price != 0d
|
||||||
&& PlotSquared.platform().getEconHandler().getMoney(player) < price) {
|
&& PlotSquared.platform().econHandler().getMoney(player) < price) {
|
||||||
if (failure != null) {
|
if (failure != null) {
|
||||||
failure.run();
|
failure.run();
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,6 @@ import com.plotsquared.core.util.StringMan;
|
|||||||
import net.kyori.adventure.text.minimessage.Template;
|
import net.kyori.adventure.text.minimessage.Template;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@CommandDeclaration(command = "merge",
|
@CommandDeclaration(command = "merge",
|
||||||
@ -251,7 +250,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.platform().getPlayerManager().getPlayerIfExists(owner);
|
final PlotPlayer accepter = PlotSquared.platform().playerManager().getPlayerIfExists(owner);
|
||||||
if (!force && accepter == null) {
|
if (!force && accepter == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -260,7 +259,7 @@ public class Merge extends SubCommand {
|
|||||||
Runnable run = () -> {
|
Runnable run = () -> {
|
||||||
accepter.sendMessage(TranslatableCaption.of("merge.merge_accepted"));
|
accepter.sendMessage(TranslatableCaption.of("merge.merge_accepted"));
|
||||||
plot.getPlotModificationManager().autoMerge(dir, maxSize - size, owner, player, terrain);
|
plot.getPlotModificationManager().autoMerge(dir, maxSize - size, owner, player, terrain);
|
||||||
PlotPlayer<?> plotPlayer = PlotSquared.platform().getPlayerManager().getPlayerIfExists(player.getUUID());
|
PlotPlayer<?> plotPlayer = PlotSquared.platform().playerManager().getPlayerIfExists(player.getUUID());
|
||||||
if (plotPlayer == null) {
|
if (plotPlayer == null) {
|
||||||
accepter.sendMessage(TranslatableCaption.of("merge.merge_not_valid"));
|
accepter.sendMessage(TranslatableCaption.of("merge.merge_not_valid"));
|
||||||
return;
|
return;
|
||||||
|
@ -117,7 +117,7 @@ public class Owner extends SetCommand {
|
|||||||
player.sendMessage(TranslatableCaption.of("owner.set_owner"));
|
player.sendMessage(TranslatableCaption.of("owner.set_owner"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final PlotPlayer<?> other = PlotSquared.platform().getPlayerManager().getPlayerIfExists(uuid);
|
final PlotPlayer<?> other = PlotSquared.platform().playerManager().getPlayerIfExists(uuid);
|
||||||
if (plot.isOwner(uuid)) {
|
if (plot.isOwner(uuid)) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("member.already_owner"),
|
TranslatableCaption.of("member.already_owner"),
|
||||||
|
@ -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.getPlatformImplementation().taskAsync(() -> {
|
TaskManager.getPlatformImplementation().taskAsync(() -> {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
StaticCaption.of("<gray>>> </gray><gold><bold>" + PlotSquared.platform().getPluginName() + " <reset><gray>(<gold>Version</gold><gray>: </gray><gold><version></gold><gray>)</gray>"),
|
StaticCaption.of("<gray>>> </gray><gold><bold>" + PlotSquared.platform().pluginName() + " <reset><gray>(<gold>Version</gold><gray>: </gray><gold><version></gold><gray>)</gray>"),
|
||||||
Template.of("version", String.valueOf(PlotSquared.get().getVersion()))
|
Template.of("version", String.valueOf(PlotSquared.get().getVersion()))
|
||||||
);
|
);
|
||||||
player.sendMessage(StaticCaption.of("<gray>>> </gray><gold><bold>Authors<reset><gray>: </gray><gold>Citymonstret </gold><gray>& </gray><gold>Empire92 </gold><gray>& </gray><gold>MattBDev </gold><gray>& </gray><gold>dordsor21 </gold><gray>& </gray><gold>NotMyFault </gold><gray>& </gray><gold>SirYwell</gold>"));
|
player.sendMessage(StaticCaption.of("<gray>>> </gray><gold><bold>Authors<reset><gray>: </gray><gold>Citymonstret </gold><gray>& </gray><gold>Empire92 </gold><gray>& </gray><gold>MattBDev </gold><gray>& </gray><gold>dordsor21 </gold><gray>& </gray><gold>NotMyFault </gold><gray>& </gray><gold>SirYwell</gold>"));
|
||||||
|
@ -165,7 +165,7 @@ public class Set extends SubCommand {
|
|||||||
});
|
});
|
||||||
if (Settings.QUEUE.NOTIFY_PROGRESS) {
|
if (Settings.QUEUE.NOTIFY_PROGRESS) {
|
||||||
queue.addProgressSubscriber(
|
queue.addProgressSubscriber(
|
||||||
PlotSquared.platform().getInjector().getInstance(ProgressSubscriberFactory.class).createWithActor(player));
|
PlotSquared.platform().injector().getInstance(ProgressSubscriberFactory.class).createWithActor(player));
|
||||||
}
|
}
|
||||||
queue.enqueue();
|
queue.enqueue();
|
||||||
player.sendMessage(TranslatableCaption.of("working.generating_component"));
|
player.sendMessage(TranslatableCaption.of("working.generating_component"));
|
||||||
|
@ -62,7 +62,7 @@ public class Setup extends SubCommand {
|
|||||||
StringBuilder message = new StringBuilder();
|
StringBuilder message = new StringBuilder();
|
||||||
message.append("<gold>What generator do you want?</gold>");
|
message.append("<gold>What generator do you want?</gold>");
|
||||||
for (Entry<String, GeneratorWrapper<?>> entry : SetupUtils.generators.entrySet()) {
|
for (Entry<String, GeneratorWrapper<?>> entry : SetupUtils.generators.entrySet()) {
|
||||||
if (entry.getKey().equals(PlotSquared.platform().getPluginName())) {
|
if (entry.getKey().equals(PlotSquared.platform().pluginName())) {
|
||||||
message.append("\n<dark_gray> - </dark_gray><dark_green>").append(entry.getKey()).append(" (Default Generator)</dark_green>");
|
message.append("\n<dark_gray> - </dark_gray><dark_green>").append(entry.getKey()).append(" (Default Generator)</dark_green>");
|
||||||
} else if (entry.getValue().isFull()) {
|
} else if (entry.getValue().isFull()) {
|
||||||
message.append("\n<dark_gray> - </dark_gray><gray>").append(entry.getKey()).append(" (Plot Generator)</gray>");
|
message.append("\n<dark_gray> - </dark_gray><gray>").append(entry.getKey()).append(" (Plot Generator)</gray>");
|
||||||
|
@ -137,7 +137,7 @@ public class Template extends SubCommand {
|
|||||||
public static byte[] getBytes(PlotArea plotArea) {
|
public static byte[] getBytes(PlotArea plotArea) {
|
||||||
ConfigurationSection section = PlotSquared.get().getWorldConfiguration().getConfigurationSection("worlds." + plotArea.getWorldName());
|
ConfigurationSection section = PlotSquared.get().getWorldConfiguration().getConfigurationSection("worlds." + plotArea.getWorldName());
|
||||||
YamlConfiguration config = new YamlConfiguration();
|
YamlConfiguration config = new YamlConfiguration();
|
||||||
String generator = PlotSquared.platform().getSetupUtils().getGenerator(plotArea);
|
String generator = PlotSquared.platform().setupUtils().getGenerator(plotArea);
|
||||||
if (generator != null) {
|
if (generator != null) {
|
||||||
config.set("generator.plugin", generator);
|
config.set("generator.plugin", generator);
|
||||||
}
|
}
|
||||||
@ -219,7 +219,7 @@ public class Template extends SubCommand {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
String manager =
|
String manager =
|
||||||
worldConfig.getString("generator.plugin", PlotSquared.platform().getPluginName());
|
worldConfig.getString("generator.plugin", PlotSquared.platform().pluginName());
|
||||||
String generator = worldConfig.getString("generator.init", manager);
|
String generator = worldConfig.getString("generator.init", manager);
|
||||||
PlotAreaBuilder builder = PlotAreaBuilder.newBuilder()
|
PlotAreaBuilder builder = PlotAreaBuilder.newBuilder()
|
||||||
.plotAreaType(ConfigurationUtil.getType(worldConfig))
|
.plotAreaType(ConfigurationUtil.getType(worldConfig))
|
||||||
|
@ -97,7 +97,7 @@ public class Trim extends SubCommand {
|
|||||||
if (ExpireManager.IMP != null) {
|
if (ExpireManager.IMP != null) {
|
||||||
plots.removeAll(ExpireManager.IMP.getPendingExpired());
|
plots.removeAll(ExpireManager.IMP.getPendingExpired());
|
||||||
}
|
}
|
||||||
result.value1 = new HashSet<>(PlotSquared.platform().getWorldUtil().getChunkChunks(world));
|
result.value1 = new HashSet<>(PlotSquared.platform().worldUtil().getChunkChunks(world));
|
||||||
result.value2 = new HashSet<>();
|
result.value2 = new HashSet<>();
|
||||||
StaticCaption.of(" - MCA #: " + result.value1.size());
|
StaticCaption.of(" - MCA #: " + result.value1.size());
|
||||||
StaticCaption.of(" - CHUNKS: " + (result.value1.size() * 1024) + " (max)");
|
StaticCaption.of(" - CHUNKS: " + (result.value1.size() * 1024) + " (max)");
|
||||||
|
@ -91,7 +91,7 @@ public class AugmentedUtils {
|
|||||||
// Mask
|
// Mask
|
||||||
if (queue == null) {
|
if (queue == null) {
|
||||||
enqueue = true;
|
enqueue = true;
|
||||||
queue = PlotSquared.platform().getGlobalBlockQueue().getNewQueue(PlotSquared.platform().getWorldUtil().getWeWorld(world));
|
queue = PlotSquared.platform().globalBlockQueue().getNewQueue(PlotSquared.platform().worldUtil().getWeWorld(world));
|
||||||
if (chunkObject != null) {
|
if (chunkObject != null) {
|
||||||
queue.setChunkObject(chunkObject);
|
queue.setChunkObject(chunkObject);
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ public class ClassicPlotManager extends SquarePlotManager {
|
|||||||
super(classicPlotWorld, regionManager);
|
super(classicPlotWorld, regionManager);
|
||||||
this.classicPlotWorld = classicPlotWorld;
|
this.classicPlotWorld = classicPlotWorld;
|
||||||
this.regionManager = regionManager;
|
this.regionManager = regionManager;
|
||||||
this.subscriberFactory = PlotSquared.platform().getInjector().getInstance(ProgressSubscriberFactory.class);
|
this.subscriberFactory = PlotSquared.platform().injector().getInstance(ProgressSubscriberFactory.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean setComponent(@Nonnull PlotId plotId,
|
@Override public boolean setComponent(@Nonnull PlotId plotId,
|
||||||
|
@ -50,7 +50,7 @@ public class HybridGen extends IndependentPlotGenerator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override public String getName() {
|
@Override public String getName() {
|
||||||
return PlotSquared.platform().getPluginName();
|
return PlotSquared.platform().pluginName();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void placeSchem(HybridPlotWorld world, ScopedQueueCoordinator result, short relativeX,
|
private void placeSchem(HybridPlotWorld world, ScopedQueueCoordinator result, short relativeX,
|
||||||
|
@ -120,7 +120,7 @@ public class HybridPlotManager extends ClassicPlotManager {
|
|||||||
|
|
||||||
private void resetBiome(@Nonnull final HybridPlotWorld hybridPlotWorld, @Nonnull final Location pos1, @Nonnull final Location pos2) {
|
private void resetBiome(@Nonnull final HybridPlotWorld hybridPlotWorld, @Nonnull final Location pos1, @Nonnull final Location pos2) {
|
||||||
BiomeType biome = hybridPlotWorld.getPlotBiome();
|
BiomeType biome = hybridPlotWorld.getPlotBiome();
|
||||||
if (!Objects.equals(PlotSquared.platform().getWorldUtil()
|
if (!Objects.equals(PlotSquared.platform().worldUtil()
|
||||||
.getBiomeSynchronous(hybridPlotWorld.getWorldName(), (pos1.getX() + pos2.getX()) / 2, (pos1.getZ() + pos2.getZ()) / 2), biome)) {
|
.getBiomeSynchronous(hybridPlotWorld.getWorldName(), (pos1.getX() + pos2.getX()) / 2, (pos1.getZ() + pos2.getZ()) / 2), biome)) {
|
||||||
WorldUtil.setBiome(hybridPlotWorld.getWorldName(), pos1.getX(), pos1.getZ(), pos2.getX(), pos2.getZ(), biome);
|
WorldUtil.setBiome(hybridPlotWorld.getWorldName(), pos1.getX(), pos1.getZ(), pos2.getX(), pos2.getZ(), biome);
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
|||||||
@WorldConfig @Nonnull final YamlConfiguration worldConfiguration,
|
@WorldConfig @Nonnull final YamlConfiguration worldConfiguration,
|
||||||
@Nonnull final GlobalBlockQueue blockQueue) {
|
@Nonnull final GlobalBlockQueue blockQueue) {
|
||||||
super(worldName, id, generator, min, max, worldConfiguration, blockQueue);
|
super(worldName, id, generator, min, max, worldConfiguration, blockQueue);
|
||||||
PlotSquared.platform().getInjector().injectMembers(this);
|
PlotSquared.platform().injector().injectMembers(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static byte wrap(byte data, int start) {
|
public static byte wrap(byte data, int start) {
|
||||||
@ -139,8 +139,8 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull @Override protected PlotManager createManager() {
|
@Nonnull @Override protected PlotManager createManager() {
|
||||||
return new HybridPlotManager(this, PlotSquared.platform().getRegionManager(),
|
return new HybridPlotManager(this, PlotSquared.platform().regionManager(),
|
||||||
PlotSquared.platform().getInjector().getInstance(ProgressSubscriberFactory.class));
|
PlotSquared.platform().injector().getInstance(ProgressSubscriberFactory.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Location getSignLocation(@Nonnull Plot plot) {
|
public Location getSignLocation(@Nonnull Plot plot) {
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
package com.plotsquared.core.inject.modules;
|
package com.plotsquared.core.inject.modules;
|
||||||
|
|
||||||
import com.google.inject.AbstractModule;
|
import com.google.inject.AbstractModule;
|
||||||
import com.google.inject.assistedinject.FactoryModuleBuilder;
|
|
||||||
import com.intellectualsites.services.ServicePipeline;
|
import com.intellectualsites.services.ServicePipeline;
|
||||||
import com.plotsquared.core.PlotSquared;
|
import com.plotsquared.core.PlotSquared;
|
||||||
import com.plotsquared.core.configuration.file.YamlConfiguration;
|
import com.plotsquared.core.configuration.file.YamlConfiguration;
|
||||||
@ -35,10 +34,7 @@ import com.plotsquared.core.inject.annotations.ConfigFile;
|
|||||||
import com.plotsquared.core.inject.annotations.ImpromptuPipeline;
|
import com.plotsquared.core.inject.annotations.ImpromptuPipeline;
|
||||||
import com.plotsquared.core.inject.annotations.WorldConfig;
|
import com.plotsquared.core.inject.annotations.WorldConfig;
|
||||||
import com.plotsquared.core.inject.annotations.WorldFile;
|
import com.plotsquared.core.inject.annotations.WorldFile;
|
||||||
import com.plotsquared.core.inject.factory.ProgressSubscriberFactory;
|
|
||||||
import com.plotsquared.core.listener.PlotListener;
|
import com.plotsquared.core.listener.PlotListener;
|
||||||
import com.plotsquared.core.queue.subscriber.DefaultProgressSubscriber;
|
|
||||||
import com.plotsquared.core.queue.subscriber.ProgressSubscriber;
|
|
||||||
import com.plotsquared.core.util.EventDispatcher;
|
import com.plotsquared.core.util.EventDispatcher;
|
||||||
import com.plotsquared.core.uuid.UUIDPipeline;
|
import com.plotsquared.core.uuid.UUIDPipeline;
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
|
@ -98,14 +98,14 @@ public class PlotListener {
|
|||||||
++value.count;
|
++value.count;
|
||||||
if (value.count == value.interval) {
|
if (value.count == value.interval) {
|
||||||
value.count = 0;
|
value.count = 0;
|
||||||
final PlotPlayer<?> player = PlotSquared.platform().getPlayerManager().getPlayerIfExists(entry.getKey());
|
final PlotPlayer<?> player = PlotSquared.platform().playerManager().getPlayerIfExists(entry.getKey());
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
double level = PlotSquared.platform().getWorldUtil().getHealth(player);
|
double level = PlotSquared.platform().worldUtil().getHealth(player);
|
||||||
if (level != value.max) {
|
if (level != value.max) {
|
||||||
PlotSquared.platform().getWorldUtil().setHealth(player, Math.min(level + value.amount, value.max));
|
PlotSquared.platform().worldUtil().setHealth(player, Math.min(level + value.amount, value.max));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -118,14 +118,14 @@ public class PlotListener {
|
|||||||
++value.count;
|
++value.count;
|
||||||
if (value.count == value.interval) {
|
if (value.count == value.interval) {
|
||||||
value.count = 0;
|
value.count = 0;
|
||||||
final PlotPlayer<?> player = PlotSquared.platform().getPlayerManager().getPlayerIfExists(entry.getKey());
|
final PlotPlayer<?> player = PlotSquared.platform().playerManager().getPlayerIfExists(entry.getKey());
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
int level = PlotSquared.platform().getWorldUtil().getFoodLevel(player);
|
int level = PlotSquared.platform().worldUtil().getFoodLevel(player);
|
||||||
if (level != value.max) {
|
if (level != value.max) {
|
||||||
PlotSquared.platform().getWorldUtil().setFoodLevel(player, Math.min(level + value.amount, value.max));
|
PlotSquared.platform().worldUtil().setFoodLevel(player, Math.min(level + value.amount, value.max));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -167,7 +167,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.platform().getPlayerManager().getPlayerIfExists(uuid);
|
final PlotPlayer owner = PlotSquared.platform().playerManager().getPlayerIfExists(uuid);
|
||||||
if (owner != null && !owner.getUUID().equals(player.getUUID()) && owner.canSee(player)) {
|
if (owner != null && !owner.getUUID().equals(player.getUUID()) && owner.canSee(player)) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("notification.notify_enter"),
|
TranslatableCaption.of("notification.notify_enter"),
|
||||||
@ -354,7 +354,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.platform().getPlayerManager().getPlayerIfExists(uuid);
|
final PlotPlayer owner = PlotSquared.platform().playerManager().getPlayerIfExists(uuid);
|
||||||
if ((owner != null) && !owner.getUUID().equals(player.getUUID()) && owner.canSee(player)) {
|
if ((owner != null) && !owner.getUUID().equals(player.getUUID()) && owner.canSee(player)) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("notification.notify_leave"),
|
TranslatableCaption.of("notification.notify_leave"),
|
||||||
|
@ -73,7 +73,7 @@ public class WESubscriber {
|
|||||||
Actor actor = event.getActor();
|
Actor actor = event.getActor();
|
||||||
if (actor != null && actor.isPlayer()) {
|
if (actor != null && actor.isPlayer()) {
|
||||||
String name = actor.getName();
|
String name = actor.getName();
|
||||||
final PlotPlayer<?> plotPlayer = PlotSquared.platform().getPlayerManager().getPlayerIfExists(name);
|
final PlotPlayer<?> plotPlayer = PlotSquared.platform().playerManager().getPlayerIfExists(name);
|
||||||
Set<CuboidRegion> mask;
|
Set<CuboidRegion> mask;
|
||||||
if (plotPlayer == null) {
|
if (plotPlayer == null) {
|
||||||
Player player = (Player) actor;
|
Player player = (Player) actor;
|
||||||
|
@ -91,7 +91,7 @@ public class ConsolePlayer extends PlotPlayer<Actor> {
|
|||||||
|
|
||||||
public static ConsolePlayer getConsole() {
|
public static ConsolePlayer getConsole() {
|
||||||
if (instance == null) {
|
if (instance == null) {
|
||||||
instance = PlotSquared.platform().getInjector().getInstance(ConsolePlayer.class);
|
instance = PlotSquared.platform().injector().getInstance(ConsolePlayer.class);
|
||||||
instance.teleport(instance.getLocation());
|
instance.teleport(instance.getLocation());
|
||||||
}
|
}
|
||||||
return instance;
|
return instance;
|
||||||
@ -144,7 +144,7 @@ public class ConsolePlayer extends PlotPlayer<Actor> {
|
|||||||
.replace('\u2010', '%').replace('\u2020', '&').replace('\u2030', '&')
|
.replace('\u2010', '%').replace('\u2020', '&').replace('\u2030', '&')
|
||||||
.replace("<prefix>", TranslatableCaption.of("core.prefix").getComponent(this));
|
.replace("<prefix>", TranslatableCaption.of("core.prefix").getComponent(this));
|
||||||
// Parse the message
|
// Parse the message
|
||||||
PlotSquared.platform().getConsoleAudience().sendMessage(MINI_MESSAGE.parse(message, replacements));
|
PlotSquared.platform().consoleAudience().sendMessage(MINI_MESSAGE.parse(message, replacements));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void teleport(Location location, TeleportCause cause) {
|
@Override public void teleport(Location location, TeleportCause cause) {
|
||||||
@ -215,7 +215,7 @@ public class ConsolePlayer extends PlotPlayer<Actor> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override @Nonnull public Audience getAudience() {
|
@Override @Nonnull public Audience getAudience() {
|
||||||
return PlotSquared.platform().getConsoleAudience();
|
return PlotSquared.platform().consoleAudience();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean canSee(final PlotPlayer<?> other) {
|
@Override public boolean canSee(final PlotPlayer<?> other) {
|
||||||
|
@ -584,7 +584,7 @@ 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.platform().getPlayerManager().removePlayer(this);
|
PlotSquared.platform().playerManager().removePlayer(this);
|
||||||
PlotSquared.platform().unregister(this);
|
PlotSquared.platform().unregister(this);
|
||||||
|
|
||||||
debugModeEnabled.remove(this);
|
debugModeEnabled.remove(this);
|
||||||
|
@ -76,7 +76,6 @@ import com.sk89q.worldedit.math.BlockVector3;
|
|||||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.TextComponent;
|
|
||||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||||
import net.kyori.adventure.text.minimessage.Template;
|
import net.kyori.adventure.text.minimessage.Template;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@ -242,7 +241,7 @@ public class Plot {
|
|||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
this.temp = temp;
|
this.temp = temp;
|
||||||
this.flagContainer.setParentContainer(area.getFlagContainer());
|
this.flagContainer.setParentContainer(area.getFlagContainer());
|
||||||
PlotSquared.platform().getInjector().injectMembers(this);
|
PlotSquared.platform().injector().injectMembers(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -294,7 +293,7 @@ public class Plot {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PlotSquared.platform().getInjector().injectMembers(this);
|
PlotSquared.platform().injector().injectMembers(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -515,7 +514,7 @@ public class Plot {
|
|||||||
*/
|
*/
|
||||||
@Nonnull public List<PlotPlayer<?>> getPlayersInPlot() {
|
@Nonnull public List<PlotPlayer<?>> getPlayersInPlot() {
|
||||||
final List<PlotPlayer<?>> players = new ArrayList<>();
|
final List<PlotPlayer<?>> players = new ArrayList<>();
|
||||||
for (final PlotPlayer<?> player : PlotSquared.platform().getPlayerManager().getPlayers()) {
|
for (final PlotPlayer<?> player : PlotSquared.platform().playerManager().getPlayers()) {
|
||||||
if (this.equals(player.getCurrentPlot())) {
|
if (this.equals(player.getCurrentPlot())) {
|
||||||
players.add(player);
|
players.add(player);
|
||||||
}
|
}
|
||||||
@ -1263,7 +1262,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.platform()).getBackupManager().getProfile(current).destroy();
|
Objects.requireNonNull(PlotSquared.platform()).backupManager().getProfile(current).destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
getArea().removePlot(getId());
|
getArea().removePlot(getId());
|
||||||
@ -2528,11 +2527,11 @@ public class Plot {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!isMerged()) {
|
if (!isMerged()) {
|
||||||
return PlotSquared.platform().getPlayerManager().getPlayerIfExists(Objects.requireNonNull(this.getOwnerAbs())) != null;
|
return PlotSquared.platform().playerManager().getPlayerIfExists(Objects.requireNonNull(this.getOwnerAbs())) != null;
|
||||||
}
|
}
|
||||||
for (final Plot current : getConnectedPlots()) {
|
for (final Plot current : getConnectedPlots()) {
|
||||||
if (current.hasOwner()
|
if (current.hasOwner()
|
||||||
&& PlotSquared.platform().getPlayerManager().getPlayerIfExists(Objects.requireNonNull(current.getOwnerAbs())) != null) {
|
&& PlotSquared.platform().playerManager().getPlayerIfExists(Objects.requireNonNull(current.getOwnerAbs())) != null) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2667,7 +2666,7 @@ public class Plot {
|
|||||||
int num = this.getConnectedPlots().size();
|
int num = this.getConnectedPlots().size();
|
||||||
String alias = !this.getAlias().isEmpty() ? this.getAlias() : TranslatableCaption.of("info.none").getComponent(player);
|
String alias = !this.getAlias().isEmpty() ? this.getAlias() : TranslatableCaption.of("info.none").getComponent(player);
|
||||||
Location bot = this.getCorners()[0];
|
Location bot = this.getCorners()[0];
|
||||||
PlotSquared.platform().getWorldUtil().getBiome(Objects.requireNonNull(this.getWorldName()), bot.getX(), bot.getZ(), biome -> {
|
PlotSquared.platform().worldUtil().getBiome(Objects.requireNonNull(this.getWorldName()), bot.getX(), bot.getZ(), biome -> {
|
||||||
Component trusted = PlayerManager.getPlayerList(this.getTrusted());
|
Component trusted = PlayerManager.getPlayerList(this.getTrusted());
|
||||||
Component members = PlayerManager.getPlayerList(this.getMembers());
|
Component members = PlayerManager.getPlayerList(this.getMembers());
|
||||||
Component denied = PlayerManager.getPlayerList(this.getDenied());
|
Component denied = PlayerManager.getPlayerList(this.getDenied());
|
||||||
|
@ -182,7 +182,7 @@ public abstract class PlotArea {
|
|||||||
@Nonnull protected abstract PlotManager createManager();
|
@Nonnull protected abstract PlotManager createManager();
|
||||||
|
|
||||||
public QueueCoordinator getQueue() {
|
public QueueCoordinator getQueue() {
|
||||||
return this.globalBlockQueue.getNewQueue(PlotSquared.platform().getWorldUtil().getWeWorld(worldName));
|
return this.globalBlockQueue.getNewQueue(PlotSquared.platform().worldUtil().getWeWorld(worldName));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -158,7 +158,7 @@ public class PlotCluster {
|
|||||||
public void getHome(@Nonnull final Consumer<Location> result) {
|
public void getHome(@Nonnull final Consumer<Location> result) {
|
||||||
final BlockLoc home = this.settings.getPosition();
|
final BlockLoc home = this.settings.getPosition();
|
||||||
Consumer<Location> locationConsumer = toReturn ->
|
Consumer<Location> locationConsumer = toReturn ->
|
||||||
PlotSquared.platform().getWorldUtil().getHighestBlock(this.area.getWorldName(), toReturn.getX(), toReturn.getZ(),
|
PlotSquared.platform().worldUtil().getHighestBlock(this.area.getWorldName(), toReturn.getX(), toReturn.getZ(),
|
||||||
highest -> {
|
highest -> {
|
||||||
if (highest == 0) {
|
if (highest == 0) {
|
||||||
highest = 63;
|
highest = 63;
|
||||||
|
@ -82,7 +82,7 @@ public final class PlotModificationManager {
|
|||||||
|
|
||||||
@Inject PlotModificationManager(@Nonnull final Plot plot) {
|
@Inject PlotModificationManager(@Nonnull final Plot plot) {
|
||||||
this.plot = plot;
|
this.plot = plot;
|
||||||
this.subscriberFactory = PlotSquared.platform().getInjector().getInstance(ProgressSubscriberFactory.class);
|
this.subscriberFactory = PlotSquared.platform().injector().getInstance(ProgressSubscriberFactory.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -174,7 +174,7 @@ public final class PlotModificationManager {
|
|||||||
Location pos1 = corners[0];
|
Location pos1 = corners[0];
|
||||||
Location pos2 = corners[1];
|
Location pos2 = corners[1];
|
||||||
Location newPos = pos1.add(offsetX, 0, offsetZ).withWorld(destination.getWorldName());
|
Location newPos = pos1.add(offsetX, 0, offsetZ).withWorld(destination.getWorldName());
|
||||||
PlotSquared.platform().getRegionManager().copyRegion(pos1, pos2, newPos, actor, this);
|
PlotSquared.platform().regionManager().copyRegion(pos1, pos2, newPos, actor, this);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
run.run();
|
run.run();
|
||||||
@ -226,7 +226,7 @@ public final class PlotModificationManager {
|
|||||||
Runnable run = () -> {
|
Runnable run = () -> {
|
||||||
for (CuboidRegion region : regions) {
|
for (CuboidRegion region : regions) {
|
||||||
Location[] corners = plot.getCorners(plot.getWorldName(), region);
|
Location[] corners = plot.getCorners(plot.getWorldName(), region);
|
||||||
PlotSquared.platform().getRegionManager().clearAllEntities(corners[0], corners[1]);
|
PlotSquared.platform().regionManager().clearAllEntities(corners[0], corners[1]);
|
||||||
}
|
}
|
||||||
TaskManager.runTask(whenDone);
|
TaskManager.runTask(whenDone);
|
||||||
};
|
};
|
||||||
@ -247,7 +247,7 @@ public final class PlotModificationManager {
|
|||||||
Plot current = queue.poll();
|
Plot current = queue.poll();
|
||||||
if (plot.getArea().getTerrain() != PlotAreaTerrainType.NONE) {
|
if (plot.getArea().getTerrain() != PlotAreaTerrainType.NONE) {
|
||||||
try {
|
try {
|
||||||
PlotSquared.platform().getRegionManager().regenerateRegion(current.getBottomAbs(), current.getTopAbs(), false, this);
|
PlotSquared.platform().regionManager().regenerateRegion(current.getBottomAbs(), current.getTopAbs(), false, this);
|
||||||
} catch (UnsupportedOperationException exception) {
|
} catch (UnsupportedOperationException exception) {
|
||||||
exception.printStackTrace();
|
exception.printStackTrace();
|
||||||
return;
|
return;
|
||||||
@ -282,7 +282,7 @@ public final class PlotModificationManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CuboidRegion region = regions.poll();
|
CuboidRegion region = regions.poll();
|
||||||
PlotSquared.platform().getRegionManager().setBiome(region, extendBiome, biome, plot.getWorldName(), this);
|
PlotSquared.platform().regionManager().setBiome(region, extendBiome, biome, plot.getWorldName(), this);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
run.run();
|
run.run();
|
||||||
@ -363,7 +363,7 @@ public final class PlotModificationManager {
|
|||||||
String id = this.plot.getId().toString();
|
String id = this.plot.getId().toString();
|
||||||
Caption[] lines = new Caption[] {TranslatableCaption.of("signs.owner_sign_line_1"), TranslatableCaption.of("signs.owner_sign_line_2"),
|
Caption[] lines = new Caption[] {TranslatableCaption.of("signs.owner_sign_line_1"), TranslatableCaption.of("signs.owner_sign_line_2"),
|
||||||
TranslatableCaption.of("signs.owner_sign_line_3"), TranslatableCaption.of("signs.owner_sign_line_4")};
|
TranslatableCaption.of("signs.owner_sign_line_3"), TranslatableCaption.of("signs.owner_sign_line_4")};
|
||||||
PlotSquared.platform().getWorldUtil().setSign(location, lines, Template.of("id", id), Template.of("owner", name));
|
PlotSquared.platform().worldUtil().setSign(location, lines, Template.of("id", id), Template.of("owner", name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -377,7 +377,7 @@ public final class PlotModificationManager {
|
|||||||
for (int x = region.getMinimumPoint().getX() >> 4; x <= region.getMaximumPoint().getX() >> 4; x++) {
|
for (int x = region.getMinimumPoint().getX() >> 4; x <= region.getMaximumPoint().getX() >> 4; x++) {
|
||||||
for (int z = region.getMinimumPoint().getZ() >> 4; z <= region.getMaximumPoint().getZ() >> 4; z++) {
|
for (int z = region.getMinimumPoint().getZ() >> 4; z <= region.getMaximumPoint().getZ() >> 4; z++) {
|
||||||
if (chunks.add(BlockVector2.at(x, z))) {
|
if (chunks.add(BlockVector2.at(x, z))) {
|
||||||
PlotSquared.platform().getWorldUtil().refreshChunk(x, z, this.plot.getWorldName());
|
PlotSquared.platform().worldUtil().refreshChunk(x, z, this.plot.getWorldName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -394,7 +394,7 @@ public final class PlotModificationManager {
|
|||||||
}
|
}
|
||||||
Location location = manager.getSignLoc(this.plot);
|
Location location = manager.getSignLoc(this.plot);
|
||||||
QueueCoordinator queue =
|
QueueCoordinator queue =
|
||||||
PlotSquared.platform().getGlobalBlockQueue().getNewQueue(PlotSquared.platform().getWorldUtil().getWeWorld(this.plot.getWorldName()));
|
PlotSquared.platform().globalBlockQueue().getNewQueue(PlotSquared.platform().worldUtil().getWeWorld(this.plot.getWorldName()));
|
||||||
queue.setBlock(location.getX(), location.getY(), location.getZ(), BlockTypes.AIR.getDefaultState());
|
queue.setBlock(location.getX(), location.getY(), location.getZ(), BlockTypes.AIR.getDefaultState());
|
||||||
queue.enqueue();
|
queue.enqueue();
|
||||||
}
|
}
|
||||||
@ -454,7 +454,7 @@ public final class PlotModificationManager {
|
|||||||
DBFunc.createPlotAndSettings(this.plot, () -> {
|
DBFunc.createPlotAndSettings(this.plot, () -> {
|
||||||
PlotArea plotworld = plot.getArea();
|
PlotArea plotworld = plot.getArea();
|
||||||
if (notify && plotworld.isAutoMerge()) {
|
if (notify && plotworld.isAutoMerge()) {
|
||||||
final PlotPlayer<?> player = PlotSquared.platform().getPlayerManager().getPlayerIfExists(uuid);
|
final PlotPlayer<?> player = PlotSquared.platform().playerManager().getPlayerIfExists(uuid);
|
||||||
|
|
||||||
PlotMergeEvent event = PlotSquared.get().getEventDispatcher().callMerge(this.plot, Direction.ALL, Integer.MAX_VALUE, player);
|
PlotMergeEvent event = PlotSquared.get().getEventDispatcher().callMerge(this.plot, Direction.ALL, Integer.MAX_VALUE, player);
|
||||||
|
|
||||||
@ -487,7 +487,7 @@ public final class PlotModificationManager {
|
|||||||
Location top = this.plot.getTopAbs();
|
Location top = this.plot.getTopAbs();
|
||||||
Location pos1 = Location.at(this.plot.getWorldName(), bot.getX(), 0, top.getZ());
|
Location pos1 = Location.at(this.plot.getWorldName(), bot.getX(), 0, top.getZ());
|
||||||
Location pos2 = Location.at(this.plot.getWorldName(), top.getX(), MAX_HEIGHT, bot.getZ());
|
Location pos2 = Location.at(this.plot.getWorldName(), top.getX(), MAX_HEIGHT, bot.getZ());
|
||||||
PlotSquared.platform().getRegionManager().regenerateRegion(pos1, pos2, true, null);
|
PlotSquared.platform().regionManager().regenerateRegion(pos1, pos2, true, null);
|
||||||
} else if (this.plot.getArea().getTerrain() != PlotAreaTerrainType.ALL) { // no road generated => no road to remove
|
} else if (this.plot.getArea().getTerrain() != PlotAreaTerrainType.ALL) { // no road generated => no road to remove
|
||||||
this.plot.getManager().removeRoadSouth(this.plot, queue);
|
this.plot.getManager().removeRoadSouth(this.plot, queue);
|
||||||
}
|
}
|
||||||
@ -683,7 +683,7 @@ public final class PlotModificationManager {
|
|||||||
Location pos1 = corners[0];
|
Location pos1 = corners[0];
|
||||||
Location pos2 = corners[1];
|
Location pos2 = corners[1];
|
||||||
Location pos3 = pos1.add(offsetX, 0, offsetZ).withWorld(destination.getWorldName());
|
Location pos3 = pos1.add(offsetX, 0, offsetZ).withWorld(destination.getWorldName());
|
||||||
PlotSquared.platform().getRegionManager().swap(pos1, pos2, pos3, actor, this);
|
PlotSquared.platform().regionManager().swap(pos1, pos2, pos3, actor, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.run();
|
}.run();
|
||||||
@ -718,7 +718,7 @@ public final class PlotModificationManager {
|
|||||||
final Location pos1 = corners[0];
|
final Location pos1 = corners[0];
|
||||||
final Location pos2 = corners[1];
|
final Location pos2 = corners[1];
|
||||||
Location newPos = pos1.add(offsetX, 0, offsetZ).withWorld(destination.getWorldName());
|
Location newPos = pos1.add(offsetX, 0, offsetZ).withWorld(destination.getWorldName());
|
||||||
PlotSquared.platform().getRegionManager().copyRegion(pos1, pos2, newPos, actor, task);
|
PlotSquared.platform().regionManager().copyRegion(pos1, pos2, newPos, actor, task);
|
||||||
}
|
}
|
||||||
}.run();
|
}.run();
|
||||||
}
|
}
|
||||||
@ -843,7 +843,7 @@ public final class PlotModificationManager {
|
|||||||
Location top = this.plot.getTopAbs();
|
Location top = this.plot.getTopAbs();
|
||||||
Location pos1 = Location.at(this.plot.getWorldName(), top.getX(), 0, bot.getZ());
|
Location pos1 = Location.at(this.plot.getWorldName(), top.getX(), 0, bot.getZ());
|
||||||
Location pos2 = Location.at(this.plot.getWorldName(), bot.getX(), MAX_HEIGHT, top.getZ());
|
Location pos2 = Location.at(this.plot.getWorldName(), bot.getX(), MAX_HEIGHT, top.getZ());
|
||||||
PlotSquared.platform().getRegionManager().regenerateRegion(pos1, pos2, true, null);
|
PlotSquared.platform().regionManager().regenerateRegion(pos1, pos2, true, null);
|
||||||
} else if (this.plot.getArea().getTerrain() != PlotAreaTerrainType.ALL) { // no road generated => no road to remove
|
} else if (this.plot.getArea().getTerrain() != PlotAreaTerrainType.ALL) { // no road generated => no road to remove
|
||||||
this.plot.getArea().getPlotManager().removeRoadEast(this.plot, queue);
|
this.plot.getArea().getPlotManager().removeRoadEast(this.plot, queue);
|
||||||
}
|
}
|
||||||
@ -860,7 +860,7 @@ public final class PlotModificationManager {
|
|||||||
Plot other = this.plot.getRelative(1, 1);
|
Plot other = this.plot.getRelative(1, 1);
|
||||||
Location pos1 = this.plot.getTopAbs().add(1, 0, 1).withY(0);
|
Location pos1 = this.plot.getTopAbs().add(1, 0, 1).withY(0);
|
||||||
Location pos2 = other.getBottomAbs().subtract(1, 0, 1).withY(MAX_HEIGHT);
|
Location pos2 = other.getBottomAbs().subtract(1, 0, 1).withY(MAX_HEIGHT);
|
||||||
PlotSquared.platform().getRegionManager().regenerateRegion(pos1, pos2, true, null);
|
PlotSquared.platform().regionManager().regenerateRegion(pos1, pos2, true, null);
|
||||||
} else if (this.plot.getArea().getTerrain() != PlotAreaTerrainType.ALL) { // no road generated => no road to remove
|
} else if (this.plot.getArea().getTerrain() != PlotAreaTerrainType.ALL) { // no road generated => no road to remove
|
||||||
this.plot.getArea().getPlotManager().removeRoadSouthEast(this.plot, queue);
|
this.plot.getArea().getPlotManager().removeRoadSouthEast(this.plot, queue);
|
||||||
}
|
}
|
||||||
|
@ -356,7 +356,7 @@ public class ExpireManager {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
final Runnable doAnalysis =
|
final Runnable doAnalysis =
|
||||||
() -> PlotSquared.platform().getHybridUtils().analyzePlot(newPlot, handleAnalysis);
|
() -> PlotSquared.platform().hybridUtils().analyzePlot(newPlot, handleAnalysis);
|
||||||
|
|
||||||
PlotAnalysis analysis = newPlot.getComplexity(null);
|
PlotAnalysis analysis = newPlot.getComplexity(null);
|
||||||
if (analysis != null) {
|
if (analysis != null) {
|
||||||
@ -413,14 +413,14 @@ public class ExpireManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (UUID helper : plot.getTrusted()) {
|
for (UUID helper : plot.getTrusted()) {
|
||||||
PlotPlayer<?> player = PlotSquared.platform().getPlayerManager().getPlayerIfExists(helper);
|
PlotPlayer<?> player = PlotSquared.platform().playerManager().getPlayerIfExists(helper);
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
player.sendMessage(TranslatableCaption.of("trusted.plot_removed_user"),
|
player.sendMessage(TranslatableCaption.of("trusted.plot_removed_user"),
|
||||||
Templates.of("plot", plot.toString()));
|
Templates.of("plot", plot.toString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (UUID helper : plot.getMembers()) {
|
for (UUID helper : plot.getMembers()) {
|
||||||
PlotPlayer<?> player = PlotSquared.platform().getPlayerManager().getPlayerIfExists(helper);
|
PlotPlayer<?> player = PlotSquared.platform().playerManager().getPlayerIfExists(helper);
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
player.sendMessage(TranslatableCaption.of("trusted.plot_removed_user"),
|
player.sendMessage(TranslatableCaption.of("trusted.plot_removed_user"),
|
||||||
Templates.of("plot", plot.toString()));
|
Templates.of("plot", plot.toString()));
|
||||||
@ -430,12 +430,12 @@ public class ExpireManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public long getAge(UUID uuid) {
|
public long getAge(UUID uuid) {
|
||||||
if (PlotSquared.platform().getPlayerManager().getPlayerIfExists(uuid) != null) {
|
if (PlotSquared.platform().playerManager().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.platform().getPlayerManager().getOfflinePlayer(uuid);
|
OfflinePlotPlayer opp = PlotSquared.platform().playerManager().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 {
|
||||||
@ -450,7 +450,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.platform().getPlayerManager().getPlayerIfExists(plot.getOwner()) != null || plot.getRunning() > 0) {
|
|| PlotSquared.platform().playerManager().getPlayerIfExists(plot.getOwner()) != null || plot.getRunning() > 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ public class PlotAnalysis {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void analyzePlot(Plot plot, RunnableVal<PlotAnalysis> whenDone) {
|
public static void analyzePlot(Plot plot, RunnableVal<PlotAnalysis> whenDone) {
|
||||||
PlotSquared.platform().getInjector().getInstance(HybridUtils.class).analyzePlot(plot, whenDone);
|
PlotSquared.platform().injector().getInstance(HybridUtils.class).analyzePlot(plot, whenDone);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -88,7 +88,7 @@ public class SinglePlotArea extends GridPlotWorld {
|
|||||||
|
|
||||||
public void loadWorld(final PlotId id) {
|
public void loadWorld(final PlotId id) {
|
||||||
String worldName = id.getX() + "." + id.getY();
|
String worldName = id.getX() + "." + id.getY();
|
||||||
if (PlotSquared.platform().getWorldUtil().isWorld(worldName)) {
|
if (PlotSquared.platform().worldUtil().isWorld(worldName)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PlotAreaBuilder builder = PlotAreaBuilder.newBuilder()
|
PlotAreaBuilder builder = PlotAreaBuilder.newBuilder()
|
||||||
@ -99,7 +99,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.platform().getWorldContainer();
|
File container = PlotSquared.platform().worldContainer();
|
||||||
File destination = new File(container, worldName);
|
File destination = new File(container, worldName);
|
||||||
|
|
||||||
{// convert old
|
{// convert old
|
||||||
@ -141,8 +141,8 @@ public class SinglePlotArea extends GridPlotWorld {
|
|||||||
try {
|
try {
|
||||||
TaskManager.getPlatformImplementation().sync(() -> {
|
TaskManager.getPlatformImplementation().sync(() -> {
|
||||||
final String name = id.getX() + "." + id.getY();
|
final String name = id.getX() + "." + id.getY();
|
||||||
if (!PlotSquared.platform().getWorldUtil().isWorld(name)) {
|
if (!PlotSquared.platform().worldUtil().isWorld(name)) {
|
||||||
PlotSquared.platform().getSetupUtils().setupWorld(builder);
|
PlotSquared.platform().setupUtils().setupWorld(builder);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
@ -65,8 +65,8 @@ public class SinglePlotManager extends PlotManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean clearPlot(@Nonnull Plot plot, final Runnable whenDone, @Nullable PlotPlayer<?> actor, @Nullable QueueCoordinator queue) {
|
@Override public boolean clearPlot(@Nonnull Plot plot, final Runnable whenDone, @Nullable PlotPlayer<?> actor, @Nullable QueueCoordinator queue) {
|
||||||
PlotSquared.platform().getSetupUtils().unload(plot.getWorldName(), false);
|
PlotSquared.platform().setupUtils().unload(plot.getWorldName(), false);
|
||||||
final File worldFolder = new File(PlotSquared.platform().getWorldContainer(), plot.getWorldName());
|
final File worldFolder = new File(PlotSquared.platform().worldContainer(), plot.getWorldName());
|
||||||
TaskManager.getPlatformImplementation().taskAsync(() -> {
|
TaskManager.getPlatformImplementation().taskAsync(() -> {
|
||||||
FileUtils.deleteDirectory(worldFolder);
|
FileUtils.deleteDirectory(worldFolder);
|
||||||
if (whenDone != null) {
|
if (whenDone != null) {
|
||||||
|
@ -52,7 +52,7 @@ public class GlobalBlockQueue {
|
|||||||
@Nonnull public QueueCoordinator getNewQueue(@Nonnull World world) {
|
@Nonnull public QueueCoordinator getNewQueue(@Nonnull World world) {
|
||||||
QueueCoordinator queue = provider.getNewQueue(world);
|
QueueCoordinator queue = provider.getNewQueue(world);
|
||||||
// Auto-inject into the queue
|
// Auto-inject into the queue
|
||||||
PlotSquared.platform().getInjector().injectMembers(queue);
|
PlotSquared.platform().injector().injectMembers(queue);
|
||||||
return queue;
|
return queue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ public abstract class QueueCoordinator {
|
|||||||
* @param world world as all queues should have this constructor
|
* @param world world as all queues should have this constructor
|
||||||
*/
|
*/
|
||||||
public QueueCoordinator(@Nullable World world) {
|
public QueueCoordinator(@Nullable World world) {
|
||||||
PlotSquared.platform().getInjector().injectMembers(this);
|
PlotSquared.platform().injector().injectMembers(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -65,7 +65,7 @@ public enum CommonSetupSteps implements SetupStep {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Nullable @Override public String getDefaultValue() {
|
@Nullable @Override public String getDefaultValue() {
|
||||||
return PlotSquared.platform().getPluginName();
|
return PlotSquared.platform().pluginName();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
CHOOSE_PLOT_AREA_TYPE(PlotAreaType.class, TranslatableCaption.of("setup.setup_world_type")) {
|
CHOOSE_PLOT_AREA_TYPE(PlotAreaType.class, TranslatableCaption.of("setup.setup_world_type")) {
|
||||||
@ -94,7 +94,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.platform().getPluginName());
|
builder.plotManager(PlotSquared.platform().pluginName());
|
||||||
plotPlayer.sendMessage(TranslatableCaption.of("setup.setup_world_generator_error"));
|
plotPlayer.sendMessage(TranslatableCaption.of("setup.setup_world_generator_error"));
|
||||||
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?
|
||||||
@ -198,7 +198,7 @@ public enum CommonSetupSteps implements SetupStep {
|
|||||||
plotPlayer.sendMessage(TranslatableCaption.of("setup.setup_world_name_format"));
|
plotPlayer.sendMessage(TranslatableCaption.of("setup.setup_world_name_format"));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
if (PlotSquared.platform().getWorldUtil().isWorld(argument)) {
|
if (PlotSquared.platform().worldUtil().isWorld(argument)) {
|
||||||
if (PlotSquared.get().getPlotAreaManager().hasPlotArea(argument)) {
|
if (PlotSquared.get().getPlotAreaManager().hasPlotArea(argument)) {
|
||||||
plotPlayer.sendMessage(TranslatableCaption.of("setup.setup_world_taken"));
|
plotPlayer.sendMessage(TranslatableCaption.of("setup.setup_world_taken"));
|
||||||
return this;
|
return this;
|
||||||
@ -212,12 +212,12 @@ public enum CommonSetupSteps implements SetupStep {
|
|||||||
}
|
}
|
||||||
String world;
|
String world;
|
||||||
if (builder.setupManager() == null) {
|
if (builder.setupManager() == null) {
|
||||||
world = PlotSquared.platform().getInjector().getInstance(SetupUtils.class).setupWorld(builder);
|
world = PlotSquared.platform().injector().getInstance(SetupUtils.class).setupWorld(builder);
|
||||||
} else {
|
} else {
|
||||||
world = builder.setupManager().setupWorld(builder);
|
world = builder.setupManager().setupWorld(builder);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
plotPlayer.teleport(PlotSquared.platform().getWorldUtil().getSpawn(world), TeleportCause.COMMAND);
|
plotPlayer.teleport(PlotSquared.platform().worldUtil().getSpawn(world), TeleportCause.COMMAND);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
plotPlayer.sendMessage(TranslatableCaption.of("errors.error_console"));
|
plotPlayer.sendMessage(TranslatableCaption.of("errors.error_console"));
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -60,7 +60,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.platform().getPluginName())
|
.plotManager(PlotSquared.platform().pluginName())
|
||||||
.minimumId(area.getMin())
|
.minimumId(area.getMin())
|
||||||
.maximumId(area.getMax())
|
.maximumId(area.getMax())
|
||||||
.settingsNodesWrapper(new SettingsNodesWrapper(area.getSettingNodes(), null));
|
.settingsNodesWrapper(new SettingsNodesWrapper(area.getSettingNodes(), null));
|
||||||
|
@ -45,7 +45,7 @@ public abstract class ChunkManager {
|
|||||||
RunnableVal<ScopedQueueCoordinator> add,
|
RunnableVal<ScopedQueueCoordinator> add,
|
||||||
String world,
|
String world,
|
||||||
BlockVector2 loc) {
|
BlockVector2 loc) {
|
||||||
QueueCoordinator queue = PlotSquared.platform().getGlobalBlockQueue().getNewQueue(PlotSquared.platform().getWorldUtil().getWeWorld(world));
|
QueueCoordinator queue = PlotSquared.platform().globalBlockQueue().getNewQueue(PlotSquared.platform().worldUtil().getWeWorld(world));
|
||||||
if (PlotSquared.get().getPlotAreaManager().isAugmented(world) && PlotSquared.get().isNonStandardGeneration(world, loc)) {
|
if (PlotSquared.get().getPlotAreaManager().isAugmented(world) && PlotSquared.get().isNonStandardGeneration(world, loc)) {
|
||||||
int blockX = loc.getX() << 4;
|
int blockX = loc.getX() << 4;
|
||||||
int blockZ = loc.getZ() << 4;
|
int blockZ = loc.getZ() << 4;
|
||||||
|
@ -67,7 +67,7 @@ public final class LegacyConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private BlockBucket blockToBucket(@Nonnull final String block) {
|
private BlockBucket blockToBucket(@Nonnull final String block) {
|
||||||
final BlockState plotBlock = PlotSquared.platform().getWorldUtil().getClosestBlock(block).best;
|
final BlockState plotBlock = PlotSquared.platform().worldUtil().getClosestBlock(block).best;
|
||||||
return BlockBucket.withSingle(plotBlock);
|
return BlockBucket.withSingle(plotBlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,7 +104,7 @@ public final class LegacyConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private BlockState[] splitBlockList(@Nonnull final List<String> list) {
|
private BlockState[] splitBlockList(@Nonnull final List<String> list) {
|
||||||
return list.stream().map(s -> PlotSquared.platform().getWorldUtil().getClosestBlock(s).best)
|
return list.stream().map(s -> PlotSquared.platform().worldUtil().getClosestBlock(s).best)
|
||||||
.toArray(BlockState[]::new);
|
.toArray(BlockState[]::new);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ public abstract class RegionManager {
|
|||||||
TaskManager.runTaskAsync(() -> {
|
TaskManager.runTaskAsync(() -> {
|
||||||
for (BlockVector2 loc : chunks) {
|
for (BlockVector2 loc : chunks) {
|
||||||
String directory = world + File.separator + "region" + File.separator + "r." + loc.getX() + "." + loc.getZ() + ".mca";
|
String directory = world + File.separator + "region" + File.separator + "r." + loc.getX() + "." + loc.getZ() + ".mca";
|
||||||
File file = new File(PlotSquared.platform().getWorldContainer(), directory);
|
File file = new File(PlotSquared.platform().worldContainer(), directory);
|
||||||
logger.info("- Deleting file: {} (max 1024 chunks)", file.getName());
|
logger.info("- Deleting file: {} (max 1024 chunks)", file.getName());
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
file.delete();
|
file.delete();
|
||||||
|
@ -224,7 +224,7 @@ public final class TabCompletions {
|
|||||||
cachedCompletionValues.put(cacheIdentifier, players);
|
cachedCompletionValues.put(cacheIdentifier, players);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
final Collection<? extends PlotPlayer<?>> onlinePlayers = PlotSquared.platform().getPlayerManager().getPlayers();
|
final Collection<? extends PlotPlayer<?>> onlinePlayers = PlotSquared.platform().playerManager().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())) {
|
||||||
|
@ -83,7 +83,7 @@ public abstract class WorldUtil {
|
|||||||
BlockVector3 pos1 = BlockVector2.at(p1x, p1z).toBlockVector3();
|
BlockVector3 pos1 = BlockVector2.at(p1x, p1z).toBlockVector3();
|
||||||
BlockVector3 pos2 = BlockVector2.at(p2x, p2z).toBlockVector3(Plot.MAX_HEIGHT - 1);
|
BlockVector3 pos2 = BlockVector2.at(p2x, p2z).toBlockVector3(Plot.MAX_HEIGHT - 1);
|
||||||
CuboidRegion region = new CuboidRegion(pos1, pos2);
|
CuboidRegion region = new CuboidRegion(pos1, pos2);
|
||||||
PlotSquared.platform().getWorldUtil().setBiomes(world, region, biome);
|
PlotSquared.platform().worldUtil().setBiomes(world, region, biome);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -293,7 +293,7 @@ public abstract class WorldUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Nullable final File getDat(@Nonnull final String world) {
|
@Nullable final File getDat(@Nonnull final String world) {
|
||||||
File file = new File(PlotSquared.platform().getWorldContainer() + File.separator + world + File.separator + "level.dat");
|
File file = new File(PlotSquared.platform().worldContainer() + File.separator + world + File.separator + "level.dat");
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
@ -302,7 +302,7 @@ public abstract class WorldUtil {
|
|||||||
|
|
||||||
@Nullable private File getMcr(@Nonnull final String world, final int x, final int z) {
|
@Nullable private File getMcr(@Nonnull final String world, final int x, final int z) {
|
||||||
final File file =
|
final File file =
|
||||||
new File(PlotSquared.platform().getWorldContainer(), world + File.separator + "region" + File.separator + "r." + x + '.' + z + ".mca");
|
new File(PlotSquared.platform().worldContainer(), world + File.separator + "region" + File.separator + "r." + x + '.' + z + ".mca");
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
@ -311,7 +311,7 @@ public abstract class WorldUtil {
|
|||||||
|
|
||||||
|
|
||||||
public Set<BlockVector2> getChunkChunks(String world) {
|
public Set<BlockVector2> getChunkChunks(String world) {
|
||||||
File folder = new File(PlotSquared.platform().getWorldContainer(), world + File.separator + "region");
|
File folder = new File(PlotSquared.platform().worldContainer(), world + File.separator + "region");
|
||||||
File[] regionFiles = folder.listFiles();
|
File[] regionFiles = folder.listFiles();
|
||||||
if (regionFiles == null) {
|
if (regionFiles == null) {
|
||||||
throw new RuntimeException("Could not find worlds folder: " + folder + " ? (no read access?)");
|
throw new RuntimeException("Could not find worlds folder: " + folder + " ? (no read access?)");
|
||||||
|
@ -50,7 +50,7 @@ public class EntityCategories {
|
|||||||
public static final EntityCategory PLAYER = register("player");
|
public static final EntityCategory PLAYER = register("player");
|
||||||
|
|
||||||
public static EntityCategory register(final String id) {
|
public static EntityCategory register(final String id) {
|
||||||
final EntityCategory entityCategory = new EntityCategory(PlotSquared.platform().getWorldUtil(), id);
|
final EntityCategory entityCategory = new EntityCategory(PlotSquared.platform().worldUtil(), id);
|
||||||
EntityCategory.REGISTRY.register(entityCategory.getId(), entityCategory);
|
EntityCategory.REGISTRY.register(entityCategory.getId(), entityCategory);
|
||||||
return entityCategory;
|
return entityCategory;
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ package com.plotsquared.core.util.placeholders;
|
|||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
import com.google.inject.Singleton;
|
||||||
import com.plotsquared.core.player.PlotPlayer;
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
import com.plotsquared.core.plot.Plot;
|
import com.plotsquared.core.plot.Plot;
|
||||||
import com.plotsquared.core.plot.flag.GlobalFlagContainer;
|
import com.plotsquared.core.plot.flag.GlobalFlagContainer;
|
||||||
@ -37,6 +38,7 @@ import com.plotsquared.core.util.PlayerManager;
|
|||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import javax.inject.Inject;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
@ -47,12 +49,13 @@ import java.util.function.BiFunction;
|
|||||||
/**
|
/**
|
||||||
* Registry that contains {@link Placeholder placeholders}
|
* Registry that contains {@link Placeholder placeholders}
|
||||||
*/
|
*/
|
||||||
|
@Singleton
|
||||||
public final class PlaceholderRegistry {
|
public final class PlaceholderRegistry {
|
||||||
|
|
||||||
private final Map<String, Placeholder> placeholders;
|
private final Map<String, Placeholder> placeholders;
|
||||||
private final EventDispatcher eventDispatcher;
|
private final EventDispatcher eventDispatcher;
|
||||||
|
|
||||||
public PlaceholderRegistry(@Nonnull final EventDispatcher eventDispatcher) {
|
@Inject public PlaceholderRegistry(@Nonnull final EventDispatcher eventDispatcher) {
|
||||||
this.placeholders = Maps.newHashMap();
|
this.placeholders = Maps.newHashMap();
|
||||||
this.eventDispatcher = eventDispatcher;
|
this.eventDispatcher = eventDispatcher;
|
||||||
this.registerDefault();
|
this.registerDefault();
|
||||||
|
Loading…
Reference in New Issue
Block a user