Add sapling types

This commit is contained in:
t00thpick1 2017-06-10 14:30:06 -04:00
parent 24f8b2fbd5
commit 755787f9ee
2 changed files with 18 additions and 4 deletions

View File

@ -7,6 +7,7 @@ import java.util.List;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.DyeColor; import org.bukkit.DyeColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.TreeSpecies;
import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
@ -314,7 +315,10 @@ public class TreasureConfig extends ConfigLoader {
if (dropper.equals("Bushes")) { if (dropper.equals("Bushes")) {
AddHylianTreasure("Small_Fern", hylianTreasure); AddHylianTreasure("Small_Fern", hylianTreasure);
AddHylianTreasure("Small_Grass", hylianTreasure); AddHylianTreasure("Small_Grass", hylianTreasure);
AddHylianTreasure(StringUtils.getPrettyItemString(Material.SAPLING), hylianTreasure); for (TreeSpecies species : TreeSpecies.values()) {
AddHylianTreasure(StringUtils.getPrettyTreeSpeciesString(species) + "_Sapling", hylianTreasure);
}
AddHylianTreasure(StringUtils.getPrettyItemString(Material.DEAD_BUSH), hylianTreasure); AddHylianTreasure(StringUtils.getPrettyItemString(Material.DEAD_BUSH), hylianTreasure);
continue; continue;
} }

View File

@ -11,6 +11,7 @@ import org.bukkit.material.Crops;
import org.bukkit.material.LongGrass; import org.bukkit.material.LongGrass;
import org.bukkit.material.MaterialData; import org.bukkit.material.MaterialData;
import org.bukkit.material.NetherWarts; import org.bukkit.material.NetherWarts;
import org.bukkit.material.Sapling;
import org.bukkit.material.Tree; import org.bukkit.material.Tree;
import org.bukkit.material.CocoaPlant.CocoaPlantSize; import org.bukkit.material.CocoaPlant.CocoaPlantSize;
@ -292,19 +293,28 @@ public class StringUtils {
if (((Crops) data).getState() == CropState.RIPE) { if (((Crops) data).getState() == CropState.RIPE) {
return getPrettyItemString(data.getItemType()).replace(" ", "_"); return getPrettyItemString(data.getItemType()).replace(" ", "_");
} }
return getPrettyItemString(data.getItemType()).replace(" ", "_") + "_UNGROWN"; return getPrettyItemString(data.getItemType()).replace(" ", "_") + "_Ungrown";
} }
case NETHER_WARTS : { case NETHER_WARTS : {
if (((NetherWarts) data).getState() == NetherWartsState.RIPE) { if (((NetherWarts) data).getState() == NetherWartsState.RIPE) {
return getPrettyItemString(data.getItemType()).replace(" ", "_"); return getPrettyItemString(data.getItemType()).replace(" ", "_");
} }
return getPrettyItemString(data.getItemType()).replace(" ", "_") + "_UNGROWN"; return getPrettyItemString(data.getItemType()).replace(" ", "_") + "_Ungrown";
} }
case COCOA : { case COCOA : {
if (((CocoaPlant) data).getSize() == CocoaPlantSize.LARGE) { if (((CocoaPlant) data).getSize() == CocoaPlantSize.LARGE) {
return getPrettyItemString(data.getItemType()).replace(" ", "_"); return getPrettyItemString(data.getItemType()).replace(" ", "_");
} }
return getPrettyItemString(data.getItemType()).replace(" ", "_") + "_UNGROWN"; return getPrettyItemString(data.getItemType()).replace(" ", "_") + "_Ungrown";
}
case SAPLING:
{
TreeSpecies species = TreeSpecies.GENERIC;
if (data instanceof Sapling) {
Sapling sapling = (Sapling) data;
species = sapling.getSpecies();
}
return createPrettyEnumString(species.name()).replace(" ", "_") + "_Sapling";
} }
case SMOOTH_BRICK : case SMOOTH_BRICK :
case WOOL : case WOOL :