From a6b667861d89d2f02f7b25bade671ac0e8ffb6a4 Mon Sep 17 00:00:00 2001 From: Xiao-MoMi <70987828+Xiao-MoMi@users.noreply.github.com> Date: Tue, 26 Jul 2022 16:59:43 +0800 Subject: [PATCH] 1.5.18 --- README.md | 5 ++- build.gradle | 8 ++-- libs/MMOCore(premium).txt | 0 libs/mcMMO(premium).txt | 0 .../momirealms/customcrops/ConfigReader.java | 37 ++++++++++++++++- .../momirealms/customcrops/CustomCrops.java | 5 --- .../datamanager/MushroomManager.java | 7 ++++ .../{ => protection}/GriefDefender.java | 2 +- .../{ => protection}/GriefPrevention.java | 2 +- .../{ => protection}/Integration.java | 2 +- .../{ => protection}/KingdomsX.java | 2 +- .../integrations/{ => protection}/Lands.java | 2 +- .../{ => protection}/PlotSquared.java | 2 +- .../{ => protection}/Residence.java | 2 +- .../integrations/{ => protection}/Towny.java | 2 +- .../{ => protection}/WorldGuard.java | 2 +- .../integrations/skill/Aurelium.java | 17 ++++++++ .../integrations/skill/MMOCore.java | 13 ++++++ .../integrations/skill/SkillXP.java | 7 ++++ .../customcrops/integrations/skill/mcMMO.java | 12 ++++++ .../customcrops/listener/BreakBlock.java | 11 +++-- .../customcrops/listener/RightClick.java | 9 ++-- .../customcrops/timer/CropTimerAsync.java | 41 ------------------- .../customcrops/utils/CropInstance.java | 4 ++ src/main/resources/config.yml | 6 ++- src/main/resources/crops.yml | 4 ++ src/main/resources/plugin.yml | 3 ++ 27 files changed, 138 insertions(+), 69 deletions(-) create mode 100644 libs/MMOCore(premium).txt create mode 100644 libs/mcMMO(premium).txt create mode 100644 src/main/java/net/momirealms/customcrops/datamanager/MushroomManager.java rename src/main/java/net/momirealms/customcrops/integrations/{ => protection}/GriefDefender.java (95%) rename src/main/java/net/momirealms/customcrops/integrations/{ => protection}/GriefPrevention.java (95%) rename src/main/java/net/momirealms/customcrops/integrations/{ => protection}/Integration.java (93%) rename src/main/java/net/momirealms/customcrops/integrations/{ => protection}/KingdomsX.java (96%) rename src/main/java/net/momirealms/customcrops/integrations/{ => protection}/Lands.java (96%) rename src/main/java/net/momirealms/customcrops/integrations/{ => protection}/PlotSquared.java (96%) rename src/main/java/net/momirealms/customcrops/integrations/{ => protection}/Residence.java (96%) rename src/main/java/net/momirealms/customcrops/integrations/{ => protection}/Towny.java (96%) rename src/main/java/net/momirealms/customcrops/integrations/{ => protection}/WorldGuard.java (98%) create mode 100644 src/main/java/net/momirealms/customcrops/integrations/skill/Aurelium.java create mode 100644 src/main/java/net/momirealms/customcrops/integrations/skill/MMOCore.java create mode 100644 src/main/java/net/momirealms/customcrops/integrations/skill/SkillXP.java create mode 100644 src/main/java/net/momirealms/customcrops/integrations/skill/mcMMO.java delete mode 100644 src/main/java/net/momirealms/customcrops/timer/CropTimerAsync.java diff --git a/README.md b/README.md index 93479b7..1444028 100644 --- a/README.md +++ b/README.md @@ -69,5 +69,8 @@ NEVER SET "only-grow-in-loaded-chunks" FALSE IF YOU DON'T DISABLE THE THREE FEAT ### Placeholders %customcrops_season% show the season in the world\ %customcrops_season_[world]%\ +==== these papi below will be accurate only in "Auto" mode ====\ %customcrops_nextseason% show the days to the next season\ -%customcrops_nextseason_[world]% +%customcrops_nextseason_[world]%\ +%customcrops_current% show the days the current season has gone\ +%customcrops_current_[world]% diff --git a/build.gradle b/build.gradle index 6bb64ac..afd6970 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ plugins { group = 'net.momirealms' -version = '1.5.17' +version = '1.5.18' repositories { mavenCentral() @@ -52,13 +52,13 @@ repositories { } dependencies { - compileOnly "com.github.angeschossen:LandsAPI:6.5.1" - compileOnly "com.github.TechFortress:GriefPrevention:16.18" + compileOnly 'com.github.Archy-X:AureliumSkills:Beta1.3.6' + compileOnly 'com.github.angeschossen:LandsAPI:6.5.1' + compileOnly 'com.github.TechFortress:GriefPrevention:16.18' compileOnly 'com.destroystokyo.paper:paper-api:1.16.5-R0.1-SNAPSHOT' compileOnly 'com.comphenix.protocol:ProtocolLib:4.8.0' compileOnly 'me.clip:placeholderapi:2.11.2' compileOnly 'com.sk89q.worldguard:worldguard-bukkit:7.0.7' - compileOnly 'io.lumine:Mythic-Dist:5.0.3-SNAPSHOT' compileOnly 'com.github.LoneDev6:api-itemsadder:3.2.0c-beta6' compileOnly 'com.palmergames.bukkit.towny:towny:0.98.2.0' compileOnly fileTree(dir:'libs',includes:['*.jar']) diff --git a/libs/MMOCore(premium).txt b/libs/MMOCore(premium).txt new file mode 100644 index 0000000..e69de29 diff --git a/libs/mcMMO(premium).txt b/libs/mcMMO(premium).txt new file mode 100644 index 0000000..e69de29 diff --git a/src/main/java/net/momirealms/customcrops/ConfigReader.java b/src/main/java/net/momirealms/customcrops/ConfigReader.java index ce5d059..cfe948a 100644 --- a/src/main/java/net/momirealms/customcrops/ConfigReader.java +++ b/src/main/java/net/momirealms/customcrops/ConfigReader.java @@ -22,7 +22,11 @@ import net.momirealms.customcrops.fertilizer.Fertilizer; import net.momirealms.customcrops.fertilizer.QualityCrop; import net.momirealms.customcrops.fertilizer.RetainingSoil; import net.momirealms.customcrops.fertilizer.SpeedGrow; -import net.momirealms.customcrops.integrations.*; +import net.momirealms.customcrops.integrations.protection.*; +import net.momirealms.customcrops.integrations.skill.Aurelium; +import net.momirealms.customcrops.integrations.skill.MMOCore; +import net.momirealms.customcrops.integrations.skill.SkillXP; +import net.momirealms.customcrops.integrations.skill.mcMMO; import net.momirealms.customcrops.requirements.Biome; import net.momirealms.customcrops.requirements.Permission; import net.momirealms.customcrops.requirements.Requirement; @@ -90,6 +94,7 @@ public class ConfigReader { public static boolean needEmptyHand; public static double quality_1; public static double quality_2; + public static SkillXP skillXP; public static void loadConfig(){ @@ -237,6 +242,33 @@ public class ConfigReader { AdventureManager.consoleMessage("[CustomCrops] GriefPrevention Hooked!"); } } + + skillXP = null; + + if(config.getBoolean("config.integration.mcMMO",false)){ + if(Bukkit.getPluginManager().getPlugin("mcMMO") == null){ + CustomCrops.instance.getLogger().warning("Failed to initialize mcMMO!"); + }else { + skillXP = new mcMMO(); + AdventureManager.consoleMessage("[CustomCrops] mcMMO Hooked!"); + } + } + if(config.getBoolean("config.integration.AureliumSkills",false)){ + if(Bukkit.getPluginManager().getPlugin("AureliumSkills") == null){ + CustomCrops.instance.getLogger().warning("Failed to initialize AureliumSkills!"); + }else { + skillXP = new Aurelium(); + AdventureManager.consoleMessage("[CustomCrops] AureliumSkills Hooked!"); + } + } + if(config.getBoolean("config.integration.MMOCore",false)){ + if(Bukkit.getPluginManager().getPlugin("MMOCore") == null){ + CustomCrops.instance.getLogger().warning("Failed to initialize MMOCore!"); + }else { + skillXP = new MMOCore(); + AdventureManager.consoleMessage("[CustomCrops] MMOCore Hooked!"); + } + } } } @@ -458,6 +490,9 @@ public class ConfigReader { if (config.contains("crops." + key + ".commands")){ cropInstance.setCommands(config.getStringList("crops." + key + ".commands")); } + if (config.contains("crops." + key + ".skill-xp")){ + cropInstance.setSkillXP(config.getDouble("crops." + key + ".skill-xp")); + } if (config.contains("crops." + key + ".requirements")){ List requirements = new ArrayList<>(); config.getConfigurationSection("crops." + key + ".requirements").getValues(false).forEach((requirement, value) -> { diff --git a/src/main/java/net/momirealms/customcrops/CustomCrops.java b/src/main/java/net/momirealms/customcrops/CustomCrops.java index 3359bfc..6534da3 100644 --- a/src/main/java/net/momirealms/customcrops/CustomCrops.java +++ b/src/main/java/net/momirealms/customcrops/CustomCrops.java @@ -48,11 +48,6 @@ public final class CustomCrops extends JavaPlugin { private SeasonManager seasonManager; private PotManager potManager; - @Override - public void onLoad(){ - - } - @Override public void onEnable() { diff --git a/src/main/java/net/momirealms/customcrops/datamanager/MushroomManager.java b/src/main/java/net/momirealms/customcrops/datamanager/MushroomManager.java new file mode 100644 index 0000000..d7a4031 --- /dev/null +++ b/src/main/java/net/momirealms/customcrops/datamanager/MushroomManager.java @@ -0,0 +1,7 @@ +package net.momirealms.customcrops.datamanager; + +public class MushroomManager { + + //A new feature coming + +} diff --git a/src/main/java/net/momirealms/customcrops/integrations/GriefDefender.java b/src/main/java/net/momirealms/customcrops/integrations/protection/GriefDefender.java similarity index 95% rename from src/main/java/net/momirealms/customcrops/integrations/GriefDefender.java rename to src/main/java/net/momirealms/customcrops/integrations/protection/GriefDefender.java index 31b5982..7f62b83 100644 --- a/src/main/java/net/momirealms/customcrops/integrations/GriefDefender.java +++ b/src/main/java/net/momirealms/customcrops/integrations/protection/GriefDefender.java @@ -15,7 +15,7 @@ * along with this program. If not, see . */ -package net.momirealms.customcrops.integrations; +package net.momirealms.customcrops.integrations.protection; import org.bukkit.Location; import org.bukkit.entity.Player; diff --git a/src/main/java/net/momirealms/customcrops/integrations/GriefPrevention.java b/src/main/java/net/momirealms/customcrops/integrations/protection/GriefPrevention.java similarity index 95% rename from src/main/java/net/momirealms/customcrops/integrations/GriefPrevention.java rename to src/main/java/net/momirealms/customcrops/integrations/protection/GriefPrevention.java index ccad10e..41fc1dd 100644 --- a/src/main/java/net/momirealms/customcrops/integrations/GriefPrevention.java +++ b/src/main/java/net/momirealms/customcrops/integrations/protection/GriefPrevention.java @@ -15,7 +15,7 @@ * along with this program. If not, see . */ -package net.momirealms.customcrops.integrations; +package net.momirealms.customcrops.integrations.protection; import org.bukkit.Location; import org.bukkit.entity.Player; diff --git a/src/main/java/net/momirealms/customcrops/integrations/Integration.java b/src/main/java/net/momirealms/customcrops/integrations/protection/Integration.java similarity index 93% rename from src/main/java/net/momirealms/customcrops/integrations/Integration.java rename to src/main/java/net/momirealms/customcrops/integrations/protection/Integration.java index a76e804..2a7402d 100644 --- a/src/main/java/net/momirealms/customcrops/integrations/Integration.java +++ b/src/main/java/net/momirealms/customcrops/integrations/protection/Integration.java @@ -15,7 +15,7 @@ * along with this program. If not, see . */ -package net.momirealms.customcrops.integrations; +package net.momirealms.customcrops.integrations.protection; import org.bukkit.Location; import org.bukkit.entity.Player; diff --git a/src/main/java/net/momirealms/customcrops/integrations/KingdomsX.java b/src/main/java/net/momirealms/customcrops/integrations/protection/KingdomsX.java similarity index 96% rename from src/main/java/net/momirealms/customcrops/integrations/KingdomsX.java rename to src/main/java/net/momirealms/customcrops/integrations/protection/KingdomsX.java index a995f8f..d0c7707 100644 --- a/src/main/java/net/momirealms/customcrops/integrations/KingdomsX.java +++ b/src/main/java/net/momirealms/customcrops/integrations/protection/KingdomsX.java @@ -15,7 +15,7 @@ * along with this program. If not, see . */ -package net.momirealms.customcrops.integrations; +package net.momirealms.customcrops.integrations.protection; import org.bukkit.Location; import org.bukkit.entity.Player; diff --git a/src/main/java/net/momirealms/customcrops/integrations/Lands.java b/src/main/java/net/momirealms/customcrops/integrations/protection/Lands.java similarity index 96% rename from src/main/java/net/momirealms/customcrops/integrations/Lands.java rename to src/main/java/net/momirealms/customcrops/integrations/protection/Lands.java index 29c8efb..874c5f5 100644 --- a/src/main/java/net/momirealms/customcrops/integrations/Lands.java +++ b/src/main/java/net/momirealms/customcrops/integrations/protection/Lands.java @@ -15,7 +15,7 @@ * along with this program. If not, see . */ -package net.momirealms.customcrops.integrations; +package net.momirealms.customcrops.integrations.protection; import me.angeschossen.lands.api.flags.Flags; import me.angeschossen.lands.api.integration.LandsIntegration; diff --git a/src/main/java/net/momirealms/customcrops/integrations/PlotSquared.java b/src/main/java/net/momirealms/customcrops/integrations/protection/PlotSquared.java similarity index 96% rename from src/main/java/net/momirealms/customcrops/integrations/PlotSquared.java rename to src/main/java/net/momirealms/customcrops/integrations/protection/PlotSquared.java index 077232a..a9e9679 100644 --- a/src/main/java/net/momirealms/customcrops/integrations/PlotSquared.java +++ b/src/main/java/net/momirealms/customcrops/integrations/protection/PlotSquared.java @@ -15,7 +15,7 @@ * along with this program. If not, see . */ -package net.momirealms.customcrops.integrations; +package net.momirealms.customcrops.integrations.protection; import com.plotsquared.core.location.Location; import org.bukkit.entity.Player; diff --git a/src/main/java/net/momirealms/customcrops/integrations/Residence.java b/src/main/java/net/momirealms/customcrops/integrations/protection/Residence.java similarity index 96% rename from src/main/java/net/momirealms/customcrops/integrations/Residence.java rename to src/main/java/net/momirealms/customcrops/integrations/protection/Residence.java index d859122..a9c43d3 100644 --- a/src/main/java/net/momirealms/customcrops/integrations/Residence.java +++ b/src/main/java/net/momirealms/customcrops/integrations/protection/Residence.java @@ -15,7 +15,7 @@ * along with this program. If not, see . */ -package net.momirealms.customcrops.integrations; +package net.momirealms.customcrops.integrations.protection; import com.bekvon.bukkit.residence.containers.Flags; import com.bekvon.bukkit.residence.protection.ClaimedResidence; diff --git a/src/main/java/net/momirealms/customcrops/integrations/Towny.java b/src/main/java/net/momirealms/customcrops/integrations/protection/Towny.java similarity index 96% rename from src/main/java/net/momirealms/customcrops/integrations/Towny.java rename to src/main/java/net/momirealms/customcrops/integrations/protection/Towny.java index 084aa49..6f71b3a 100644 --- a/src/main/java/net/momirealms/customcrops/integrations/Towny.java +++ b/src/main/java/net/momirealms/customcrops/integrations/protection/Towny.java @@ -15,7 +15,7 @@ * along with this program. If not, see . */ -package net.momirealms.customcrops.integrations; +package net.momirealms.customcrops.integrations.protection; import com.palmergames.bukkit.towny.object.TownyPermission; import com.palmergames.bukkit.towny.utils.PlayerCacheUtil; diff --git a/src/main/java/net/momirealms/customcrops/integrations/WorldGuard.java b/src/main/java/net/momirealms/customcrops/integrations/protection/WorldGuard.java similarity index 98% rename from src/main/java/net/momirealms/customcrops/integrations/WorldGuard.java rename to src/main/java/net/momirealms/customcrops/integrations/protection/WorldGuard.java index 1f39a07..a25518d 100644 --- a/src/main/java/net/momirealms/customcrops/integrations/WorldGuard.java +++ b/src/main/java/net/momirealms/customcrops/integrations/protection/WorldGuard.java @@ -15,7 +15,7 @@ * along with this program. If not, see . */ -package net.momirealms.customcrops.integrations; +package net.momirealms.customcrops.integrations.protection; import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.math.BlockVector3; diff --git a/src/main/java/net/momirealms/customcrops/integrations/skill/Aurelium.java b/src/main/java/net/momirealms/customcrops/integrations/skill/Aurelium.java new file mode 100644 index 0000000..1eeee43 --- /dev/null +++ b/src/main/java/net/momirealms/customcrops/integrations/skill/Aurelium.java @@ -0,0 +1,17 @@ +package net.momirealms.customcrops.integrations.skill; + +import com.archyx.aureliumskills.api.AureliumAPI; +import com.archyx.aureliumskills.leveler.Leveler; +import com.archyx.aureliumskills.skills.Skill; +import org.bukkit.entity.Player; + +public class Aurelium implements SkillXP { + + private static final Leveler leveler = AureliumAPI.getPlugin().getLeveler(); + private static final Skill skill = AureliumAPI.getPlugin().getSkillRegistry().getSkill("farming"); + + @Override + public void addXp(Player player, double amount) { + leveler.addXp(player, skill, amount); + } +} diff --git a/src/main/java/net/momirealms/customcrops/integrations/skill/MMOCore.java b/src/main/java/net/momirealms/customcrops/integrations/skill/MMOCore.java new file mode 100644 index 0000000..6420dc2 --- /dev/null +++ b/src/main/java/net/momirealms/customcrops/integrations/skill/MMOCore.java @@ -0,0 +1,13 @@ +package net.momirealms.customcrops.integrations.skill; + +import net.Indyuce.mmocore.experience.EXPSource; +import net.Indyuce.mmocore.experience.Profession; +import org.bukkit.entity.Player; + +public class MMOCore implements SkillXP{ + @Override + public void addXp(Player player, double amount) { + Profession profession = net.Indyuce.mmocore.MMOCore.plugin.professionManager.get("farming"); + profession.giveExperience(net.Indyuce.mmocore.MMOCore.plugin.dataProvider.getDataManager().get(player), amount, null ,EXPSource.OTHER); + } +} diff --git a/src/main/java/net/momirealms/customcrops/integrations/skill/SkillXP.java b/src/main/java/net/momirealms/customcrops/integrations/skill/SkillXP.java new file mode 100644 index 0000000..1eb8c43 --- /dev/null +++ b/src/main/java/net/momirealms/customcrops/integrations/skill/SkillXP.java @@ -0,0 +1,7 @@ +package net.momirealms.customcrops.integrations.skill; + +import org.bukkit.entity.Player; + +public interface SkillXP { + void addXp(Player player, double amount); +} diff --git a/src/main/java/net/momirealms/customcrops/integrations/skill/mcMMO.java b/src/main/java/net/momirealms/customcrops/integrations/skill/mcMMO.java new file mode 100644 index 0000000..d9e0903 --- /dev/null +++ b/src/main/java/net/momirealms/customcrops/integrations/skill/mcMMO.java @@ -0,0 +1,12 @@ +package net.momirealms.customcrops.integrations.skill; + +import com.gmail.nossr50.api.ExperienceAPI; +import org.bukkit.entity.Player; + +public class mcMMO implements SkillXP { + + @Override + public void addXp(Player player, double amount) { + ExperienceAPI.addXP(player, "Herbalism", (int) amount, "UNKNOWN"); + } +} \ No newline at end of file diff --git a/src/main/java/net/momirealms/customcrops/listener/BreakBlock.java b/src/main/java/net/momirealms/customcrops/listener/BreakBlock.java index 57047ae..30b0ef8 100644 --- a/src/main/java/net/momirealms/customcrops/listener/BreakBlock.java +++ b/src/main/java/net/momirealms/customcrops/listener/BreakBlock.java @@ -25,7 +25,7 @@ import net.momirealms.customcrops.CustomCrops; import net.momirealms.customcrops.datamanager.PotManager; import net.momirealms.customcrops.fertilizer.Fertilizer; import net.momirealms.customcrops.fertilizer.QualityCrop; -import net.momirealms.customcrops.integrations.Integration; +import net.momirealms.customcrops.integrations.protection.Integration; import net.momirealms.customcrops.utils.CropInstance; import net.momirealms.customcrops.utils.SimpleLocation; import org.apache.commons.lang.StringUtils; @@ -84,6 +84,12 @@ public class BreakBlock implements Listener { return null; }); } + if (ConfigReader.Config.skillXP != null && cropInstance.getSkillXP() != 0){ + Bukkit.getScheduler().callSyncMethod(CustomCrops.instance, ()-> { + ConfigReader.Config.skillXP.addXp(player, cropInstance.getSkillXP()); + return null; + }); + } if (fertilizer != null){ if (fertilizer instanceof QualityCrop qualityCrop){ int[] weights = qualityCrop.getChance(); @@ -111,8 +117,7 @@ public class BreakBlock implements Listener { }); } - } - else { + } else { Bukkit.getScheduler().callSyncMethod(CustomCrops.instance, ()-> { normalDrop(cropInstance, random, itemLoc, world); return null; diff --git a/src/main/java/net/momirealms/customcrops/listener/RightClick.java b/src/main/java/net/momirealms/customcrops/listener/RightClick.java index 63e2dee..d5767c8 100644 --- a/src/main/java/net/momirealms/customcrops/listener/RightClick.java +++ b/src/main/java/net/momirealms/customcrops/listener/RightClick.java @@ -32,7 +32,7 @@ import net.momirealms.customcrops.fertilizer.Fertilizer; import net.momirealms.customcrops.fertilizer.QualityCrop; import net.momirealms.customcrops.fertilizer.RetainingSoil; import net.momirealms.customcrops.fertilizer.SpeedGrow; -import net.momirealms.customcrops.integrations.Integration; +import net.momirealms.customcrops.integrations.protection.Integration; import net.momirealms.customcrops.limits.CropsPerChunk; import net.momirealms.customcrops.limits.SprinklersPerChunk; import net.momirealms.customcrops.requirements.PlantingCondition; @@ -180,7 +180,7 @@ public class RightClick implements Listener { return; } } - if(water != 0 && action == Action.RIGHT_CLICK_BLOCK && event.getBlockFace() == BlockFace.UP){ + if(water != 0 && action == Action.RIGHT_CLICK_BLOCK){ Block block = event.getClickedBlock(); CustomBlock customBlock = CustomBlock.byAlreadyPlaced(block); if (customBlock == null) return; @@ -188,7 +188,7 @@ public class RightClick implements Listener { if(!integration.canPlace(block.getLocation(), player)) return; } String namespacedID = customBlock.getNamespacedID(); - if (namespacedID.equals(ConfigReader.Basic.pot) || namespacedID.equals(ConfigReader.Basic.watered_pot)){ + if ((namespacedID.equals(ConfigReader.Basic.pot) || namespacedID.equals(ConfigReader.Basic.watered_pot)) && event.getBlockFace() == BlockFace.UP){ nbtItem.setInteger("WaterAmount", water - 1); AdventureManager.playerSound(player, ConfigReader.Sounds.waterPotSource, ConfigReader.Sounds.waterPotKey); waterPot(wateringCan.getWidth(), wateringCan.getLength(), block.getLocation(), player.getLocation().getYaw()); @@ -354,6 +354,9 @@ public class RightClick implements Listener { Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), command.replace("{player}", player.getName())); } } + if (ConfigReader.Config.skillXP != null && cropInstance.getSkillXP() != 0){ + ConfigReader.Config.skillXP.addXp(player, cropInstance.getSkillXP()); + } if (fertilizer != null){ if (fertilizer instanceof QualityCrop qualityCrop){ int[] weights = qualityCrop.getChance(); diff --git a/src/main/java/net/momirealms/customcrops/timer/CropTimerAsync.java b/src/main/java/net/momirealms/customcrops/timer/CropTimerAsync.java deleted file mode 100644 index 838c6f2..0000000 --- a/src/main/java/net/momirealms/customcrops/timer/CropTimerAsync.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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.timer; - -import net.momirealms.customcrops.CustomCrops; -import org.bukkit.Bukkit; -import org.bukkit.scheduler.BukkitTask; - -public class CropTimerAsync { - - private final int taskID; - - public CropTimerAsync(CustomCrops plugin) { - TimeCheck tc = new TimeCheck(plugin); - BukkitTask task = tc.runTaskTimerAsynchronously(CustomCrops.instance, 1,1); - this.taskID = task.getTaskId(); - } - - public void stopTimer(int ID) { - Bukkit.getScheduler().cancelTask(ID); - } - - public int getTaskID() { - return this.taskID; - } -} diff --git a/src/main/java/net/momirealms/customcrops/utils/CropInstance.java b/src/main/java/net/momirealms/customcrops/utils/CropInstance.java index 66d3188..5c541ea 100644 --- a/src/main/java/net/momirealms/customcrops/utils/CropInstance.java +++ b/src/main/java/net/momirealms/customcrops/utils/CropInstance.java @@ -17,6 +17,7 @@ package net.momirealms.customcrops.utils; +import net.momirealms.customcrops.integrations.skill.SkillXP; import net.momirealms.customcrops.requirements.Requirement; import java.util.List; @@ -33,6 +34,7 @@ public class CropInstance { private String quality_1; private String quality_2; private String quality_3; + private double skillXP; private List commands; public CropInstance(int min, int max){ @@ -55,6 +57,7 @@ public class CropInstance { public int getMax() { return max; } public int getMin() { return min; } public List getCommands() { return commands; } + public double getSkillXP() {return skillXP;} public void setReturnStage(String stage){ this.returnStage = stage; } public void setGiant(String giant) { this.giant = giant; } @@ -65,4 +68,5 @@ public class CropInstance { public void setQuality_2(String quality_2) { this.quality_2 = quality_2; } public void setQuality_3(String quality_3) { this.quality_3 = quality_3; } public void setCommands(List commands) { this.commands = commands; } + public void setSkillXP(double skillXP) {this.skillXP = skillXP;} } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 738ede1..02462f7 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -2,8 +2,9 @@ config: #english spanish chinese lang: english - #integration to prevent other players' grief + integration: + #integration to prevent other players' grief Residence: false WorldGuard: false Kingdoms: false @@ -12,9 +13,10 @@ config: Towny: false Lands: false GriefPrevention: false - + #integration to add players' farming skill xp AureliumSkills: false mcMMO: false + MMOCore: false #The time to start growing(ticks) #1000ticks is 7am in game. (0-23999) diff --git a/src/main/resources/crops.yml b/src/main/resources/crops.yml index 92f167e..1c54ddd 100644 --- a/src/main/resources/crops.yml +++ b/src/main/resources/crops.yml @@ -20,6 +20,10 @@ crops: commands: - 'say {player} harvested a tomato! lol' + #optional + #If you are using skill plugin, you can add farming skill xp to players + #skill-xp: 100 + #optional season: - summer diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 5630182..6aa14a2 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -16,6 +16,9 @@ softdepend: - Towny - Lands - GriefPrevention + - mcMMO + - AureliumSkills + - MMOCore commands: customcrops: usage: /customcrops \ No newline at end of file