org.bukkit.event.block.BlockBurnEvent Java Examples

The following examples show how to use org.bukkit.event.block.BlockBurnEvent. 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: BlockTransformListener.java    From PGM with GNU Affero General Public License v3.0 6 votes vote down vote up
@EventWrapper
public void onBlockBurn(final BlockBurnEvent event) {
  Match match = PGM.get().getMatchManager().getMatch(event.getBlock().getWorld());
  if (match == null) return;

  BlockState oldState = event.getBlock().getState();
  BlockState newState = BlockStates.toAir(oldState);
  MatchPlayerState igniterState = null;
  TrackerMatchModule tmm = match.needModule(TrackerMatchModule.class);

  for (BlockFace face : NEIGHBORS) {
    Block neighbor = oldState.getBlock().getRelative(face);
    if (neighbor.getType() == Material.FIRE) {
      igniterState = tmm.getOwner(neighbor);
      if (igniterState != null) break;
    }
  }

  this.callEvent(event, oldState, newState, igniterState);
}
 
Example #3
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 #4
Source File: BlockTransformListener.java    From ProjectAres with GNU Affero General Public License v3.0 6 votes vote down vote up
@EventWrapper
public void onBlockBurn(final BlockBurnEvent event) {
    Match match = PGM.getMatchManager().getMatch(event.getBlock().getWorld());
    if(match == null) return;

    BlockState oldState = event.getBlock().getState();
    BlockState newState = BlockStateUtils.toAir(oldState);
    MatchPlayerState igniterState = null;

    for(BlockFace face : NEIGHBORS) {
        Block neighbor = oldState.getBlock().getRelative(face);
        if(neighbor.getType() == Material.FIRE) {
            igniterState = blockResolver.getOwner(neighbor);
            if(igniterState != null) break;
        }
    }

    this.callEvent(event, oldState, newState, igniterState);
}
 
Example #5
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 #6
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 #7
Source File: BlockEventTracker.java    From GriefDefender with MIT License 5 votes vote down vote up
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBlockBurn(BlockBurnEvent event) {
    final GDClaimManager claimWorldManager = GriefDefenderPlugin.getInstance().dataStore.getClaimWorldManager(event.getBlock().getWorld().getUID());
    final GDChunk gpChunk = claimWorldManager.getChunk(event.getBlock().getChunk());
    final GDPermissionUser notifier = gpChunk.getBlockNotifier(event.getBlock().getLocation());
    if (notifier != null) {
        gpChunk.addTrackedBlockPosition(event.getBlock(), notifier.getUniqueId(), PlayerTracker.Type.NOTIFIER);
        return;
    }
    final GDPermissionUser owner = gpChunk.getBlockOwner(event.getBlock().getLocation());
    if (owner != null) {
        gpChunk.addTrackedBlockPosition(event.getBlock(), owner.getUniqueId(), PlayerTracker.Type.OWNER);
    }
}
 
Example #8
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 #9
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 #10
Source File: EventForwarder.java    From BlueMap with MIT License 4 votes vote down vote up
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBlockChange(BlockBurnEvent evt) {
	onBlockChange(evt.getBlock().getLocation());
}
 
Example #11
Source File: BlockEventHandler.java    From GriefDefender with MIT License 4 votes vote down vote up
@EventHandler(priority = EventPriority.LOWEST)
public void onBlockBurn(BlockBurnEvent event) {
    final Block fromBlock = NMSUtil.getInstance().getIgnitingBlock(event);
    final Block toBlock = event.getBlock();
    CommonBlockEventHandler.getInstance().handleBlockModify(event, fromBlock, toBlock.getState());
}
 
Example #12
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 #13
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 #14
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 #15
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);
    }
}
 
Example #16
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);

}