use of com.gamebuster19901.excite.bot.audit.ban.Ban in project ExciteBot by TheGameCommunity.
the class Player method ban.
@SuppressWarnings({ "rawtypes" })
public Ban ban(MessageContext context, Duration duration, String reason) {
Ban ban = Ban.addBan(context, this, reason, duration);
DiscordUser discord = DiscordUser.getDiscordUserIncludingUnknown(context, getDiscord());
if (!(discord instanceof UnknownDiscordUser)) {
discord.sendMessage(context, toString() + " " + reason);
}
return ban;
}
use of com.gamebuster19901.excite.bot.audit.ban.Ban in project ExciteBot by TheGameCommunity.
the class PardonCommand method pardon.
@SuppressWarnings("rawtypes")
private static final int pardon(MessageContext context, long baneeOrBanID) {
if (context.isAdmin()) {
Ban ban = Ban.getBanByAuditId(context, baneeOrBanID);
if (ban != null) {
return pardon(context, ban);
}
Banee banee = Banee.getBanee(context, baneeOrBanID);
return pardon(context, banee);
} else {
context.sendMessage("You do not have permission to execute this command");
}
return 1;
}
use of com.gamebuster19901.excite.bot.audit.ban.Ban in project ExciteBot by TheGameCommunity.
the class Ban method addBan.
@SuppressWarnings({ "rawtypes", "deprecation" })
public static Ban addBan(MessageContext context, Banee banee, String reason, Duration banDuration, Instant banExpire, long pardon) {
Audit parent = Audit.addAudit(context, AuditType.BAN, reason);
PreparedStatement st;
context.sendMessage(banee.getClass().getCanonicalName());
try {
st = Insertion.insertInto(AUDIT_BANS).setColumns(AUDIT_ID, BAN_DURATION, BAN_EXPIRE, BANNED_ID, BANNED_USERNAME).to(parent.getID(), banDuration, banExpire, banee.getID(), banee.getName()).prepare(context, true);
st.execute();
Ban ret = getBanByAuditId(context, parent.getID());
ret.parentData = parent;
return ret;
} catch (SQLException e) {
throw new IOError(e);
}
}
use of com.gamebuster19901.excite.bot.audit.ban.Ban in project ExciteBot by TheGameCommunity.
the class Pardon method addPardonByAuditID.
@Nullable
@SuppressWarnings("rawtypes")
public static Pardon addPardonByAuditID(MessageContext context, long id) {
try {
Audit pardoned = Audit.getAuditById(context, id);
if (pardoned == null) {
context.sendMessage("Could not find audit #" + id);
return null;
}
AuditType type = pardoned.getType();
if (type == BAN) {
Ban ban = (Ban) pardoned;
if (ban.isPardoned()) {
context.sendMessage(type + " #" + id + " is already pardoned.");
return null;
}
Audit parent = Audit.addAudit(context, PARDON, context.getAuthor().getIdentifierName() + " pardoned " + ban.getBannedUsername());
PreparedStatement st;
st = Insertion.insertInto(AUDIT_PARDONS).setColumns(AUDIT_ID, PARDONED_AUDIT_ID).to(parent.getID(), pardoned.getID()).prepare(context, true);
st.execute();
Pardon ret = getPardonByAuditID(context, parent.getID());
ret.parentData = parent;
return ret;
} else {
context.sendMessage("Audit #" + id + " is a " + type + ", not a " + BAN);
return null;
}
} catch (SQLException e) {
throw new IOError(e);
}
}
use of com.gamebuster19901.excite.bot.audit.ban.Ban 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;
}
Aggregations