Add more logging

This commit is contained in:
Ghoti 2021-06-22 09:16:29 -05:00
parent b8f29984a6
commit 7a2d31233a
18 changed files with 549 additions and 477 deletions

View File

@ -67,6 +67,11 @@
</plugins> </plugins>
</build> </build>
<repositories> <repositories>
<repository>
<id>dv8tion</id>
<name>m2-dv8tion</name>
<url>https://m2.dv8tion.net/releases</url>
</repository>
<repository> <repository>
<id>spigot-repo</id> <id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url> <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
@ -84,13 +89,6 @@
<name>jcenter-bintray</name> <name>jcenter-bintray</name>
<url>https://jcenter.bintray.com</url> <url>https://jcenter.bintray.com</url>
</repository> </repository>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>soluvas-public-thirdparty</id>
<url>http://nexus.bippo.co.id/nexus/content/repositories/soluvas-public-thirdparty/</url>
</repository>
<repository> <repository>
<id>jitpack.io</id> <id>jitpack.io</id>
<url>https://jitpack.io</url> <url>https://jitpack.io</url>

16
pom.xml
View File

@ -75,6 +75,11 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties> </properties>
<repositories> <repositories>
<repository>
<id>dv8tion</id>
<name>m2-dv8tion</name>
<url>https://m2.dv8tion.net/releases</url>
</repository>
<repository> <repository>
<id>spigot-repo</id> <id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url> <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
@ -92,13 +97,6 @@
<name>jcenter-bintray</name> <name>jcenter-bintray</name>
<url>https://jcenter.bintray.com</url> <url>https://jcenter.bintray.com</url>
</repository> </repository>
<repository>
<id>soluvas-public-thirdparty</id>
<url>http://nexus.bippo.co.id/nexus/content/repositories/soluvas-public-thirdparty/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository> <repository>
<id>jitpack.io</id> <id>jitpack.io</id>
<url>https://jitpack.io</url> <url>https://jitpack.io</url>
@ -159,7 +157,7 @@
<dependency> <dependency>
<groupId>net.dv8tion</groupId> <groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId> <artifactId>JDA</artifactId>
<version>4.2.0_225</version> <version>4.3.0_281</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.github.cage</groupId> <groupId>com.github.cage</groupId>
@ -179,7 +177,7 @@
<dependency> <dependency>
<groupId>com.sedmelluq</groupId> <groupId>com.sedmelluq</groupId>
<artifactId>lavaplayer</artifactId> <artifactId>lavaplayer</artifactId>
<version>1.3.66</version> <version>1.3.77</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.pf4j</groupId> <groupId>org.pf4j</groupId>

View File

