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


Java StructureGrowEvent.setCancelled方法代码示例

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


在下文中一共展示了StructureGrowEvent.setCancelled方法的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包/类
/**
 * 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

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

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

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

示例6: onStructureGrow

import org.bukkit.event.world.StructureGrowEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onStructureGrow(StructureGrowEvent event) {
    BukkitWorld world = new BukkitWorld(event.getWorld());
    if (manager.isPlotWorld(world)) {
        for (int i = 0; i < event.getBlocks().size(); i++) {
            PlotId id = manager.getPlotId(BukkitUtil.adapt(event.getBlocks().get(i).getLocation()));
            if (id == null) {
                event.getBlocks().remove(i);
                i--;
            } else {
                event.setCancelled(api.isPlotLocked(id));
            }
        }
    }
}
 
开发者ID:WorldCretornica,项目名称:PlotMe-Core,代码行数:16,代码来源:BukkitPlotListener.java

示例7: onTreeGrow

import org.bukkit.event.world.StructureGrowEvent; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@EventHandler
  public void onTreeGrow(StructureGrowEvent event)
  {
    for (int i = 0; i < planets.size(); i++)
    {
      if (event.getWorld().getName().equalsIgnoreCase(((Planet)planets.get(i)).name))
      {

        Planet p = (Planet)planets.get(i);
        
        int x = getRandom(0, p.schematics.size() - 1);
        String chosenSchemName = (String)p.schematics.get(x);
        for (int k = 0; k < Schematics.size(); k++)
        {
          if (((schematic)Schematics.get(k)).name.equalsIgnoreCase(chosenSchemName))
          {
            schematic chosenSchem = (schematic)Schematics.get(k);
            
            Vector offset = chosenSchem.schematicOffset;
            Vector dimensions = chosenSchem.schematicDimensions;
            Location location = event.getLocation();
            event.setCancelled(true);
            Vector lowCorner = new Vector(location.getBlockX() - offset.getBlockX(), location.getBlockY() - offset.getBlockY(), location.getBlockZ() - offset.getBlockZ());
            for (int q = 0; q < dimensions.getBlockX(); q++)
            {
              for (int w = 0; w < dimensions.getBlockY(); w++)
              {
                for (int e = 0; e < dimensions.getBlockZ(); e++)
                {
                  location.getWorld().getBlockAt(lowCorner.getBlockX() + q, lowCorner.getBlockY() + w, lowCorner.getBlockZ() + e).setTypeId(chosenSchem.data[q][w][e]);
                  location.getWorld().getBlockAt(lowCorner.getBlockX() + q, lowCorner.getBlockY() + w, lowCorner.getBlockZ() + e).setData((byte)chosenSchem.meta[q][w][e]);
                }
              }
            }
          }
        }
      }
    }
  }
 
开发者ID:StarQuestMinecraft,项目名称:StarQuestCode,代码行数:41,代码来源:TreeListener.java

示例8: onStructureGrow

import org.bukkit.event.world.StructureGrowEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onStructureGrow(final StructureGrowEvent event) {
    if (event.isFromBonemeal()) {
        final GeneralRegion region = this.getPlugin().getDb().getPriorByLocation(event.getLocation());
        if (region != null && region.getFlag(Flag.BUILD) && !region.isUser(event.getPlayer())) {
            event.setCancelled(true);
        }
    }
}
 
开发者ID:Ribesg,项目名称:NPlugins,代码行数:10,代码来源:BuildFlagListener.java

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

示例10: onStructureGrow

import org.bukkit.event.world.StructureGrowEvent; //导入方法依赖的package包/类
@EventHandler
public void onStructureGrow(StructureGrowEvent event) {
    event.setCancelled(true);
}
 
开发者ID:edasaki,项目名称:ZentrelaRPG,代码行数:5,代码来源:EnvironmentManager.java

示例11: onStructureGrow

import org.bukkit.event.world.StructureGrowEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.LOWEST)
public final void onStructureGrow(final StructureGrowEvent event) {
	if(event.isCancelled()) {
		return;
	}
	final Location location = event.getLocation();
	final Block block = location.getBlock();
	if(block.getType() != Material.SAPLING) {
		return;
	}
	final Random random = new Random();
	String file = null;
	switch(block.getData()) {
	case 8: // Oak
		file = OwnGarden.config.saplingOakSchematics.get(random.nextInt(OwnGarden.config.saplingOakSchematics.size()));
		break;
	case 9: // Spruce
		file = OwnGarden.config.saplingSpruceSchematics.get(random.nextInt(OwnGarden.config.saplingSpruceSchematics.size()));
		break;
	case 10: // Birch
		file = OwnGarden.config.saplingBirchSchematics.get(random.nextInt(OwnGarden.config.saplingBirchSchematics.size()));
		break;
	case 11: // Jungle
		file = OwnGarden.config.saplingJungleSchematics.get(random.nextInt(OwnGarden.config.saplingJungleSchematics.size()));
		break;
	case 12: // Acacia
		file = OwnGarden.config.saplingAcaciaSchematics.get(random.nextInt(OwnGarden.config.saplingAcaciaSchematics.size()));
		break;
	case 13: // Dark Oak
		file = OwnGarden.config.saplingDarkOakSchematics.get(random.nextInt(OwnGarden.config.saplingDarkOakSchematics.size()));
		break;
	}
	try {
		if(file == null) {
			return;
		}
		
		final Object result = OwnGarden.testSchematic(file);
		if(result instanceof Exception) {
			throw (Exception)result;
		}
		else if(result instanceof String) {
			OwnGarden.log(ChatColor.RED, result.toString());
			return;
		}
		
		((Schematic)result).paste(location);
		event.getBlocks().clear();
		event.setCancelled(true);
	}
	catch(final Exception ex) {
		OwnGarden.log(ChatColor.RED, "Unable to load the schematic : \"" + file + "\".");
		ex.printStackTrace();
	}
}
 
开发者ID:Skyost,项目名称:OwnGarden,代码行数:56,代码来源:GlobalEvents.java

示例12: onTreeGrow

import org.bukkit.event.world.StructureGrowEvent; //导入方法依赖的package包/类
@EventHandler
public void onTreeGrow(StructureGrowEvent event) {
	
	if (!(event.getSpecies().equals(TreeType.RED_MUSHROOM) || !event.getSpecies().equals(TreeType.BROWN_MUSHROOM))) {
		
		boolean withinFarm = false;
		
		for (File farm : SQTreeFarm.treefarms) {
			
			if (isWithinFarm(farm, event.getLocation())) {
				
				withinFarm = true;
				
			}
			
		}
		
		if (withinFarm) {

			event.setCancelled(false);
			
		}
		
	}
	
}
 
开发者ID:StarQuestMinecraft,项目名称:StarQuestCode,代码行数:27,代码来源:Events.java

示例13: e

import org.bukkit.event.world.StructureGrowEvent; //导入方法依赖的package包/类
@EventHandler public void e(StructureGrowEvent event) { event.setCancelled(true); } 
开发者ID:Limeth,项目名称:Breakpoint,代码行数:2,代码来源:BanListener.java


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