Fixed armor stands not being removed after shop removal

This commit is contained in:
Eric 2017-05-23 15:34:32 +02:00
parent ca064da094
commit c5611027a7
4 changed files with 8 additions and 26 deletions

View File

@ -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() + ")");
}

View File

@ -287,6 +287,10 @@ public class Hologram {
armorStand.remove();
}
if (interactArmorStand != null) {
interactArmorStand.remove();
}
exists = false;
holograms.remove(this);
}

View File

@ -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
*/

View File

@ -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