mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2024-11-28 13:36:33 +01:00
Don't allow to start the server if 1.14+ Paper async chunk loading is enabled
This commit is contained in:
parent
432976712c
commit
ff1e615d6d
@ -87,6 +87,7 @@ import de.erethon.dungeonsxl.world.WorldConfig;
|
||||
import de.erethon.dungeonsxl.world.WorldUnloadTask;
|
||||
import de.erethon.vignette.api.VignetteAPI;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
@ -96,6 +97,8 @@ import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
@ -204,6 +207,25 @@ public class DungeonsXL extends DREPlugin implements DungeonsAPI {
|
||||
@Override
|
||||
public void onEnable() {
|
||||
super.onEnable();
|
||||
if (compat.isPaper() && Internals.andHigher(Internals.v1_14_R1).contains(compat.getInternals())) {
|
||||
File paperFile = new File("paper.yml");
|
||||
FileConfiguration paperConfig = YamlConfiguration.loadConfiguration(paperFile);
|
||||
if (paperConfig.getBoolean("settings.async-chunks.enable")) {
|
||||
MessageUtil.log(this, "&4It seems that the server runs Paper 1.14 or higher and that asynchronous world / chunk (un-) loading is enabled.");
|
||||
MessageUtil.log(this, "&4This feature seems to be too error-prone for massive usage at runtime, which DungeonsXL requires.");
|
||||
MessageUtil.log(this, "&4See &6https://github.com/PaperMC/Paper/issues/3063 &4for further information.");
|
||||
MessageUtil.log(this, "&4The server will be restarted with asynchronous chunk loading turned off.");
|
||||
paperConfig.set("settings.async-chunks.enable", false);
|
||||
try {
|
||||
paperConfig.save(paperFile);
|
||||
} catch (IOException exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
getServer().spigot().restart();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
instance = this;
|
||||
initFolders();
|
||||
loadCaliburnAPI();
|
||||
@ -223,6 +245,9 @@ public class DungeonsXL extends DREPlugin implements DungeonsAPI {
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
if (!loaded) {
|
||||
return;
|
||||
}
|
||||
saveData();
|
||||
deleteAllInstances();
|
||||
HandlerList.unregisterAll(this);
|
||||
|
Loading…
Reference in New Issue
Block a user