Add support for torchflower replanting to herbalism

This commit is contained in:
nossr50 2023-04-02 20:38:05 -07:00
parent cd96bc79d8
commit 5f388a9906

View File

@ -42,10 +42,7 @@ import org.bukkit.inventory.PlayerInventory;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.util.ArrayList; import java.util.*;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
public class HerbalismManager extends SkillManager { public class HerbalismManager extends SkillManager {
public HerbalismManager(McMMOPlayer mcMMOPlayer) { public HerbalismManager(McMMOPlayer mcMMOPlayer) {
@ -773,35 +770,40 @@ public class HerbalismManager extends SkillManager {
PlayerInventory playerInventory = player.getInventory(); PlayerInventory playerInventory = player.getInventory();
Material seed; Material seed;
switch (blockState.getType()) { switch (blockState.getType().getKey().getKey().toLowerCase(Locale.ROOT)) {
case CARROTS: case "carrots":
seed = Material.CARROT; seed = Material.matchMaterial("CARROT");
break; break;
case WHEAT: case "wheat":
seed = Material.WHEAT_SEEDS; seed = Material.matchMaterial("WHEAT_SEEDS");
break; break;
case NETHER_WART: case "nether_wart":
seed = Material.NETHER_WART; seed = Material.getMaterial("NETHER_WART");
break; break;
case POTATOES: case "potatoes":
seed = Material.POTATO; seed = Material.matchMaterial("POTATO");
break; break;
case BEETROOTS: case "beetroots":
seed = Material.BEETROOT_SEEDS; seed = Material.matchMaterial("BEETROOT_SEEDS");
break; break;
case COCOA: case "cocoa":
seed = Material.COCOA_BEANS; seed = Material.matchMaterial("COCOA_BEANS");
break;
case "torchflower":
seed = Material.matchMaterial("TORCHFLOWER_SEEDS");
break; break;
default: default:
return false; return false;
} }
ItemStack seedStack = new ItemStack(seed); ItemStack seedStack = new ItemStack(seed);
if (ItemUtils.isAxe(blockBreakEvent.getPlayer().getInventory().getItemInMainHand()) if (ItemUtils.isAxe(blockBreakEvent.getPlayer().getInventory().getItemInMainHand())