@ -60,6 +60,8 @@ import com.fpghoti.biscuit.listener.LeaveListener;
import com.fpghoti.biscuit.listener.MessageDeleteListener; import com.fpghoti.biscuit.listener.MessageDeleteListener;
import com.fpghoti.biscuit.listener.MessageEditListener; import com.fpghoti.biscuit.listener.MessageEditListener;
import com.fpghoti.biscuit.listener.MessageReceiveListener; import com.fpghoti.biscuit.listener.MessageReceiveListener;
import com.fpghoti.biscuit.listener.NameListener;
import com.fpghoti.biscuit.listener.NicknameListener;
import com.fpghoti.biscuit.listener.ReactionListener; import com.fpghoti.biscuit.listener.ReactionListener;
import com.fpghoti.biscuit.listener.RoleListener; import com.fpghoti.biscuit.listener.RoleListener;
import com.fpghoti.biscuit.logging.BColor; import com.fpghoti.biscuit.logging.BColor;
@ -139,6 +141,8 @@ public class Main {
jda.addEventListener(new DMListener()); jda.addEventListener(new DMListener());
jda.addEventListener(new ReactionListener()); jda.addEventListener(new ReactionListener());
jda.addEventListener(new RoleListener()); jda.addEventListener(new RoleListener());
jda.addEventListener(new NicknameListener());
jda.addEventListener(new NameListener());
biscuits = new ArrayList<Biscuit>(); biscuits = new ArrayList<Biscuit>();
for(Guild g : jda.getGuilds()) { for(Guild g : jda.getGuilds()) {
Biscuit.loadGuild(g); Biscuit.loadGuild(g);

View File

@ -227,15 +227,15 @@ public class Biscuit {
public ArrayList<TextChannel> getCaptchaLogChannels() { public ArrayList<TextChannel> getCaptchaLogChannels() {
ArrayList<TextChannel> ch = new ArrayList<TextChannel>(); ArrayList<TextChannel> ch = new ArrayList<TextChannel>();
for(TextChannel t : guild.getTextChannels()) { for(TextChannel t : guild.getTextChannels()) {
if(t.getName().equalsIgnoreCase(properties.getCaptchaLogChannel())) { if(t.getName().equalsIgnoreCase(properties.getEventLogChannel())) {
ch.add(t); ch.add(t);
} }
} }
return ch; return ch;
} }
public void captchaLog(String msg) { public void eventLog(String msg) {
if(properties.logCaptcha()) { if(properties.logEvents()) {
for(TextChannel t : getCaptchaLogChannels()) { for(TextChannel t : getCaptchaLogChannels()) {
MessageText.send(t, msg); MessageText.send(t, msg);
} }

View File

@ -197,7 +197,7 @@ public class Captcha {
token = null; token = null;
log(BColor.YELLOW_BOLD + author.getName() + " successfully completed a captcha challenge. Granting role."); log(BColor.YELLOW_BOLD + author.getName() + " successfully completed a captcha challenge. Granting role.");
biscuit.captchaLog(" ``" + author.getName() +"`` " + author.getAsMention() + " successfully completed a captcha challenge. Granting role."); biscuit.eventLog(" ``" + author.getName() +"`` " + author.getAsMention() + " successfully completed a captcha challenge. Granting role.");
} }
} }

View File

@ -1,5 +1,6 @@
package com.fpghoti.biscuit.commands.base; package com.fpghoti.biscuit.commands.base;
import com.fpghoti.biscuit.Main;
import com.fpghoti.biscuit.biscuit.Biscuit; import com.fpghoti.biscuit.biscuit.Biscuit;
import com.fpghoti.biscuit.commands.BaseCommand; import com.fpghoti.biscuit.commands.BaseCommand;
import com.fpghoti.biscuit.commands.CommandType; import com.fpghoti.biscuit.commands.CommandType;
@ -33,9 +34,12 @@ public class CustomCommand extends BaseCommand {
@Override @Override
public String getDescription() { public String getDescription() {
String desc = biscuit.getConfig().getFromConfig("cc-" + name + "-description", biscuit); String desc = biscuit.getConfig().getFromConfig("cc-" + name + "-description");
if(desc == null) { if(desc == null) {
return "null"; desc = Main.getMainBiscuit().getConfig().getFromConfig("cc-" + name + "-description");
if(desc == null) {
return "null";
}
} }
return desc; return desc;
} }
@ -46,9 +50,12 @@ public class CustomCommand extends BaseCommand {
} }
public String getMessage() { public String getMessage() {
String msg = biscuit.getConfig().getFromConfig("cc-" + name + "-message", biscuit); String msg = biscuit.getConfig().getFromConfig("cc-" + name + "-message");
if(msg == null) { if(msg == null) {
return "null"; msg = Main.getMainBiscuit().getConfig().getFromConfig("cc-" + name + "-message");
if(msg == null) {
return "null";
}
} }
return msg; return msg;
} }

View File

@ -61,30 +61,30 @@ public class BiscuitConfig {
} }
@Async @Async
public void replaceConfig(Attachment a, TextChannel c) { public void replaceConfig(Attachment a, TextChannel c) {
Guild guild = biscuit.getGuild(); Guild guild = biscuit.getGuild();
String code = getFromConfig("Guild-Code", biscuit); String code = getFromConfig("Guild-Code");
if(guild == null) { if(guild == null) {
biscuit.error("Main config replacement is currently not allowed."); biscuit.error("Main config replacement is currently not allowed.");
return; return;
} }
String name = guild.getId() + ".properties"; String name = guild.getId() + ".properties";
if(a.getSize() > 51200) { if(a.getSize() > 51200) {
MessageText.send(c, "**The file is too big!**"); MessageText.send(c, "**The file is too big!**");
return; return;
} }
File config = new File(biscuit.getConfigDir(), name); File config = new File(biscuit.getConfigDir(), name);
a.downloadToFile(config).thenAccept(file -> { a.downloadToFile(config).thenAccept(file -> {
updateConfig(file, true, code); updateConfig(file, true, code);
MessageText.send(c, "**The config was successfully updated.**"); MessageText.send(c, "**The config was successfully updated.**");
}).exceptionally(t -> { }).exceptionally(t -> {
biscuit.error("Could not accept config file."); biscuit.error("Could not accept config file.");
MessageText.send(c, "**An Exception occurred while trying to read the file.**"); MessageText.send(c, "**An Exception occurred while trying to read the file.**");
return null; return null;
}); });
return; return;
} }
public void updateConfig(File config) { public void updateConfig(File config) {
updateConfig(config, false); updateConfig(config, false);
@ -172,8 +172,8 @@ public class BiscuitConfig {
added = addProperty("Toggle-Role-React-Channels", "toggleroles1,toggleroles2,toggleroles3", prop, added, silent); added = addProperty("Toggle-Role-React-Channels", "toggleroles1,toggleroles2,toggleroles3", prop, added, silent);
added = addProperty("Boost-Exclusive-Roles", "role2,role3", prop, added, silent); added = addProperty("Boost-Exclusive-Roles", "role2,role3", prop, added, silent);
added = addProperty("Treat-Like-Booster", "Nitro Booster,silver,gold", prop, added, silent); added = addProperty("Treat-Like-Booster", "Nitro Booster,silver,gold", prop, added, silent);
added = addProperty("LogCaptcha", "false", prop, added, silent); added = addProperty("LogEvents", "false", prop, added, silent);
added = addProperty("Captcha-Log-Channel", "verify-log", prop, added, silent); added = addProperty("Event-Log-Channel", "verify-log", prop, added, silent);
added = addProperty("Check-Join-Invite", "false", prop, added, silent); added = addProperty("Check-Join-Invite", "false", prop, added, silent);
added = addProperty("Custom-Command-Names", "", prop, added, silent); added = addProperty("Custom-Command-Names", "", prop, added, silent);
added = addProperty("DM-Before-Kick", "true", prop, added, silent); added = addProperty("DM-Before-Kick", "true", prop, added, silent);
@ -206,44 +206,44 @@ public class BiscuitConfig {
return added; return added;
} }
public String getFromConfig(String property, Biscuit biscuit){ public String getFromConfig(String property){
boolean isMain = biscuit.getGuild() == null; boolean isMain = biscuit.getGuild() == null;
String setting = ""; String setting = "";
Properties prop = new Properties(); Properties prop = new Properties();
InputStream input = null; InputStream input = null;
String name = "config.properties"; String name = "config.properties";
if(!isMain) { if(!isMain) {
name = biscuit.getGuild().getId() + ".properties"; name = biscuit.getGuild().getId() + ".properties";
} }
File config = new File(biscuit.getConfigDir(), name); File config = new File(biscuit.getConfigDir(), name);
if(!config.exists()) { if(!config.exists()) {
return ""; return "";
} }
try { try {
input = new FileInputStream(config); input = new FileInputStream(config);
prop.load(input); prop.load(input);
setting = prop.getProperty(property); setting = prop.getProperty(property);
} catch (IOException ex) { } catch (IOException ex) {
ex.printStackTrace(); ex.printStackTrace();
} finally { } finally {
if (input != null) { if (input != null) {
try { try {
input.close(); input.close();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
} }
return setting; return setting;
} }
public File getFile() { public File getFile() {
if(biscuit.getGuild() == null) { if(biscuit.getGuild() == null) {

View File

@ -6,378 +6,378 @@ import com.fpghoti.biscuit.util.Util;
public class BiscuitProperties { public class BiscuitProperties {
Biscuit biscuit; Biscuit biscuit;
public BiscuitProperties(Biscuit b) { public BiscuitProperties(Biscuit b) {
this.biscuit = b; this.biscuit = b;
} }
public String getToken(){ public String getToken(){
String key = "Bot-Token"; String key = "Bot-Token";
return Main.getMainBiscuit().getConfig().getFromConfig(key, Main.getMainBiscuit()); return Main.getMainBiscuit().getConfig().getFromConfig(key);
} }
public String getCommandSignifier(){ public String getCommandSignifier(){
String key = "Command-Signifier"; String key = "Command-Signifier";
return Main.getMainBiscuit().getConfig().getFromConfig(key, Main.getMainBiscuit()); return Main.getMainBiscuit().getConfig().getFromConfig(key);
} }
public boolean musicBotEnabled(){ public boolean musicBotEnabled(){
String key = "Enable-Music-Bot"; String key = "Enable-Music-Bot";
return Main.getMainBiscuit().getConfig().getFromConfig(key, Main.getMainBiscuit()).equalsIgnoreCase("true"); return Main.getMainBiscuit().getConfig().getFromConfig(key).equalsIgnoreCase("true");
} }
public boolean logMusicPlayer(){ public boolean logMusicPlayer(){
String key = "Log-Music-Player"; String key = "Log-Music-Player";
return Main.getMainBiscuit().getConfig().getFromConfig(key, Main.getMainBiscuit()).equalsIgnoreCase("true"); return Main.getMainBiscuit().getConfig().getFromConfig(key).equalsIgnoreCase("true");
} }
public boolean allowMusicBot(){ public boolean allowMusicBot(){
if(!musicBotEnabled()) { if(!musicBotEnabled()) {
return false; return false;
} }
String key = "Allow-Music-Bot"; String key = "Allow-Music-Bot";
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) { if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
return Main.getMainBiscuit().getProperties().allowMusicBot(); return Main.getMainBiscuit().getProperties().allowMusicBot();
} }
String value = biscuit.getConfig().getFromConfig(key, biscuit); String value = biscuit.getConfig().getFromConfig(key);
return value.equalsIgnoreCase("true"); return value.equalsIgnoreCase("true");
} }
public String getGuildCode(){ public String getGuildCode(){
String key = "Guild-Code"; String key = "Guild-Code";
if(biscuit.getGuild() == null) { if(biscuit.getGuild() == null) {
return "MAIN"; return "MAIN";
} }
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) { if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
return biscuit.getConfig().makeCode(biscuit.getGuild().getName()); return biscuit.getConfig().makeCode(biscuit.getGuild().getName());
} }
return biscuit.getConfig().getFromConfig(key, biscuit); return biscuit.getConfig().getFromConfig(key);
} }
public String getDoneEmote(){ public String getDoneEmote(){
String key = "Done-Emote"; String key = "Done-Emote";
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) { if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
return Main.getMainBiscuit().getProperties().getDoneEmote(); return Main.getMainBiscuit().getProperties().getDoneEmote();
} }
return biscuit.getConfig().getFromConfig(key, biscuit); return biscuit.getConfig().getFromConfig(key);
} }
public String getMusicControllerRole(){ public String getMusicControllerRole(){
String key = "Music-Controller-Role"; String key = "Music-Controller-Role";
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) { if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
return Main.getMainBiscuit().getProperties().getMusicControllerRole(); return Main.getMainBiscuit().getProperties().getMusicControllerRole();
} }
return biscuit.getConfig().getFromConfig(key, biscuit); return biscuit.getConfig().getFromConfig(key);
} }
public String getKickDMInvite(){ public String getKickDMInvite(){
String key = "Kick-DM-Invite"; String key = "Kick-DM-Invite";
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) { if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
return Main.getMainBiscuit().getProperties().getKickDMInvite(); return Main.getMainBiscuit().getProperties().getKickDMInvite();
} }
return biscuit.getConfig().getFromConfig(key, biscuit); return biscuit.getConfig().getFromConfig(key);
} }
public boolean captchaEnabled(){ public boolean captchaEnabled(){
String key = "Captcha"; String key = "Captcha";
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) { if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
return Main.getMainBiscuit().getProperties().captchaEnabled(); return Main.getMainBiscuit().getProperties().captchaEnabled();
} }
String value = biscuit.getConfig().getFromConfig(key, biscuit); String value = biscuit.getConfig().getFromConfig(key);
return value.equalsIgnoreCase("true"); return value.equalsIgnoreCase("true");
} }
public boolean customDefaultRole(){ public boolean customDefaultRole(){
String key = "UseCustomDefaultRole"; String key = "UseCustomDefaultRole";
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) { if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
return Main.getMainBiscuit().getProperties().customDefaultRole(); return Main.getMainBiscuit().getProperties().customDefaultRole();
} }
String value = biscuit.getConfig().getFromConfig(key, biscuit); String value = biscuit.getConfig().getFromConfig(key);
return value.equalsIgnoreCase("true"); return value.equalsIgnoreCase("true");
} }
public boolean dmBeforeKick(){ public boolean dmBeforeKick(){
String key = "DM-Before-Kick"; String key = "DM-Before-Kick";
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) { if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
return Main.getMainBiscuit().getProperties().dmBeforeKick(); return Main.getMainBiscuit().getProperties().dmBeforeKick();
} }
String value = biscuit.getConfig().getFromConfig(key, biscuit); String value = biscuit.getConfig().getFromConfig(key);
return value.equalsIgnoreCase("true"); return value.equalsIgnoreCase("true");
} }
public String getCaptchaReward(){ public String getCaptchaReward(){
String key = "Captcha-Reward-Role"; String key = "Captcha-Reward-Role";
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) { if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
return Main.getMainBiscuit().getProperties().getCaptchaReward(); return Main.getMainBiscuit().getProperties().getCaptchaReward();
} }
return biscuit.getConfig().getFromConfig(key, biscuit); return biscuit.getConfig().getFromConfig(key);
} }
public String getDefaultRole(){ public String getDefaultRole(){
String key = "DefaultRoleName"; String key = "DefaultRoleName";
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) { if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
return Main.getMainBiscuit().getProperties().getDefaultRole(); return Main.getMainBiscuit().getProperties().getDefaultRole();
} }
return biscuit.getConfig().getFromConfig(key, biscuit); return biscuit.getConfig().getFromConfig(key);
} }
public String getModRole(){ public String getModRole(){
String key = "ModRole"; String key = "ModRole";
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) { if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
return Main.getMainBiscuit().getProperties().getModRole(); return Main.getMainBiscuit().getProperties().getModRole();
} }
return biscuit.getConfig().getFromConfig(key, biscuit); return biscuit.getConfig().getFromConfig(key);
} }
public String getAdminRole(){ public String getAdminRole(){
String key = "AdminRole"; String key = "AdminRole";
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) { if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
return Main.getMainBiscuit().getProperties().getAdminRole(); return Main.getMainBiscuit().getProperties().getAdminRole();
} }
return biscuit.getConfig().getFromConfig(key, biscuit); return biscuit.getConfig().getFromConfig(key);
} }
public String getCaptchaLogChannel(){ public String getEventLogChannel(){
String key = "Captcha-Log-Channel"; String key = "Event-Log-Channel";
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) { if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
return Main.getMainBiscuit().getProperties().getCaptchaLogChannel(); return Main.getMainBiscuit().getProperties().getEventLogChannel();
} }
return biscuit.getConfig().getFromConfig(key, biscuit); return biscuit.getConfig().getFromConfig(key);
} }
public boolean logCaptcha(){ public boolean logEvents(){
String key = "LogCaptcha"; String key = "LogEvents";
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) { if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
return Main.getMainBiscuit().getProperties().logCaptcha(); return Main.getMainBiscuit().getProperties().logEvents();
} }
String value = biscuit.getConfig().getFromConfig(key, biscuit); String value = biscuit.getConfig().getFromConfig(key);
return value.equalsIgnoreCase("true"); return value.equalsIgnoreCase("true");
} }
public boolean spamPunishAllow(){ public boolean spamPunishAllow(){
String key = "AllowSpamPunish"; String key = "AllowSpamPunish";
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) { if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
return Main.getMainBiscuit().getProperties().spamPunishAllow(); return Main.getMainBiscuit().getProperties().spamPunishAllow();
} }
String value = biscuit.getConfig().getFromConfig(key, biscuit); String value = biscuit.getConfig().getFromConfig(key);
return value.equalsIgnoreCase("true"); return value.equalsIgnoreCase("true");
} }
public boolean checkJoinInvite(){ public boolean checkJoinInvite(){
String key = "Check-Join-Invite"; String key = "Check-Join-Invite";
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) { if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
return Main.getMainBiscuit().getProperties().checkJoinInvite(); return Main.getMainBiscuit().getProperties().checkJoinInvite();
} }
String value = biscuit.getConfig().getFromConfig(key, biscuit); String value = biscuit.getConfig().getFromConfig(key);
return value.equalsIgnoreCase("true"); return value.equalsIgnoreCase("true");
} }
public boolean noCaptchaKick(){ public boolean noCaptchaKick(){
String key = "No-Captcha-Kick"; String key = "No-Captcha-Kick";
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) { if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
return Main.getMainBiscuit().getProperties().noCaptchaKick(); return Main.getMainBiscuit().getProperties().noCaptchaKick();
} }
String value = biscuit.getConfig().getFromConfig(key, biscuit); String value = biscuit.getConfig().getFromConfig(key);
return value.equalsIgnoreCase("true"); return value.equalsIgnoreCase("true");
} }
public Integer noCaptchaKickTime(){ public Integer noCaptchaKickTime(){
String key = "No-Captcha-Kick-Time"; String key = "No-Captcha-Kick-Time";
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) { if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
return Main.getMainBiscuit().getProperties().noCaptchaKickTime(); return Main.getMainBiscuit().getProperties().noCaptchaKickTime();
} }
String value = biscuit.getConfig().getFromConfig(key, biscuit); String value = biscuit.getConfig().getFromConfig(key);
if(!Util.isDigit(value)) { if(!Util.isDigit(value)) {
return 0; return 0;
} }
return Integer.parseInt(value); return Integer.parseInt(value);
} }
public boolean logChat(){ public boolean logChat(){
String key = "ChatLog"; String key = "ChatLog";
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) { if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
return Main.getMainBiscuit().getProperties().logChat(); return Main.getMainBiscuit().getProperties().logChat();
} }
String value = biscuit.getConfig().getFromConfig(key, biscuit); String value = biscuit.getConfig().getFromConfig(key);
return value.equalsIgnoreCase("true"); return value.equalsIgnoreCase("true");
} }
public String[] getNaughtyWords(){ public String[] getNaughtyWords(){
String key = "NaughtyList"; String key = "NaughtyList";
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) { if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
return Main.getMainBiscuit().getProperties().getNaughtyWords(); return Main.getMainBiscuit().getProperties().getNaughtyWords();
} }
String [] list = biscuit.getConfig().getFromConfig(key, biscuit).replace(" ", "").split(","); String [] list = biscuit.getConfig().getFromConfig(key).replace(" ", "").split(",");
if(list.length == 1 && list[0].equals("")) { if(list.length == 1 && list[0].equals("")) {
String[] blank = {}; String[] blank = {};
return blank; return blank;
} }
return list; return list;
} }
public boolean restrictCmdChannels(){ public boolean restrictCmdChannels(){
String key = "Restrict-Cmd-Channels"; String key = "Restrict-Cmd-Channels";
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) { if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
return Main.getMainBiscuit().getProperties().restrictCmdChannels(); return Main.getMainBiscuit().getProperties().restrictCmdChannels();
} }
String value = biscuit.getConfig().getFromConfig(key, biscuit); String value = biscuit.getConfig().getFromConfig(key);
return value.equalsIgnoreCase("true"); return value.equalsIgnoreCase("true");
} }
public String[] getCmdChannels(){ public String[] getCmdChannels(){
String key = "CmdChannels"; String key = "CmdChannels";
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) { if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
return Main.getMainBiscuit().getProperties().getCmdChannels(); return Main.getMainBiscuit().getProperties().getCmdChannels();
} }
String [] list = biscuit.getConfig().getFromConfig(key, biscuit).replace(" ", "").split(","); String [] list = biscuit.getConfig().getFromConfig(key).replace(" ", "").split(",");
if(list.length == 1 && list[0].equals("")) { if(list.length == 1 && list[0].equals("")) {
String[] blank = {}; String[] blank = {};
return blank; return blank;
} }
return list; return list;
} }
public String[] getDontLogChannels(){ public String[] getDontLogChannels(){
String key = "Channels-To-Not-Chatlog"; String key = "Channels-To-Not-Chatlog";
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) { if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
return Main.getMainBiscuit().getProperties().getCmdChannels(); return Main.getMainBiscuit().getProperties().getCmdChannels();
} }
String [] list = biscuit.getConfig().getFromConfig(key, biscuit).replace(" ", "").split(","); String [] list = biscuit.getConfig().getFromConfig(key).replace(" ", "").split(",");
if(list.length == 1 && list[0].equals("")) { if(list.length == 1 && list[0].equals("")) {
String[] blank = {}; String[] blank = {};
return blank; return blank;
} }
return list; return list;
} }
public String[] getToggleRoles(){ public String[] getToggleRoles(){
String key = "ToggleRoles"; String key = "ToggleRoles";
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) { if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
return Main.getMainBiscuit().getProperties().getToggleRoles(); return Main.getMainBiscuit().getProperties().getToggleRoles();
} }
String [] list = biscuit.getConfig().getFromConfig(key, biscuit).replace(" , ", ",").replace(", ", ",").split(","); String [] list = biscuit.getConfig().getFromConfig(key).replace(" , ", ",").replace(", ", ",").split(",");
if(list.length == 1 && list[0].equals("")) { if(list.length == 1 && list[0].equals("")) {
String[] blank = {}; String[] blank = {};
return blank; return blank;
} }
return list; return list;
} }
public String[] getBoostExclusiveRoles(){ public String[] getBoostExclusiveRoles(){
String key = "Boost-Exclusive-Roles"; String key = "Boost-Exclusive-Roles";
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) { if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
return Main.getMainBiscuit().getProperties().getBoostExclusiveRoles(); return Main.getMainBiscuit().getProperties().getBoostExclusiveRoles();
} }
String [] list = biscuit.getConfig().getFromConfig(key, biscuit).replace(" , ", ",").replace(", ", ",").split(","); String [] list = biscuit.getConfig().getFromConfig(key).replace(" , ", ",").replace(", ", ",").split(",");
if(list.length == 1 && list[0].equals("")) { if(list.length == 1 && list[0].equals("")) {
String[] blank = {}; String[] blank = {};
return blank; return blank;
} }
return list; return list;
} }
public String[] getBoosterRoles(){ public String[] getBoosterRoles(){
String key = "Treat-Like-Booster"; String key = "Treat-Like-Booster";
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) { if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
return Main.getMainBiscuit().getProperties().getBoosterRoles(); return Main.getMainBiscuit().getProperties().getBoosterRoles();
} }
String [] list = biscuit.getConfig().getFromConfig(key, biscuit).replace(" , ", ",").replace(", ", ",").split(","); String [] list = biscuit.getConfig().getFromConfig(key).replace(" , ", ",").replace(", ", ",").split(",");
if(list.length == 1 && list[0].equals("")) { if(list.length == 1 && list[0].equals("")) {
String[] blank = {}; String[] blank = {};
return blank; return blank;
} }
return list; return list;
} }
public String[] getMusicChannels(){ public String[] getMusicChannels(){
String key = "Music-Channels"; String key = "Music-Channels";
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) { if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
return Main.getMainBiscuit().getProperties().getMusicChannels(); return Main.getMainBiscuit().getProperties().getMusicChannels();
} }
String [] list = biscuit.getConfig().getFromConfig(key, biscuit).replace(" , ", ",").replace(", ", ",").split(","); String [] list = biscuit.getConfig().getFromConfig(key).replace(" , ", ",").replace(", ", ",").split(",");
if(list.length == 1 && list[0].equals("")) { if(list.length == 1 && list[0].equals("")) {
String[] blank = {}; String[] blank = {};
return blank; return blank;
} }
return list; return list;
} }
public String[] blockedUnicodeEmotes(){ public String[] blockedUnicodeEmotes(){
String key = "Block-Unicode-Emotes"; String key = "Block-Unicode-Emotes";
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) { if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
return Main.getMainBiscuit().getProperties().blockedUnicodeEmotes(); return Main.getMainBiscuit().getProperties().blockedUnicodeEmotes();
} }
String [] list = biscuit.getConfig().getFromConfig(key, biscuit).replace(" ", "").split(","); String [] list = biscuit.getConfig().getFromConfig(key).replace(" ", "").split(",");
if(list.length == 1 && list[0].equals("")) { if(list.length == 1 && list[0].equals("")) {
String[] blank = {}; String[] blank = {};
return blank; return blank;
} }
return list; return list;
} }
public String[] blockedCustomEmotes(){ public String[] blockedCustomEmotes(){
String key = "Block-Custom-Emotes"; String key = "Block-Custom-Emotes";
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) { if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
return Main.getMainBiscuit().getProperties().blockedCustomEmotes(); return Main.getMainBiscuit().getProperties().blockedCustomEmotes();
} }
String [] list = biscuit.getConfig().getFromConfig(key, biscuit).replace(" ", "").split(","); String [] list = biscuit.getConfig().getFromConfig(key).replace(" ", "").split(",");
if(list.length == 1 && list[0].equals("")) { if(list.length == 1 && list[0].equals("")) {
String[] blank = {}; String[] blank = {};
return blank; return blank;
} }
return list; return list;
} }
public String[] getCustomCmds(){ public String[] getCustomCmds(){
String key = "Custom-Command-Names"; String key = "Custom-Command-Names";
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) { if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
return Main.getMainBiscuit().getProperties().getCustomCmds(); return Main.getMainBiscuit().getProperties().getCustomCmds();
} }
String [] list = biscuit.getConfig().getFromConfig(key, biscuit).replace(" ", "").split(","); String [] list = biscuit.getConfig().getFromConfig(key).replace(" ", "").split(",");
if(list.length == 1 && list[0].equals("")) { if(list.length == 1 && list[0].equals("")) {
String[] blank = {}; String[] blank = {};
return blank; return blank;
} }
return list; return list;
} }
public String[] disabledCommands(){ public String[] disabledCommands(){
String key = "DisabledCommands"; String key = "DisabledCommands";
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) { if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
return Main.getMainBiscuit().getProperties().disabledCommands(); return Main.getMainBiscuit().getProperties().disabledCommands();
} }
String [] list = biscuit.getConfig().getFromConfig(key, biscuit).replace(" ", "").split(","); String [] list = biscuit.getConfig().getFromConfig(key).replace(" ", "").split(",");
if(list.length == 1 && list[0].equals("")) { if(list.length == 1 && list[0].equals("")) {
String[] blank = {}; String[] blank = {};
return blank; return blank;
} }
return list; return list;
} }
public String[] disabledUserCommands(){ public String[] disabledUserCommands(){
String key = "DisabledUserCommands"; String key = "DisabledUserCommands";
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) { if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
return Main.getMainBiscuit().getProperties().disabledUserCommands(); return Main.getMainBiscuit().getProperties().disabledUserCommands();
} }
String [] list = biscuit.getConfig().getFromConfig(key, biscuit).replace(" ", "").split(","); String [] list = biscuit.getConfig().getFromConfig(key).replace(" ", "").split(",");
if(list.length == 1 && list[0].equals("")) { if(list.length == 1 && list[0].equals("")) {
String[] blank = {}; String[] blank = {};
return blank; return blank;
} }
return list; return list;
} }
public String[] getToggleChannels(){ public String[] getToggleChannels(){
String key = "Toggle-Role-React-Channels"; String key = "Toggle-Role-React-Channels";
if(biscuit.getConfig().getFromConfig(key, biscuit).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) { if(biscuit.getConfig().getFromConfig(key).equalsIgnoreCase("[global]") && biscuit.getGuild() != null) {
return Main.getMainBiscuit().getProperties().getToggleChannels(); return Main.getMainBiscuit().getProperties().getToggleChannels();
} }
String [] list = biscuit.getConfig().getFromConfig(key, biscuit).replace(" ", "").split(","); String [] list = biscuit.getConfig().getFromConfig(key).replace(" ", "").split(",");
if(list.length == 1 && list[0].equals("")) { if(list.length == 1 && list[0].equals("")) {
String[] blank = {}; String[] blank = {};
return blank; return blank;
} }
return list; return list;
} }
} }

