Exemplo n.º 1
0
	@EventHandler
	public void onEntitySpawn(CreatureSpawnEvent e) {
		for (Game game : GameManager.getGames()) {
			if (game.contains(e.getLocation())) {
				e.setCancelled(true);
				return;
			}
		}
	}
Exemplo n.º 2
0
	@EventHandler
	public void onEntityExplode(EntityExplodeEvent e) {
		if (!HeavySpleef.getSystemConfig().getGeneralSection().isProtectArenas())
			return;

		for (Game game : GameManager.getGames()) {
			if (game.contains(e.getLocation())) {
				e.blockList().clear();
				return;
			}
		}
	}
Exemplo n.º 3
0
	@EventHandler
	public void onBlockPlace(BlockPlaceEvent e) {
		for (Game game : GameManager.getGames()) {
			if (!game.contains(e.getBlock().getLocation())) {
				continue;
			}

			if (e.getPlayer().hasPermission(Permissions.BUILD_BYPASS.getPerm())) {
				return;
			}

			if (!HeavySpleef.getSystemConfig().getGeneralSection().isProtectArenas()) {
				return;
			}

			e.setCancelled(true);
			e.getPlayer().sendMessage(I18N._("notAllowedToBuild"));
		}
	}
Exemplo n.º 4
0
	@EventHandler
	public void onBlockBreak(BlockBreakEvent e) {
		SpleefPlayer player = HeavySpleef.getInstance().getSpleefPlayer(e.getPlayer());
		Block block = e.getBlock();

		if (!player.isActive()) {
			for (Game game : GameManager.getGames()) {
				if (game.contains(block.getLocation())) {
					if (player.getBukkitPlayer().hasPermission(Permissions.BUILD_BYPASS.getPerm()))
						return;
					if (!HeavySpleef.getSystemConfig().getGeneralSection().isProtectArenas())
						return;

					e.setCancelled(true);
					fixBlockGlitch(player.getBukkitPlayer(), block);
					player.sendMessage(I18N._("notAllowedToBuild"));
					return;
				}
			}
			return;
		}

		Game game = player.getGame();

		if (!game.canSpleef(player, block.getLocation())) {
			e.setCancelled(true);
			fixBlockGlitch(player.getBukkitPlayer(), block);
			player.sendMessage(I18N._("notAllowedToBuild"));
			return;
		}

		if (game.getFlag(FlagType.BOWSPLEEF) || game.getFlag(FlagType.SPLEGG)) {
			e.setCancelled(true);
			return;
		}

		player.addBrokenBlock(block);
	}