1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-29 05:55:27 +01:00

Improve Berry Checks

Allow payment when holding bonemeal by checking the plant's age.
This commit is contained in:
FireML 2023-05-17 12:20:52 +01:00
parent 8f1402ff72
commit 6f1d348a16

View File

@ -1750,12 +1750,15 @@ public final class JobsPaymentListener implements Listener {
if (level.getLevel() == level.getMaximumLevel()) {
Jobs.action(jPlayer, new BlockCollectInfo(CMIMaterial.BONE_MEAL, ActionType.COLLECT), block);
}
} else if ((cmat == CMIMaterial.SWEET_BERRY_BUSH || cmat == CMIMaterial.CAVE_VINES_PLANT || cmat == CMIMaterial.CAVE_VINES) && hand != CMIMaterial.BONE_MEAL.getMaterial()) {
} else if ((cmat == CMIMaterial.SWEET_BERRY_BUSH || cmat == CMIMaterial.CAVE_VINES_PLANT || cmat == CMIMaterial.CAVE_VINES)) {
if (cmat == CMIMaterial.SWEET_BERRY_BUSH) {
Ageable age = (Ageable) block.getBlockData();
if (age.getAge() >= 2)
if (age.getAge() == 2 && hand != CMIMaterial.BONE_MEAL.getMaterial()) {
Jobs.action(jPlayer, new BlockCollectInfo(CMIMaterial.SWEET_BERRIES, ActionType.COLLECT, age.getAge()), block);
} else if (age.getAge() == 3) {
Jobs.action(jPlayer, new BlockCollectInfo(CMIMaterial.SWEET_BERRIES, ActionType.COLLECT, age.getAge()), block);
}
} else {
org.bukkit.block.data.type.CaveVinesPlant caveVines = (org.bukkit.block.data.type.CaveVinesPlant) block.getBlockData();
if (caveVines.isBerries()) {