32 lines
858 B
Java
32 lines
858 B
Java
package de.epiceric.shopchest.listeners;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import org.bukkit.Material;
|
|
import org.bukkit.block.Block;
|
|
import org.bukkit.event.EventHandler;
|
|
import org.bukkit.event.Listener;
|
|
import org.bukkit.event.block.BlockExplodeEvent;
|
|
|
|
import de.epiceric.shopchest.ShopChest;
|
|
|
|
public class BlockExplodeListener implements Listener {
|
|
|
|
private ShopChest plugin;
|
|
|
|
public BlockExplodeListener(ShopChest plugin) {
|
|
this.plugin = plugin;
|
|
}
|
|
|
|
@EventHandler
|
|
public void onBlockExplode(BlockExplodeEvent e) {
|
|
ArrayList<Block> bl = new ArrayList<>(e.blockList());
|
|
for (Block b : bl) {
|
|
if (b.getType().equals(Material.CHEST) || b.getType().equals(Material.TRAPPED_CHEST)) {
|
|
if (plugin.getShopUtils().isShop(b.getLocation())) e.blockList().remove(b);
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|