View File

@ -22,7 +22,7 @@ public class JoinListener extends ListenerAdapter {
Biscuit biscuit = Biscuit.getBiscuit(event.getGuild()); Biscuit biscuit = Biscuit.getBiscuit(event.getGuild());
User user = event.getMember().getUser(); User user = event.getMember().getUser();
biscuit.log(BColor.YELLOW_BOLD + "USER JOINED: " + user.getName() + " " + user.getAsMention()); biscuit.log(BColor.YELLOW_BOLD + "USER JOINED: " + user.getName() + " " + user.getAsMention());
biscuit.captchaLog("**User Joined:** ``" + user.getName() + "`` " + user.getAsMention()); biscuit.eventLog("**User Joined:** ``" + user.getName() + "`` " + user.getAsMention());
if(biscuit.canManageServer() && biscuit.getProperties().checkJoinInvite()) { if(biscuit.canManageServer() && biscuit.getProperties().checkJoinInvite()) {
logUserInvite(user, biscuit); logUserInvite(user, biscuit);
}else { }else {
@ -74,7 +74,7 @@ public class JoinListener extends ListenerAdapter {
} }
b.setInviteUses(newinv); b.setInviteUses(newinv);
b.log(BColor.YELLOW_BOLD + "INVITE INFO: " + BColor.WHITE + user.getName() + " used invite: " + BColor.GREEN_BOLD + usedInv); b.log(BColor.YELLOW_BOLD + "INVITE INFO: " + BColor.WHITE + user.getName() + " used invite: " + BColor.GREEN_BOLD + usedInv);
b.captchaLog("**Invite Info:** ``" + user.getName() + "`` used invite: ``" + usedInv + "``"); b.eventLog("**Invite Info:** ``" + user.getName() + "`` used invite: ``" + usedInv + "``");
}); });
} }

