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


Java EntityBlockFormEvent类代码示例

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


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

示例1: onEntityBlockFormEvent

import org.bukkit.event.block.EntityBlockFormEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onEntityBlockFormEvent(EntityBlockFormEvent event)
{
	if (WorldGuardExtraFlagsPlugin.isSupportFrostwalker())
	{
		BlockState newState = event.getNewState();
		if (newState.getType() == Material.FROSTED_ICE)
		{
			if (event.getEntity() instanceof Player)
			{
				Player player = (Player)event.getEntity();

				if (!WorldGuardUtils.hasBypass(player))
				{
					ApplicableRegionSet regions = WorldGuardExtraFlagsPlugin.getWorldGuardPlugin().getRegionContainer().createQuery().getApplicableRegions(newState.getLocation());
					if (regions.queryValue(WorldGuardUtils.wrapPlayer(player), FlagUtils.FROSTWALKER) == State.DENY)
					{
						event.setCancelled(true);
					}
				}
			}
		}
	}
}
 
开发者ID:isokissa3,项目名称:WorldGuardExtraFlagsPlugin,代码行数:25,代码来源:BlockListener.java

示例2: onPlayerFrostWalk

import org.bukkit.event.block.EntityBlockFormEvent; //导入依赖的package包/类
@EventHandler
public void onPlayerFrostWalk(EntityBlockFormEvent e) {
	Region r = RedProtect.get().rm.getTopRegion(e.getBlock().getLocation());
	if (r != null){
		return;
	}
	RedProtect.get().logger.debug("RPGlobalListener - EntityBlockFormEvent canceled? " + e.isCancelled()); 
	if (e.getEntity() instanceof Player){
		Player p = (Player) e.getEntity();
		if (!RPConfig.getGlobalFlagBool(p.getWorld().getName()+".iceform-by.player") && !p.hasPermission("redprotect.bypass.world")){
    		e.setCancelled(true);
    	}
	} 
	else if (!RPConfig.getGlobalFlagBool(e.getEntity().getWorld().getName()+".iceform-by.entity")){
		e.setCancelled(true);
	}    	
}
 
开发者ID:FabioZumbi12,项目名称:RedProtect,代码行数:18,代码来源:RPGlobalListener.java

示例3: onBlockForm

import org.bukkit.event.block.EntityBlockFormEvent; //导入依赖的package包/类
/**
 * Handles Frost Walking on visitor's islands
 * @param e
 */
@EventHandler(priority = EventPriority.LOW, ignoreCancelled=true)
public void onBlockForm(EntityBlockFormEvent e) {
    if (DEBUG) {
        plugin.getLogger().info("1.9 " +e.getEventName());
    }
    if (e.getEntity() instanceof Player && e.getNewState().getType().equals(Material.FROSTED_ICE)) {
        Player player= (Player) e.getEntity();
        if (!Util.inWorld(player)) {
            return;
        }
        if (player.isOp()) {
            return;
        }
        // This permission bypasses protection
        if (VaultHelper.hasPerm(player, Settings.PERMPREFIX + "mod.bypassprotect")) {
            return;
        }
        // Check island
        Island island = plugin.getIslands().getIslandAt(player.getLocation());
        if (island == null && Settings.defaultWorldSettings.get(SettingsFlag.PLACE_BLOCKS)) {
            return;
        }
        if (island !=null) {
            if (island.getMembers().contains(player.getUniqueId()) || island.getFlag(SettingsFlag.PLACE_BLOCKS)) {
                return;
            }
        }
        // Silently cancel the event
        e.setCancelled(true);
    }
}
 
开发者ID:tastybento,项目名称:bskyblock,代码行数:36,代码来源:IslandGuard1_9.java

示例4: onBlockForm

import org.bukkit.event.block.EntityBlockFormEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onBlockForm(EntityBlockFormEvent event) {
    Entity e = event.getEntity();
    if (ReflectionUtil.getEntityHandle(e) instanceof IEntityPet && event.getNewState().getType().equals(Material.SNOW)) {
        event.setCancelled(true);
        event.getNewState().setType(Material.AIR);
    }
}
 
开发者ID:Borlea,项目名称:EchoPet,代码行数:9,代码来源:PetEntityListener.java

示例5: disableFrostWalker

import org.bukkit.event.block.EntityBlockFormEvent; //导入依赖的package包/类
@EventHandler(ignoreCancelled = true)
public void disableFrostWalker(EntityBlockFormEvent e) {

    if (config.checkEnabled(Config.Node.FROSTWALKER, e.getBlock().getLocation())
            && e.getEntity() instanceof Player
            && !wg.canBuild((Player) e.getEntity(), e.getBlock())) e.setCancelled(true);
}
 
开发者ID:Kakifrucht,项目名称:WorldGuardFix,代码行数:8,代码来源:Listeners.java

示例6: onBlockForm

import org.bukkit.event.block.EntityBlockFormEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onBlockForm(EntityBlockFormEvent event) {
    Entity e = event.getEntity();
    if (plugin.isPet(e) && event.getNewState().getType().equals(Material.SNOW)) {
        event.setCancelled(true);
        event.getNewState().setType(Material.AIR);
    }
}
 
