public static void setGamemode(Player player, String playerName,
			String gamemodePlayerName, String gamemode) {
		ArrayList<Player> gamemodePlayers = AdminEyeUtils
				.requestPlayers(gamemodePlayerName);

		if (gamemodePlayers == null && gamemodePlayerName != null) {
			StefsAPI.MessageHandler.buildMessage().addSender(playerName)
					.setMessage("error.playerNotFound", AdminEye.messages)
					.changeVariable("playername", gamemodePlayerName).build();
			return;
		}

		if (!AdminEyeUtils.isGamemode(gamemode)) {
			StefsAPI.MessageHandler.buildMessage().addSender(playerName)
					.setMessage("error.notAGamemode", AdminEye.messages)
					.changeVariable("gamemode", gamemode).build();
			return;
		}

		String gamemodedPlayers = "";

		for (Player gamemodePlayer : gamemodePlayers) {
			gamemodePlayer.setGameMode(AdminEyeUtils.getGameMode(gamemode));

			if (AdminEyeUtils.getGameMode(gamemode) == GameMode.CREATIVE) {
				PlayerFile playerFile = new PlayerFile(gamemodePlayer.getName());
				playerFile.flyFlying = false;
				playerFile.save();
			}

			gamemodedPlayers += "%A" + gamemodePlayer.getName() + "%N, ";
		}

		gamemodedPlayers = (gamemodePlayerName.equals("*") ? gamemodedPlayers = AdminEye.config
				.getFile().getString("chat.everyone") + "%N, "
				: gamemodedPlayers);

		AdminEye.broadcastAdminEyeMessage(playerName, "setgamemode",
				"gamemode", "playernames", gamemodedPlayers, "gamemode",
				AdminEyeUtils.getGameMode(gamemode).name().toLowerCase());
	}