View File

@ -22,7 +22,7 @@ public class LeaveListener extends ListenerAdapter {
} }
if(time > 0) { if(time > 0) {
biscuit.log(BColor.YELLOW + "USER LEFT: " + user.getName() + " " + user.getAsMention()); biscuit.log(BColor.YELLOW + "USER LEFT: " + user.getName() + " " + user.getAsMention());
biscuit.captchaLog("**User Left: ** ``" + user.getName() + "`` " + user.getAsMention()); biscuit.eventLog("**User Left: ** ``" + user.getName() + "`` " + user.getAsMention());
} }
} }

View File

@ -13,7 +13,7 @@ public class MessageDeleteListener extends ListenerAdapter {
public void onMessageDelete(MessageDeleteEvent event) { public void onMessageDelete(MessageDeleteEvent event) {
Biscuit biscuit = Biscuit.getBiscuit(event.getGuild()); Biscuit biscuit = Biscuit.getBiscuit(event.getGuild());
if(Util.isLoggable(event.getTextChannel())) { if(Util.isLoggable(event.getTextChannel())) {
biscuit.log(BColor.MAGENTA_BOLD + "Message " + event.getMessageId() + " was deleted."); biscuit.log("[" + BColor.MAGENTA + "#" + event.getChannel().getName() + BColor.RESET + "] " + BColor.MAGENTA_BOLD + "Message " + event.getMessageId() + " was deleted.");
} }
} }

View File

@ -14,9 +14,8 @@ public class MessageEditListener extends ListenerAdapter {
Biscuit biscuit = Biscuit.getBiscuit(event.getGuild()); Biscuit biscuit = Biscuit.getBiscuit(event.getGuild());
if(Util.isLoggable(event.getTextChannel()) && (!event.getAuthor().getName().equalsIgnoreCase("jbot") && !event.getAuthor().isBot())) { if(Util.isLoggable(event.getTextChannel()) && (!event.getAuthor().getName().equalsIgnoreCase("jbot") && !event.getAuthor().isBot())) {
biscuit.log("[" + BColor.CYAN_BOLD + "MSG EDIT" + BColor.RESET + "] " + BColor.CYAN + "ID: " + BColor.RESET + biscuit.log("[" + BColor.CYAN_BOLD + "MSG EDIT" + BColor.RESET + "] " + BColor.CYAN + "ID: " + BColor.RESET +
event.getMessageId() + BColor.CYAN + " User: " + BColor.RESET + event.getAuthor().getAsMention() + event.getMessageId() + BColor.CYAN + " User: " + BColor.RESET + event.getAuthor().getAsMention());
BColor.GREEN + " Channel: " + BColor.RESET + event.getChannel().getName()); biscuit.log("[" + BColor.CYAN_BOLD + "#" + event.getChannel().getName() + BColor.RESET + "] " + BColor.CYAN + event.getAuthor().getName() + ": " + BColor.WHITE_BOLD + event.getMessage().getContentDisplay());
biscuit.log(BColor.CYAN + event.getAuthor().getName() + ": " + BColor.WHITE_BOLD + event.getMessage().getContentDisplay());
} }
} }

