diff --git a/src/main/java/net/Indyuce/mmocore/api/experience/source/HarvestCropExperienceSource.java b/src/main/java/net/Indyuce/mmocore/api/experience/source/HarvestCropExperienceSource.java deleted file mode 100644 index ccce02e5..00000000 --- a/src/main/java/net/Indyuce/mmocore/api/experience/source/HarvestCropExperienceSource.java +++ /dev/null @@ -1,56 +0,0 @@ -package net.Indyuce.mmocore.api.experience.source; - -import org.bukkit.GameMode; -import org.bukkit.Material; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.block.BlockBreakEvent; - -import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.experience.Profession; -import net.Indyuce.mmocore.api.experience.source.type.SpecificExperienceSource; -import net.Indyuce.mmocore.api.load.MMOLineConfig; -import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.manager.profession.ExperienceManager; - -public class HarvestCropExperienceSource extends SpecificExperienceSource { - private final Material material; - private final boolean ripe; - - public HarvestCropExperienceSource(Profession profession, MMOLineConfig config) { - super(profession, config); - - config.validate("type"); - material = Material.valueOf(config.getString("type").toUpperCase().replace("-", "_").replace(" ", "_")); - ripe = config.getBoolean("ripe", true); - } - - @Override - public ExperienceManager newManager() { - return new ExperienceManager() { - - @EventHandler(priority = EventPriority.HIGHEST) - public void a(BlockBreakEvent event) { - if (event.isCancelled() || event.getPlayer().getGameMode() != GameMode.SURVIVAL) - return; - - - - if (ripe && !MMOCore.plugin.version.getVersionWrapper().isCropFullyGrown(event.getBlock())) - return; - - Material broken = event.getBlock().getType(); - - PlayerData data = PlayerData.get(event.getPlayer()); - for (HarvestCropExperienceSource source : getSources()) - if (source.matches(data, broken)) - source.giveExperience(data); - } - }; - } - - @Override - public boolean matches(PlayerData player, Material obj) { - return material == obj && hasRightClass(player); - } -} diff --git a/src/main/java/net/Indyuce/mmocore/api/experience/source/MineBlockExperienceSource.java b/src/main/java/net/Indyuce/mmocore/api/experience/source/MineBlockExperienceSource.java index 2415b36f..69122dea 100644 --- a/src/main/java/net/Indyuce/mmocore/api/experience/source/MineBlockExperienceSource.java +++ b/src/main/java/net/Indyuce/mmocore/api/experience/source/MineBlockExperienceSource.java @@ -8,6 +8,7 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.inventory.ItemStack; +import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.experience.Profession; import net.Indyuce.mmocore.api.experience.source.type.SpecificExperienceSource; import net.Indyuce.mmocore.api.load.MMOLineConfig; @@ -17,6 +18,7 @@ import net.Indyuce.mmocore.manager.profession.ExperienceManager; public class MineBlockExperienceSource extends SpecificExperienceSource { private final Material material; private final boolean silkTouch; + private final boolean crop; public MineBlockExperienceSource(Profession profession, MMOLineConfig config) { super(profession, config); @@ -24,6 +26,7 @@ public class MineBlockExperienceSource extends SpecificExperienceSource