diff --git a/build.gradle.kts b/build.gradle.kts index d761037..7d8a63d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ plugins { allprojects { project.group = "net.momirealms" - project.version = "3.3.1.13" + project.version = "3.3.1.14" apply() apply(plugin = "java") diff --git a/plugin/libs/AdvancedSeasons-API.jar b/plugin/libs/AdvancedSeasons-API.jar new file mode 100644 index 0000000..19ddf21 Binary files /dev/null and b/plugin/libs/AdvancedSeasons-API.jar differ diff --git a/plugin/src/main/java/net/momirealms/customcrops/integration/IntegrationManager.java b/plugin/src/main/java/net/momirealms/customcrops/integration/IntegrationManager.java index 09b36bf..6350f0a 100644 --- a/plugin/src/main/java/net/momirealms/customcrops/integration/IntegrationManager.java +++ b/plugin/src/main/java/net/momirealms/customcrops/integration/IntegrationManager.java @@ -30,6 +30,7 @@ import net.momirealms.customcrops.integration.papi.PlaceholderManager; import net.momirealms.customcrops.integration.quest.BattlePassCCQuest; import net.momirealms.customcrops.integration.quest.BetonQuestCCQuest; import net.momirealms.customcrops.integration.quest.ClueScrollCCQuest; +import net.momirealms.customcrops.integration.season.AdvancedSeasonsImpl; import net.momirealms.customcrops.integration.season.CustomCropsSeasonImpl; import net.momirealms.customcrops.integration.season.RealisticSeasonsImpl; import net.momirealms.customcrops.integration.skill.AureliumsImpl; @@ -115,6 +116,10 @@ public class IntegrationManager extends Function { this.seasonInterface = new RealisticSeasonsImpl(); ConfigManager.rsHook = true; hookMessage("RealisticSeasons"); + } else if (pluginManager.isPluginEnabled("AdvancedSeasons")) { + this.seasonInterface = new AdvancedSeasonsImpl(); + ConfigManager.rsHook = true; + hookMessage("AdvancedSeasons"); } else { this.seasonInterface = new CustomCropsSeasonImpl(); } diff --git a/plugin/src/main/java/net/momirealms/customcrops/integration/season/AdvancedSeasonsImpl.java b/plugin/src/main/java/net/momirealms/customcrops/integration/season/AdvancedSeasonsImpl.java new file mode 100644 index 0000000..67cc411 --- /dev/null +++ b/plugin/src/main/java/net/momirealms/customcrops/integration/season/AdvancedSeasonsImpl.java @@ -0,0 +1,50 @@ +/* + * Copyright (C) <2022> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package net.momirealms.customcrops.integration.season; + +import me.casperge.realisticseasons.api.SeasonsAPI; +import net.advancedplugins.seasons.api.AdvancedSeasonsAPI; +import net.momirealms.customcrops.api.object.season.CCSeason; +import net.momirealms.customcrops.helper.Log; +import net.momirealms.customcrops.integration.SeasonInterface; +import org.bukkit.Bukkit; + +public class AdvancedSeasonsImpl implements SeasonInterface { + + private final AdvancedSeasonsAPI api; + + public AdvancedSeasonsImpl() { + this.api = new AdvancedSeasonsAPI(); + } + + @Override + public CCSeason getSeason(String world) { + return switch (api.getSeason(Bukkit.getWorld(world))) { + case "SPRING" -> CCSeason.SPRING; + case "WINTER" -> CCSeason.WINTER; + case "SUMMER" -> CCSeason.SUMMER; + case "FALL" -> CCSeason.AUTUMN; + default -> CCSeason.UNKNOWN; + }; + } + + @Override + public int getDate(String world) { + return SeasonsAPI.getInstance().getDate(Bukkit.getWorld(world)).getDay(); + } +} diff --git a/plugin/src/main/resources/config.yml b/plugin/src/main/resources/config.yml index 3b3d314..21fb2a2 100644 --- a/plugin/src/main/resources/config.yml +++ b/plugin/src/main/resources/config.yml @@ -18,9 +18,9 @@ worlds: # Requires a restart when changing mode or editing world list for the safety of data # 模式:白名单/黑名单 # 修改本栏需要重启服务器 - mode: whitelist + mode: blacklist list: - - world + - blacklist_world schedule-system: # If disabled, you can do that manually with command /customcrops force [consume/sprinklerwork/cropgrow] or API methods diff --git a/plugin/src/main/resources/plugin.yml b/plugin/src/main/resources/plugin.yml index 1c76cab..647d4e9 100644 --- a/plugin/src/main/resources/plugin.yml +++ b/plugin/src/main/resources/plugin.yml @@ -16,6 +16,7 @@ softdepend: - MMOCore - EcoSkills - RealisticSeasons + - AdvancedSeasons - Jobs - IridiumSkyblock - SuperiorSkyBlock2