View File

@ -54,8 +54,7 @@ public class MessageReceiveListener extends ListenerAdapter{
if(Util.isLoggable(event.getChannel())) { if(Util.isLoggable(event.getChannel())) {
if(biscuit.getProperties().logChat()) { if(biscuit.getProperties().logChat()) {
biscuit.log("[" + BColor.CYAN_BOLD + "MSG" + BColor.RESET + "] " + BColor.GREEN + "ID: " + BColor.RESET + biscuit.log("[" + BColor.CYAN_BOLD + "MSG" + BColor.RESET + "] " + BColor.GREEN + "ID: " + BColor.RESET +
event.getMessageId() + BColor.GREEN + " Sender: " + BColor.RESET + event.getAuthor().getAsMention() + event.getMessageId() + BColor.GREEN + " Sender: " + BColor.RESET + event.getAuthor().getAsMention());
BColor.GREEN + " Channel: " + BColor.RESET + event.getChannel().getName());
String msg = event.getMessage().getContentDisplay(); String msg = event.getMessage().getContentDisplay();
if(event.getMessage().getAttachments().size() >= 1) { if(event.getMessage().getAttachments().size() >= 1) {
@ -69,7 +68,7 @@ public class MessageReceiveListener extends ListenerAdapter{
msg = msg + tail; msg = msg + tail;
} }
biscuit.log(BColor.GREEN_BOLD + event.getAuthor().getName() + ": " + BColor.WHITE_BOLD + msg); biscuit.log("[" + BColor.CYAN_BOLD + "#" + event.getChannel().getName() + BColor.RESET + "] " + BColor.GREEN_BOLD + event.getAuthor().getName() + ": " + BColor.RESET + msg);
} }
} }
} }

