Search in sources :

Example 16 with Player

use of tel.discord.rtab.Player in project RtaB6 by Telnaior.

the class HiddenCommandCommand method execute.

@Override
protected void execute(CommandEvent event) {
    // Start by checking to see if they're in-game, and read from their player-file instead
    Player player = null;
    // Find the channel
    GameController controller = null;
    for (GameController next : RaceToABillionBot.game) if (next.channel.equals(event.getChannel())) {
        controller = next;
        break;
    }
    if (controller == null) {
        event.reply("This command must be used in a game channel.");
        return;
    }
    for (Player next : controller.players) if (next.uID.equals(event.getAuthor().getId())) {
        player = next;
        break;
    }
    // If they aren't in-game, get their data by generating their player object
    if (player == null) {
        player = new Player(event.getMember(), controller, null);
    }
    // At this point we've found them, so just prompt the reminder method
    player.remindHiddenCommand();
}
Also used : Player(tel.discord.rtab.Player) GameController(tel.discord.rtab.GameController)

Aggregations

Player (tel.discord.rtab.Player)16 GameController (tel.discord.rtab.GameController)4 Game (tel.discord.rtab.board.Game)3 ArrayList (java.util.ArrayList)2 LinkedList (java.util.LinkedList)2 IOException (java.io.IOException)1 Path (java.nio.file.Path)1 Pair (net.dv8tion.jda.internal.utils.tuple.Pair)1