mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-02-07 07:51:55 +01:00
Allow auto equip in nbt serialized kits (#4491)
Co-authored-by: Josh Roy <10731363+JRoy@users.noreply.github.com>
This commit is contained in:
parent
4811eb1558
commit
e4c179f5ed
@ -188,31 +188,33 @@ public class Kit {
|
||||
continue;
|
||||
}
|
||||
|
||||
final ItemStack stack;
|
||||
|
||||
if (kitItem.startsWith("@")) {
|
||||
if (ess.getSerializationProvider() == null) {
|
||||
ess.getLogger().log(Level.WARNING, tl("kitError3", kitName, user.getName()));
|
||||
continue;
|
||||
}
|
||||
itemList.add(ess.getSerializationProvider().deserializeItem(Base64Coder.decodeLines(kitItem.substring(1))));
|
||||
continue;
|
||||
}
|
||||
stack = ess.getSerializationProvider().deserializeItem(Base64Coder.decodeLines(kitItem.substring(1)));
|
||||
} else {
|
||||
final String[] parts = kitItem.split(" +");
|
||||
final ItemStack parseStack = ess.getItemDb().get(parts[0], parts.length > 1 ? Integer.parseInt(parts[1]) : 1);
|
||||
|
||||
final String[] parts = kitItem.split(" +");
|
||||
final ItemStack parseStack = ess.getItemDb().get(parts[0], parts.length > 1 ? Integer.parseInt(parts[1]) : 1);
|
||||
if (parseStack.getType() == Material.AIR) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (parseStack.getType() == Material.AIR) {
|
||||
continue;
|
||||
}
|
||||
final MetaItemStack metaStack = new MetaItemStack(parseStack);
|
||||
|
||||
final MetaItemStack metaStack = new MetaItemStack(parseStack);
|
||||
if (parts.length > 2) {
|
||||
// We pass a null sender here because kits should not do perm checks
|
||||
metaStack.parseStringMeta(null, allowUnsafe, parts, 2, ess);
|
||||
}
|
||||
|
||||
if (parts.length > 2) {
|
||||
// We pass a null sender here because kits should not do perm checks
|
||||
metaStack.parseStringMeta(null, allowUnsafe, parts, 2, ess);
|
||||
stack = metaStack.getItemStack();
|
||||
}
|
||||
|
||||
if (autoEquip) {
|
||||
final ItemStack stack = metaStack.getItemStack();
|
||||
final Material material = stack.getType();
|
||||
final PlayerInventory inventory = user.getBase().getInventory();
|
||||
if (MaterialUtil.isHelmet(material) && isEmptyStack(inventory.getHelmet())) {
|
||||
@ -230,7 +232,7 @@ public class Kit {
|
||||
}
|
||||
}
|
||||
|
||||
itemList.add(metaStack.getItemStack());
|
||||
itemList.add(stack);
|
||||
}
|
||||
|
||||
final Map<Integer, ItemStack> overfilled;
|
||||
|
Loading…
Reference in New Issue
Block a user