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