mirror of
https://github.com/songoda/EpicBosses.git
synced 2025-01-06 23:37:33 +01:00
remove durability check, prefer material and item meta for spawn eggs
This commit is contained in:
parent
cfa18f7c3f
commit
7d4fb871bc
@ -64,7 +64,7 @@ public class BossSpawnListener implements Listener {
|
||||
if(block.getType() == Material.AIR) return;
|
||||
|
||||
Map<BossEntity, ItemStack> entitiesAndSpawnItems = this.bossEntityManager.getMapOfEntitiesAndSpawnItems();
|
||||
ItemStack itemStack = this.versionHandler.getItemInHand(player).clone();
|
||||
ItemStack itemStack = this.versionHandler.getItemInHand(player);
|
||||
BossEntity bossEntity = null;
|
||||
|
||||
for(Map.Entry<BossEntity, ItemStack> entry : entitiesAndSpawnItems.entrySet()) {
|
||||
|
@ -60,7 +60,7 @@ public class ItemStackUtils {
|
||||
return new ItemStack(Material.AIR);
|
||||
|
||||
if (versionHandler.getVersion().isLessThanOrEqualTo(Versions.v1_12_R1)) {
|
||||
return new ItemStack(Material.valueOf("MONSTER_EGG"), spawnableEntityIds.get(entityType));
|
||||
return new ItemStack(Material.valueOf("MONSTER_EGG"), 1, spawnableEntityIds.get(entityType));
|
||||
} else {
|
||||
return new ItemStack(spawnableEntityMaterials.get(entityType));
|
||||
}
|
||||
@ -399,7 +399,8 @@ public class ItemStackUtils {
|
||||
public static boolean isItemStackSame(ItemStack itemStack1, ItemStack itemStack2) {
|
||||
if(itemStack1 == null || itemStack2 == null) return false;
|
||||
if(itemStack1.getType() != itemStack2.getType()) return false;
|
||||
if(itemStack1.getDurability() != itemStack2.getDurability()) return false;
|
||||
// Durability checks are too tempermental to be reliable for all versions
|
||||
//if(itemStack1.getDurability() != itemStack2.getDurability()) return false;
|
||||
|
||||
ItemMeta itemMeta1 = itemStack1.getItemMeta();
|
||||
ItemMeta itemMeta2 = itemStack2.getItemMeta();
|
||||
@ -407,17 +408,15 @@ public class ItemStackUtils {
|
||||
if(itemMeta1 == null || itemMeta2 == null) return false;
|
||||
|
||||
if(itemMeta1.hasDisplayName() == itemMeta2.hasDisplayName()) {
|
||||
if(itemMeta1.hasDisplayName()) {
|
||||
if(!itemMeta1.getDisplayName().equals(itemMeta2.getDisplayName())) return false;
|
||||
}
|
||||
if(itemMeta1.hasDisplayName() && !itemMeta1.getDisplayName().equals(itemMeta2.getDisplayName()))
|
||||
return false;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(itemMeta1.hasLore() == itemMeta2.hasLore()) {
|
||||
if(itemMeta1.hasLore()) {
|
||||
if(!itemMeta1.getLore().equals(itemMeta2.getLore())) return false;
|
||||
}
|
||||
if(itemMeta1.hasLore() && !itemMeta1.getLore().equals(itemMeta2.getLore()))
|
||||
return false;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user