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 HashMap<EntityType, List<ShakeTreasure>> shakeMap = new HashMap<EntityType, List<ShakeTreasure>>();
|
||||||
public List<HylianTreasure> hylianFromFlowers = new ArrayList<HylianTreasure>();
|
public HashMap<String, List<HylianTreasure>> hylianMap = new HashMap<String, List<HylianTreasure>>();
|
||||||
public List<HylianTreasure> hylianFromPots = new ArrayList<HylianTreasure>();
|
|
||||||
|
|
||||||
public HashMap<EntityType, List<ShakeTreasure>> shakeMap = new HashMap<EntityType, List<ShakeTreasure>>();
|
|
||||||
|
|
||||||
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>>();
|
||||||
@ -144,9 +143,9 @@ public class TreasureConfig extends ConfigLoader {
|
|||||||
|
|
||||||
if (materialName.contains("INK_SACK")) {
|
if (materialName.contains("INK_SACK")) {
|
||||||
material = Material.INK_SACK;
|
material = Material.INK_SACK;
|
||||||
} else if(materialName.contains("COAL")){
|
} else if (materialName.contains("COAL")) {
|
||||||
material = Material.COAL;
|
material = Material.COAL;
|
||||||
} else if (materialName.contains("INVENTORY")) {
|
} 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
|
// Use magic material BED_BLOCK to know that we're grabbing something from the inventory and not a normal treasure
|
||||||
if (!shakeMap.containsKey(EntityType.PLAYER))
|
if (!shakeMap.containsKey(EntityType.PLAYER))
|
||||||
shakeMap.put(EntityType.PLAYER, new ArrayList<ShakeTreasure>());
|
shakeMap.put(EntityType.PLAYER, new ArrayList<ShakeTreasure>());
|
||||||
@ -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,22 +310,40 @@ 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);
|
||||||
if (dropList.contains("Flowers")) {
|
AddHylianTreasure(StringUtils.getPrettyItemString(Material.SAPLING), hylianTreasure);
|
||||||
hylianFromFlowers.add(hylianTreasure);
|
AddHylianTreasure(StringUtils.getPrettyItemString(Material.DEAD_BUSH), hylianTreasure);
|
||||||
}
|
continue;
|
||||||
|
}
|
||||||
if (dropList.contains("Pots")) {
|
if (dropper.equals("Flowers")) {
|
||||||
hylianFromPots.add(hylianTreasure);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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() {
|
||||||
for (Rarity rarity : Rarity.values()) {
|
for (Rarity rarity : Rarity.values()) {
|
||||||
if (rarity == Rarity.TRAP || rarity == Rarity.RECORD) {
|
if (rarity == Rarity.TRAP || rarity == Rarity.RECORD) {
|
||||||
|
@ -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()) {
|
return false;
|
||||||
case DEAD_BUSH:
|
List<HylianTreasure> treasures = TreasureConfig.getInstance().hylianMap.get(friendly);
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
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