下面列出了怎么用org.bukkit.event.entity.EntityBreakDoorEvent的API类实例代码及写法,或者点击链接到github查看源代码。
@EventHandler
public void entityBreakDoor(EntityBreakDoorEvent event) {
Block block = event.getBlock();
// See if there is a protection there
Protection protection = plugin.getLWC().findProtection(block.getLocation());
if (protection != null) {
// protections.allowEntityBreakDoor
boolean allowEntityBreakDoor = Boolean
.parseBoolean(plugin.getLWC().resolveProtectionConfiguration(block, "allowEntityBreakDoor"));
if (!allowEntityBreakDoor) {
event.setCancelled(true);
}
}
}
@EventHandler(priority = EventPriority.HIGH)
public void onEntityBreakDoor(EntityBreakDoorEvent event) {
bcoord.setFromLocation(event.getBlock().getLocation());
StructureBlock sb = CivGlobal.getStructureBlock(bcoord);
if (sb != null) {
event.setCancelled(true);
}
CampBlock cb = CivGlobal.getCampBlock(bcoord);
if (cb != null) {
event.setCancelled(true);
}
}
@EventHandler(priority = EventPriority.LOWEST)
public void onEntityBreakDoorEvent(EntityBreakDoorEvent event) {
CommonBlockEventHandler.getInstance().handleBlockBreak(event, event.getEntity(), event.getBlock().getState());
}