Java Code Examples for org.bukkit.event.block.BlockBurnEvent#setCancelled()

The following examples show how to use org.bukkit.event.block.BlockBurnEvent#setCancelled() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WorldListener.java    From BedWars with GNU Lesser General Public License v3.0 6 votes vote down vote up
@EventHandler
public void onBurn(BlockBurnEvent event) {
    if (event.isCancelled()) {
        return;
    }

    for (String s : Main.getGameNames()) {
        Game game = Main.getGame(s);
        if (game.getStatus() == GameStatus.RUNNING || game.getStatus() == GameStatus.GAME_END_CELEBRATING) {
            if (GameCreator.isInArea(event.getBlock().getLocation(), game.getPos1(), game.getPos2())) {
                if (!game.isBlockAddedDuringGame(event.getBlock().getLocation())) {
                    event.setCancelled(true);
                }
                return;
            }
        }
    }
}
 
Example 2
Source File: WorldListener.java    From BedWars with GNU Lesser General Public License v3.0 6 votes vote down vote up
@EventHandler
public void onBurn(BlockBurnEvent event) {
    if (event.isCancelled()) {
        return;
    }

    for (String s : Main.getGameNames()) {
        Game game = Main.getGame(s);
        if (game.getStatus() == GameStatus.RUNNING || game.getStatus() == GameStatus.GAME_END_CELEBRATING) {
            if (GameCreator.isInArea(event.getBlock().getLocation(), game.getPos1(), game.getPos2())) {
                if (!game.isBlockAddedDuringGame(event.getBlock().getLocation())) {
                    event.setCancelled(true);
                }
                return;
            }
        }
    }
}
 
Example 3
Source File: BlockListener.java    From BedwarsRel with GNU General Public License v3.0 6 votes vote down vote up
@EventHandler(priority = EventPriority.HIGH)
public void onBurn(BlockBurnEvent bbe) {
  Block block = bbe.getBlock();
  if (block == null) {
    return;
  }

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

  if (game.getState() == GameState.STOPPED) {
    return;
  }

  bbe.setCancelled(true);
}
 
Example 4
Source File: BlockListener.java    From civcraft with GNU General Public License v2.0 6 votes vote down vote up
@EventHandler(priority = EventPriority.LOW)
public void onBlockBurnEvent(BlockBurnEvent event) {
	bcoord.setFromLocation(event.getBlock().getLocation());

	StructureBlock sb = CivGlobal.getStructureBlock(bcoord);
	if (sb != null) {
		event.setCancelled(true);
		return;
	}

	RoadBlock rb = CivGlobal.getRoadBlock(bcoord);
	if (rb != null) {
		event.setCancelled(true);
		return;
	}

	CampBlock cb = CivGlobal.getCampBlock(bcoord);
	if (cb != null) {
		event.setCancelled(true);
		return;
	}
}
 
Example 5
Source File: IslandGuard.java    From askyblock with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Prevents fire spread
 * @param e - event
 */
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onBlockBurn(BlockBurnEvent e) {
    if (DEBUG) {
        plugin.getLogger().info(e.getEventName());
    }
    if (!inWorld(e.getBlock())) {
        //plugin.getLogger().info("DEBUG: Not in world");
        return;
    }
    if (actionAllowed(e.getBlock().getLocation(), SettingsFlag.FIRE_SPREAD)) {
        return;
    }
    e.setCancelled(true);
}
 
Example 6
Source File: EnvironmentControlListener.java    From ProjectAres with GNU Affero General Public License v3.0 4 votes vote down vote up
@EventHandler(priority = EventPriority.HIGH)
public void noFire(final BlockBurnEvent event) {
    event.setCancelled(true);
}
 
Example 7
Source File: GuildHeartProtectionHandler.java    From FunnyGuilds with Apache License 2.0 4 votes vote down vote up
@EventHandler
public void onBlockBurn(BlockBurnEvent event) {
    if (isGuildHeart(event.getBlock())) {
        event.setCancelled(true);
    }
}
 
Example 8
Source File: WorldFreeze.java    From CardinalPGM with MIT License 4 votes vote down vote up
@EventHandler
public void onBlockBurn(BlockBurnEvent event) {
    if (!match.isRunning()) {
        event.setCancelled(true);
    }
}
 
Example 9
Source File: BlockEventRegion.java    From CardinalPGM with MIT License 4 votes vote down vote up
@EventHandler
public void onBlockBurn(BlockBurnEvent event) {
    if (filter.evaluate(event.getBlock(), event).equals(FilterState.DENY) && region.contains(new BlockRegion(null, event.getBlock().getLocation().toVector()))) {
        event.setCancelled(true);
    }
}