mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
Merge remote-tracking branch 'refs/remotes/mcMMO-Dev/master'
This commit is contained in:
commit
4f9a463b9d
@ -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,29 +238,36 @@ 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) {
|
||||||
try {
|
reason.add("Potion format for Treasures.yml has changed");
|
||||||
item = new Potion(PotionType.valueOf(potionType.toUpperCase().trim())).toItemStack(amount);
|
} else {
|
||||||
|
item = new ItemStack(mat, amount, data);
|
||||||
|
PotionMeta itemMeta = (PotionMeta) item.getItemMeta();
|
||||||
|
|
||||||
|
PotionType potionType = null;
|
||||||
|
try {
|
||||||
|
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")) {
|
||||||
|
@ -31,6 +31,9 @@ public class EnchantmentUtils {
|
|||||||
enchants.put("FLAME", Enchantment.ARROW_FIRE);
|
enchants.put("FLAME", Enchantment.ARROW_FIRE);
|
||||||
enchants.put("KNOCKBACK", Enchantment.KNOCKBACK);
|
enchants.put("KNOCKBACK", Enchantment.KNOCKBACK);
|
||||||
enchants.put("THORNS", Enchantment.THORNS);
|
enchants.put("THORNS", Enchantment.THORNS);
|
||||||
|
enchants.put("MENDING", Enchantment.MENDING);
|
||||||
|
enchants.put("DEPTH_STRIDER", Enchantment.DEPTH_STRIDER);
|
||||||
|
enchants.put("FROST_WALKER", Enchantment.FROST_WALKER);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -45,6 +48,6 @@ public class EnchantmentUtils {
|
|||||||
return enchants.get(enchantmentName);
|
return enchants.get(enchantmentName);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return Enchantment.getByName(enchantmentName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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