Ensure that all shop item get removed on disable

This commit is contained in:
Eric 2016-06-09 20:34:10 +02:00
parent 9a37efd49e
commit e5ed1918ad

View File

@ -20,6 +20,9 @@ import net.milkbowl.vault.economy.Economy;
import net.milkbowl.vault.permission.Permission;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.World;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin;
@ -268,6 +271,17 @@ public class ShopChest extends JavaPlugin {
for (Shop shop : ShopUtils.getShops()) {
ShopUtils.removeShop(shop, false);
}
for (World world : Bukkit.getWorlds()) {
for (Entity entity : world.getEntities()) {
if (entity instanceof Item) {
Item item = (Item) entity;
if (item.hasMetadata("shopItem")) {
item.remove();
}
}
}
}
}
private void initializeShops() {