mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-21 11:45:19 +01:00
Fix sync tasks not being sync
This commit is contained in:
parent
0a5c73478d
commit
7ac3f7ca03
@ -333,7 +333,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
||||
|
||||
// Economy
|
||||
if (Settings.Enabled_Components.ECONOMY) {
|
||||
TaskManager.runTask(() -> {
|
||||
TaskManager.runTaskAsync(() -> {
|
||||
this.permissionHandler().initialize();
|
||||
final EconHandler econHandler = injector().getInstance(EconHandler.class);
|
||||
econHandler.init();
|
||||
|
@ -40,9 +40,10 @@ import com.plotsquared.core.plot.PlotAreaType;
|
||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||
import com.plotsquared.core.setup.PlotAreaBuilder;
|
||||
import com.plotsquared.core.util.SetupUtils;
|
||||
import io.papermc.lib.PaperLib;
|
||||
import com.plotsquared.core.util.task.TaskManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
@ -97,24 +98,26 @@ import java.util.Objects;
|
||||
}
|
||||
|
||||
@Override public void unload(String worldName, boolean save) {
|
||||
World world = Bukkit.getWorld(worldName);
|
||||
if (world == null) {
|
||||
return;
|
||||
}
|
||||
World dw = Bukkit.getWorlds().get(0);
|
||||
for (Player player : world.getPlayers()) {
|
||||
PaperLib.teleportAsync(player, dw.getSpawnLocation());
|
||||
}
|
||||
if (save) {
|
||||
for (Chunk chunk : world.getLoadedChunks()) {
|
||||
chunk.unload(true);
|
||||
TaskManager.runTask(() -> {
|
||||
World world = Bukkit.getWorld(worldName);
|
||||
if (world == null) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
for (Chunk chunk : world.getLoadedChunks()) {
|
||||
chunk.unload(false);
|
||||
Location location = Bukkit.getWorlds().get(0).getSpawnLocation();
|
||||
for (Player player : world.getPlayers()) {
|
||||
player.teleport(location);
|
||||
}
|
||||
}
|
||||
Bukkit.unloadWorld(world, false);
|
||||
if (save) {
|
||||
for (Chunk chunk : world.getLoadedChunks()) {
|
||||
chunk.unload(true);
|
||||
}
|
||||
} else {
|
||||
for (Chunk chunk : world.getLoadedChunks()) {
|
||||
chunk.unload(false);
|
||||
}
|
||||
}
|
||||
Bukkit.unloadWorld(world, false);
|
||||
});
|
||||
}
|
||||
|
||||
@Override public String setupWorld(PlotAreaBuilder builder) {
|
||||
|
@ -92,7 +92,7 @@ import java.util.concurrent.TimeUnit;
|
||||
}
|
||||
|
||||
@Override public void task(@Nonnull final Runnable runnable) {
|
||||
new BukkitPlotSquaredTask(runnable).runTaskAsynchronously(this.bukkitMain);
|
||||
new BukkitPlotSquaredTask(runnable).runTask(this.bukkitMain);
|
||||
}
|
||||
|
||||
@Override public void taskLater(@Nonnull final Runnable runnable,
|
||||
|
@ -387,7 +387,7 @@ public class PlotSquared {
|
||||
if (!file.exists()) {
|
||||
return;
|
||||
}
|
||||
TaskManager.runTask(() -> {
|
||||
TaskManager.runTaskAsync(() -> {
|
||||
try (ObjectInputStream ois = new ObjectInputStream(new FileInputStream(file))) {
|
||||
List<Object> list = (List<Object>) ois.readObject();
|
||||
ArrayList<int[]> regionInts = (ArrayList<int[]>) list.get(0);
|
||||
|
@ -47,7 +47,7 @@ public class Confirm extends SubCommand {
|
||||
player.sendMessage(TranslatableCaption.of("confirm.expired_confirm"));
|
||||
return false;
|
||||
}
|
||||
TaskManager.runTask(command.command);
|
||||
TaskManager.runTaskAsync(command.command);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -210,7 +210,7 @@ public abstract class SchematicHandler {
|
||||
}
|
||||
this.exportAll = true;
|
||||
final ArrayList<Plot> plots = new ArrayList<>(collection);
|
||||
TaskManager.runTask(new Runnable() {
|
||||
TaskManager.runTaskAsync(new Runnable() {
|
||||
@Override public void run() {
|
||||
if (plots.isEmpty()) {
|
||||
SchematicHandler.this.exportAll = false;
|
||||
@ -637,7 +637,7 @@ public abstract class SchematicHandler {
|
||||
ByteArrayOutputStream buffer = new ByteArrayOutputStream(width * height * length);
|
||||
ByteArrayOutputStream biomeBuffer = new ByteArrayOutputStream(width * length);
|
||||
// Queue
|
||||
TaskManager.runTask(() -> {
|
||||
TaskManager.runTaskAsync(() -> {
|
||||
final BlockVector3 minimum = aabb.getMinimumPoint();
|
||||
final BlockVector3 maximum = aabb.getMaximumPoint();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user