开发者ID:TechzoneMC,项目名称:SonarPet,代码行数:9,代码来源:PetEntityListener.java

示例7: onPlayerFrostWalk

import org.bukkit.event.block.EntityBlockFormEvent; //导入依赖的package包/类
@EventHandler
public void onPlayerFrostWalk(EntityBlockFormEvent e) {  
	if (e.getEntity() instanceof Player){
		return;
	}
	RedProtect.get().logger.debug("RPEntityListener - EntityBlockFormEvent canceled? " + e.isCancelled());  
	Region r = RedProtect.get().rm.getTopRegion(e.getBlock().getLocation());
	if (r != null && !r.canIceForm()){
		e.setCancelled(true);
	}
}
 
开发者ID:FabioZumbi12,项目名称:RedProtect,代码行数:12,代码来源:RPEntityListener.java

示例8: onPlayerFrostWalk

import org.bukkit.event.block.EntityBlockFormEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.LOW)
public void onPlayerFrostWalk(EntityBlockFormEvent e) {  
	if (!(e.getEntity() instanceof Player)){
		return;
	}
	RedProtect.get().logger.debug("RPPlayerListener - EntityBlockFormEvent canceled? " + e.isCancelled());  
	Player p = (Player) e.getEntity();
	Region r = RedProtect.get().rm.getTopRegion(e.getBlock().getLocation());
	if (r != null && e.getNewState().getType().name().contains("FROSTED_ICE") && !r.canIceForm(p)){
		e.setCancelled(true);
	}
}
 
开发者ID:FabioZumbi12,项目名称:RedProtect,代码行数:13,代码来源:RPPlayerListener.java

示例9: e

