From c5611027a7fa60066215cd00b3360c8f8e8fedd9 Mon Sep 17 00:00:00 2001 From: Eric Date: Tue, 23 May 2017 15:34:32 +0200 Subject: [PATCH] Fixed armor stands not being removed after shop removal --- src/main/java/de/epiceric/shopchest/ShopChest.java | 2 +- .../java/de/epiceric/shopchest/nms/Hologram.java | 4 ++++ src/main/java/de/epiceric/shopchest/shop/Shop.java | 14 +------------- .../de/epiceric/shopchest/utils/ShopUtils.java | 14 ++------------ 4 files changed, 8 insertions(+), 26 deletions(-) diff --git a/src/main/java/de/epiceric/shopchest/ShopChest.java b/src/main/java/de/epiceric/shopchest/ShopChest.java index e82f819..3c480f8 100644 --- a/src/main/java/de/epiceric/shopchest/ShopChest.java +++ b/src/main/java/de/epiceric/shopchest/ShopChest.java @@ -188,7 +188,7 @@ public class ShopChest extends JavaPlugin { if (database != null) { for (Shop shop : shopUtils.getShops()) { - shopUtils.removeShop(shop, false, true); + shopUtils.removeShop(shop, false); debug("Removed shop (#" + shop.getID() + ")"); } diff --git a/src/main/java/de/epiceric/shopchest/nms/Hologram.java b/src/main/java/de/epiceric/shopchest/nms/Hologram.java index 8533b3f..a583373 100644 --- a/src/main/java/de/epiceric/shopchest/nms/Hologram.java +++ b/src/main/java/de/epiceric/shopchest/nms/Hologram.java @@ -287,6 +287,10 @@ public class Hologram { armorStand.remove(); } + if (interactArmorStand != null) { + interactArmorStand.remove(); + } + exists = false; holograms.remove(this); } diff --git a/src/main/java/de/epiceric/shopchest/shop/Shop.java b/src/main/java/de/epiceric/shopchest/shop/Shop.java index 89c687b..2c336fd 100644 --- a/src/main/java/de/epiceric/shopchest/shop/Shop.java +++ b/src/main/java/de/epiceric/shopchest/shop/Shop.java @@ -92,25 +92,13 @@ public class Shop { /** * Removes the hologram of the shop */ - public void removeHologram(boolean useCurrentThread) { + public void removeHologram() { if (hologram != null && hologram.exists()) { plugin.debug("Removing hologram (#" + id + ")"); - - for (Player p : Bukkit.getOnlinePlayers()) { - hologram.hidePlayer(p, useCurrentThread); - } - hologram.remove(); } } - /** - * Removes the hologram of the shop - */ - public void removeHologram() { - removeHologram(false); - } - /** * Removes the floating item of the shop */ diff --git a/src/main/java/de/epiceric/shopchest/utils/ShopUtils.java b/src/main/java/de/epiceric/shopchest/utils/ShopUtils.java index 3ee0fef..045361b 100644 --- a/src/main/java/de/epiceric/shopchest/utils/ShopUtils.java +++ b/src/main/java/de/epiceric/shopchest/utils/ShopUtils.java @@ -90,9 +90,8 @@ public class ShopUtils { * Remove a shop * @param shop Shop to remove * @param removeFromDatabase Whether the shop should also be removed from the database - * @param useCurrentThread Whether the current thread should be used instead of a new async task */ - public void removeShop(Shop shop, boolean removeFromDatabase, boolean useCurrentThread) { + public void removeShop(Shop shop, boolean removeFromDatabase) { plugin.debug("Removing shop (#" + shop.getID() + ")"); InventoryHolder ih = shop.getInventoryHolder(); @@ -109,21 +108,12 @@ public class ShopUtils { } shop.removeItem(); - shop.removeHologram(useCurrentThread); + shop.removeHologram(); if (removeFromDatabase) plugin.getShopDatabase().removeShop(shop, null); } - /** - * Remove a shop - * @param shop Shop to remove - * @param removeFromDatabase Whether the shop should also be removed from the database - */ - public void removeShop(Shop shop, boolean removeFromDatabase) { - removeShop(shop, removeFromDatabase, false); - } - /** * Get the shop limits of a player * @param p Player, whose shop limits should be returned