类org.bukkit.event.block.BlockGrowEvent源码实例Demo

下面列出了怎么用org.bukkit.event.block.BlockGrowEvent的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: IridiumSkyblock   文件: BlockGrowListener.java
@EventHandler
public void onBlockGrow(BlockGrowEvent event) {
    try {
        final Block block = event.getBlock();
        final Location location = block.getLocation();
        final IslandManager islandManager = IridiumSkyblock.getIslandManager();
        final Island island = islandManager.getIslandViaLocation(location);
        if (island == null) return;

        if (island.getFarmingBooster() == 0) return;

        final Material material = block.getType();
        if (!XBlock.isCrops(material)) return;

        event.setCancelled(true);

        final Crops crops = new Crops(CropState.RIPE);
        final BlockState blockState = block.getState();
        blockState.setData(crops);
        blockState.update();
    } catch (Exception e) {
        IridiumSkyblock.getInstance().sendErrorMessage(e);
    }
}
 
源代码2 项目: GriefDefender   文件: BlockEventHandler.java
@EventHandler(priority = EventPriority.LOWEST)
public void onBlockGrow(BlockGrowEvent event) {
    final Block block = event.getBlock();
    final World world = event.getBlock().getWorld();
    if (!GriefDefenderPlugin.getInstance().claimsEnabledForWorld(world.getUID())) {
        return;
    }

    final Location location = block.getLocation();
    final GDClaim targetClaim = this.storage.getClaimAt(location);
    if (targetClaim.isWilderness()) {
        return;
    }

    final Tristate result = GDPermissionManager.getInstance().getFinalPermission(event, location, targetClaim, Flags.BLOCK_GROW, null, event.getBlock(), (GDPermissionUser) null, TrustTypes.BUILDER, false);
    if (result == Tristate.FALSE) {
        event.setCancelled(true);
        return;
    }
}
 
源代码3 项目: GlobalWarming   文件: FarmYield.java
@EventHandler
public void onCropGrow(BlockGrowEvent event) {
    WorldClimateEngine worldEngine = ClimateEngine.getInstance().getClimateEngine(event.getBlock().getWorld().getUID());
    if (worldEngine != null && worldEngine.isEffectEnabled(ClimateEffectType.FARM_YIELD)) {
        Distribution distribution = cropDistribution.get(event.getBlock().getType());
        if (distribution != null) {
            double random = GlobalWarming.getInstance().getRandom().nextDouble();
            double chance = distribution.getValue(worldEngine.getTemperature());
            if (chance / 100.f <= random) {
                event.setCancelled(true);
            }
        }
    }
}
 
源代码4 项目: Skript   文件: EvtPlantGrowth.java
@SuppressWarnings("null")
@Override
public boolean check(Event e) {
	if (types != null) {
		for (ItemType type : types.getAll()) {
			if (new ItemType(((BlockGrowEvent) e).getBlock()).equals(type))
				return true;
		}
		return false; // Not one of given types
	}
	
	return true;
}
 
源代码5 项目: Survival-Games   文件: LoggingManager.java
@EventHandler(priority = EventPriority.MONITOR)
public void blockChanged(BlockGrowEvent e){
	if(e.isCancelled())return;

	logBlockCreated(e.getBlock());
	//    System.out.println(7);

}
 
源代码6 项目: BedwarsRel   文件: BlockListener.java
@EventHandler(ignoreCancelled = true)
public void onBlockGrow(BlockGrowEvent grow) {

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

  grow.setCancelled(true);
}
 
源代码7 项目: ShopChest   文件: ShopItemListener.java
@EventHandler(priority = EventPriority.HIGH)
public void onBlockGrow(BlockGrowEvent e) {
    Block newBlock = e.getNewState().getBlock();
    if (shopUtils.isShop(newBlock.getLocation()) || shopUtils.isShop(newBlock.getRelative(BlockFace.DOWN).getLocation())) {
        e.setCancelled(true);
    }
}
 
源代码8 项目: civcraft   文件: BlockListener.java
@EventHandler(priority = EventPriority.NORMAL)
public void onBlockGrowEvent(BlockGrowEvent event) {
	bcoord.setFromLocation(event.getBlock().getLocation().add(0, -1, 0));
	if (CivGlobal.vanillaGrowthLocations.contains(bcoord)) {
		/* Allow vanilla growth on these plots. */
		return;
	}

	Block b = event.getBlock();

	if (Farm.isBlockControlled(b)) {
		event.setCancelled(true);
	}
}
 
源代码9 项目: PlotMe-Core   文件: BukkitPlotListener.java
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onBlockGrow(BlockGrowEvent event) {
    Location location = BukkitUtil.adapt(event.getBlock().getLocation());

    if (manager.isPlotWorld(location)) {
        PlotId id = manager.getPlotId(location);

        if (id == null) {
            event.setCancelled(true);
        } else {
            event.setCancelled(api.isPlotLocked(id));
        }
    }
}
 
源代码10 项目: BlueMap   文件: EventForwarder.java
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBlockChange(BlockGrowEvent evt) {
	onBlockChange(evt.getBlock().getLocation());
}
 
源代码11 项目: PGM   文件: BlockTransformListener.java
@EventWrapper
public void onBlockForm(final BlockGrowEvent event) {
  this.callEvent(
      new BlockTransformEvent(event, event.getBlock().getState(), event.getNewState()));
}
 
源代码12 项目: ProjectAres   文件: BlockTransformListener.java
@EventWrapper
public void onBlockForm(final BlockGrowEvent event) {
    this.callEvent(new BlockTransformEvent(event, event.getBlock().getState(), event.getNewState()));
}
 
源代码13 项目: CardinalPGM   文件: WorldFreeze.java
@EventHandler
public void onBlockGrow(BlockGrowEvent event) {
    if (!match.isRunning()) {
        event.setCancelled(true);
    }
}
 
源代码14 项目: CardinalPGM   文件: BlockEventRegion.java
@EventHandler
public void onBlockGrow(BlockGrowEvent event) {
    if (filter.evaluate(event.getBlock(), event).equals(FilterState.DENY) && region.contains(new BlockRegion(null, event.getBlock().getLocation().toVector()))) {
        event.setCancelled(true);
    }
}
 
 类所在包
 类方法
 同包方法