@EventHandler(priority=EventPriority.MONITOR, ignoreCancelled=true) public void onBlockGrow(BlockGrowEvent event) { Location loc = event.getBlock().getLocation(); String wn = getWorld(loc.getWorld()).getName(); sscache.invalidateSnapshot(wn, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()); mapManager.touch(wn, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), "blockgrow"); } };
@Override public MCBlock getBlock() { return new BukkitMCBlock(bge.getBlock()); }
/** * @param event */ @EventHandler(priority = EventPriority.HIGH) public void onBlockGrow(BlockGrowEvent event) { if (event.getBlock() == null) { return; } Field field = plugin.getForceFieldManager().getEnabledSourceField(event.getBlock().getLocation(), FieldFlag.NO_GROWTH); if (field != null) { event.setCancelled(true); } }
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onBlockGrow(BlockGrowEvent event) { /* WORLD BLACKLIST CHECK */ if(WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld())) return; BlockState blockState = event.getBlock().getState(); if (!BlockUtils.shouldBeWatched(blockState)) { return; } mcMMO.getPlaceStore().setFalse(blockState); }
@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); } } } }
@EventHandler(ignoreCancelled = true) public void onBlockGrow(BlockGrowEvent grow) { Game game = BedwarsRel.getInstance().getGameManager().getGameByLocation(grow.getBlock().getLocation()); if (game == null) { return; } grow.setCancelled(true); }
@EventHandler(ignoreCancelled = true) public void onBlockGrow(BlockGrowEvent grow) { Game game = BedwarsRel.getInstance().getGameManager().getGameByLocation(grow.getBlock().getLocation()); if (game == null) { return; } grow.setCancelled(true); }
private void growCrop(BlockGrowEvent e) { if (e.getBlock().getType().equals(SavageFactions.plugin.CROPS)) { e.setCancelled(true); Crops c = new Crops(CropState.RIPE); BlockState bs = e.getBlock().getState(); bs.setData(c); bs.update(); } Block below = e.getBlock().getLocation().subtract(0, 1, 0).getBlock(); if (below.getType() == SavageFactions.plugin.SUGAR_CANE_BLOCK) { Block above = e.getBlock().getLocation().add(0, 1, 0).getBlock(); if (above.getType() == Material.AIR && above.getLocation().add(0, - 2, 0).getBlock().getType() != Material.AIR) { above.setType(SavageFactions.plugin.SUGAR_CANE_BLOCK); } } else if (below.getType() == Material.CACTUS) { Block above = e.getBlock().getLocation().add(0, 1, 0).getBlock(); if (above.getType() == Material.AIR && above.getLocation().add(0, - 2, 0).getBlock().getType() != Material.AIR) { above.setType(Material.CACTUS); } } } }
@EventHandler public void onCropGrow(BlockGrowEvent e) { FLocation floc = new FLocation(e.getBlock().getLocation()); Faction factionAtLoc = Board.getInstance().getFactionAt(floc); if (!factionAtLoc.isWilderness()) { int level = factionAtLoc.getUpgrade(Upgrade.CROP); if (level != 0) { int chance = -1; switch (level) { case 1: chance = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Crops.Crop-Boost.level-1"); break; case 2: chance = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Crops.Crop-Boost.level-2"); break; case 3: chance = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Crops.Crop-Boost.level-3"); break; } if (chance >= 0) { int randomNum = ThreadLocalRandom.current().nextInt(1, 100 + 1); if (randomNum <= chance) growCrop(e); } } } }
@EventHandler(ignoreCancelled = true) public void onPlantGrowth(BlockGrowEvent event) { Block plant = event.getBlock(); Material species = plant.getType(); if (!plants.contains(species)) {