Java 类org.bukkit.event.block.CauldronLevelChangeEvent 实例源码

项目:NovaGuilds    文件:RegionInteractListener.java   
@EventHandler
public void onCauldronLevelChange(CauldronLevelChangeEvent event) {
    Player player = (Player) event.getEntity();
    NovaPlayer nPlayer = PlayerManager.getPlayer(player);

    if(RegionManager.get(event.getBlock()) != null
            && (!plugin.getRegionManager().canInteract(player, event.getBlock()) || (!nPlayer.getPreferences().getBypass() && !nPlayer.hasPermission(GuildPermission.BLOCK_PLACE)))) {
        event.setCancelled(true);
        Message.CHAT_REGION_DENY_INTERACT.send(player);
    }
}
项目:SpigotSource    文件:BlockCauldron.java   
public void a(World world, BlockPosition blockposition, IBlockData iblockdata, Entity entity) {
    int i = ((Integer) iblockdata.get(BlockCauldron.LEVEL)).intValue();
    float f = (float) blockposition.getY() + (6.0F + (float) (3 * i)) / 16.0F;

    if (!world.isClientSide && entity.isBurning() && i > 0 && entity.getBoundingBox().b <= (double) f) {
        // CraftBukkit start
        if (!this.changeLevel(world, blockposition, iblockdata, i - 1, entity, CauldronLevelChangeEvent.ChangeReason.EXTINGUISH)) {
            return;
        }
        entity.extinguish();
        // this.a(world, blockposition, iblockdata, i - 1);
        // CraftBukkit end
    }

}
项目:SpigotSource    文件:BlockCauldron.java   
private boolean changeLevel(World world, BlockPosition blockposition, IBlockData iblockdata, int i, Entity entity, CauldronLevelChangeEvent.ChangeReason reason) {
    int newLevel = Integer.valueOf(MathHelper.clamp(i, 0, 3));
    CauldronLevelChangeEvent event = new CauldronLevelChangeEvent(
            world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()),
            (entity == null) ? null : entity.getBukkitEntity(), reason, iblockdata.get(BlockCauldron.LEVEL), newLevel
    );
    world.getServer().getPluginManager().callEvent(event);
    if (event.isCancelled()) {
        return false;
    }
    world.setTypeAndData(blockposition, iblockdata.set(BlockCauldron.LEVEL, newLevel), 2);
    world.updateAdjacentComparators(blockposition, this);
    return true;
    // CraftBukkit end
}
项目:SpigotSource    文件:BlockCauldron.java   
public void a(World world, BlockPosition blockposition, IBlockData iblockdata, int i) {
    this.changeLevel(world, blockposition, iblockdata, i, null, CauldronLevelChangeEvent.ChangeReason.UNKNOWN);
}