use of gg.projecteden.nexus.framework.exceptions.postconfigured.PlayerNotFoundException in project Nexus by ProjectEdenGG.
the class AltBanCommand method bots.
@Permission(Group.ADMIN)
@Path("bots <names> [--dryrun]")
void bots(@Arg(type = String.class) List<String> names, @Switch boolean dryrun) {
int banned = 0;
int ignored = 0;
for (String name : names) {
try {
Nerd nerd = Nerd.of(name);
if (!nerd.getPastNames().contains(name))
throw new PlayerNotFoundException(name);
++banned;
if (dryrun)
send("Banning " + name);
else
Punishments.of(nerd).add(Punishment.ofType(PunishmentType.ALT_BAN).punisher(uuid()).input("Spam bot").now(true));
} catch (PlayerNotFoundException ex) {
send("Ignoring " + name);
++ignored;
} catch (Exception ex) {
ex.printStackTrace();
}
}
send("Banned " + banned + ", ignored " + ignored);
}
use of gg.projecteden.nexus.framework.exceptions.postconfigured.PlayerNotFoundException in project Nexus by ProjectEdenGG.
the class HallOfHistoryCommand method create.
@Permission(Group.STAFF)
@Path("create <player>")
void create(@Arg(tabCompleter = Nerd.class) String player) {
runCommand("blockcenter");
String name;
String skin;
try {
Nerd nerd = Nerd.of(convertToOfflinePlayer(player));
name = nerd.getColoredName();
skin = nerd.getName();
} catch (PlayerNotFoundException e) {
// probably a veteran
name = Rank.VETERAN.colored().getHex() + player;
skin = player;
}
// is there a better workaround for this? :P
final String name1 = name;
final String skin1 = skin;
Tasks.wait(5, () -> runCommand("npc create " + name1));
Tasks.wait(10, () -> runCommand("npc skin " + skin1));
}
Aggregations