当前位置: 首页>>代码示例>>Java>>正文


Java HangingBreakEvent类代码示例

本文整理汇总了Java中org.bukkit.event.hanging.HangingBreakEvent的典型用法代码示例。如果您正苦于以下问题:Java HangingBreakEvent类的具体用法?Java HangingBreakEvent怎么用?Java HangingBreakEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


HangingBreakEvent类属于org.bukkit.event.hanging包,在下文中一共展示了HangingBreakEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onFrameBrake

import org.bukkit.event.hanging.HangingBreakEvent; //导入依赖的package包/类
@EventHandler
  public void onFrameBrake(HangingBreakEvent e) {
  	if (e.isCancelled()){
  		return;
  	}

  	Location l = e.getEntity().getLocation();
Region r = RedProtect.get().rm.getTopRegion(l);
  	if (r != null){
  		return;
  	}
  	
  	if (e.getCause().toString().equals("EXPLOSION") || e.getCause().toString().equals("ENTITY")) {
  		if (!RPConfig.getGlobalFlagBool(l.getWorld().getName()+".entity-block-damage")){
  			e.setCancelled(true);
	}
      }   
  }
 
开发者ID:FabioZumbi12,项目名称:RedProtect,代码行数:19,代码来源:RPGlobalListener.java

示例2: onFrameBrake

import org.bukkit.event.hanging.HangingBreakEvent; //导入依赖的package包/类
@EventHandler
 public void onFrameBrake(HangingBreakEvent e) {
 	RedProtect.get().logger.debug("Is BlockListener - HangingBreakEvent event");
 	if (e.isCancelled()){
 		return;
 	}
 	
 	Entity ent = e.getEntity();
 	Location l = e.getEntity().getLocation();		
 	
 	if ((ent instanceof ItemFrame || ent instanceof Painting) && (e.getCause().toString().equals("EXPLOSION"))) {
 		Region r = RedProtect.get().rm.getTopRegion(l);
 		if (r != null && !r.canFire()){
 			e.setCancelled(true);
}
     }    
 }
 
开发者ID:FabioZumbi12,项目名称:RedProtect,代码行数:18,代码来源:RPBlockListener.java

示例3: move