import org.bukkit.event.block.EntityBlockFormEvent; //导入依赖的package包/类
public void e() {
    super.e();
    int i = MathHelper.floor(this.locX);
    int j = MathHelper.floor(this.locY);
    int k = MathHelper.floor(this.locZ);

    if (this.L()) {
        this.damageEntity(DamageSource.DROWN, 1.0F);
    }

    if (this.world.getBiome(i, k).a(i, j, k) > 1.0F) {
        this.damageEntity(CraftEventFactory.MELTING, 1.0F); // CraftBukkit - DamageSource.BURN -> CraftEventFactory.MELTING
    }

    for (int l = 0; l < 4; ++l) {
        i = MathHelper.floor(this.locX + (double) ((float) (l % 2 * 2 - 1) * 0.25F));
        j = MathHelper.floor(this.locY);
        k = MathHelper.floor(this.locZ + (double) ((float) (l / 2 % 2 * 2 - 1) * 0.25F));
        if (this.world.getType(i, j, k).getMaterial() == Material.AIR && this.world.getBiome(i, k).a(i, j, k) < 0.8F && Blocks.SNOW.canPlace(this.world, i, j, k)) {
            // CraftBukkit start
            org.bukkit.block.BlockState blockState = this.world.getWorld().getBlockAt(i, j, k).getState();
            blockState.setType(CraftMagicNumbers.getMaterial(Blocks.SNOW));

            EntityBlockFormEvent event = new EntityBlockFormEvent(this.getBukkitEntity(), blockState.getBlock(), blockState);
            this.world.getServer().getPluginManager().callEvent(event);

            if(!event.isCancelled()) {
                blockState.update(true);
            }
            // CraftBukkit end
        }
    }
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:34,代码来源:EntitySnowman.java

示例10: onEntityBlockForm

import org.bukkit.event.block.EntityBlockFormEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onEntityBlockForm(final EntityBlockFormEvent e) {
    final String world = e.getBlock().getWorld().getName();
    if (!PlotSquared.isPlotWorld(world)) {
        return;
    }
    if ((!(e.getEntity() instanceof Player))) {
        if (MainUtil.isPlotArea(BukkitUtil.getLocation(e.getBlock().getLocation()))) {
            e.setCancelled(true);
        }
    }
}
 
开发者ID:Mayomi,项目名称:PlotSquared-Chinese,代码行数:13,代码来源:PlayerEvents.java

示例11: c

import org.bukkit.event.block.EntityBlockFormEvent; //导入依赖的package包/类
public void c() {
    super.c();
    if (this.G()) {
        this.damageEntity(DamageSource.DROWN, 1.0F);
    }

    int i = MathHelper.floor(this.locX);
    int j = MathHelper.floor(this.locZ);

    if (this.world.getBiome(i, j).j() > 1.0F) {
        this.damageEntity(CraftEventFactory.MELTING, 1.0F); // CraftBukkit - DamageSource.BURN -> CraftEventFactory.MELTING
    }

    for (i = 0; i < 4; ++i) {
        j = MathHelper.floor(this.locX + (double) ((float) (i % 2 * 2 - 1) * 0.25F));
        int k = MathHelper.floor(this.locY);
        int l = MathHelper.floor(this.locZ + (double) ((float) (i / 2 % 2 * 2 - 1) * 0.25F));

        if (this.world.getTypeId(j, k, l) == 0 && this.world.getBiome(j, l).j() < 0.8F && Block.SNOW.canPlace(this.world, j, k, l)) {
            // CraftBukkit start
            org.bukkit.block.BlockState blockState = this.world.getWorld().getBlockAt(j, k, l).getState();
            blockState.setTypeId(Block.SNOW.id);

            EntityBlockFormEvent event = new EntityBlockFormEvent(this.getBukkitEntity(), blockState.getBlock(), blockState);
            this.world.getServer().getPluginManager().callEvent(event);

            if(!event.isCancelled()) {
                blockState.update(true);
            }
            // CraftBukkit end
        }
    }
}
 
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:34,代码来源:EntitySnowman.java

示例12: onBlockForm

import org.bukkit.event.block.EntityBlockFormEvent; //导入依赖的package包/类
/**
 * Handles Frost Walking on visitor's islands
 * @param e
 */
@EventHandler(priority = EventPriority.LOW, ignoreCancelled=true)
public void onBlockForm(EntityBlockFormEvent e) {
    if (DEBUG) {
        plugin.getLogger().info("1.9 " +e.getEventName());
    }
    if (e.getEntity() instanceof Player && e.getNewState().getType().equals(Material.FROSTED_ICE)) {
        Player player= (Player) e.getEntity();
        if (!IslandGuard.inWorld(player)) {
            return;
        }
        if (player.isOp()) {
            return;
        }
        // This permission bypasses protection
        if (VaultHelper.checkPerm(player, Settings.PERMPREFIX + "mod.bypassprotect")) {
            return;
        }
        // Check island
        Island island = plugin.getGrid().getIslandAt(player.getLocation());
        if (island == null && Settings.defaultWorldSettings.get(SettingsFlag.PLACE_BLOCKS)) {
            return;
        }
        if (island !=null) {
            if (island.getMembers().contains(player.getUniqueId()) || island.getIgsFlag(SettingsFlag.PLACE_BLOCKS)) {
                return;
            }
        }
        // Silently cancel the event
        e.setCancelled(true);
    }
}
 
开发者ID:tastybento,项目名称:acidisland,代码行数:36,代码来源:IslandGuard1_9.java

示例13: onLivingUpdate

import org.bukkit.event.block.EntityBlockFormEvent; //导入依赖的package包/类
public void onLivingUpdate()
{
    super.onLivingUpdate();
    int i = MathHelper.floor_double(this.posX);
    int j = MathHelper.floor_double(this.posY);
    int k = MathHelper.floor_double(this.posZ);

    if (this.isWet())
    {
        this.attackEntityFrom(DamageSource.drown, 1.0F);
    }

    if (this.worldObj.getBiomeGenForCoords(i, k).getFloatTemperature(i, j, k) > 1.0F)
    {
        this.attackEntityFrom(CraftEventFactory.MELTING, 1.0F); // CraftBukkit - DamageSource.BURN -> CraftEventFactory.MELTING
    }

    for (int l = 0; l < 4; ++l)
    {
        i = MathHelper.floor_double(this.posX + (double)((float)(l % 2 * 2 - 1) * 0.25F));
        j = MathHelper.floor_double(this.posY);
        k = MathHelper.floor_double(this.posZ + (double)((float)(l / 2 % 2 * 2 - 1) * 0.25F));

        if (this.worldObj.getBlock(i, j, k).getMaterial() == Material.air && this.worldObj.getBiomeGenForCoords(i, k).getFloatTemperature(i, j, k) < 0.8F && Blocks.snow_layer.canPlaceBlockAt(this.worldObj, i, j, k))
        {
            // CraftBukkit start
            org.bukkit.block.BlockState blockState = this.worldObj.getWorld().getBlockAt(i, j, k).getState();
            blockState.setType(CraftMagicNumbers.getMaterial(Blocks.snow_layer));
            EntityBlockFormEvent event = new EntityBlockFormEvent(this.getBukkitEntity(), blockState.getBlock(), blockState);
            this.worldObj.getServer().getPluginManager().callEvent(event);

            if (!event.isCancelled())
            {
                blockState.update(true);
            }

            // CraftBukkit end
        }
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:41,代码来源:EntitySnowman.java

示例14: onEntityBlockForm

import org.bukkit.event.block.EntityBlockFormEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onEntityBlockForm(final EntityBlockFormEvent event)
{
    ActionEntityBlock action = this.newAction(EntityForm.class, event.getBlock().getWorld());
    if (action != null)
    {
        action.setNewBlock(event.getNewState());
        this.setAndLog(action, event.getBlock().getState(), event.getEntity());
    }
}
 
开发者ID:CubeEngine,项目名称:modules-extra,代码行数:11,代码来源:ListenerEntityBlock.java

示例15: onBlockForm

import org.bukkit.event.block.EntityBlockFormEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBlockForm(BlockFormEvent event)
{
    if (event instanceof EntityBlockFormEvent)
    {
        return;
    }
    this.setAndLog(BlockForm.class, event.getBlock().getState(), event.getNewState());
}
 
开发者ID:CubeEngine,项目名称:modules-extra,代码行数:10,代码来源:ListenerBlock.java


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