mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
More configuration for hylian luck
This commit is contained in:
parent
ee02a19e9a
commit
24f8b2fbd5
@ -14,6 +14,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.inventory.meta.PotionMeta;
|
||||
import org.bukkit.material.Dye;
|
||||
import org.bukkit.material.MaterialData;
|
||||
import org.bukkit.potion.PotionData;
|
||||
import org.bukkit.potion.PotionType;
|
||||
|
||||
@ -25,6 +26,7 @@ import com.gmail.nossr50.datatypes.treasure.HylianTreasure;
|
||||
import com.gmail.nossr50.datatypes.treasure.Rarity;
|
||||
import com.gmail.nossr50.datatypes.treasure.ShakeTreasure;
|
||||
import com.gmail.nossr50.util.EnchantmentUtils;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
|
||||
public class TreasureConfig extends ConfigLoader {
|
||||
|
||||
@ -32,11 +34,8 @@ public class TreasureConfig extends ConfigLoader {
|
||||
|
||||
public HashMap<Material, List<ExcavationTreasure>> excavationMap = new HashMap<Material, List<ExcavationTreasure>>();
|
||||
|
||||
public List<HylianTreasure> hylianFromBushes = new ArrayList<HylianTreasure>();
|
||||
public List<HylianTreasure> hylianFromFlowers = new ArrayList<HylianTreasure>();
|
||||
public List<HylianTreasure> hylianFromPots = new ArrayList<HylianTreasure>();
|
||||
|
||||
public HashMap<EntityType, List<ShakeTreasure>> shakeMap = new HashMap<EntityType, List<ShakeTreasure>>();
|
||||
public HashMap<String, List<HylianTreasure>> hylianMap = new HashMap<String, List<HylianTreasure>>();
|
||||
|
||||
public HashMap<Rarity, List<FishingTreasure>> fishingRewards = new HashMap<Rarity, List<FishingTreasure>>();
|
||||
public HashMap<Rarity, List<EnchantmentTreasure>> fishingEnchantments = new HashMap<Rarity, List<EnchantmentTreasure>>();
|
||||
@ -144,7 +143,7 @@ public class TreasureConfig extends ConfigLoader {
|
||||
|
||||
if (materialName.contains("INK_SACK")) {
|
||||
material = Material.INK_SACK;
|
||||
} else if(materialName.contains("COAL")){
|
||||
} else if (materialName.contains("COAL")) {
|
||||
material = Material.COAL;
|
||||
} else if (materialName.contains("INVENTORY")) {
|
||||
// Use magic material BED_BLOCK to know that we're grabbing something from the inventory and not a normal treasure
|
||||
@ -301,8 +300,7 @@ public class TreasureConfig extends ConfigLoader {
|
||||
ExcavationTreasure excavationTreasure = new ExcavationTreasure(item, xp, dropChance, dropLevel);
|
||||
List<String> dropList = config.getStringList(type + "." + treasureName + ".Drops_From");
|
||||
|
||||
for (String blockType : dropList)
|
||||
{
|
||||
for (String blockType : dropList) {
|
||||
Material mat = Material.matchMaterial(blockType);
|
||||
if (!excavationMap.containsKey(mat))
|
||||
excavationMap.put(mat, new ArrayList<ExcavationTreasure>());
|
||||
@ -312,20 +310,38 @@ public class TreasureConfig extends ConfigLoader {
|
||||
HylianTreasure hylianTreasure = new HylianTreasure(item, xp, dropChance, dropLevel);
|
||||
List<String> dropList = config.getStringList(type + "." + treasureName + ".Drops_From");
|
||||
|
||||
if (dropList.contains("Bushes")) {
|
||||
hylianFromBushes.add(hylianTreasure);
|
||||
for (String dropper : dropList) {
|
||||
if (dropper.equals("Bushes")) {
|
||||
AddHylianTreasure("Small_Fern", hylianTreasure);
|
||||
AddHylianTreasure("Small_Grass", hylianTreasure);
|
||||
AddHylianTreasure(StringUtils.getPrettyItemString(Material.SAPLING), hylianTreasure);
|
||||
AddHylianTreasure(StringUtils.getPrettyItemString(Material.DEAD_BUSH), hylianTreasure);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (dropList.contains("Flowers")) {
|
||||
hylianFromFlowers.add(hylianTreasure);
|
||||
if (dropper.equals("Flowers")) {
|
||||
for (int i = 0; i < 9; i++) {
|
||||
AddHylianTreasure(StringUtils.getFriendlyConfigMaterialDataString(new MaterialData(Material.RED_ROSE, (byte) i)), hylianTreasure);
|
||||
}
|
||||
AddHylianTreasure(StringUtils.getPrettyItemString(Material.YELLOW_FLOWER), hylianTreasure);
|
||||
continue;
|
||||
}
|
||||
if (dropper.equals("Pots")) {
|
||||
for (int i = 0; i < 14; i++) {
|
||||
AddHylianTreasure(StringUtils.getFriendlyConfigMaterialDataString(new MaterialData(Material.FLOWER_POT, (byte) i)), hylianTreasure);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
AddHylianTreasure(dropper, hylianTreasure);
|
||||
}
|
||||
|
||||
if (dropList.contains("Pots")) {
|
||||
hylianFromPots.add(hylianTreasure);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void AddHylianTreasure(String dropper, HylianTreasure treasure) {
|
||||
if (!hylianMap.containsKey(dropper))
|
||||
hylianMap.put(dropper, new ArrayList<HylianTreasure>());
|
||||
hylianMap.get(dropper).add(treasure);
|
||||
}
|
||||
|
||||
private void loadEnchantments() {
|
||||
|
@ -207,32 +207,10 @@ public class HerbalismManager extends SkillManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
List<HylianTreasure> treasures;
|
||||
|
||||
switch (blockState.getType()) {
|
||||
case DEAD_BUSH:
|
||||
case LONG_GRASS:
|
||||
case SAPLING:
|
||||
treasures = TreasureConfig.getInstance().hylianFromBushes;
|
||||
break;
|
||||
|
||||
case RED_ROSE:
|
||||
case YELLOW_FLOWER:
|
||||
if (mcMMO.getPlaceStore().isTrue(blockState)) {
|
||||
mcMMO.getPlaceStore().setFalse(blockState);
|
||||
String friendly = StringUtils.getFriendlyConfigMaterialDataString(blockState.getData());
|
||||
if (!TreasureConfig.getInstance().hylianMap.containsKey(friendly))
|
||||
return false;
|
||||
}
|
||||
|
||||
treasures = TreasureConfig.getInstance().hylianFromFlowers;
|
||||
break;
|
||||
|
||||
case FLOWER_POT:
|
||||
treasures = TreasureConfig.getInstance().hylianFromPots;
|
||||
break;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
List<HylianTreasure> treasures = TreasureConfig.getInstance().hylianMap.get(friendly);
|
||||
|
||||
Player player = getPlayer();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user