mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-30 00:56:47 +01:00
Update Treasures for potions
This commit is contained in:
parent
898fad6be4
commit
cbf2f34f93
@ -12,8 +12,10 @@ import org.bukkit.enchantments.Enchantment;
|
|||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.inventory.ItemStack;
|
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.material.Dye;
|
import org.bukkit.material.Dye;
|
||||||
import org.bukkit.potion.Potion;
|
import org.bukkit.potion.Potion;
|
||||||
|
import org.bukkit.potion.PotionData;
|
||||||
import org.bukkit.potion.PotionType;
|
import org.bukkit.potion.PotionType;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.ConfigLoader;
|
import com.gmail.nossr50.config.ConfigLoader;
|
||||||
@ -170,10 +172,7 @@ public class TreasureConfig extends ConfigLoader {
|
|||||||
*/
|
*/
|
||||||
Material material;
|
Material material;
|
||||||
|
|
||||||
if (materialName.contains("POTION")) {
|
if (materialName.contains("INK_SACK")) {
|
||||||
material = Material.POTION;
|
|
||||||
}
|
|
||||||
else if (materialName.contains("INK_SACK")) {
|
|
||||||
material = Material.INK_SACK;
|
material = Material.INK_SACK;
|
||||||
}
|
}
|
||||||
else if (materialName.contains("INVENTORY")) {
|
else if (materialName.contains("INVENTORY")) {
|
||||||
@ -239,31 +238,38 @@ public class TreasureConfig extends ConfigLoader {
|
|||||||
ItemStack item = null;
|
ItemStack item = null;
|
||||||
|
|
||||||
if (materialName.contains("POTION")) {
|
if (materialName.contains("POTION")) {
|
||||||
String potionType = materialName.substring(7);
|
Material mat = Material.matchMaterial(materialName);
|
||||||
|
if (mat == null) {
|
||||||
|
reason.add("Potion format for Treasures.yml has changed");
|
||||||
|
} else {
|
||||||
|
item = new ItemStack(mat, amount, data);
|
||||||
|
PotionMeta itemMeta = (PotionMeta) item.getItemMeta();
|
||||||
|
|
||||||
|
PotionType potionType = null;
|
||||||
try {
|
try {
|
||||||
item = new Potion(PotionType.valueOf(potionType.toUpperCase().trim())).toItemStack(amount);
|
potionType = PotionType.valueOf(config.getString(type + "." + treasureName + ".PotionData.PotionType", "WATER"));
|
||||||
|
}
|
||||||
|
catch (IllegalArgumentException ex) {
|
||||||
|
reason.add("Invalid Potion_Type: " + config.getString(type + "." + treasureName + ".PotionData.PotionType", "WATER"));
|
||||||
|
}
|
||||||
|
boolean extended = config.getBoolean(type + "." + treasureName + ".PotionData.Extended", false);
|
||||||
|
boolean upgraded = config.getBoolean(type + "." + treasureName + ".PotionData.Upgraded", false);
|
||||||
|
itemMeta.setBasePotionData(new PotionData(potionType, extended, upgraded));
|
||||||
|
|
||||||
if (config.contains(type + "." + treasureName + ".Custom_Name")) {
|
if (config.contains(type + "." + treasureName + ".Custom_Name")) {
|
||||||
ItemMeta itemMeta = item.getItemMeta();
|
|
||||||
itemMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', config.getString(type + "." + treasureName + ".Custom_Name")));
|
itemMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', config.getString(type + "." + treasureName + ".Custom_Name")));
|
||||||
item.setItemMeta(itemMeta);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.contains(type + "." + treasureName + ".Lore")) {
|
if (config.contains(type + "." + treasureName + ".Lore")) {
|
||||||
ItemMeta itemMeta = item.getItemMeta();
|
|
||||||
List<String> lore = new ArrayList<String>();
|
List<String> lore = new ArrayList<String>();
|
||||||
for (String s : config.getStringList(type + "." + treasureName + ".Lore")) {
|
for (String s : config.getStringList(type + "." + treasureName + ".Lore")) {
|
||||||
lore.add(ChatColor.translateAlternateColorCodes('&', s));
|
lore.add(ChatColor.translateAlternateColorCodes('&', s));
|
||||||
}
|
}
|
||||||
itemMeta.setLore(lore);
|
itemMeta.setLore(lore);
|
||||||
|
}
|
||||||
item.setItemMeta(itemMeta);
|
item.setItemMeta(itemMeta);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (IllegalArgumentException ex) {
|
|
||||||
reason.add("Invalid Potion_Type: " + potionType);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (materialName.contains("INK_SACK")) {
|
else if (materialName.contains("INK_SACK")) {
|
||||||
String color = materialName.substring(9);
|
String color = materialName.substring(9);
|
||||||
|
|
||||||
|
@ -651,7 +651,9 @@ Shake:
|
|||||||
XP: 0
|
XP: 0
|
||||||
Drop_Chance: 1.0
|
Drop_Chance: 1.0
|
||||||
Drop_Level: 0
|
Drop_Level: 0
|
||||||
POTION_POISON:
|
POTION|0|POISON:
|
||||||
|
PotionData:
|
||||||
|
PotionType: POISON
|
||||||
Amount: 1
|
Amount: 1
|
||||||
XP: 0
|
XP: 0
|
||||||
Drop_Chance: 1.0
|
Drop_Chance: 1.0
|
||||||
@ -861,17 +863,23 @@ Shake:
|
|||||||
Drop_Chance: 100.0
|
Drop_Chance: 100.0
|
||||||
Drop_Level: 0
|
Drop_Level: 0
|
||||||
WITCH:
|
WITCH:
|
||||||
POTION_INSTANT_HEAL:
|
SPLASH_POTION|0|INSTANT_HEAL:
|
||||||
|
PotionData:
|
||||||
|
PotionType: INSTANT_HEAL
|
||||||
Amount: 1
|
Amount: 1
|
||||||
XP: 0
|
XP: 0
|
||||||
Drop_Chance: 1.0
|
Drop_Chance: 1.0
|
||||||
Drop_Level: 0
|
Drop_Level: 0
|
||||||
POTION_FIRE_RESISTANCE:
|
SPLASH_POTION|0|FIRE_RESISTANCE:
|
||||||
|
PotionData:
|
||||||
|
PotionType: FIRE_RESISTANCE
|
||||||
Amount: 1
|
Amount: 1
|
||||||
XP: 0
|
XP: 0
|
||||||
Drop_Chance: 1.0
|
Drop_Chance: 1.0
|
||||||
Drop_Level: 0
|
Drop_Level: 0
|
||||||
POTION_SPEED:
|
SPLASH_POTION|0|SPEED:
|
||||||
|
PotionData:
|
||||||
|
PotionType: SPEED
|
||||||
Amount: 1
|
Amount: 1
|
||||||
XP: 0
|
XP: 0
|
||||||
Drop_Chance: 1.0
|
Drop_Chance: 1.0
|
||||||
|
Loading…
Reference in New Issue
Block a user