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


Java StructureGrowEvent类代码示例

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


StructureGrowEvent类属于org.bukkit.event.world包,在下文中一共展示了StructureGrowEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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包/类
/**
 * Prevents trees from growing outside of the protected area.
 *
 * @param e
 */
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onTreeGrow(final StructureGrowEvent e) {
    if (DEBUG) {
        plugin.getLogger().info(e.getEventName());
    }
    // Check world
    if (!Util.inWorld(e.getLocation())) {
        return;
    }
    // Check if this is on an island
    Island island = plugin.getIslands().getIslandAt(e.getLocation());
    if (island == null || island.isSpawn()) {
        return;
    }
    Iterator<BlockState> it = e.getBlocks().iterator();
    while (it.hasNext()) {
        BlockState b = it.next();
        if (b.getType() == Material.LOG || b.getType() == Material.LOG_2
                || b.getType() == Material.LEAVES || b.getType() == Material.LEAVES_2) {
            if (!island.onIsland(b.getLocation())) {
                it.remove();
            }
        }
    }
}
 
开发者ID:tastybento,项目名称:bskyblock,代码行数:31,代码来源:IslandGuard.java

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: onTreeGrow

import org.bukkit.event.world.StructureGrowEvent; //导入依赖的package包/类
/**
 * Prevents trees from growing outside of the protected area.
 *
 * @param e
 */
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onTreeGrow(final StructureGrowEvent e) {
    if (DEBUG) {
        plugin.getLogger().info(e.getEventName());
    }
    // Check world
    if (!IslandGuard.inWorld(e.getLocation())) {
        return;
    }
    // Check if this is on an island
    Island island = plugin.getGrid().getIslandAt(e.getLocation());
    if (island == null || island.isSpawn()) {
        return;
    }
    Iterator<BlockState> it = e.getBlocks().iterator();
    while (it.hasNext()) {
        BlockState b = it.next();
        if (b.getType() == Material.LOG || b.getType() == Material.LOG_2
                || b.getType() == Material.LEAVES || b.getType() == Material.LEAVES_2) {
            if (!island.onIsland(b.getLocation())) {
                it.remove();
            }
        }
    }
}
 
开发者ID:tastybento,项目名称:acidisland,代码行数:31,代码来源:EntityLimits.java

示例10: getBiome

import org.bukkit.event.world.StructureGrowEvent; //导入依赖的package包/类
public static String getBiome(StructureGrowEvent e) 
{
	if (tc != null) 
	{
		String tControl = TerrainControl.getBiomeName(e.getWorld().getName(), e.getLocation().getBlockX(), e.getLocation().getBlockZ());
		if (tControl != null)
		{
			return tControl;
		}
		else 
		{
			return String.valueOf(e.getLocation().getBlock().getBiome());
		}
	}
	else
	{
		return String.valueOf(e.getLocation().getBlock().getBiome());
	}
}
 
开发者ID:Pwn9,项目名称:PwnPlantGrowth,代码行数:20,代码来源:PwnPlantGrowth.java

示例11: 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

示例12: check

import org.bukkit.event.world.StructureGrowEvent; //导入依赖的package包/类
@Override
public boolean check(final Event e) {
	if (types != null) {
		return types.check(e, new Checker<StructureType>() {
			@SuppressWarnings("null")
			@Override
			public boolean check(final StructureType t) {
				return t.is(((StructureGrowEvent) e).getSpecies());
			}
		});
	}
	return true;
}
 
开发者ID:nfell2009,项目名称:Skript,代码行数:14,代码来源:EvtGrow.java

示例13: 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

示例14: onStructureGrow

import org.bukkit.event.world.StructureGrowEvent; //导入依赖的package包/类
@EventHandler(ignoreCancelled = true)
public void onStructureGrow(StructureGrowEvent grow) {

  Game game = BedwarsRel.getInstance().getGameManager().getGameByLocation(grow.getLocation());
  if (game == null) {
    return;
  }

  grow.setCancelled(true);
}
 
开发者ID:BedwarsRel,项目名称:BedwarsRel,代码行数:11,代码来源:BlockListener.java

示例15: 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


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