Former-commit-id: 5d45fd86018ece1ac104c332aa7e11e395dc1708
This commit is contained in:
Sotr committed 2020-01-20 20:50:20 +07:00
1 parent c5503411da
commit 6b38e6db9e
1 file changed
+17 -9
@@ -23,6 +23,8 @@ import lombok.AllArgsConstructor;
import org.bukkit.Bukkit;
import org.bukkit.scheduler.BukkitRunnable;
import org.maxgamer.quickshop.QuickShop;
import org.maxgamer.quickshop.Shop.DisplayItem;
import org.maxgamer.quickshop.Shop.Shop;
import org.maxgamer.quickshop.Util.Util;
@AllArgsConstructor
@@ -48,16 +50,22 @@ public class DisplayAutoDespawnWatcher extends BukkitRunnable {
shop.checkDisplay();
}
} else if (shop.getDisplay().isSpawned()) {
if (shop.getDisplay().isPendingRemoval()) {
// Actually remove the pending display
Util.debugLog("Removing the shop " + shop + " the display, cause nobody can see it");
shop.getDisplay().remove();
} else {
// Delayed to next cycle
Util.debugLog("Pending to remove the shop " + shop + " the display, cause nobody can see it");
shop.getDisplay().pendingRemoval();
}
removeDisplayItemDelayed(shop);
}
});
}
public boolean removeDisplayItemDelayed(Shop shop) {
if (shop.getDisplay().isPendingRemoval()) {
// Actually remove the pending display
Util.debugLog("Removing the shop " + shop + " the display, cause nobody can see it");
shop.getDisplay().remove();
return true;
} else {
// Delayed to next calling
Util.debugLog("Pending to remove the shop " + shop + " the display, cause nobody can see it");
shop.getDisplay().pendingRemoval();
return false;
}
}
}