View File

@ -0,0 +1,26 @@
package com.fpghoti.biscuit.listener;
import com.fpghoti.biscuit.Main;
import com.fpghoti.biscuit.biscuit.Biscuit;
import com.fpghoti.biscuit.logging.BColor;
import net.dv8tion.jda.api.entities.Guild;
import net.dv8tion.jda.api.entities.User;
import net.dv8tion.jda.api.events.user.update.UserUpdateNameEvent;
import net.dv8tion.jda.api.hooks.ListenerAdapter;
public class NameListener extends ListenerAdapter {
@Override
public void onUserUpdateName(UserUpdateNameEvent event) {
User user = event.getUser();
Main.getMainBiscuit().log(BColor.CYAN_BOLD + "User " + user.getName() + " " + user.getAsMention() + " changed username from " +
event.getOldName() + " to " + event.getNewName() + ".");
for(Guild guild : user.getMutualGuilds()) {
Biscuit biscuit = Biscuit.getBiscuit(guild);
biscuit.eventLog("**Username changed:** ``" + user.getName() + "`` " + user.getAsMention() + " - From ``" +
event.getOldName() + "`` to ``" + event.getNewName() + "``");
}
}
}

View File

@ -0,0 +1,41 @@
package com.fpghoti.biscuit.listener;
import com.fpghoti.biscuit.biscuit.Biscuit;
import com.fpghoti.biscuit.logging.BColor;
import net.dv8tion.jda.api.entities.User;
import net.dv8tion.jda.api.events.guild.member.update.GuildMemberUpdateNicknameEvent;
import net.dv8tion.jda.api.hooks.ListenerAdapter;
public class NicknameListener extends ListenerAdapter {
@Override
public void onGuildMemberUpdateNickname(GuildMemberUpdateNicknameEvent event) {
Biscuit biscuit = Biscuit.getBiscuit(event.getGuild());
User user = event.getMember().getUser();
String oldNick = "None";
String newNick = "None";
if(event.getOldNickname() != null) {
oldNick = event.getOldNickname();
}
if(event.getNewNickname() != null) {
newNick = event.getNewNickname();
}
biscuit.log(BColor.CYAN + "User " + user.getName() + " " + user.getAsMention() + " changed nickname from " +
oldNick + " to " + newNick + ".");
if(event.getOldNickname() != null) {
oldNick = "``" + event.getOldNickname() + "``";
}
if(event.getNewNickname() != null) {
newNick = "``" + event.getNewNickname() + "``";
}
biscuit.eventLog("**Nickname changed:** ``" + user.getName() + "`` " + user.getAsMention() + " - From " +
oldNick + " to " + newNick);
}
}

