use of com.github.vaerys.masterobjects.GuildObject in project DiscordSailv2 by Vaerys-Dawn.
the class Globals method backupAll.
public static void backupAll() {
if (shuttingDown) {
return;
}
savingFiles = true;
logger.debug("Backing up Files.");
// global files
if (dailyMessages != null)
dailyMessages.backUp();
if (events != null)
events.backUp();
if (globalData != null)
globalData.backUp();
// guild files
for (GuildObject g : guilds) {
for (GuildFile file : g.guildFiles) {
file.backUp();
}
}
savingFiles = false;
}
use of com.github.vaerys.masterobjects.GuildObject in project DiscordSailv2 by Vaerys-Dawn.
the class Globals method unloadGuild.
public static void unloadGuild(long id) {
ListIterator iterator = guilds.listIterator();
while (iterator.hasNext()) {
GuildObject guild = (GuildObject) iterator.next();
if (guild.longID == id) {
logger.info("Guild: " + guild.get().getName() + " unloaded.");
iterator.remove();
}
}
}
use of com.github.vaerys.masterobjects.GuildObject in project DiscordSailv2 by Vaerys-Dawn.
the class Globals method saveFiles.
public static void saveFiles(boolean shuttingDown) {
if (shuttingDown)
Globals.shuttingDown = true;
else if (Globals.shuttingDown || Globals.savingFiles)
return;
savingFiles = true;
logger.debug("Saving Files.");
// global files
if (dailyMessages != null)
dailyMessages.flushFile();
if (events != null)
events.flushFile();
if (globalData != null)
globalData.flushFile();
// guild files
for (GuildObject g : guilds) {
for (GuildFile file : g.guildFiles) {
file.flushFile();
}
}
savingFiles = false;
}
use of com.github.vaerys.masterobjects.GuildObject in project DiscordSailv2 by Vaerys-Dawn.
the class Globals method initGuild.
public static void initGuild(GuildObject guild) {
for (GuildObject g : guilds) {
if (g.longID == guild.longID) {
return;
}
}
guild.config.updateVariables(guild.get());
guilds.add(guild);
}
use of com.github.vaerys.masterobjects.GuildObject in project DiscordSailv2 by Vaerys-Dawn.
the class Utility method sendGlobalAdminLogging.
public static void sendGlobalAdminLogging(Command command, String args, CommandObject commandObject) {
for (GuildObject c : Globals.getGuilds()) {
StringHandler message = new StringHandler("***GLOBAL LOGGING***\n> **@").append(commandObject.user.username).append("** Has Used Command `").append(command.names[0]).append("`");
List<IChannel> adminlog = c.getChannelsByType(ChannelSetting.ADMIN_LOG);
List<IChannel> serverLog = c.getChannelsByType(ChannelSetting.SERVER_LOG);
IChannel channel = null;
if (!(args == null || args.isEmpty())) {
message.append(" with args: `" + args + "`");
}
if (serverLog.size() != 0) {
channel = serverLog.get(0);
}
if (adminlog.size() != 0) {
channel = adminlog.get(0);
}
if (channel != null) {
RequestHandler.sendMessage(message.toString(), channel);
}
}
}
Aggregations