mirror of
https://github.com/amalthea-mc/ShopChest.git
synced 2024-11-08 19:51:05 +00:00
Ensure that all shop item get removed on disable
This commit is contained in:
parent
9a37efd49e
commit
e5ed1918ad
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user