Fix missing shulker box, undo stackables armor stand change

This commit is contained in:
Esophose 2019-03-02 22:17:40 -07:00
parent 404e0f6092
commit 9133a1db73
2 changed files with 6 additions and 11 deletions

View File

@ -3,7 +3,6 @@ package me.goodandevil.skyblock.listeners;
import java.io.File;
import java.util.Set;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
@ -161,7 +160,8 @@ public class Interact implements Listener {
}
} else if (block.getType() == Material.CHEST || block.getType() == Material.TRAPPED_CHEST
|| (NMSUtil.getVersionNumber() > 9
&& (block.getType() == Materials.BLACK_SHULKER_BOX.parseMaterial()
&& (block.getType() == Materials.SHULKER_BOX.parseMaterial()
|| block.getType() == Materials.BLACK_SHULKER_BOX.parseMaterial()
|| block.getType() == Materials.BLUE_SHULKER_BOX.parseMaterial()
|| block.getType() == Materials.BROWN_SHULKER_BOX.parseMaterial()
|| block.getType() == Materials.CYAN_SHULKER_BOX.parseMaterial()

View File

@ -91,14 +91,9 @@ public class Stackable {
private void updateDisplay() {
if (this.size > 1) {
if (this.display == null && !this.findExistingDisplay()) {
this.createDisplay();
}
if (this.display.isDead()) {
this.createDisplay();
}
this.findExistingDisplay();
this.removeDisplay();
this.createDisplay();
this.display.setCustomName(WordUtils.capitalize(material.name().toLowerCase()).replace("_", " ") + "s: " + size);
this.display.setCustomNameVisible(true);
} else {
@ -126,7 +121,7 @@ public class Stackable {
private boolean findExistingDisplay() {
for (Entity entity : this.location.getWorld().getNearbyEntities(this.location.clone().add(0.5, 0.55, 0.5), 0.1, 0.5, 0.1)) {
if (entity instanceof ArmorStand && !entity.isDead()) {
if (entity instanceof ArmorStand && entity.isValid()) {
this.display = (ArmorStand) entity;
return true;
}