mirror of
https://github.com/amalthea-mc/ShopChest.git
synced 2024-11-22 10:22:29 +00:00
Added extra class for BlockExplodeEvent
BlockExplodeEvent class is not found in v1.8_R1, and if a class is not found in a listener, the whole listener with all its event won't get registered.
This commit is contained in:
parent
c713d0f014
commit
9a9f95eec2
@ -285,6 +285,10 @@ public class ShopChest extends JavaPlugin {
|
|||||||
getServer().getPluginManager().registerEvents(new ShopInteractListener(this), this);
|
getServer().getPluginManager().registerEvents(new ShopInteractListener(this), this);
|
||||||
getServer().getPluginManager().registerEvents(new NotifyUpdateOnJoinListener(this), this);
|
getServer().getPluginManager().registerEvents(new NotifyUpdateOnJoinListener(this), this);
|
||||||
getServer().getPluginManager().registerEvents(new ChestProtectListener(this), this);
|
getServer().getPluginManager().registerEvents(new ChestProtectListener(this), this);
|
||||||
|
|
||||||
|
if (!Utils.getServerVersion().equals("v1_8_R1"))
|
||||||
|
getServer().getPluginManager().registerEvents(new BlockExplodeListener(this), this);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -0,0 +1,32 @@
|
|||||||
|
package de.epiceric.shopchest.listeners;
|
||||||
|
|
||||||
|
import de.epiceric.shopchest.ShopChest;
|
||||||
|
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 java.util.ArrayList;
|
||||||
|
|
||||||
|
public class BlockExplodeListener implements Listener {
|
||||||
|
|
||||||
|
private ShopChest plugin;
|
||||||
|
|
||||||
|
public BlockExplodeListener(ShopChest plugin) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onBlockExplode(BlockExplodeEvent e) {
|
||||||
|
if (plugin.getShopChestConfig().explosion_protection) {
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -41,18 +41,6 @@ public class ChestProtectListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onBlockExplode(BlockExplodeEvent e) {
|
|
||||||
if (plugin.getShopChestConfig().explosion_protection) {
|
|
||||||
ArrayList<Block> bl = new ArrayList<>(e.blockList());
|
|
||||||
for (Block b : bl) {
|
|
||||||
if (b.getType().equals(Material.CHEST) || b.getType().equals(Material.TRAPPED_CHEST)) {
|
|
||||||
if (shopUtils.isShop(b.getLocation())) e.blockList().remove(b);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onEntityExplode(EntityExplodeEvent e) {
|
public void onEntityExplode(EntityExplodeEvent e) {
|
||||||
if (plugin.getShopChestConfig().explosion_protection) {
|
if (plugin.getShopChestConfig().explosion_protection) {
|
||||||
|
Loading…
Reference in New Issue
Block a user