mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-25 02:04:44 +02:00
Get chunks asynchronously
This commit is contained in:
@ -10,14 +10,16 @@ repositories {
|
||||
mavenLocal()
|
||||
}
|
||||
|
||||
apply plugin: "com.github.johnrengelman.shadow"
|
||||
|
||||
dependencies {
|
||||
implementation project(':Core')
|
||||
compile project(':Core')
|
||||
compile 'com.destroystokyo.paper:paper-api:1.14.3-R0.1-SNAPSHOT'
|
||||
compile 'com.destroystokyo.paper:paper-api:1.14.4-R0.1-SNAPSHOT'
|
||||
//implementation 'com.onarandombox.multiversecore:Multiverse-Core:3.0.0-SNAPSHOT'
|
||||
implementation 'org.spigotmc:spigot-api:1.14.3-R0.1-SNAPSHOT'
|
||||
implementation 'org.spigotmc:spigot-api:1.14.4-R0.1-SNAPSHOT'
|
||||
compile(group: 'com.sk89q.worldedit', name: 'worldedit-bukkit', version: '7.0.0')
|
||||
compile "io.papermc:paperlib:1.0.1"
|
||||
compile "io.papermc:paperlib:1.0.2"
|
||||
compile("net.milkbowl.vault:VaultAPI:1.7") {
|
||||
exclude module: 'bukkit'
|
||||
}
|
||||
@ -47,7 +49,7 @@ shadowJar {
|
||||
include(dependency('com.squareup.okhttp3:okhttp:3.14.0'))
|
||||
include(dependency('com.squareup.okio:okio:2.2.2'))
|
||||
include(dependency('org.jetbrains.kotlin:kotlin-stdlib:1.3.30'))
|
||||
include(dependency("io.papermc:paperlib:1.0.1"))
|
||||
include(dependency("io.papermc:paperlib:1.0.2"))
|
||||
}
|
||||
relocate 'io.papermc.lib', 'com.github.intellectualsites.plotsquared.bukkit.paperlib'
|
||||
// relocate('org.mcstats', 'com.plotsquared.stats')
|
||||
|
@ -10,6 +10,7 @@ import com.github.intellectualsites.plotsquared.plot.util.block.BasicLocalBlockQ
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import io.papermc.lib.PaperLib;
|
||||
import lombok.NonNull;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Chunk;
|
||||
@ -20,6 +21,7 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
public class BukkitLocalQueue extends BasicLocalBlockQueue {
|
||||
|
||||
@ -69,7 +71,8 @@ public class BukkitLocalQueue extends BasicLocalBlockQueue {
|
||||
}
|
||||
}
|
||||
|
||||
@Override public final void setComponents(LocalChunk lc) {
|
||||
@Override public final void setComponents(LocalChunk lc)
|
||||
throws ExecutionException, InterruptedException {
|
||||
setBaseBlocks(lc);
|
||||
}
|
||||
|
||||
@ -77,14 +80,17 @@ public class BukkitLocalQueue extends BasicLocalBlockQueue {
|
||||
return Bukkit.getWorld(getWorld());
|
||||
}
|
||||
|
||||
public Chunk getChunk(int x, int z) {
|
||||
return getBukkitWorld().getChunkAt(x, z);
|
||||
public Chunk getChunk(int x, int z) throws ExecutionException, InterruptedException {
|
||||
return PaperLib.getChunkAtAsync(getBukkitWorld(), x, z).get();
|
||||
}
|
||||
|
||||
public void setBaseBlocks(LocalChunk lc) {
|
||||
public void setBaseBlocks(LocalChunk lc) throws ExecutionException, InterruptedException {
|
||||
World worldObj = Bukkit.getWorld(getWorld());
|
||||
if (worldObj == null) {
|
||||
throw new NullPointerException("World cannot be null.");
|
||||
}
|
||||
PaperLib.getChunkAtAsync(worldObj, lc.getX(), lc.getZ(), true).get();
|
||||
Chunk chunk = worldObj.getChunkAt(lc.getX(), lc.getZ());
|
||||
chunk.load(true);
|
||||
for (int layer = 0; layer < lc.baseblocks.length; layer++) {
|
||||
BaseBlock[] blocksLayer = lc.baseblocks[layer];
|
||||
if (blocksLayer != null) {
|
||||
|
Reference in New Issue
Block a user