Made it use the core's test detection

This commit is contained in:
Norbi Peti 2016-12-22 21:17:24 +01:00
parent 8f92c8eb9b
commit 599f853f19

View file

@ -47,7 +47,6 @@ public class DiscordPlugin extends JavaPlugin implements IListener<ReadyEvent> {
} else { } else {
lastannouncementtime = getConfig().getLong("lastannouncementtime"); lastannouncementtime = getConfig().getLong("lastannouncementtime");
lastseentime = getConfig().getLong("lastseentime"); lastseentime = getConfig().getLong("lastseentime");
Test = getConfig().getBoolean("test", true);
saveConfig(); saveConfig();
} }
ClientBuilder cb = new ClientBuilder(); ClientBuilder cb = new ClientBuilder();
@ -79,8 +78,6 @@ public class DiscordPlugin extends JavaPlugin implements IListener<ReadyEvent> {
public static IGuild mainServer; public static IGuild mainServer;
public static IGuild devServer; public static IGuild devServer;
public static boolean Test = true;
@Override @Override
public void handle(ReadyEvent event) { public void handle(ReadyEvent event) {
try { try {
@ -90,7 +87,7 @@ public class DiscordPlugin extends JavaPlugin implements IListener<ReadyEvent> {
devServer = event.getClient().getGuildByID("219529124321034241"); devServer = event.getClient().getGuildByID("219529124321034241");
Thread.sleep(100); Thread.sleep(100);
} while ((mainServer == null || devServer == null) && retryc++ < 10); } while ((mainServer == null || devServer == null) && retryc++ < 10);
if (!Test) { if (!TBMCCoreAPI.IsTestServer()) {
botchannel = mainServer.getChannelByID("209720707188260864"); // bot botchannel = mainServer.getChannelByID("209720707188260864"); // bot
annchannel = mainServer.getChannelByID("126795071927353344"); // announcements annchannel = mainServer.getChannelByID("126795071927353344"); // announcements
genchannel = mainServer.getChannelByID("125813020357165056"); // general genchannel = mainServer.getChannelByID("125813020357165056"); // general
@ -211,7 +208,7 @@ public class DiscordPlugin extends JavaPlugin implements IListener<ReadyEvent> {
e2.printStackTrace(); e2.printStackTrace();
} }
try { try {
return channel.sendMessage(Test && channel != chatchannel return channel.sendMessage(TBMCCoreAPI.IsTestServer() && channel != chatchannel
? "*The following message is from a test server*\n" + message : message); ? "*The following message is from a test server*\n" + message : message);
} catch (RateLimitException e) { } catch (RateLimitException e) {
try { try {