@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); }
/** * @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 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(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); } }
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); } } } }