mirror of
https://github.com/Xiao-MoMi/Custom-Crops.git
synced 2025-12-25 18:09:28 +00:00
3.0.2-hotfix3
This commit is contained in:
@@ -18,7 +18,10 @@
|
||||
package net.momirealms.customcrops.api.object.requirement;
|
||||
|
||||
import net.momirealms.customcrops.CustomCrops;
|
||||
import net.momirealms.customcrops.api.object.basic.ConfigManager;
|
||||
import net.momirealms.customcrops.api.object.season.CCSeason;
|
||||
import net.momirealms.customcrops.api.object.world.SimpleLocation;
|
||||
import net.momirealms.customcrops.api.object.world.WorldDataManager;
|
||||
import net.momirealms.customcrops.integration.SeasonInterface;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -36,11 +39,20 @@ public class SeasonImpl extends AbstractRequirement implements Requirement {
|
||||
@Override
|
||||
public boolean isConditionMet(CurrentState currentState) {
|
||||
SeasonInterface seasonInterface = CustomCrops.getInstance().getIntegrationManager().getSeasonInterface();
|
||||
if (seasonInterface == null) return true;
|
||||
CCSeason currentSeason = seasonInterface.getSeason(currentState.getLocation().getWorld().getName());
|
||||
if (seasons.contains(currentSeason)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
SimpleLocation simpleLocation = SimpleLocation.getByBukkitLocation(currentState.getLocation());
|
||||
WorldDataManager worldDataManager = CustomCrops.getInstance().getWorldDataManager();
|
||||
if (ConfigManager.enableGreenhouse) {
|
||||
for (int i = 0; i < ConfigManager.greenhouseRange; i++) {
|
||||
if (worldDataManager.isGreenhouse(simpleLocation.add(0, i, 0))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
notMetMessage(currentState.getPlayer());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -134,6 +134,7 @@ public class CCWorld extends Function {
|
||||
public void disable() {
|
||||
closePool();
|
||||
saveCache();
|
||||
CustomCrops.getInstance().getSeasonManager().unloadSeasonData(worldName);
|
||||
}
|
||||
|
||||
@SuppressWarnings("ResultOfMethodCallIgnored")
|
||||
@@ -157,7 +158,7 @@ public class CCWorld extends Function {
|
||||
}
|
||||
YamlConfiguration dataFile = new YamlConfiguration();
|
||||
if (ConfigManager.enableSeason && !ConfigManager.rsHook) {
|
||||
SeasonData seasonData = CustomCrops.getInstance().getSeasonManager().unloadSeasonData(worldName);
|
||||
SeasonData seasonData = CustomCrops.getInstance().getSeasonManager().getSeasonData(worldName);
|
||||
if (seasonData == null) {
|
||||
dataFile.set("season", "SPRING");
|
||||
dataFile.set("date", 1);
|
||||
|
||||
Reference in New Issue
Block a user