mirror of
https://github.com/Xiao-MoMi/Custom-Crops.git
synced 2026-01-04 15:41:46 +00:00
3.0.2-hotfix3
This commit is contained in:
@@ -4,7 +4,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = 'net.momirealms'
|
group = 'net.momirealms'
|
||||||
version = '3.0.2-hotfix2'
|
version = '3.0.2-hotfix3'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
|||||||
@@ -18,7 +18,10 @@
|
|||||||
package net.momirealms.customcrops.api.object.requirement;
|
package net.momirealms.customcrops.api.object.requirement;
|
||||||
|
|
||||||
import net.momirealms.customcrops.CustomCrops;
|
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.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 net.momirealms.customcrops.integration.SeasonInterface;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
@@ -36,11 +39,20 @@ public class SeasonImpl extends AbstractRequirement implements Requirement {
|
|||||||
@Override
|
@Override
|
||||||
public boolean isConditionMet(CurrentState currentState) {
|
public boolean isConditionMet(CurrentState currentState) {
|
||||||
SeasonInterface seasonInterface = CustomCrops.getInstance().getIntegrationManager().getSeasonInterface();
|
SeasonInterface seasonInterface = CustomCrops.getInstance().getIntegrationManager().getSeasonInterface();
|
||||||
if (seasonInterface == null) return true;
|
|
||||||
CCSeason currentSeason = seasonInterface.getSeason(currentState.getLocation().getWorld().getName());
|
CCSeason currentSeason = seasonInterface.getSeason(currentState.getLocation().getWorld().getName());
|
||||||
if (seasons.contains(currentSeason)) {
|
if (seasons.contains(currentSeason)) {
|
||||||
return true;
|
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());
|
notMetMessage(currentState.getPlayer());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -134,6 +134,7 @@ public class CCWorld extends Function {
|
|||||||
public void disable() {
|
public void disable() {
|
||||||
closePool();
|
closePool();
|
||||||
saveCache();
|
saveCache();
|
||||||
|
CustomCrops.getInstance().getSeasonManager().unloadSeasonData(worldName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("ResultOfMethodCallIgnored")
|
@SuppressWarnings("ResultOfMethodCallIgnored")
|
||||||
@@ -157,7 +158,7 @@ public class CCWorld extends Function {
|
|||||||
}
|
}
|
||||||
YamlConfiguration dataFile = new YamlConfiguration();
|
YamlConfiguration dataFile = new YamlConfiguration();
|
||||||
if (ConfigManager.enableSeason && !ConfigManager.rsHook) {
|
if (ConfigManager.enableSeason && !ConfigManager.rsHook) {
|
||||||
SeasonData seasonData = CustomCrops.getInstance().getSeasonManager().unloadSeasonData(worldName);
|
SeasonData seasonData = CustomCrops.getInstance().getSeasonManager().getSeasonData(worldName);
|
||||||
if (seasonData == null) {
|
if (seasonData == null) {
|
||||||
dataFile.set("season", "SPRING");
|
dataFile.set("season", "SPRING");
|
||||||
dataFile.set("date", 1);
|
dataFile.set("date", 1);
|
||||||
|
|||||||
Reference in New Issue
Block a user