use of com.gamebuster19901.excite.Player in project ExciteBot by TheGameCommunity.
the class BanCommand method banProfileForever.
@SuppressWarnings("rawtypes")
private static int banProfileForever(MessageContext context, Player[] profile, String reason) {
if (profile.length != 1) {
context.sendMessage("Ambigious name, enter a PID or FC");
return 0;
}
if (context.isAdmin()) {
if (profile[0] instanceof UnknownPlayer) {
context.sendMessage("There is no profile known as " + profile);
return 0;
}
Duration duration = ChronoUnit.FOREVER.getDuration();
profile[0].ban(context, duration, parseReason(duration, reason));
} else {
context.sendMessage("You do not have permission to execute this command");
}
return 0;
}
use of com.gamebuster19901.excite.Player in project ExciteBot by TheGameCommunity.
the class DiscordUser method getProfiles.
@SuppressWarnings("rawtypes")
public Set<Player> getProfiles(MessageContext context) {
try {
HashSet<Player> players = new HashSet<Player>();
Result results = Table.selectColumnsFromWhere(ConsoleContext.INSTANCE, PLAYER_ID, PLAYERS, new Comparison(DISCORD_ID, EQUALS, getID()));
while (results.next()) {
players.add(Player.getPlayerByID(context, results.getInt(PLAYER_ID)));
}
return players;
} catch (SQLException e) {
throw new IOError(e);
}
}
use of com.gamebuster19901.excite.Player in project ExciteBot by TheGameCommunity.
the class DiscordUser method notifyDiscordUsers.
public static void notifyDiscordUsers() throws SQLException {
int count = Wiimmfi.getAcknowledgedPlayerCount();
Result result = Table.selectAllFrom(ConsoleContext.INSTANCE, DISCORD_USERS);
while (result.next()) {
int threshold = result.getInt(THRESHOLD);
if (count < threshold) {
new DiscordUser(result).setDippedBelowThreshold(true);
continue;
} else {
if (Instant.parse(result.getString(LAST_NOTIFICATION)).plus(Duration.parse(result.getString(FREQUENCY))).isBefore(Instant.now())) {
if (result.getBoolean(BELOW_THRESHOLD)) {
DiscordUser user = new DiscordUser(result);
if (!result.getBoolean(NOTIFY_CONTINUOUSLY)) {
user.setDippedBelowThreshold(false);
}
if (threshold != -1) {
for (Player player : Wiimmfi.getOnlinePlayers()) {
if (player.getDiscord() == result.getLong(DISCORD_ID)) {
return;
}
}
user.sendMessage("Players Online" + Wiimmfi.getOnlinePlayerList(user.sendDetailedPM()));
user.setLastNotification();
}
}
}
}
}
}
use of com.gamebuster19901.excite.Player in project ExciteBot by TheGameCommunity.
the class Banee method getBanee.
@SuppressWarnings("rawtypes")
public static Banee getBanee(MessageContext context, long id) {
DiscordUser discord = DiscordUser.getDiscordUserIncludingUnknown(context, id);
Player player = Player.getPlayerByID(context, (int) id);
if (!player.isKnown()) {
return discord;
}
return player;
}
use of com.gamebuster19901.excite.Player in project ExciteBot by TheGameCommunity.
the class Banee method getBanee.
@Nullable
@SuppressWarnings({ "rawtypes", "deprecation" })
public static Banee getBanee(MessageContext context, String name) {
DiscordUser[] discords = DiscordUser.getDiscordUsersWithUsername(context, name);
Player[] players = Player.getPlayersByName(context, name);
int amount = discords.length + players.length;
if (amount == 1) {
if (discords.length == 1) {
return discords[0];
}
return players[0];
} else if (amount < 1) {
context.sendMessage("Could not find a discord user or player named " + name);
} else if (amount > 1) {
String ret = name + " is ambiguous, please supply an ID instead.\n\nAmbiguities\n\n:";
if (discords.length > 0) {
ret = ret + "Discord Users:\n";
for (DiscordUser discord : discords) {
ret = ret + discord.toDetailedString();
}
}
if (players.length > 0) {
ret = ret + "Profiles:\n";
for (Player player : players) {
ret = ret + player.toFullString();
}
}
context.sendMessage(ret);
}
return null;
}
Aggregations