1.14.2
This commit is contained in:
parent
70fccf26fb
commit
dd0b1c173f
2 changed files with 17 additions and 8 deletions
|
|
@ -533,7 +533,7 @@ public class ItemUtils {
|
|||
Multimap<Attribute,AttributeModifier> attributes = meta.getAttributeModifiers();
|
||||
Set<Attribute> set = attributes.keySet();
|
||||
|
||||
List<String> attributeList = new ArrayList<String>();
|
||||
List<String> attributeList = new ArrayList<>();
|
||||
for(Attribute a : set) {
|
||||
Collection<AttributeModifier> listModifiers = attributes.get(a);
|
||||
for(AttributeModifier m : listModifiers) {
|
||||
|
|
@ -542,7 +542,7 @@ public class ItemUtils {
|
|||
line = a.name()+";"+m.getOperation().name()+";"+m.getAmount()+";"+m.getKey().getNamespace()+":"+m.getKey().getKey();
|
||||
line=line+";"+m.getSlotGroup().toString();
|
||||
}else{
|
||||
line = a.name()+";"+m.getOperation().name()+";"+m.getAmount()+";"+m.getUniqueId();
|
||||
line = getAttributeName(a)+";"+m.getOperation().name()+";"+m.getAmount()+";"+m.getUniqueId();
|
||||
if(m.getSlot() != null) {
|
||||
line=line+";"+m.getSlot().name();
|
||||
}
|
||||
|
|
@ -605,7 +605,7 @@ public class ItemUtils {
|
|||
}
|
||||
}
|
||||
|
||||
meta.addAttributeModifier(Attribute.valueOf(attribute), modifier);
|
||||
meta.addAttributeModifier(getAttributeByName(attribute), modifier);
|
||||
}
|
||||
|
||||
item.setItemMeta(meta);
|
||||
|
|
@ -764,10 +764,19 @@ public class ItemUtils {
|
|||
|
||||
private static Attribute getAttributeByName(String name){
|
||||
try {
|
||||
Class<?> attributeTypeClass = Class.forName("org.bukkit.attribute");
|
||||
Method valueOf = attributeTypeClass.getMethod("valueOf", String.class);
|
||||
return (Attribute) valueOf.invoke(null,name);
|
||||
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException | ClassNotFoundException e) {
|
||||
Class<?> attributeTypeClass = Class.forName("org.bukkit.attribute.Attribute");
|
||||
Field field = attributeTypeClass.getField(name);
|
||||
return (Attribute) field.get(null);
|
||||
} catch (IllegalAccessException | ClassNotFoundException | NoSuchFieldException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private static String getAttributeName(Object attribute){
|
||||
try {
|
||||
Class<?> attributeTypeClass = Class.forName("org.bukkit.attribute.Attribute");
|
||||
return (String)attributeTypeClass.getMethod("name").invoke(attribute);
|
||||
} catch (IllegalAccessException | ClassNotFoundException | NoSuchMethodException | InvocationTargetException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
main: pk.ajneb97.PlayerKits2
|
||||
version: 1.14.1
|
||||
version: 1.14.2
|
||||
name: PlayerKits2
|
||||
api-version: 1.13
|
||||
softdepend: [Vault,PlaceholderAPI]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue