mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-25 02:04:44 +02:00
Switch to using QueueCoordinators everywhere
This commit is contained in:
@ -90,7 +90,6 @@ import com.plotsquared.core.plot.message.PlainChatManager;
|
||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||
import com.plotsquared.core.plot.world.SinglePlotArea;
|
||||
import com.plotsquared.core.plot.world.SinglePlotAreaManager;
|
||||
import com.plotsquared.core.queue.GlobalBlockQueue;
|
||||
import com.plotsquared.core.setup.PlotAreaBuilder;
|
||||
import com.plotsquared.core.setup.SettingsNodesWrapper;
|
||||
import com.plotsquared.core.util.ChatManager;
|
||||
@ -156,9 +155,11 @@ import static com.plotsquared.core.util.PremiumVerification.getResourceID;
|
||||
import static com.plotsquared.core.util.PremiumVerification.getUserID;
|
||||
import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
|
||||
|
||||
@SuppressWarnings("unused") public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPlatform<Player> {
|
||||
@SuppressWarnings("unused")
|
||||
public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPlatform<Player> {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger("P2/" + BukkitPlatform.class.getSimpleName());
|
||||
private static final Logger logger =
|
||||
LoggerFactory.getLogger("P2/" + BukkitPlatform.class.getSimpleName());
|
||||
private static final int BSTATS_ID = 1404;
|
||||
|
||||
static {
|
||||
@ -233,8 +234,9 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
|
||||
|
||||
// We create the injector after PlotSquared has been initialized, so that we have access
|
||||
// to generated instances and settings
|
||||
this.injector = Guice.createInjector(Stage.PRODUCTION, new WorldManagerModule(), new PlotSquaredModule(),
|
||||
new BukkitModule(this), new BackupModule());
|
||||
this.injector = Guice
|
||||
.createInjector(Stage.PRODUCTION, new WorldManagerModule(), new PlotSquaredModule(),
|
||||
new BukkitModule(this), new BackupModule());
|
||||
this.injector.injectMembers(this);
|
||||
|
||||
if (PremiumVerification.isPremium() && Settings.Enabled_Components.UPDATE_NOTIFICATIONS) {
|
||||
@ -288,34 +290,37 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
|
||||
if (Settings.Enabled_Components.WORLDEDIT_RESTRICTIONS) {
|
||||
try {
|
||||
logger.info("[P2] {} hooked into WorldEdit", this.getPluginName());
|
||||
WorldEdit.getInstance().getEventBus().register(this.getInjector().getInstance(WESubscriber.class));
|
||||
WorldEdit.getInstance().getEventBus()
|
||||
.register(this.getInjector().getInstance(WESubscriber.class));
|
||||
if (Settings.Enabled_Components.COMMANDS) {
|
||||
new WE_Anywhere();
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
logger.error("[P2] Incompatible version of WorldEdit, please upgrade: http://builds.enginehub.org/job/worldedit?branch=master");
|
||||
logger.error(
|
||||
"[P2] Incompatible version of WorldEdit, please upgrade: http://builds.enginehub.org/job/worldedit?branch=master");
|
||||
}
|
||||
}
|
||||
|
||||
if (Settings.Enabled_Components.EVENTS) {
|
||||
getServer().getPluginManager().registerEvents(getInjector().getInstance(PlayerEvents.class), this);
|
||||
getServer().getPluginManager().registerEvents(getInjector().getInstance(EntitySpawnListener.class), this);
|
||||
getServer().getPluginManager()
|
||||
.registerEvents(getInjector().getInstance(PlayerEvents.class), this);
|
||||
getServer().getPluginManager()
|
||||
.registerEvents(getInjector().getInstance(EntitySpawnListener.class), this);
|
||||
if (PaperLib.isPaper() && Settings.Paper_Components.PAPER_LISTENERS) {
|
||||
getServer().getPluginManager().registerEvents(getInjector().getInstance(PaperListener.class), this);
|
||||
getServer().getPluginManager()
|
||||
.registerEvents(getInjector().getInstance(PaperListener.class), this);
|
||||
}
|
||||
this.plotListener.startRunnable();
|
||||
}
|
||||
|
||||
// Required
|
||||
getServer().getPluginManager().registerEvents(getInjector().getInstance(WorldEvents.class), this);
|
||||
getServer().getPluginManager()
|
||||
.registerEvents(getInjector().getInstance(WorldEvents.class), this);
|
||||
if (Settings.Enabled_Components.CHUNK_PROCESSOR) {
|
||||
getServer().getPluginManager().registerEvents(getInjector().getInstance(ChunkListener.class), this);
|
||||
getServer().getPluginManager()
|
||||
.registerEvents(getInjector().getInstance(ChunkListener.class), this);
|
||||
}
|
||||
|
||||
// Start the global block queue
|
||||
final GlobalBlockQueue globalBlockQueue = this.injector.getInstance(GlobalBlockQueue.class);
|
||||
globalBlockQueue.runTask();
|
||||
|
||||
// Commands
|
||||
if (Settings.Enabled_Components.COMMANDS) {
|
||||
this.registerCommands();
|
||||
@ -344,7 +349,8 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
|
||||
}
|
||||
|
||||
// World generators:
|
||||
final ConfigurationSection section = this.worldConfiguration.getConfigurationSection("worlds");
|
||||
final ConfigurationSection section =
|
||||
this.worldConfiguration.getConfigurationSection("worlds");
|
||||
final WorldUtil worldUtil = getInjector().getInstance(WorldUtil.class);
|
||||
|
||||
if (section != null) {
|
||||
@ -362,11 +368,15 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
|
||||
continue;
|
||||
}
|
||||
if (!worldUtil.isWorld(world) && !world.equals("*")) {
|
||||
logger.warn("[P2] `{}` was not properly loaded - {} will now try to load it properly",
|
||||
logger.warn(
|
||||
"[P2] `{}` was not properly loaded - {} will now try to load it properly",
|
||||
world, this.getPluginName());
|
||||
logger.warn("[P2] - Are you trying to delete this world? Remember to remove it from the worlds.yml, bukkit.yml and multiverse worlds.yml");
|
||||
logger.warn("[P2] - Your world management plugin may be faulty (or non existent)");
|
||||
logger.warn("[P2] This message may also be a false positive and could be ignored.");
|
||||
logger.warn(
|
||||
"[P2] - Are you trying to delete this world? Remember to remove it from the worlds.yml, bukkit.yml and multiverse worlds.yml");
|
||||
logger.warn(
|
||||
"[P2] - Your world management plugin may be faulty (or non existent)");
|
||||
logger.warn(
|
||||
"[P2] This message may also be a false positive and could be ignored.");
|
||||
this.setGenerator(world);
|
||||
}
|
||||
}
|
||||
@ -374,7 +384,8 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
|
||||
}
|
||||
|
||||
// Services are accessed in order
|
||||
final CacheUUIDService cacheUUIDService = new CacheUUIDService(Settings.UUID.UUID_CACHE_SIZE);
|
||||
final CacheUUIDService cacheUUIDService =
|
||||
new CacheUUIDService(Settings.UUID.UUID_CACHE_SIZE);
|
||||
this.impromptuPipeline.registerService(cacheUUIDService);
|
||||
this.backgroundPipeline.registerService(cacheUUIDService);
|
||||
this.impromptuPipeline.registerConsumer(cacheUUIDService);
|
||||
@ -390,7 +401,8 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
|
||||
}
|
||||
|
||||
if (Settings.UUID.SERVICE_BUKKIT) {
|
||||
final OfflinePlayerUUIDService offlinePlayerUUIDService = new OfflinePlayerUUIDService();
|
||||
final OfflinePlayerUUIDService offlinePlayerUUIDService =
|
||||
new OfflinePlayerUUIDService();
|
||||
this.impromptuPipeline.registerService(offlinePlayerUUIDService);
|
||||
this.backgroundPipeline.registerService(offlinePlayerUUIDService);
|
||||
}
|
||||
@ -406,8 +418,8 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
|
||||
}
|
||||
|
||||
final LuckPermsUUIDService luckPermsUUIDService;
|
||||
if (Settings.UUID.SERVICE_LUCKPERMS &&
|
||||
Bukkit.getPluginManager().getPlugin("LuckPerms") != null) {
|
||||
if (Settings.UUID.SERVICE_LUCKPERMS
|
||||
&& Bukkit.getPluginManager().getPlugin("LuckPerms") != null) {
|
||||
luckPermsUUIDService = new LuckPermsUUIDService();
|
||||
logger.info("[P2] (UUID) Using LuckPerms as a complementary UUID service");
|
||||
} else {
|
||||
@ -415,8 +427,8 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
|
||||
}
|
||||
|
||||
final BungeePermsUUIDService bungeePermsUUIDService;
|
||||
if (Settings.UUID.SERVICE_BUNGEE_PERMS &&
|
||||
Bukkit.getPluginManager().getPlugin("BungeePerms") != null) {
|
||||
if (Settings.UUID.SERVICE_BUNGEE_PERMS
|
||||
&& Bukkit.getPluginManager().getPlugin("BungeePerms") != null) {
|
||||
bungeePermsUUIDService = new BungeePermsUUIDService();
|
||||
logger.info("[P2] (UUID) Using BungeePerms as a complementary UUID service");
|
||||
} else {
|
||||
@ -424,7 +436,8 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
|
||||
}
|
||||
|
||||
final EssentialsUUIDService essentialsUUIDService;
|
||||
if (Settings.UUID.SERVICE_ESSENTIALSX && Bukkit.getPluginManager().getPlugin("Essentials") != null) {
|
||||
if (Settings.UUID.SERVICE_ESSENTIALSX
|
||||
&& Bukkit.getPluginManager().getPlugin("Essentials") != null) {
|
||||
essentialsUUIDService = new EssentialsUUIDService();
|
||||
logger.info("[P2] (UUID) Using EssentialsX as a complementary UUID service");
|
||||
} else {
|
||||
@ -511,8 +524,10 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
|
||||
// Clean up potential memory leak
|
||||
Bukkit.getScheduler().runTaskTimer(this, () -> {
|
||||
try {
|
||||
for (final PlotPlayer<? extends Player> player : this.getPlayerManager().getPlayers()) {
|
||||
if (player.getPlatformPlayer() == null || !player.getPlatformPlayer().isOnline()) {
|
||||
for (final PlotPlayer<? extends Player> player : this.getPlayerManager()
|
||||
.getPlayers()) {
|
||||
if (player.getPlatformPlayer() == null || !player.getPlatformPlayer()
|
||||
.isOnline()) {
|
||||
this.getPlayerManager().removePlayer(player);
|
||||
}
|
||||
}
|
||||
@ -626,7 +641,8 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
|
||||
// Now fetch names for all known UUIDs
|
||||
final int totalSize = uuidQueue.size();
|
||||
int read = 0;
|
||||
logger.info("[P2] (UUID) PlotSquared will fetch UUIDs in groups of {}", Settings.UUID.BACKGROUND_LIMIT);
|
||||
logger.info("[P2] (UUID) PlotSquared will fetch UUIDs in groups of {}",
|
||||
Settings.UUID.BACKGROUND_LIMIT);
|
||||
final List<UUID> uuidList = new ArrayList<>(Settings.UUID.BACKGROUND_LIMIT);
|
||||
|
||||
// Used to indicate that the second retrieval has been attempted
|
||||
@ -659,7 +675,8 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
|
||||
// Print progress
|
||||
final double percentage = ((double) read / (double) totalSize) * 100.0D;
|
||||
if (Settings.DEBUG) {
|
||||
logger.info("[P2] (UUID) PlotSquared has cached {} of UUIDs", String.format("%.1f%%", percentage));
|
||||
logger.info("[P2] (UUID) PlotSquared has cached {} of UUIDs",
|
||||
String.format("%.1f%%", percentage));
|
||||
}
|
||||
} catch (final InterruptedException | ExecutionException e) {
|
||||
logger.error("[P2] (UUID) Failed to retrieve last batch. Will try again", e);
|
||||
@ -845,7 +862,8 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
|
||||
if (currentPlotId != null) {
|
||||
entity.setMetadata("shulkerPlot",
|
||||
new FixedMetadataValue(
|
||||
(Plugin) PlotSquared.platform(), currentPlotId));
|
||||
(Plugin) PlotSquared.platform(),
|
||||
currentPlotId));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -970,7 +988,8 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
|
||||
if (id != null && id.equalsIgnoreCase("single")) {
|
||||
result = getInjector().getInstance(SingleWorldGenerator.class);
|
||||
} else {
|
||||
result = getInjector().getInstance(Key.get(IndependentPlotGenerator.class, DefaultGenerator.class));
|
||||
result = getInjector()
|
||||
.getInstance(Key.get(IndependentPlotGenerator.class, DefaultGenerator.class));
|
||||
if (!PlotSquared.get().setupPlotWorld(worldName, id, result)) {
|
||||
return null;
|
||||
}
|
||||
@ -992,7 +1011,8 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
|
||||
return new BukkitPlotGenerator(world, gen, this.plotAreaManager);
|
||||
} else {
|
||||
return new BukkitPlotGenerator(world, getInjector()
|
||||
.getInstance(Key.get(IndependentPlotGenerator.class, DefaultGenerator.class)), this.plotAreaManager);
|
||||
.getInstance(Key.get(IndependentPlotGenerator.class, DefaultGenerator.class)),
|
||||
this.plotAreaManager);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1035,7 +1055,8 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
|
||||
World world = BukkitUtil.getWorld(worldName);
|
||||
if (world == null) {
|
||||
// create world
|
||||
ConfigurationSection worldConfig = this.worldConfiguration.getConfigurationSection("worlds." + worldName);
|
||||
ConfigurationSection worldConfig =
|
||||
this.worldConfiguration.getConfigurationSection("worlds." + worldName);
|
||||
String manager = worldConfig.getString("generator.plugin", getPluginName());
|
||||
PlotAreaBuilder builder = PlotAreaBuilder.newBuilder().plotManager(manager)
|
||||
.generatorName(worldConfig.getString("generator.init", manager))
|
||||
@ -1061,7 +1082,8 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
|
||||
if (gen instanceof BukkitPlotGenerator) {
|
||||
PlotSquared.get().loadWorld(worldName, (BukkitPlotGenerator) gen);
|
||||
} else if (gen != null) {
|
||||
PlotSquared.get().loadWorld(worldName, new BukkitPlotGenerator(worldName, gen, this.plotAreaManager));
|
||||
PlotSquared.get().loadWorld(worldName,
|
||||
new BukkitPlotGenerator(worldName, gen, this.plotAreaManager));
|
||||
} else if (this.worldConfiguration.contains("worlds." + worldName)) {
|
||||
PlotSquared.get().loadWorld(worldName, null);
|
||||
}
|
||||
@ -1128,7 +1150,8 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
|
||||
return names;
|
||||
}
|
||||
|
||||
@Override public com.plotsquared.core.location.World<?> getPlatformWorld(@Nonnull final String worldName) {
|
||||
@Override public com.plotsquared.core.location.World<?> getPlatformWorld(
|
||||
@Nonnull final String worldName) {
|
||||
return BukkitWorld.of(worldName);
|
||||
}
|
||||
|
||||
|
@ -30,8 +30,8 @@ import com.plotsquared.core.generator.IndependentPlotGenerator;
|
||||
import com.plotsquared.core.location.ChunkWrapper;
|
||||
import com.plotsquared.core.plot.PlotArea;
|
||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||
import com.plotsquared.core.queue.LocalBlockQueue;
|
||||
import com.plotsquared.core.queue.ScopedLocalBlockQueue;
|
||||
import com.plotsquared.core.queue.QueueCoordinator;
|
||||
import com.plotsquared.core.queue.ScopedQueueCoordinator;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.generator.BlockPopulator;
|
||||
@ -44,7 +44,7 @@ final class BlockStatePopulator extends BlockPopulator {
|
||||
private final IndependentPlotGenerator plotGenerator;
|
||||
private final PlotAreaManager plotAreaManager;
|
||||
|
||||
private LocalBlockQueue queue;
|
||||
private QueueCoordinator queue;
|
||||
|
||||
public BlockStatePopulator(@Nonnull final IndependentPlotGenerator plotGenerator,
|
||||
@Nonnull final PlotAreaManager plotAreaManager) {
|
||||
@ -65,9 +65,9 @@ final class BlockStatePopulator extends BlockPopulator {
|
||||
}
|
||||
final ChunkWrapper wrap =
|
||||
new ChunkWrapper(area.getWorldName(), source.getX(), source.getZ());
|
||||
final ScopedLocalBlockQueue chunk = this.queue.getForChunk(wrap.x, wrap.z);
|
||||
final ScopedQueueCoordinator chunk = this.queue.getForChunk(wrap.x, wrap.z);
|
||||
if (this.plotGenerator.populateChunk(chunk, area)) {
|
||||
this.queue.flush();
|
||||
this.queue.enqueue();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ import com.plotsquared.core.generator.SingleWorldGenerator;
|
||||
import com.plotsquared.core.location.ChunkWrapper;
|
||||
import com.plotsquared.core.plot.PlotArea;
|
||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||
import com.plotsquared.core.queue.ScopedLocalBlockQueue;
|
||||
import com.plotsquared.core.queue.ScopedQueueCoordinator;
|
||||
import com.plotsquared.core.util.ChunkManager;
|
||||
import com.plotsquared.core.util.MainUtil;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
@ -190,7 +190,7 @@ public class BukkitPlotGenerator extends ChunkGenerator
|
||||
return result.getChunkData();
|
||||
}
|
||||
|
||||
private void generate(BlockVector2 loc, World world, ScopedLocalBlockQueue result) {
|
||||
private void generate(BlockVector2 loc, World world, ScopedQueueCoordinator result) {
|
||||
// Load if improperly loaded
|
||||
if (!this.loaded) {
|
||||
String name = world.getName();
|
||||
|
@ -31,16 +31,16 @@ import com.plotsquared.core.generator.IndependentPlotGenerator;
|
||||
import com.plotsquared.core.location.Location;
|
||||
import com.plotsquared.core.plot.PlotArea;
|
||||
import com.plotsquared.core.plot.PlotId;
|
||||
import com.plotsquared.core.queue.ScopedLocalBlockQueue;
|
||||
import com.plotsquared.core.queue.ScopedQueueCoordinator;
|
||||
import com.plotsquared.core.util.MathMan;
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.generator.BlockPopulator;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
import javax.annotation.Nonnull;
|
||||
import org.jetbrains.annotations.Range;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Random;
|
||||
|
||||
final class DelegatePlotGenerator extends IndependentPlotGenerator {
|
||||
@ -64,7 +64,7 @@ final class DelegatePlotGenerator extends IndependentPlotGenerator {
|
||||
return PlotSquared.platform().getDefaultGenerator().getNewPlotArea(world, id, min, max);
|
||||
}
|
||||
|
||||
@Override public void generateChunk(final ScopedLocalBlockQueue result, PlotArea settings) {
|
||||
@Override public void generateChunk(final ScopedQueueCoordinator result, PlotArea settings) {
|
||||
World world = BukkitUtil.getWorld(this.world);
|
||||
Location min = result.getMin();
|
||||
int chunkX = min.getX() >> 4;
|
||||
@ -72,8 +72,7 @@ final class DelegatePlotGenerator extends IndependentPlotGenerator {
|
||||
Random random = new Random(MathMan.pair((short) chunkX, (short) chunkZ));
|
||||
try {
|
||||
ChunkGenerator.BiomeGrid grid = new ChunkGenerator.BiomeGrid() {
|
||||
@Override
|
||||
public void setBiome(@Range(from = 0, to = 15) int x,
|
||||
@Override public void setBiome(@Range(from = 0, to = 15) int x,
|
||||
@Range(from = 0, to = 15) int z, @Nonnull Biome biome) {
|
||||
result.setBiome(x, z, BukkitAdapter.adapt(biome));
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ import com.google.inject.assistedinject.FactoryModuleBuilder;
|
||||
import com.google.inject.util.Providers;
|
||||
import com.plotsquared.bukkit.BukkitPlatform;
|
||||
import com.plotsquared.bukkit.player.BukkitPlayerManager;
|
||||
import com.plotsquared.bukkit.queue.BukkitLocalQueue;
|
||||
import com.plotsquared.bukkit.queue.BukkitQueueCoordinator;
|
||||
import com.plotsquared.bukkit.schematic.BukkitSchematicHandler;
|
||||
import com.plotsquared.bukkit.util.BukkitChunkManager;
|
||||
import com.plotsquared.bukkit.util.BukkitEconHandler;
|
||||
@ -66,9 +66,11 @@ import lombok.RequiredArgsConstructor;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@RequiredArgsConstructor public class BukkitModule extends AbstractModule {
|
||||
@RequiredArgsConstructor
|
||||
public class BukkitModule extends AbstractModule {
|
||||
|
||||
private final BukkitPlatform bukkitPlatform;
|
||||
|
||||
@ -76,16 +78,19 @@ import javax.annotation.Nonnull;
|
||||
bind(PlayerManager.class).to(BukkitPlayerManager.class);
|
||||
bind(JavaPlugin.class).toInstance(bukkitPlatform);
|
||||
bind(PlotPlatform.class).toInstance(bukkitPlatform);
|
||||
bind(IndependentPlotGenerator.class).annotatedWith(DefaultGenerator.class).to(HybridGen.class);
|
||||
bind(IndependentPlotGenerator.class).annotatedWith(DefaultGenerator.class)
|
||||
.to(HybridGen.class);
|
||||
// Console actor
|
||||
@Nonnull ConsoleCommandSender console = Bukkit.getServer().getConsoleSender();
|
||||
WorldEditPlugin wePlugin = ((WorldEditPlugin) Bukkit.getPluginManager().getPlugin("WorldEdit"));
|
||||
bind(Actor.class).annotatedWith(ConsoleActor.class).toInstance(wePlugin.wrapCommandSender(console));
|
||||
WorldEditPlugin wePlugin =
|
||||
((WorldEditPlugin) Bukkit.getPluginManager().getPlugin("WorldEdit"));
|
||||
bind(Actor.class).annotatedWith(ConsoleActor.class)
|
||||
.toInstance(wePlugin.wrapCommandSender(console));
|
||||
bind(InventoryUtil.class).to(BukkitInventoryUtil.class);
|
||||
bind(SetupUtils.class).to(BukkitSetupUtils.class);
|
||||
bind(WorldUtil.class).to(BukkitUtil.class);
|
||||
bind(GlobalBlockQueue.class).toInstance(new GlobalBlockQueue(
|
||||
QueueProvider.of(BukkitLocalQueue.class, BukkitLocalQueue.class), 1, Settings.QUEUE.TARGET_TIME));
|
||||
QueueProvider.of(BukkitQueueCoordinator.class, BukkitQueueCoordinator.class)));
|
||||
bind(ChunkManager.class).to(BukkitChunkManager.class);
|
||||
bind(RegionManager.class).to(BukkitRegionManager.class);
|
||||
bind(SchematicHandler.class).to(BukkitSchematicHandler.class);
|
||||
@ -108,7 +113,8 @@ import javax.annotation.Nonnull;
|
||||
bind(PermHandler.class).toProvider(Providers.of(null));
|
||||
}
|
||||
try {
|
||||
final BukkitEconHandler bukkitEconHandler = new BukkitEconHandler(bukkitPermHandler);
|
||||
final BukkitEconHandler bukkitEconHandler =
|
||||
new BukkitEconHandler(bukkitPermHandler);
|
||||
bind(EconHandler.class).toInstance(bukkitEconHandler);
|
||||
} catch (final Exception ignored) {
|
||||
bind(EconHandler.class).toProvider(Providers.of(null));
|
||||
|
@ -53,6 +53,7 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator {
|
||||
|
||||
private final World world;
|
||||
private final SideEffectSet sideEffectSet;
|
||||
private Runnable whenDone;
|
||||
|
||||
public BukkitQueueCoordinator(World world) {
|
||||
super(world);
|
||||
@ -74,91 +75,96 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator {
|
||||
@Override public boolean enqueue() {
|
||||
BukkitChunkCoordinator.builder().inWorld(BukkitAdapter.adapt(world))
|
||||
.withChunks(getBlockChunks().keySet()).withInitialBatchSize(3).withMaxIterationTime(40)
|
||||
.withThrowableConsumer(Throwable::printStackTrace).withConsumer(chunk -> {
|
||||
LocalChunk localChunk =
|
||||
getBlockChunks().get(BlockVector2.at(chunk.getX(), chunk.getZ()));
|
||||
if (localChunk == null) {
|
||||
throw new NullPointerException(
|
||||
"LocalChunk cannot be null when accessed from ChunkCoordinator");
|
||||
}
|
||||
World worldObj = getWorld();
|
||||
int sx = chunk.getX() << 4;
|
||||
int sz = chunk.getX() << 4;
|
||||
for (int layer = 0; layer < localChunk.getBaseblocks().length; layer++) {
|
||||
BaseBlock[] blocksLayer = localChunk.getBaseblocks()[layer];
|
||||
if (blocksLayer == null) {
|
||||
continue;
|
||||
.withThrowableConsumer(Throwable::printStackTrace).withFinalAction(whenDone)
|
||||
.withConsumer(chunk -> {
|
||||
LocalChunk localChunk =
|
||||
getBlockChunks().get(BlockVector2.at(chunk.getX(), chunk.getZ()));
|
||||
if (localChunk == null) {
|
||||
throw new NullPointerException(
|
||||
"LocalChunk cannot be null when accessed from ChunkCoordinator");
|
||||
}
|
||||
for (int j = 0; j < blocksLayer.length; j++) {
|
||||
if (blocksLayer[j] == null) {
|
||||
World worldObj = getWorld();
|
||||
int sx = chunk.getX() << 4;
|
||||
int sz = chunk.getX() << 4;
|
||||
for (int layer = 0; layer < localChunk.getBaseblocks().length; layer++) {
|
||||
BaseBlock[] blocksLayer = localChunk.getBaseblocks()[layer];
|
||||
if (blocksLayer == null) {
|
||||
continue;
|
||||
}
|
||||
BaseBlock block = blocksLayer[j];
|
||||
int x = sx + MainUtil.x_loc[layer][j];
|
||||
int y = MainUtil.y_loc[layer][j];
|
||||
int z = sz + MainUtil.z_loc[layer][j];
|
||||
try {
|
||||
worldObj.setBlock(BlockVector3.at(x, y, z), block, sideEffectSet);
|
||||
} catch (WorldEditException ignored) {
|
||||
// Fallback to not so nice method
|
||||
BlockData blockData = BukkitAdapter.adapt(block);
|
||||
|
||||
Block existing = chunk.getBlock(x, y, z);
|
||||
final BlockState existingBaseBlock =
|
||||
BukkitAdapter.adapt(existing.getBlockData());
|
||||
if (BukkitBlockUtil.get(existing).equals(existingBaseBlock) && existing
|
||||
.getBlockData().matches(blockData)) {
|
||||
for (int j = 0; j < blocksLayer.length; j++) {
|
||||
if (blocksLayer[j] == null) {
|
||||
continue;
|
||||
}
|
||||
BaseBlock block = blocksLayer[j];
|
||||
int x = sx + MainUtil.x_loc[layer][j];
|
||||
int y = MainUtil.y_loc[layer][j];
|
||||
int z = sz + MainUtil.z_loc[layer][j];
|
||||
try {
|
||||
worldObj.setBlock(BlockVector3.at(x, y, z), block, sideEffectSet);
|
||||
} catch (WorldEditException ignored) {
|
||||
// Fallback to not so nice method
|
||||
BlockData blockData = BukkitAdapter.adapt(block);
|
||||
|
||||
if (existing.getState() instanceof Container) {
|
||||
((Container) existing.getState()).getInventory().clear();
|
||||
}
|
||||
Block existing = chunk.getBlock(x, y, z);
|
||||
final BlockState existingBaseBlock =
|
||||
BukkitAdapter.adapt(existing.getBlockData());
|
||||
if (BukkitBlockUtil.get(existing).equals(existingBaseBlock) && existing
|
||||
.getBlockData().matches(blockData)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
existing.setType(BukkitAdapter.adapt(block.getBlockType()), false);
|
||||
existing.setBlockData(blockData, false);
|
||||
if (block.hasNbtData()) {
|
||||
CompoundTag tag = block.getNbtData();
|
||||
StateWrapper sw = new StateWrapper(tag);
|
||||
if (existing.getState() instanceof Container) {
|
||||
((Container) existing.getState()).getInventory().clear();
|
||||
}
|
||||
|
||||
sw.restoreTag(worldObj.getName(), existing.getX(), existing.getY(),
|
||||
existing.getZ());
|
||||
existing.setType(BukkitAdapter.adapt(block.getBlockType()), false);
|
||||
existing.setBlockData(blockData, false);
|
||||
if (block.hasNbtData()) {
|
||||
CompoundTag tag = block.getNbtData();
|
||||
StateWrapper sw = new StateWrapper(tag);
|
||||
|
||||
sw.restoreTag(worldObj.getName(), existing.getX(), existing.getY(),
|
||||
existing.getZ());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int layer = 0; layer < localChunk.getBaseblocks().length; layer++) {
|
||||
BiomeType[] biomesLayer = localChunk.getBiomes()[layer];
|
||||
if (biomesLayer == null) {
|
||||
continue;
|
||||
}
|
||||
for (int j = 0; j < biomesLayer.length; j++) {
|
||||
if (biomesLayer[j] == null) {
|
||||
for (int layer = 0; layer < localChunk.getBaseblocks().length; layer++) {
|
||||
BiomeType[] biomesLayer = localChunk.getBiomes()[layer];
|
||||
if (biomesLayer == null) {
|
||||
continue;
|
||||
}
|
||||
BiomeType biome = biomesLayer[j];
|
||||
int x = sx + MainUtil.x_loc[layer][j];
|
||||
int y = MainUtil.y_loc[layer][j];
|
||||
int z = sz + MainUtil.z_loc[layer][j];
|
||||
worldObj.setBiome(BlockVector3.at(x, y, z), biome);
|
||||
}
|
||||
}
|
||||
if (localChunk.getTiles().size() > 0) {
|
||||
localChunk.getTiles().forEach(((blockVector3, tag) -> {
|
||||
try {
|
||||
BaseBlock block = worldObj.getBlock(blockVector3).toBaseBlock(tag);
|
||||
worldObj.setBlock(blockVector3, block, sideEffectSet);
|
||||
} catch (WorldEditException ignored) {
|
||||
StateWrapper sw = new StateWrapper(tag);
|
||||
sw.restoreTag(worldObj.getName(), blockVector3.getX(), blockVector3.getY(),
|
||||
blockVector3.getZ());
|
||||
for (int j = 0; j < biomesLayer.length; j++) {
|
||||
if (biomesLayer[j] == null) {
|
||||
continue;
|
||||
}
|
||||
BiomeType biome = biomesLayer[j];
|
||||
int x = sx + MainUtil.x_loc[layer][j];
|
||||
int y = MainUtil.y_loc[layer][j];
|
||||
int z = sz + MainUtil.z_loc[layer][j];
|
||||
worldObj.setBiome(BlockVector3.at(x, y, z), biome);
|
||||
}
|
||||
}));
|
||||
}
|
||||
});
|
||||
}
|
||||
if (localChunk.getTiles().size() > 0) {
|
||||
localChunk.getTiles().forEach(((blockVector3, tag) -> {
|
||||
try {
|
||||
BaseBlock block = worldObj.getBlock(blockVector3).toBaseBlock(tag);
|
||||
worldObj.setBlock(blockVector3, block, sideEffectSet);
|
||||
} catch (WorldEditException ignored) {
|
||||
StateWrapper sw = new StateWrapper(tag);
|
||||
sw.restoreTag(worldObj.getName(), blockVector3.getX(),
|
||||
blockVector3.getY(), blockVector3.getZ());
|
||||
}
|
||||
}));
|
||||
}
|
||||
});
|
||||
return super.enqueue();
|
||||
}
|
||||
|
||||
@Override public void setCompleteTask(Runnable whenDone) {
|
||||
this.whenDone = whenDone;
|
||||
}
|
||||
|
||||
private void setMaterial(@Nonnull final BlockState plotBlock, @Nonnull final Block block) {
|
||||
Material material = BukkitAdapter.adapt(plotBlock.getBlockType());
|
||||
block.setType(material, false);
|
||||
|
@ -30,7 +30,7 @@ import com.plotsquared.bukkit.util.BukkitBlockUtil;
|
||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||
import com.plotsquared.core.location.ChunkWrapper;
|
||||
import com.plotsquared.core.location.Location;
|
||||
import com.plotsquared.core.queue.ScopedLocalBlockQueue;
|
||||
import com.plotsquared.core.queue.ScopedQueueCoordinator;
|
||||
import com.plotsquared.core.util.MainUtil;
|
||||
import com.plotsquared.core.util.PatternUtil;
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
@ -41,16 +41,17 @@ import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.generator.ChunkGenerator.BiomeGrid;
|
||||
import org.bukkit.generator.ChunkGenerator.ChunkData;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class GenChunk extends ScopedLocalBlockQueue {
|
||||
public class GenChunk extends ScopedQueueCoordinator {
|
||||
|
||||
public final Biome[] biomes;
|
||||
public BlockState[][] result;
|
||||
@ -191,16 +192,18 @@ public class GenChunk extends ScopedLocalBlockQueue {
|
||||
return chunk == null ? chunkZ : chunk.getZ();
|
||||
}
|
||||
|
||||
@Override public String getWorld() {
|
||||
return chunk == null ? world : chunk.getWorld().getName();
|
||||
@Override public com.sk89q.worldedit.world.World getWorld() {
|
||||
return chunk == null ?
|
||||
BukkitAdapter.adapt(Bukkit.getWorld(world)) :
|
||||
BukkitAdapter.adapt(chunk.getWorld());
|
||||
}
|
||||
|
||||
@Override public Location getMax() {
|
||||
return Location.at(getWorld(), 15 + (getX() << 4), 255, 15 + (getZ() << 4));
|
||||
return Location.at(getWorld().getName(), 15 + (getX() << 4), 255, 15 + (getZ() << 4));
|
||||
}
|
||||
|
||||
@Override public Location getMin() {
|
||||
return Location.at(getWorld(), getX() << 4, 0, getZ() << 4);
|
||||
return Location.at(getWorld().getName(), getX() << 4, 0, getZ() << 4);
|
||||
}
|
||||
|
||||
public GenChunk clone() {
|
||||
|
@ -27,7 +27,7 @@ package com.plotsquared.bukkit.schematic;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Singleton;
|
||||
import com.plotsquared.core.queue.LocalBlockQueue;
|
||||
import com.plotsquared.core.queue.QueueCoordinator;
|
||||
import com.plotsquared.core.util.SchematicHandler;
|
||||
import com.plotsquared.core.util.WorldUtil;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
@ -43,7 +43,7 @@ import javax.annotation.Nonnull;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean restoreTile(LocalBlockQueue queue, CompoundTag ct, int x, int y, int z) {
|
||||
return new StateWrapper(ct).restoreTag(queue.getWorld(), x, y, z);
|
||||
public boolean restoreTile(QueueCoordinator queue, CompoundTag ct, int x, int y, int z) {
|
||||
return new StateWrapper(ct).restoreTag(queue.getWorld().getName(), x, y, z);
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ package com.plotsquared.bukkit.util;
|
||||
import com.google.inject.Singleton;
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
import com.plotsquared.core.listener.WEExtent;
|
||||
import com.plotsquared.core.queue.LocalBlockQueue;
|
||||
import com.plotsquared.core.queue.QueueCoordinator;
|
||||
import com.plotsquared.core.util.ChunkManager;
|
||||
import com.plotsquared.core.util.entity.EntityCategories;
|
||||
import com.plotsquared.core.util.task.TaskManager;
|
||||
@ -54,7 +54,8 @@ import static com.plotsquared.core.util.entity.EntityCategories.CAP_MOB;
|
||||
import static com.plotsquared.core.util.entity.EntityCategories.CAP_MONSTER;
|
||||
import static com.plotsquared.core.util.entity.EntityCategories.CAP_VEHICLE;
|
||||
|
||||
@Singleton public class BukkitChunkManager extends ChunkManager {
|
||||
@Singleton
|
||||
public class BukkitChunkManager extends ChunkManager {
|
||||
|
||||
public static boolean isIn(CuboidRegion region, int x, int z) {
|
||||
return x >= region.getMinimumPoint().getX() && x <= region.getMaximumPoint().getX()
|
||||
@ -79,8 +80,10 @@ import static com.plotsquared.core.util.entity.EntityCategories.CAP_VEHICLE;
|
||||
BukkitWorld bukkitWorld1 = new BukkitWorld(world1);
|
||||
BukkitWorld bukkitWorld2 = new BukkitWorld(world2);
|
||||
|
||||
LocalBlockQueue queue1 = PlotSquared.platform().getGlobalBlockQueue().getNewQueue(worldName1, false);
|
||||
LocalBlockQueue queue2 = PlotSquared.platform().getGlobalBlockQueue().getNewQueue(worldName2, false);
|
||||
QueueCoordinator queue1 =
|
||||
PlotSquared.platform().getGlobalBlockQueue().getNewQueue(worldName1, false);
|
||||
QueueCoordinator queue2 =
|
||||
PlotSquared.platform().getGlobalBlockQueue().getNewQueue(worldName2, false);
|
||||
|
||||
for (int x = Math.max(r1.getMinimumPoint().getX(), sx);
|
||||
x <= Math.min(r1.getMaximumPoint().getX(), sx + 15); x++) {
|
||||
|
@ -35,8 +35,8 @@ import com.plotsquared.core.location.PlotLoc;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.plot.PlotArea;
|
||||
import com.plotsquared.core.plot.PlotManager;
|
||||
import com.plotsquared.core.queue.LocalBlockQueue;
|
||||
import com.plotsquared.core.queue.ScopedLocalBlockQueue;
|
||||
import com.plotsquared.core.queue.QueueCoordinator;
|
||||
import com.plotsquared.core.queue.ScopedQueueCoordinator;
|
||||
import com.plotsquared.core.util.ChunkManager;
|
||||
import com.plotsquared.core.util.MainUtil;
|
||||
import com.plotsquared.core.util.RegionManager;
|
||||
@ -78,9 +78,11 @@ import static com.plotsquared.core.util.entity.EntityCategories.CAP_MOB;
|
||||
import static com.plotsquared.core.util.entity.EntityCategories.CAP_MONSTER;
|
||||
import static com.plotsquared.core.util.entity.EntityCategories.CAP_VEHICLE;
|
||||
|
||||
@Singleton public class BukkitRegionManager extends RegionManager {
|
||||
@Singleton
|
||||
public class BukkitRegionManager extends RegionManager {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger("P2/" + BukkitRegionManager.class.getSimpleName());
|
||||
private static final Logger logger =
|
||||
LoggerFactory.getLogger("P2/" + BukkitRegionManager.class.getSimpleName());
|
||||
|
||||
@Inject public BukkitRegionManager(@Nonnull final ChunkManager chunkManager) {
|
||||
super(chunkManager);
|
||||
@ -102,14 +104,16 @@ import static com.plotsquared.core.util.entity.EntityCategories.CAP_VEHICLE;
|
||||
final Semaphore semaphore = new Semaphore(1);
|
||||
try {
|
||||
semaphore.acquire();
|
||||
Bukkit.getScheduler().runTask(BukkitPlatform.getPlugin(BukkitPlatform.class), () -> {
|
||||
for (Chunk chunk : Objects.requireNonNull(Bukkit.getWorld(world))
|
||||
.getLoadedChunks()) {
|
||||
BlockVector2 loc = BlockVector2.at(chunk.getX() >> 5, chunk.getZ() >> 5);
|
||||
chunks.add(loc);
|
||||
}
|
||||
semaphore.release();
|
||||
});
|
||||
Bukkit.getScheduler()
|
||||
.runTask(BukkitPlatform.getPlugin(BukkitPlatform.class), () -> {
|
||||
for (Chunk chunk : Objects.requireNonNull(Bukkit.getWorld(world))
|
||||
.getLoadedChunks()) {
|
||||
BlockVector2 loc =
|
||||
BlockVector2.at(chunk.getX() >> 5, chunk.getZ() >> 5);
|
||||
chunks.add(loc);
|
||||
}
|
||||
semaphore.release();
|
||||
});
|
||||
semaphore.acquireUninterruptibly();
|
||||
} catch (final Exception e) {
|
||||
e.printStackTrace();
|
||||
@ -198,8 +202,7 @@ import static com.plotsquared.core.util.entity.EntityCategories.CAP_VEHICLE;
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean copyRegion(Location pos1, Location pos2, Location newPos,
|
||||
@Override public boolean copyRegion(Location pos1, Location pos2, Location newPos,
|
||||
final Runnable whenDone) {
|
||||
final int relX = newPos.getX() - pos1.getX();
|
||||
final int relZ = newPos.getZ() - pos1.getZ();
|
||||
@ -213,7 +216,8 @@ import static com.plotsquared.core.util.entity.EntityCategories.CAP_VEHICLE;
|
||||
assert oldWorld != null;
|
||||
final String newWorldName = newWorld.getName();
|
||||
final ContentMap map = new ContentMap();
|
||||
final LocalBlockQueue queue = PlotSquared.platform().getGlobalBlockQueue().getNewQueue(newWorldName, false);
|
||||
final QueueCoordinator queue =
|
||||
PlotSquared.platform().getGlobalBlockQueue().getNewQueue(newWorldName, false);
|
||||
ChunkManager.chunkTask(pos1, pos2, new RunnableVal<int[]>() {
|
||||
@Override public void run(int[] value) {
|
||||
int bx = value[2];
|
||||
@ -243,18 +247,17 @@ import static com.plotsquared.core.util.entity.EntityCategories.CAP_VEHICLE;
|
||||
}
|
||||
}
|
||||
}
|
||||
queue.enqueue();
|
||||
PlotSquared.platform().getGlobalBlockQueue().addEmptyTask(() -> {
|
||||
queue.setCompleteTask(() -> {
|
||||
//map.restoreBlocks(newWorld, 0, 0);
|
||||
map.restoreEntities(newWorld, relX, relZ);
|
||||
TaskManager.runTask(whenDone);
|
||||
});
|
||||
queue.enqueue();
|
||||
}, 5);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean regenerateRegion(final Location pos1, final Location pos2,
|
||||
@Override public boolean regenerateRegion(final Location pos1, final Location pos2,
|
||||
final boolean ignoreAugment, final Runnable whenDone) {
|
||||
final String world = pos1.getWorldName();
|
||||
|
||||
@ -292,8 +295,8 @@ import static com.plotsquared.core.util.entity.EntityCategories.CAP_VEHICLE;
|
||||
if (chunkObj == null) {
|
||||
return;
|
||||
}
|
||||
final LocalBlockQueue queue = PlotSquared.platform().getGlobalBlockQueue()
|
||||
.getNewQueue(world, false);
|
||||
final QueueCoordinator queue =
|
||||
PlotSquared.platform().getGlobalBlockQueue().getNewQueue(world, false);
|
||||
if (xxb >= p1x && xxt <= p2x && zzb >= p1z && zzt <= p2z) {
|
||||
AugmentedUtils.bypass(ignoreAugment,
|
||||
() -> queue.regenChunkSafe(chunk.getX(), chunk.getZ()));
|
||||
@ -362,8 +365,8 @@ import static com.plotsquared.core.util.entity.EntityCategories.CAP_VEHICLE;
|
||||
.createRegion(pos1.getX(), pos2.getX(), pos1.getZ(), pos2.getZ());
|
||||
map.saveEntitiesOut(chunkObj, currentPlotClear);
|
||||
AugmentedUtils.bypass(ignoreAugment, () -> ChunkManager
|
||||
.setChunkInPlotArea(null, new RunnableVal<ScopedLocalBlockQueue>() {
|
||||
@Override public void run(ScopedLocalBlockQueue value) {
|
||||
.setChunkInPlotArea(null, new RunnableVal<ScopedQueueCoordinator>() {
|
||||
@Override public void run(ScopedQueueCoordinator value) {
|
||||
Location min = value.getMin();
|
||||
int bx = min.getX();
|
||||
int bz = min.getZ();
|
||||
@ -429,8 +432,7 @@ import static com.plotsquared.core.util.entity.EntityCategories.CAP_VEHICLE;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void swap(Location bot1, Location top1, Location bot2, Location top2,
|
||||
@Override public void swap(Location bot1, Location top1, Location bot2, Location top2,
|
||||
final Runnable whenDone) {
|
||||
CuboidRegion region1 =
|
||||
RegionUtil.createRegion(bot1.getX(), top1.getX(), bot1.getZ(), top1.getZ());
|
||||
@ -468,16 +470,17 @@ import static com.plotsquared.core.util.entity.EntityCategories.CAP_VEHICLE;
|
||||
region.getMinimumPoint().getY(), region.getMinimumPoint().getZ() - extendBiome);
|
||||
Location pos2 = Location.at(world, region.getMaximumPoint().getX() + extendBiome,
|
||||
region.getMaximumPoint().getY(), region.getMaximumPoint().getZ() + extendBiome);
|
||||
final LocalBlockQueue queue = PlotSquared.platform().getGlobalBlockQueue()
|
||||
.getNewQueue(world, false);
|
||||
final QueueCoordinator queue =
|
||||
PlotSquared.platform().getGlobalBlockQueue().getNewQueue(world, false);
|
||||
|
||||
ChunkManager.chunkTask(pos1, pos2, new RunnableVal<int[]>() {
|
||||
@Override public void run(int[] value) {
|
||||
BlockVector2 loc = BlockVector2.at(value[0], value[1]);
|
||||
PlotSquared.platform().getChunkManager().loadChunk(world, loc, false).thenRun(() -> {
|
||||
MainUtil.setBiome(world, value[2], value[3], value[4], value[5], biome);
|
||||
queue.refreshChunk(value[0], value[1]);
|
||||
});
|
||||
PlotSquared.platform().getChunkManager().loadChunk(world, loc, false)
|
||||
.thenRun(() -> {
|
||||
MainUtil.setBiome(world, value[2], value[3], value[4], value[5], biome);
|
||||
queue.refreshChunk(value[0], value[1]);
|
||||
});
|
||||
}
|
||||
}, whenDone, 5);
|
||||
}
|
||||
|
Reference in New Issue
Block a user