mirror of https://github.com/taoneill/war.git
Fixed anvil names not being saved to loadout.
I also fixed "lore" too, but I do not know what it is.
This commit is contained in:
parent
c3d7b74109
commit
9ca2ed1f46
|
@ -14,6 +14,7 @@ import java.util.Arrays;
|
|||
import java.util.logging.Level;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.inventory.meta.LeatherArmorMeta;
|
||||
|
||||
public class LoadoutYmlMapper {
|
||||
|
@ -58,6 +59,18 @@ public class LoadoutYmlMapper {
|
|||
meta.setColor(clr);
|
||||
stack.setItemMeta(meta);
|
||||
}
|
||||
if (config.contains(prefix + "name")) {
|
||||
String itemName = config.getString(prefix + "name");
|
||||
ItemMeta meta = stack.getItemMeta();
|
||||
meta.setDisplayName(itemName);
|
||||
stack.setItemMeta(meta);
|
||||
}
|
||||
if (config.contains(prefix + "lore")) {
|
||||
List<String> itemLore = config.getStringList(prefix + "lore");
|
||||
ItemMeta meta = stack.getItemMeta();
|
||||
meta.setLore(itemLore);
|
||||
stack.setItemMeta(meta);
|
||||
}
|
||||
|
||||
loadout.put(slot, stack);
|
||||
}
|
||||
|
@ -125,6 +138,14 @@ public class LoadoutYmlMapper {
|
|||
int rgb = meta.getColor().asRGB();
|
||||
slotSection.set("armorcolor", rgb);
|
||||
}
|
||||
if (stack.hasItemMeta() && stack.getItemMeta().hasDisplayName()) {
|
||||
ItemMeta meta = stack.getItemMeta();
|
||||
slotSection.set("name", meta.getDisplayName());
|
||||
}
|
||||
if (stack.hasItemMeta() && stack.getItemMeta().hasLore()) {
|
||||
ItemMeta meta = stack.getItemMeta();
|
||||
slotSection.set("lore", meta.getLore());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue