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


Java StructureGrowEvent.getBlocks方法代码示例

本文整理汇总了Java中org.bukkit.event.world.StructureGrowEvent.getBlocks方法的典型用法代码示例。如果您正苦于以下问题:Java StructureGrowEvent.getBlocks方法的具体用法?Java StructureGrowEvent.getBlocks怎么用?Java StructureGrowEvent.getBlocks使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.event.world.StructureGrowEvent的用法示例。


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

示例1: TreeGrowChecker

import org.bukkit.event.world.StructureGrowEvent; //导入方法依赖的package包/类
@EventHandler
public void TreeGrowChecker(StructureGrowEvent event) {
    if (ConfigPatch.safetyBonemeal) {
    	if(event.isFromBonemeal() == false) {
    		return;
    	}
    	List<BlockState> blocks = event.getBlocks();
    	int bs = blocks.size();
    	for(int i = 0;i<bs;i++){
    		Block block = blocks.get(i).getBlock();
    		if(block.getType() != Material.AIR && block.getType() != Material.SAPLING && block.getType() != event.getLocation().getBlock().getRelative(BlockFace.DOWN).getType()){
    			event.setCancelled(true);
                if (event.getPlayer() != null) {
                    AzureAPI.log(event.getPlayer(), "§c这棵树生长区域有方块阻挡,请不要尝试利用骨粉BUG!");
                    return;
                }
    		}
    	}
    }
}
 
开发者ID:GelandiAssociation,项目名称:EscapeLag,代码行数:21,代码来源:BonemealDupePatch.java

示例2: onTreeGrow

import org.bukkit.event.world.StructureGrowEvent; //导入方法依赖的package包/类
/**
 * Converts trees to gravel and glowstone
 *
 * @param e
 */
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onTreeGrow(final StructureGrowEvent e) {
    if (DEBUG)
        plugin.getLogger().info("DEBUG: " + e.getEventName());

    if (!Settings.netherTrees) {
        return;
    }
    if (!Settings.netherGenerate || IslandWorld.getNetherWorld() == null) {
        return;
    }
    // Check world
    if (!e.getLocation().getWorld().equals(IslandWorld.getNetherWorld())) {
        return;
    }
    for (BlockState b : e.getBlocks()) {
        if (b.getType() == Material.LOG || b.getType() == Material.LOG_2) {
            b.setType(Material.GRAVEL);
        } else if (b.getType() == Material.LEAVES || b.getType() == Material.LEAVES_2) {
            b.setType(Material.GLOWSTONE);
        }
    }
}
 
开发者ID:tastybento,项目名称:bskyblock,代码行数:29,代码来源:NetherEvents.java

示例3: onStructureGrow

import org.bukkit.event.world.StructureGrowEvent; //导入方法依赖的package包/类
@EventHandler
public void onStructureGrow(StructureGrowEvent e){
	RedProtect.get().logger.debug("RPBlockListener - Is StructureGrowEvent event");
	if (!RPConfig.getBool("deny-structure-bypass-regions")){
		return;
	}
	Region rfrom = RedProtect.get().rm.getTopRegion(e.getLocation());
	for (BlockState bstt:e.getBlocks()){
		Region rto = RedProtect.get().rm.getTopRegion(bstt.getLocation());
		Block bloc = bstt.getLocation().getBlock();
		//deny blocks spread in/out regions
		if (rfrom != null && rto != null && rfrom != rto && !rfrom.sameLeaders(rto)){
			bstt.setType(bloc.getType());
		}
		if (rfrom == null && rto != null){
			bstt.setType(bloc.getType());
		}
		if (rfrom != null && rto == null){
			bstt.setType(bloc.getType());
		}
		bstt.update();
	}		
}
 
开发者ID:FabioZumbi12,项目名称:RedProtect,代码行数:24,代码来源:RPBlockListener.java

示例4: onTreeGrow

import org.bukkit.event.world.StructureGrowEvent; //导入方法依赖的package包/类
/**
 * Prevent trees from growing above beacons
 * 
 * @param e
 */
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onTreeGrow(final StructureGrowEvent e) {
    if (DEBUG)
        getLogger().info("DEBUG: " + e.getEventName());
    World world = e.getLocation().getWorld();
    if (!world.equals(getBeaconzWorld())) {
        return;
    }
    for (BlockState b : e.getBlocks()) {
        if (getRegister().isAboveBeacon(b.getLocation())) {
            e.setCancelled(true);
            break;
        }
    }
}
 
开发者ID:tastybento,项目名称:beaconz,代码行数:21,代码来源:BeaconSurroundListener.java

示例5: onStructureGrow

import org.bukkit.event.world.StructureGrowEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onStructureGrow(final StructureGrowEvent e) {
    if (!PlotSquared.isPlotWorld(e.getWorld().getName())) {
        return;
    }
    final List<BlockState> blocks = e.getBlocks();
    if (blocks.size() == 0) {
        return;
    }
    Plot origin = MainUtil.getPlot(BukkitUtil.getLocation(blocks.get(0).getLocation()));
    BlockState start = blocks.get(0);
    for (int i = blocks.size() - 1; i >= 0; i--) {
        final Location loc = BukkitUtil.getLocation(blocks.get(i).getLocation());
        final Plot plot = MainUtil.getPlot(loc);
        if (!MainUtil.equals(plot, origin)) {
            e.getBlocks().remove(i);
        }
    }
}
 
开发者ID:Mayomi,项目名称:PlotSquared-Chinese,代码行数:20,代码来源:PlayerEvents.java

示例6: onStructureGrow

import org.bukkit.event.world.StructureGrowEvent; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = true)
public void onStructureGrow(StructureGrowEvent event) {
    if (plugin.getChestSettings().allowDestroyBy(AttackType.SAPLING)) {
        return;
    }
    // Check deleted blocks
    List<BlockState> blocks = event.getBlocks();
    for (Iterator<BlockState> it = blocks.iterator(); it.hasNext();) {
        BlockState blockState = it.next();

        if (blockState.getType() == Material.AIR) {
            // Almost all replaced blocks are air, so this is a cheap,
            // zero-allocation way out
            continue;
        }

        if (isProtected(blockState.getBlock())) {
            it.remove();
        }
    }
}
 
开发者ID:rutgerkok,项目名称:BlockLocker,代码行数:22,代码来源:BlockDestroyListener.java

示例7: onTreeGrow

import org.bukkit.event.world.StructureGrowEvent; //导入方法依赖的package包/类
/**
 * Converts trees to gravel and glowstone
 * 
 * @param e
 */
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onTreeGrow(final StructureGrowEvent e) {
    if (DEBUG)
        plugin.getLogger().info("DEBUG: " + e.getEventName());

    if (!Settings.netherTrees) {
        return;
    }
    if (!Settings.createNether || ASkyBlock.getNetherWorld() == null) {
        return;
    }
    // Check world
    if (!e.getLocation().getWorld().equals(ASkyBlock.getNetherWorld())) {
        return;
    }
    for (BlockState b : e.getBlocks()) {
        if (b.getType() == Material.LOG || b.getType() == Material.LOG_2) {
            b.setType(Material.GRAVEL);
        } else if (b.getType() == Material.LEAVES || b.getType() == Material.LEAVES_2) {
            b.setType(Material.GLOWSTONE);
        }
    }
}
 
开发者ID:tastybento,项目名称:acidisland,代码行数:29,代码来源:NetherPortals.java

示例8: onTreeGrow

import org.bukkit.event.world.StructureGrowEvent; //导入方法依赖的package包/类
@EventHandler
public void onTreeGrow(StructureGrowEvent event)
{
	if(this.rtCommand.GetPlayerSetting(event.getPlayer().getName()))
	{
		Material material = this.GetRndMaterial();
		byte color = this.HandleWoolColor();
		
		if(event.isFromBonemeal())
		{			
			for(BlockState blockState : event.getBlocks())
			{
				if(blockState.getType() == Material.LEAVES)
				{
					this.HandleSpecialBlock(material, blockState, color);
				}
			}
		}
	}
}
 
开发者ID:DreanorBukkit,项目名称:RandomTrees,代码行数:21,代码来源:TreeGrow.java

示例9: onStructureGrow

import org.bukkit.event.world.StructureGrowEvent; //导入方法依赖的package包/类
@EventHandler
public void onStructureGrow(StructureGrowEvent event) throws InterruptedException {
    if (disabling) { return; }
    while (plugin.isUpdatingChecks) {
        Thread.sleep(25);
    }
    for (BlockState blockState : event.getBlocks()) {
        plugin.needsCheck.add(blockState.getBlock());
    }
}
 
开发者ID:ArdiMaster,项目名称:SunBurnsTrees,代码行数:11,代码来源:EventListener.java

示例10: onStructureGrow

import org.bukkit.event.world.StructureGrowEvent; //导入方法依赖的package包/类
@EventHandler
public void onStructureGrow(StructureGrowEvent event) {
    for(BlockState block : event.getBlocks()) {
        BlockProtection blockProtection = this.module.getProtectManager().getBlockProtection(block.getBlock().getLocation());
        if(blockProtection.exists()) {
            event.setCancelled(true);
            break;
        }
    }
}
 
开发者ID:Steveice10,项目名称:Peacecraft,代码行数:11,代码来源:ProtectListener.java

示例11: onStructureGrow

import org.bukkit.event.world.StructureGrowEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGH)
public void onStructureGrow(StructureGrowEvent e) {
    for (BlockState state : e.getBlocks()) {
        Block newBlock = state.getBlock();
        if (shopUtils.isShop(newBlock.getLocation()) || shopUtils.isShop(newBlock.getRelative(BlockFace.DOWN).getLocation())) {
            e.setCancelled(true);
        }
    }
}
 
开发者ID:EpicEricEE,项目名称:ShopChest,代码行数:10,代码来源:ShopItemListener.java

示例12: onStructureGrow

import org.bukkit.event.world.StructureGrowEvent; //导入方法依赖的package包/类
/**
 * Monitor StructureGrow events.
 *
 * @param event The event to watch
 */
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onStructureGrow(StructureGrowEvent event) {
    if (!mcMMO.getPlaceStore().isTrue(event.getLocation().getBlock())) {
        return;
    }

    for (BlockState blockState : event.getBlocks()) {
        mcMMO.getPlaceStore().setFalse(blockState);
    }
}
 
开发者ID:Pershonkey,项目名称:McMMOPlus,代码行数:16,代码来源:WorldListener.java

示例13: onStructureGrow

import org.bukkit.event.world.StructureGrowEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onStructureGrow(StructureGrowEvent event) {
    // Get the bounding box for all the blocks involved.
    final List<BlockState> blocks = event.getBlocks();
    Location[] cube = BlockUtils.getBounds(blocks);

    // Now, see if any portals are involved.
    final ArrayList<ABPortal> portals = plugin.getManager().getWithin(cube[0], cube[1]);
    if ( portals == null || portals.size() == 0 )
        return;

    // See if any important frame blocks were affected. This is awful. A nested for loop.
    // Thankfully it won't come up often. Use an iterator and remove the blocks that
    // intersect with portal frames.
    for(final Iterator<BlockState> it = blocks.iterator(); it.hasNext(); ) {
        final BlockState bs = it.next();
        final World world = bs.getWorld();
        final int x = bs.getX(), y = bs.getY(), z = bs.getZ();

        for(final ABPortal portal: portals) {
            if ( portal.isInFrame(world, x, y, z) ) {
                it.remove();
                break;
            }
        }
    }

    // Did we remove everything?
    if ( blocks.size() == 0 ) {
        event.setCancelled(true);
        return;
    }

    // After the block is gone, update all our portals.
    if ( portals.size() > 0 )
        plugin.getServer().getScheduler().runTask(plugin, new UpdatePortals(event, portals));
}
 
开发者ID:stendec,项目名称:Abyss,代码行数:38,代码来源:BlockListener.java


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