9
0
mirror of https://github.com/Xiao-MoMi/Custom-Crops.git synced 2025-12-27 19:09:09 +00:00
This commit is contained in:
XiaoMoMi
2024-10-24 01:29:50 +08:00
parent 1e36768382
commit a320a2153c
8 changed files with 32 additions and 24 deletions

View File

@@ -194,9 +194,10 @@ public interface CustomCropsWorld<W> {
/**
* Saves the world data to a file.
*
* @param async async or not
* @param async async or not
* @param disabling is the server disabled
*/
void save(boolean async);
void save(boolean async, boolean disabling);
/**
* Sets whether the ticking task is ongoing.

View File

@@ -186,11 +186,15 @@ public class CustomCropsWorldImpl<W> implements CustomCropsWorld<W> {
}
@Override
public void save(boolean async) {
if (async) {
public void save(boolean async, boolean disabling) {
if (async && !disabling) {
this.scheduler.async().execute(this::save);
} else {
BukkitCustomCropsPlugin.getInstance().getScheduler().sync().run(this::save, null);
if (disabling) {
save();
} else {
BukkitCustomCropsPlugin.getInstance().getScheduler().sync().run(this::save, null);
}
}
}

View File

@@ -66,10 +66,11 @@ public interface WorldManager extends Reloadable {
/**
* Unloads the CustomCrops world associated with the specified Bukkit world.
*
* @param world The Bukkit world to unload.
* @param world The Bukkit world to unload.
* @param disabling
* @return True if the world was successfully unloaded, false otherwise.
*/
boolean unloadWorld(World world);
boolean unloadWorld(World world, boolean disabling);
/**
* Retrieves a CustomCrops world based on the specified Bukkit world, if loaded.

View File

@@ -129,7 +129,7 @@ public abstract class AbstractRequirementManager<T> implements RequirementManage
if (inner != null) {
requirements.add(parseRequirement(inner, runActions));
} else {
plugin.getPluginLogger().warn("Section " + typeOrName + " is misconfigured");
plugin.getPluginLogger().warn("Section " + section.getRouteAsString() + "." + typeOrName + " is misconfigured");
}
}
}