use of com.gamebuster19901.excite.bot.audit.Audit in project ExciteBot by TheGameCommunity.
the class DiscoveryAudit method addProfileDiscovery.
@SuppressWarnings("rawtypes")
public static DiscoveryAudit addProfileDiscovery(MessageContext context, boolean automatic, Player player) {
Audit parent = Audit.addAudit(context, AuditType.DISCOVERY_AUDIT, getMessage(context, automatic, player));
PreparedStatement st;
try {
st = Insertion.insertInto(Table.AUDIT_PROFILE_DISCOVERIES).setColumns(AUDIT_ID, PLAYER_ID).to(parent.getID(), player.getID()).prepare(context, true);
st.execute();
DiscoveryAudit ret = getProfileDiscoveryByDiscoveredID(ConsoleContext.INSTANCE, player.getID());
ret.parentData = parent;
return ret;
} catch (SQLException e) {
throw new IOError(e);
}
}
use of com.gamebuster19901.excite.bot.audit.Audit in project ExciteBot by TheGameCommunity.
the class MailAudit method addMailAudit.
@SuppressWarnings("rawtypes")
public static MailAudit addMailAudit(MessageContext context, MimeMessage message, boolean incoming, File file) throws AddressException, MessagingException {
ElectronicAddress from = new EmailAddress(message.getFrom()[0]);
ElectronicAddress to = new EmailAddress(new InternetAddress(message.getHeader("To")[0]));
String description = from.getEmail() + " sent mail to " + to.getEmail();
String[] appIDHeader = message.getHeader(Mailbox.APP_ID_HEADER);
String mailType = "GENERIC";
if (appIDHeader != null) {
switch(appIDHeader[0]) {
case Mailbox.FRIEND_REQUEST:
description = from + " sent a friend request to " + to;
mailType = "FRIEND_REQUEST";
break;
case Mailbox.EXCITEBOTS:
description = from + " sent a challenge to " + to;
mailType = "CHALLENGE";
break;
}
}
Audit parent = Audit.addAudit(context, AuditType.MAIL_AUDIT, description);
PreparedStatement st;
try {
st = Insertion.insertInto(Table.MAIL).setColumns(AUDIT_ID, SENDER, RECIPIENT, INCOMING, MAIL_TYPE, FILE).to(parent.getID(), from.getEmail(), to.getEmail(), incoming, mailType, file.getAbsolutePath()).prepare(context, true);
st.execute();
MailAudit ret = getMailAuditByAuditID(ConsoleContext.INSTANCE, parent.getID());
ret.parentData = parent;
return ret;
} catch (SQLException e) {
throw new IOError(e);
}
}
use of com.gamebuster19901.excite.bot.audit.Audit in project ExciteBot by TheGameCommunity.
the class NameChangeAudit method addNameChange.
@SuppressWarnings("rawtypes")
public static NameChangeAudit addNameChange(MessageContext context, Player player, String newName) {
Audit parent = Audit.addAudit(ConsoleContext.INSTANCE, context, AuditType.NAME_CHANGE_AUDIT, getMessage(context, newName));
String name = player.getName();
PreparedStatement st;
try {
st = Insertion.insertInto(Table.AUDIT_NAME_CHANGES).setColumns(AUDIT_ID, OLD_PLAYER_NAME, NEW_PLAYER_NAME, PLAYER_ID, FRIEND_CODE).to(parent.getID(), name, newName, player.getID(), player.getFriendCode()).prepare(ConsoleContext.INSTANCE, true);
st.execute();
NameChangeAudit ret = getNameChangeByAuditID(ConsoleContext.INSTANCE, parent.getID());
ret.parentData = parent;
return ret;
} catch (SQLException e) {
throw new IOError(e);
}
}
use of com.gamebuster19901.excite.bot.audit.Audit in project ExciteBot by TheGameCommunity.
the class RankChangeAudit method addRankChange.
@SuppressWarnings({ "rawtypes", "unchecked" })
public static RankChangeAudit addRankChange(MessageContext context, DiscordUser promotee, String rank, boolean added) {
Audit parent = Audit.addAudit(ConsoleContext.INSTANCE, context, AuditType.RANK_CHANGE_AUDIT, getMessage(context, new MessageContext(promotee), rank, added));
PreparedStatement st;
try {
st = Insertion.insertInto(AUDIT_RANK_CHANGES).setColumns(AUDIT_ID, PROMOTEE, PROMOTEE_ID).to(parent.getID(), promotee, promotee.getID()).prepare(ConsoleContext.INSTANCE, true);
st.execute();
RankChangeAudit ret = getRankChangeAuditByID(ConsoleContext.INSTANCE, parent.getID());
ret.parentData = parent;
return ret;
} catch (SQLException e) {
throw new IOError(e);
}
}
use of com.gamebuster19901.excite.bot.audit.Audit in project ExciteBot by TheGameCommunity.
the class TransactionAudit method addTransactionAudit.
public static TransactionAudit addTransactionAudit(MessageContext context, Transaction transaction) {
Audit parent = Audit.addAudit(context, AuditType.TRANSACTION_AUDIT, getMessage(context, transaction));
PreparedStatement st;
try {
st = Insertion.insertInto(AUDIT_TRANSACTIONS).setColumns(AUDIT_ID, RECIPIENT, TRANSACTION_TYPE, AMOUNT, CURRENCY, WALLET).to(parent.getID(), transaction.getBalanceHolder(), transaction.getTransactionType(), transaction.getAmount(), transaction.getCurrency(), transaction.getWallet()).prepare(context, true);
st.execute();
TransactionAudit ret = getTransactionAuditByAuditID(ConsoleContext.INSTANCE, parent.getID());
ret.parentData = parent;
return ret;
} catch (SQLException e) {
throw new IOError(e);
}
}
Aggregations