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

The following examples show how to use org.bukkit.event.block.BlockBurnEvent#isCancelled() . 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: BlockFire.java    From Carbon with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void a(World world, int i, int j, int k, int l, Random random, int i1) {
	int j1 = this.b[Block.getId(world.getType(i, j, k))];
	if(random.nextInt(l) < j1) {
		boolean flag = world.getType(i, j, k) == Blocks.TNT;

		org.bukkit.block.Block theBlock = world.getWorld().getBlockAt(i, j, k);

		BlockBurnEvent event = new BlockBurnEvent(theBlock);
		world.getServer().getPluginManager().callEvent(event);
		if(event.isCancelled()) {
			return;
		}
		if((random.nextInt(i1 + 10) < 5) && (!world.isRainingAt(i, j, k))) {
			int k1 = i1 + random.nextInt(5) / 4;
			if(k1 > 15) {
				k1 = 15;
			}
			world.setTypeAndData(i, j, k, this, k1, 3);
		}
		else {
			world.setAir(i, j, k);
		}
		if(flag) {
			Blocks.TNT.postBreak(world, i, j, k, 1);
		}
	}
}
 
Example 4
Source File: LoggingManager.java    From Survival-Games with GNU General Public License v3.0 3 votes vote down vote up
@EventHandler(priority = EventPriority.MONITOR)
public void blockChanged(BlockBurnEvent e){
	if(e.isCancelled())return;

	logBlockDestoryed(e.getBlock() );
	i.put("BBURN", i.get("BBURN")+1);

	//    System.out.println(6);

}