mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-23 05:36: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.ItemMeta;
|
||||||
import org.bukkit.inventory.meta.PotionMeta;
|
import org.bukkit.inventory.meta.PotionMeta;
|
||||||
import org.bukkit.material.Dye;
|
import org.bukkit.material.Dye;
|
||||||
|
import org.bukkit.material.MaterialData;
|
||||||
import org.bukkit.potion.PotionData;
|
import org.bukkit.potion.PotionData;
|
||||||
import org.bukkit.potion.PotionType;
|
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.Rarity;
|
||||||
import com.gmail.nossr50.datatypes.treasure.ShakeTreasure;
|
import com.gmail.nossr50.datatypes.treasure.ShakeTreasure;
|
||||||
import com.gmail.nossr50.util.EnchantmentUtils;
|
import com.gmail.nossr50.util.EnchantmentUtils;
|
||||||
|
import com.gmail.nossr50.util.StringUtils;
|
||||||
|
|
||||||
public class TreasureConfig extends ConfigLoader {
|
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 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<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<FishingTreasure>> fishingRewards = new HashMap<Rarity, List<FishingTreasure>>();
|
||||||
public HashMap<Rarity, List<EnchantmentTreasure>> fishingEnchantments = new HashMap<Rarity, List<EnchantmentTreasure>>();
|
public HashMap<Rarity, List<EnchantmentTreasure>> fishingEnchantments = new HashMap<Rarity, List<EnchantmentTreasure>>();
|
||||||
@ -301,8 +300,7 @@ public class TreasureConfig extends ConfigLoader {
|
|||||||
ExcavationTreasure excavationTreasure = new ExcavationTreasure(item, xp, dropChance, dropLevel);
|
ExcavationTreasure excavationTreasure = new ExcavationTreasure(item, xp, dropChance, dropLevel);
|
||||||
List<String> dropList = config.getStringList(type + "." + treasureName + ".Drops_From");
|
List<String> dropList = config.getStringList(type + "." + treasureName + ".Drops_From");
|
||||||
|
|
||||||
for (String blockType : dropList)
|
for (String blockType : dropList) {
|
||||||
{
|
|
||||||
Material mat = Material.matchMaterial(blockType);
|
Material mat = Material.matchMaterial(blockType);
|
||||||
if (!excavationMap.containsKey(mat))
|
if (!excavationMap.containsKey(mat))
|
||||||
excavationMap.put(mat, new ArrayList<ExcavationTreasure>());
|
excavationMap.put(mat, new ArrayList<ExcavationTreasure>());
|
||||||
@ -312,20 +310,38 @@ public class TreasureConfig extends ConfigLoader {
|
|||||||
HylianTreasure hylianTreasure = new HylianTreasure(item, xp, dropChance, dropLevel);
|
HylianTreasure hylianTreasure = new HylianTreasure(item, xp, dropChance, dropLevel);
|
||||||
List<String> dropList = config.getStringList(type + "." + treasureName + ".Drops_From");
|
List<String> dropList = config.getStringList(type + "." + treasureName + ".Drops_From");
|
||||||
|
|
||||||
if (dropList.contains("Bushes")) {
|
for (String dropper : dropList) {
|
||||||
hylianFromBushes.add(hylianTreasure);
|
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 (dropper.equals("Flowers")) {
|
||||||
if (dropList.contains("Flowers")) {
|
for (int i = 0; i < 9; i++) {
|
||||||
hylianFromFlowers.add(hylianTreasure);
|
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() {
|
private void loadEnchantments() {
|
||||||
|
@ -207,32 +207,10 @@ public class HerbalismManager extends SkillManager {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<HylianTreasure> treasures;
|
String friendly = StringUtils.getFriendlyConfigMaterialDataString(blockState.getData());
|
||||||
|
if (!TreasureConfig.getInstance().hylianMap.containsKey(friendly))
|
||||||
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);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
List<HylianTreasure> treasures = TreasureConfig.getInstance().hylianMap.get(friendly);
|
||||||
|
|
||||||
treasures = TreasureConfig.getInstance().hylianFromFlowers;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FLOWER_POT:
|
|
||||||
treasures = TreasureConfig.getInstance().hylianFromPots;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Player player = getPlayer();
|
Player player = getPlayer();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user