use of com.github.vaerys.commands.creator.Restart in project DiscordSailv2 by Vaerys-Dawn.
the class CreatorHandler method restart.
@EventSubscriber
public void restart(MessageReceivedEvent event) {
CommandObject command = new CommandObject(event.getMessage());
Restart restart = new Restart();
if (restart.isCall(event.getMessage().getContent(), command)) {
List<Long> auth = new LinkedList<>();
try {
List<String> toParse = FileHandler.readFromFile(Constants.FILE_AUTH_TO_RESTART);
auth.addAll(toParse.stream().map(Long::parseUnsignedLong).collect(Collectors.toList()));
} catch (NumberFormatException e) {
// do nothing
}
auth.add(Globals.creatorID);
if (auth.contains(event.getAuthor().getLongID())) {
restart.execute("", command);
return;
}
}
}
Aggregations