Closed eccentricdevotion closed 4 years ago
Hello
The keys contain indeed these custom attributes you said. There shouldn’t be any other change on this items. If for some reason your fix isn’t working don’t hesitate to send me private messages via Discord
Will see what my user reports, but in my testing GMI handles all the above attributes without issues in its current state, so no fix needed AFAIK.
Hey! Sorry for the delay. I don't know if the problem persists but here is the code to get the ItemStack copy of a ContainerKey of RPGChest:
public static ItemStack getKey(String name) {
final YamlConfiguration items = RPGChest.fileManager.keys;
if(!items.contains(name))
return null;
final ConfigurationSection itemSection = items.getConfigurationSection(name);
final ItemStack item = new ItemStack(Material.valueOf(itemSection.getString("Material")));
final ItemMeta itemMeta = item.getItemMeta();
if(itemSection.contains("Displayed name"))
itemMeta.setDisplayName(Common.colorize(itemSection.getString("Displayed name")));
if(itemSection.contains("Lore")) {
final List<String> configLore = itemSection.getStringList("Lore");
final List<String> itemLore = new ArrayList<>();
for(final String line : configLore)
itemLore.add(Common.colorize(line));
itemMeta.setLore(itemLore);
}
if(itemSection.getBoolean("Glowing")) {
itemMeta.addEnchant(Enchantment.ARROW_DAMAGE, 1, true);
itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
}
if(itemSection.contains("Flags"))
for(final String flagName : itemSection.getStringList("Flags"))
if(ItemManager.validFlags.contains(flagName))
itemMeta.addItemFlags(ItemFlag.valueOf(flagName));
item.setItemMeta(itemMeta);
return item;
}
Thanks for the code, it basically the same as I was testing with. I haven't heard back from the original reporter, so they either don't really care, or it's not actually a GMI issue. Feel free to close this ticket, if it is ever resolved on my end I'll let you know what the solution was.
Alright thank you!
Turned out to not be my plugin, but when you use a chat color formatting character to add an empty line in the key lore - such as §0
- it gets stripped out when using the pick block (middle mouse) button in an inventory, making the key invalid.
Possibly caused by this plugin: https://www.spigotmc.org/resources/creative-nbt-copy-control.13598/, but I think it's probably a Minecraft / Spigot behaviour...
I develop a Spigot plugin called GameModeInventories (separate inventories per game mode) - https://dev.bukkit.org/projects/gamemodeinventories - a user has reported that key items from the RPGChest plugin become unusable after switching inventories.
I don't have access to the premium plugin, but have tested iron ingot item stacks that have all of the following:
display name
lore
arrow_damage
enchantmenthide_enchant
item flagIs there anything else special about these keys that I should be aware of to make them compatible with my plugin?