import org.bukkit.event.hanging.HangingBreakEvent; //导入依赖的package包/类
public void move(double d0, double d1, double d2) {
    if (!this.world.isStatic && !this.dead && d0 * d0 + d1 * d1 + d2 * d2 > 0.0D) {
        if (this.dead) return; // CraftBukkit

        // CraftBukkit start - fire break events
        // TODO - Does this need its own cause? Seems to only be triggered by pistons
        HangingBreakEvent event = new HangingBreakEvent((Hanging) this.getBukkitEntity(), HangingBreakEvent.RemoveCause.PHYSICS);
        this.world.getServer().getPluginManager().callEvent(event);

        if (this.dead || event.isCancelled()) {
            return;
        }
        // CraftBukkit end

        this.die();
        this.b((Entity) null);
    }
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:19,代码来源:EntityHanging.java

示例4: onHangingBreak

import org.bukkit.event.hanging.HangingBreakEvent; //导入依赖的package包/类
@EventHandler
public void onHangingBreak(HangingBreakEvent event) {
    EntityProtection entityProtection = this.module.getProtectManager().getEntityProtection(event.getEntity().getType(), event.getEntity().getUniqueId());
    if(entityProtection.exists()) {
        if(event instanceof HangingBreakByEntityEvent) {
            HangingBreakByEntityEvent entityEvent = (HangingBreakByEntityEvent) event;
            if(entityEvent.getRemover() instanceof Player) {
                Player player = (Player) entityEvent.getRemover();

                if(entityProtection.getOwner().equals(player.getUniqueId()) || player.hasPermission(ProtectPermissions.MODIFY_ALL)) {
                    entityProtection.remove();
                    sendMessage(player, "protect.entity-unprotected");
                    return;
                }

                sendMessage(player, "protect.entity-protected-by", getDisplayName(this.module.getManager().getUsername(entityProtection.getOwner()), event.getEntity().getWorld().getName()));
            }
        }

        event.setCancelled(true);
    }
}
 
开发者ID:Steveice10,项目名称:Peacecraft,代码行数:23,代码来源:ProtectListener.java

示例5: moveEntity

import org.bukkit.event.hanging.HangingBreakEvent; //导入依赖的package包/类
public void moveEntity(double p_70091_1_, double p_70091_3_, double p_70091_5_)
{
    if (!this.worldObj.isRemote && !this.isDead && p_70091_1_ * p_70091_1_ + p_70091_3_ * p_70091_3_ + p_70091_5_ * p_70091_5_ > 0.0D)
    {
        if (this.isDead)
        {
            return;    // CraftBukkit
        }

        // CraftBukkit start
        // TODO - Does this need its own cause? Seems to only be triggered by pistons
        HangingBreakEvent event = new HangingBreakEvent((Hanging) this.getBukkitEntity(), HangingBreakEvent.RemoveCause.PHYSICS);
        this.worldObj.getServer().getPluginManager().callEvent(event);

        if (this.isDead || event.isCancelled())
        {
            return;
        }

        // CraftBukkit end
        this.setDead();
        this.onBroken((Entity)null);
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:25,代码来源:EntityHanging.java

示例6: move

import org.bukkit.event.hanging.HangingBreakEvent; //导入依赖的package包/类
public void move(double d0, double d1, double d2) {
    if (!this.world.isClientSide && !this.dead && d0 * d0 + d1 * d1 + d2 * d2 > 0.0D) {
        if (this.dead) return; // CraftBukkit

        // CraftBukkit start - fire break events
        // TODO - Does this need its own cause? Seems to only be triggered by pistons
        HangingBreakEvent event = new HangingBreakEvent((Hanging) this.getBukkitEntity(), HangingBreakEvent.RemoveCause.PHYSICS);
        this.world.getServer().getPluginManager().callEvent(event);

        if (this.dead || event.isCancelled()) {
            return;
        }
        // CraftBukkit end

        this.die();
        this.a((Entity) null);
    }

}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:20,代码来源:EntityHanging.java

示例7: onHangingBreakEvent

import org.bukkit.event.hanging.HangingBreakEvent; //导入依赖的package包/类
/**
 * Event handler to watch whenever an itemframe is broken by something other than a player..
 * This will remove the cache of the hoppers around it.
 * 
 * @param event HangingBreakEvent containing data about the broken hanging item. We care about the ItemFrame being removed.
 */
@EventHandler(ignoreCancelled=true)
public void onHangingBreakEvent(HangingBreakEvent event) {
    if (event.getEntity() instanceof ItemFrame) {
        //get the item frame entity
        ItemFrame itemFrame =  (ItemFrame)event.getEntity();

        //get the block location that represents the ItemFrame location
        Location itemFrameLocation = itemFrame.getLocation().getBlock().getLocation();
        
        //debug if requested
        if (plugin.debugLevel_get() > 0) plugin.getLogger().info("ItemFrame broken by non-player at (" + itemFrameLocation.toString() + ")");

        //an itemFrame was broken. Clear the cache from the hoppers around the frame.
        plugin.knownHoppersCache_ClearAroundLocation(itemFrameLocation);
    }
}
 
开发者ID:TheNut,项目名称:HopperFilterSimplified,代码行数:23,代码来源:HfsBlockListener.java

示例8: onPaintingBreak

import org.bukkit.event.hanging.HangingBreakEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPaintingBreak(final HangingBreakByEntityEvent event)
{
	final ProtectHolder settings = prot.getSettings();
	Entity remover = event.getRemover();
	if ((event.getCause() == HangingBreakEvent.RemoveCause.ENTITY)
		&& ((remover instanceof Creeper) && getSettings().isCreeperBlockdamage())
		|| ((remover instanceof Wither) && getSettings().isWitherSpawnBlockdamage())
		|| ((remover instanceof Fireball) && getSettings().isFireballBlockdamage())
		|| ((remover instanceof TNTPrimed) && getSettings().isTntBlockdamage())
		|| ((remover instanceof WitherSkull) && getSettings().isWitherskullBlockdamage())
		|| ((remover instanceof ExplosiveMinecart) && getSettings().isTntMinecartBlockdamage()))
	{
		event.setCancelled(true);
	}
}
 
开发者ID:Curtis3321,项目名称:Essentials,代码行数:17,代码来源:EssentialsProtectEntityListener.java

示例9: onHangingDamage

import org.bukkit.event.hanging.HangingBreakEvent; //导入依赖的package包/类
@EventHandler
public void onHangingDamage(HangingBreakEvent event) {
    if (!event.isCancelled()) {
        for (Region region : regions) {
            if (region.contains(event.getEntity().getLocation())) {
                event.setCancelled(true);
            }
        }
    }
}
 
开发者ID:WarzoneMC,项目名称:Warzone,代码行数:11,代码来源:BuildFilterType.java

示例10: check

import org.bukkit.event.hanging.HangingBreakEvent; //导入依赖的package包/类
@Override
public boolean check(Event event) {
    return removeCauseOptional.map(cause -> cause.check(event, new Checker<HangingBreakEvent.RemoveCause>() {
        @Override
        public boolean check(HangingBreakEvent.RemoveCause removeCause) {
            return removeCause == ((HangingBreakEvent) event).getCause();
        }
    })).orElse(true);
}
 
开发者ID:MundoSK,项目名称:MundoSK,代码行数:10,代码来源:EvtUnhang.java

示例11: init

import org.bukkit.event.hanging.HangingBreakEvent; //导入依赖的package包/类
@Override
public boolean init(Expression<?>[] expressions, int i, Kleenean kleenean, SkriptParser.ParseResult parseResult) {
    if (ScriptLoader.isCurrentEvent(HangingPlaceEvent.class) || ScriptLoader.isCurrentEvent(HangingBreakEvent.class)) {
        return true;
    }
    Skript.error("'hanged entity' can only be used in hang and unhang events!");
    return false;
}
 
开发者ID:MundoSK,项目名称:MundoSK,代码行数:9,代码来源:ExprHangedEntity.java

示例12: onHangingBreak

import org.bukkit.event.hanging.HangingBreakEvent; //导入依赖的package包/类
@EventHandler
public void onHangingBreak(HangingBreakEvent event)
{
	if(event.isCancelled())
		return;
	if(event.getCause() == RemoveCause.ENTITY)
		event.setCancelled(true);
}
 
开发者ID:Limeth,项目名称:Breakpoint,代码行数:9,代码来源:PlayerInteractListener.java

示例13: onItemFrameBreak

import org.bukkit.event.hanging.HangingBreakEvent; //导入依赖的package包/类
@EventHandler(priority = HIGHEST, ignoreCancelled = true)
public void onItemFrameBreak(HangingBreakEvent ev) {
    if (!(ev.getEntity() instanceof ItemFrame)) return;
    ItemFrame f = (ItemFrame) ev.getEntity();
    if (f.getItem() == null || f.getItem().getType() == Material.AIR) return;
    if (ExhibitionFrame.fromItemFrame(f).isSet()) {
        if (ev.getCause() == HangingBreakEvent.RemoveCause.EXPLOSION) { // Explosion protect
            ev.setCancelled(true);
        } else {
            plugin.getLogger().warning(String.format("Exhibition broken: Location: %s, item: %s", f.getLocation().toString(),
                    f.getItem().toString()));
            f.setItem(new ItemStack(Material.AIR));
        }
    }
}
 
开发者ID:NyaaCat,项目名称:NyaaUtils,代码行数:16,代码来源:ExhibitionListener.java

示例14: init

import org.bukkit.event.hanging.HangingBreakEvent; //导入依赖的package包/类
public boolean init(Expression<?>[] args, int arg1, Kleenean arg2, SkriptParser.ParseResult arg3) {
	if (!ScriptLoader.isCurrentEvent(HangingBreakEvent.class) && ScriptLoader.isCurrentEvent(HangingBreakByEntityEvent.class)) {
		Skript.error("You can not use HangingCause expression in any event but on unhang!");
		return false;
	}
	return true;
}
 
开发者ID:TheLimeGlass,项目名称:Skellett,代码行数:8,代码来源:ExprHangingCause.java

示例15: init

import org.bukkit.event.hanging.HangingBreakEvent; //导入依赖的package包/类
public boolean init(Expression<?>[] args, int arg1, Kleenean arg2, SkriptParser.ParseResult arg3) {
	if (!ScriptLoader.isCurrentEvent(HangingBreakByEntityEvent.class) && !ScriptLoader.isCurrentEvent(HangingBreakEvent.class)) {
		Skript.error("You can not use HangingCause expression in any event but on unhang remove!");
		return false;
	}
	return true;
}
 
开发者ID:TheLimeGlass,项目名称:Skellett,代码行数:8,代码来源:ExprHangingRemover.java


注:本文中的org.bukkit.event.hanging.HangingBreakEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。