/*
 * This file is part of Inferno, licensed under the MIT License (MIT).
 *
 * Copyright (c) 2016, Max Roncace and contributors <me@caseif.net>
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

package net.caseif.flint.inferno.challenger;

import net.caseif.flint.common.challenger.CommonChallenger;
import net.caseif.flint.common.round.CommonRound;

import org.apache.commons.lang3.NotImplementedException;

import java.util.UUID;

public class InfernoChallenger extends CommonChallenger {

    public InfernoChallenger(UUID playerUuid, String playerName, CommonRound round) {
        super(playerUuid, playerName, round);
    }

    @Override
    public void setSpectating(boolean spectating) {
        throw new NotImplementedException("TODO");
    }

}

@@ -1264,16 +1264,63 @@
 enger;%0A%0A
+import net.caseif.flint.challenger.Challenger;%0A
 import n
@@ -1402,32 +1402,105 @@
 .com
-mon.round.Common
+ponent.exception.OrphanedComponentException;%0Aimport net.caseif.flint.inferno.round.Inferno
 Round;%0A
-%0A
 impo
@@ -1510,209 +1510,443 @@
 org.
-apache.commons.lang3.NotImplementedException;%0A%0Aimport java.util.UUID;%0A%0Apublic class InfernoChallenger extends CommonChallenger %7B%0A%0A    public InfernoChallenger(UUID playerUuid, String playerName, Common
+spongepowered.api.entity.living.player.Player;%0Aimport org.spongepowered.api.entity.living.player.gamemode.GameMode;%0Aimport org.spongepowered.api.entity.living.player.gamemode.GameModes;%0A%0A/**%0A * The implementation of %7B@link Challenger%7D for Inferno.%0A */%0Apublic class InfernoChallenger extends CommonChallenger %7B%0A%0A    private final Player player;%0A    private GameMode previousGameMode;%0A%0A    public InfernoChallenger(Player player, Inferno
 Roun
@@ -1980,20 +1980,30 @@
 ayer
-Uuid
+.getUniqueId()
 , player
 Name
@@ -2002,12 +2002,18 @@
 ayer
+.get
 Name
+()
 , ro
@@ -2017,16 +2017,47 @@
  round);
+%0A%0A        this.player = player;
 %0A    %7D%0A%0A
@@ -2124,66 +2124,410 @@
 ng) 
-%7B%0A        throw new NotImplementedException(%22TODO%22);%0A
+throws OrphanedComponentException %7B%0A        super.setSpectating(spectating);%0A%0A        if (spectating) %7B%0A            this.previousGameMode = this.player.gameMode().get();%0A            this.player.gameMode().set(GameModes.SPECTATOR);%0A        %7D else if (this.previousGameMode != null) %7B%0A            this.player.gameMode().set(this.previousGameMode);%0A            this.previousGameMode = null;%0A    
     %7D%0A
+    %7D
 %0A%7D%0A

Implement Challenger