本文整理汇总了Java中org.bukkit.event.hanging.HangingBreakByEntityEvent.isCancelled方法的典型用法代码示例。如果您正苦于以下问题:Java HangingBreakByEntityEvent.isCancelled方法的具体用法?Java HangingBreakByEntityEvent.isCancelled怎么用?Java HangingBreakByEntityEvent.isCancelled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.event.hanging.HangingBreakByEntityEvent
的用法示例。
在下文中一共展示了HangingBreakByEntityEvent.isCancelled方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onHangingDamaged
import org.bukkit.event.hanging.HangingBreakByEntityEvent; //导入方法依赖的package包/类
@EventHandler
public void onHangingDamaged(HangingBreakByEntityEvent e) {
if (e.isCancelled()) {
return;
}
Entity ent = e.getRemover();
Location loc = e.getEntity().getLocation();
Region r = RedProtect.get().rm.getTopRegion(loc);
if (r != null){
return;
}
if (ent instanceof Player) {
Player p = (Player)ent;
if (!bypassBuild(p, null, 0)) {
e.setCancelled(true);
}
}
}
示例2: onFrameBrake
import org.bukkit.event.hanging.HangingBreakByEntityEvent; //导入方法依赖的package包/类
@EventHandler
public void onFrameBrake(HangingBreakByEntityEvent e) {
RedProtect.get().logger.debug("Is BlockListener - HangingBreakByEntityEvent event");
if (e.isCancelled()){
return;
}
Entity remover = e.getRemover();
Entity ent = e.getEntity();
Location l = e.getEntity().getLocation();
if ((ent instanceof ItemFrame || ent instanceof Painting) && remover instanceof Monster) {
Region r = RedProtect.get().rm.getTopRegion(l);
if (r != null && !r.canMobLoot()){
e.setCancelled(true);
}
}
}
示例3: onHangingDamaged
import org.bukkit.event.hanging.HangingBreakByEntityEvent; //导入方法依赖的package包/类
@EventHandler
public void onHangingDamaged(HangingBreakByEntityEvent e) {
if (e.isCancelled()) {
return;
}
RedProtect.get().logger.debug("Is RPPlayerListener - HangingBreakByEntityEvent event");
Entity ent = e.getRemover();
Location loc = e.getEntity().getLocation();
Region r = RedProtect.get().rm.getTopRegion(loc);
if (ent instanceof Player) {
Player player = (Player)ent;
if (r != null && !r.canBuild(player) && !r.canBreak(e.getEntity().getType())) {
RPLang.sendMessage(player, "blocklistener.region.cantbuild");
e.setCancelled(true);
}
}
if (ent instanceof Monster){
if (r != null && !r.canMobLoot()) {
e.setCancelled(true);
}
}
}
示例4: onHangingBreakByEntity
import org.bukkit.event.hanging.HangingBreakByEntityEvent; //导入方法依赖的package包/类
/**
* Prevent players from destroying item frames in protected regions
*/
@EventHandler
public void onHangingBreakByEntity(HangingBreakByEntityEvent event) {
CuboidRegion region = regionHandler.getApplicableRegion(event.getEntity().getLocation());
if (!event.isCancelled() && region != null && !region.allows("destroy")) {
event.setCancelled(true);
if (event.getRemover() instanceof Player) {
warnPlayer((Player) event.getRemover());
}
}
}
示例5: onItemFrameDestory
import org.bukkit.event.hanging.HangingBreakByEntityEvent; //导入方法依赖的package包/类
@EventHandler
public void onItemFrameDestory(final HangingBreakByEntityEvent event) {
if (!event.isCancelled() && event.getEntity() instanceof ItemFrame) {
final Block block = event.getEntity().getLocation().getBlock();
if (block.getType().equals(Material.STONE_BUTTON)) {
final Optional<Craftomat> craftomat = this.storage.getCraftomat(block.getLocation());
if (craftomat.isPresent()) {
event.setCancelled(true);
}
}
}
}
示例6: onLightningStrike
import org.bukkit.event.hanging.HangingBreakByEntityEvent; //导入方法依赖的package包/类
public void onLightningStrike(EntityLightning entitylightning) {
// CraftBukkit start
final org.bukkit.entity.Entity thisBukkitEntity = this.getBukkitEntity();
final org.bukkit.entity.Entity stormBukkitEntity = entitylightning.getBukkitEntity();
final PluginManager pluginManager = Bukkit.getPluginManager();
if (thisBukkitEntity instanceof Hanging) {
HangingBreakByEntityEvent hangingEvent = new HangingBreakByEntityEvent((Hanging) thisBukkitEntity, stormBukkitEntity);
pluginManager.callEvent(hangingEvent);
if (hangingEvent.isCancelled()) {
return;
}
}
if (this.fireProof) {
return;
}
CraftEventFactory.entityDamage = entitylightning;
if (!this.damageEntity(DamageSource.LIGHTNING, 5.0F)) {
CraftEventFactory.entityDamage = null;
return;
}
// CraftBukkit end
++this.fireTicks;
if (this.fireTicks == 0) {
// CraftBukkit start - Call a combust event when lightning strikes
EntityCombustByEntityEvent entityCombustEvent = new EntityCombustByEntityEvent(stormBukkitEntity, thisBukkitEntity, 8);
pluginManager.callEvent(entityCombustEvent);
if (!entityCombustEvent.isCancelled()) {
this.setOnFire(entityCombustEvent.getDuration());
}
// CraftBukkit end
}
}