package org.royaldev.thehumanity.commands.impl; import org.jetbrains.annotations.NotNull; import org.kitteh.irc.client.library.element.User; import org.kitteh.irc.client.library.event.channel.ChannelMessageEvent; import org.royaldev.thehumanity.TheHumanity; import org.royaldev.thehumanity.commands.InGameCommand; import org.royaldev.thehumanity.game.TheHumanityGame; import org.royaldev.thehumanity.game.round.CurrentRound; import org.royaldev.thehumanity.player.TheHumanityPlayer; import xyz.cardstock.cardstock.commands.CallInfo; import xyz.cardstock.cardstock.commands.Command; import java.util.List; @Command( name = "skip", description = "Skips a player for the round.", usage = "<command> [player]" ) public class SkipCommand extends InGameCommand { public SkipCommand(final TheHumanity instance) { super(instance); } @Override public void run(@NotNull ChannelMessageEvent event, @NotNull CallInfo callInfo, @NotNull TheHumanityGame game, @NotNull TheHumanityPlayer player, @NotNull List<String> arguments) { final User u = player.getUser(); if (arguments.size() < 1) { u.sendNotice("Usage: " + this.getUsage().replace("<command>", callInfo.getLabel())); return; } final TheHumanityPlayer t = game.getPlayer(arguments.get(0)); if (t == null) { u.sendNotice("That person is not playing in this game."); return; } final CurrentRound r = game.getCurrentRound(); if (r == null) { u.sendNotice("No round to skip in."); return; } if (!u.getNick().equalsIgnoreCase(arguments.get(0)) && !this.isHostOrOp(player, game)) { u.sendNotice("You're not an op, the host, or skipping yourself!"); return; } if (r.isSkipped(t)) { u.sendNotice("That user is already skipped."); return; } u.sendNotice(r.skip(t) ? "User skipped." : "User could not be skipped."); } }