Items MUST have matching uuids
This commit is contained in:
1 parent
3d27999357
commit
0775bb0d91
1 file changed
+16
-4
+16
-4
@@ -127,19 +127,31 @@ public class ArmourBound extends BasicHack {
|
||||
if (second == null || second.getType() == Material.AIR) {
|
||||
return;
|
||||
}
|
||||
if (!first.hasItemMeta()) {
|
||||
return;
|
||||
}
|
||||
if (!second.hasItemMeta()) {
|
||||
return;
|
||||
}
|
||||
PersistentDataContainer container = second.getItemMeta().getPersistentDataContainer();
|
||||
if (!container.has(this.key, PersistentDataType.STRING)) {
|
||||
PersistentDataContainer firstContainer = first.getItemMeta().getPersistentDataContainer();
|
||||
if (!firstContainer.has(this.key, PersistentDataType.STRING)) {
|
||||
return;
|
||||
}
|
||||
UUID firstUUID = UUID.fromString(firstContainer.get(this.key, PersistentDataType.STRING));
|
||||
PersistentDataContainer secondContainer = second.getItemMeta().getPersistentDataContainer();
|
||||
if (!secondContainer.has(this.key, PersistentDataType.STRING)) {
|
||||
return;
|
||||
}
|
||||
UUID secondUUID = UUID.fromString(secondContainer.get(this.key, PersistentDataType.STRING));
|
||||
ItemStack result = event.getResult();
|
||||
if (result == null || result.getType() == Material.AIR) {
|
||||
return;
|
||||
}
|
||||
result.setItemMeta(second.getItemMeta());
|
||||
event.setResult(result);
|
||||
if (firstUUID.equals(secondUUID)) {
|
||||
//We dont want to do anything if these both match, otherwise set the result to null
|
||||
return;
|
||||
}
|
||||
event.setResult(null);
|
||||
}
|
||||
|
||||
private EquipmentSlot getRealSlot(PlayerArmorChangeEvent.SlotType slotType) {
|
||||
|
||||
Reference in new issue
Block a user