Some improve in ContainerShop

Former-commit-id: cf81b2673ea87febf0766c3def03466b7cb26b2f [formerly 653f25585cffc26a6c787ce54e06474c26f98bd2]
Former-commit-id: 58bf2c8d043f7d13befc42ffc55e4207f21cfaf7
This commit is contained in:
Ghost_chu committed 2019-06-02 22:09:04 +08:00
1 parent 548d21e6b0
commit feada50350
1 file changed
+8 -7
@@ -673,7 +673,7 @@ public class ContainerShop implements Shop {
}
public void checkDisplay() {
if (plugin.isDisplay() == false)
if (!plugin.isDisplay())
return;
if (getLocation().getWorld() == null)
return; // not loaded
@@ -690,11 +690,12 @@ public class ContainerShop implements Shop {
this.getDisplayItem().spawn();
}
if (this.getDisplayItem() != null) {
if (!trans) { // We have a display item in a block... delete it
this.getDisplayItem().remove();
this.displayItem = null;
return;
}
// Already checked above
// if (!trans) { // We have a display item in a block... delete it
// this.getDisplayItem().remove();
// this.displayItem = null;
// return;
// }
DisplayItem disItem = this.getDisplayItem();
Location dispLoc = disItem.getDisplayLocation();
if (dispLoc.getBlock() != null && dispLoc.getBlock().getType() == Material.WATER) {
@@ -710,7 +711,7 @@ public class ContainerShop implements Shop {
if (item.getTicksLived() > 5000 || !item.isValid() || item.isDead()) {
disItem.respawn();
disItem.removeDupe();
} else if (item.getLocation().distanceSquared(dispLoc) > 1) {
} else if (checkDisplayMoved()) {
item.teleport(dispLoc, TeleportCause.PLUGIN);
}
}