View File

@ -11,14 +11,14 @@ public class BiscuitLog {
private final Logger file = LoggerFactory.getLogger("B-File"); private final Logger file = LoggerFactory.getLogger("B-File");
public void debug(String msg) { public void debug(String msg) {
console.debug(BColor.MAGENTA_BOLD + msg + BColor.RESET); console.debug("[" + BColor.MAGENTA_BOLD + "DEBUG" + BColor.RESET + "] " + BColor.MAGENTA + msg + BColor.RESET);
if(!Main.isPlugin) { if(!Main.isPlugin) {
file.debug(BColor.clear(msg)); file.debug(BColor.clear(msg));
} }
} }
public void error(String msg) { public void error(String msg) {
console.error(BColor.RED + msg + BColor.RESET); console.error("[" + BColor.RED_BOLD + "ERROR" + BColor.RESET + "] " + BColor.RED + msg + BColor.RESET);
if(!Main.isPlugin) { if(!Main.isPlugin) {
file.error(BColor.clear(msg)); file.error(BColor.clear(msg));
} }
@ -32,14 +32,14 @@ public class BiscuitLog {
} }
public void trace(String msg) { public void trace(String msg) {
console.trace(BColor.WHITE_BOLD + msg + BColor.RESET); console.trace("[" + BColor.CYAN_BOLD + "TRACE" + BColor.RESET + "] " + BColor.CYAN + msg + BColor.RESET);
if(!Main.isPlugin) { if(!Main.isPlugin) {
file.trace(BColor.clear(msg)); file.trace(BColor.clear(msg));
} }
} }
public void warn(String msg) { public void warn(String msg) {
console.warn(BColor.YELLOW + msg + BColor.RESET); console.warn("[" + BColor.YELLOW_BOLD + "WARN" + BColor.RESET + "] " + BColor.YELLOW + msg + BColor.RESET);
if(!Main.isPlugin) { if(!Main.isPlugin) {
file.warn(BColor.clear(msg)); file.warn(BColor.clear(msg));
} }

View File

@ -95,7 +95,7 @@ public class PreUser {
} }
biscuit.log(user.getName() + " " + user.getAsMention() + " waited too long to complete the captcha. Kicking..."); biscuit.log(user.getName() + " " + user.getAsMention() + " waited too long to complete the captcha. Kicking...");
biscuit.captchaLog("``" + user.getName() +"`` " + user.getAsMention() + " waited too long to complete the captcha! Kicking..."); biscuit.eventLog("``" + user.getName() +"`` " + user.getAsMention() + " waited too long to complete the captcha! Kicking...");
//While being checked for captcha, a user should only have one role. If they have the captcha role and other roles(s), //While being checked for captcha, a user should only have one role. If they have the captcha role and other roles(s),
//do not kick. This is to prevent issues from arising where users are given the captcha role after the check. //do not kick. This is to prevent issues from arising where users are given the captcha role after the check.

View File

@ -7,7 +7,7 @@
<appender name="STDOUT" <appender name="STDOUT"
class="ch.qos.logback.core.ConsoleAppender"> class="ch.qos.logback.core.ConsoleAppender">
<encoder> <encoder>
<pattern>%colorize([%date{MM/dd/yyyy HH:mm:ss}] %level) - %msg%n</pattern> <pattern>%colorize([%date{MM/dd/yyyy HH:mm:ss}]) %msg%n</pattern>
</encoder> </encoder>
</appender> </appender>
@ -19,7 +19,7 @@
<encoder <encoder
class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<Pattern> <Pattern>
<pattern>[%date{MM/dd/yyyy HH:mm:ss}] %level - %msg%n</pattern> <pattern>[%date{MM/dd/yyyy HH:mm:ss}] %msg%n</pattern>
</Pattern> </Pattern>
</encoder> </encoder>