commit
d3691222b8
2 changed files with 33 additions and 1 deletions
|
@ -0,0 +1,28 @@
|
||||||
|
package buttondevteam.discordplugin;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
|
||||||
|
import buttondevteam.lib.TBMCDebugMessageEvent;
|
||||||
|
|
||||||
|
public class DebugMessageListener implements Listener{
|
||||||
|
@EventHandler
|
||||||
|
public void onException(TBMCDebugMessageEvent e) {
|
||||||
|
SendMessage(e.getDebugMessage());
|
||||||
|
e.setSent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void SendMessage(String message) {
|
||||||
|
try {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("```").append("\n");
|
||||||
|
if (message.length() > 2000)
|
||||||
|
message = message.substring(0, 2000);
|
||||||
|
sb.append(message).append("\n");
|
||||||
|
sb.append("```");
|
||||||
|
DiscordPlugin.sendMessageToChannel(DiscordPlugin.debugchannel, sb.toString());
|
||||||
|
} catch (Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -75,6 +75,7 @@ public class DiscordPlugin extends JavaPlugin implements IListener<ReadyEvent> {
|
||||||
public static IChannel annchannel;
|
public static IChannel annchannel;
|
||||||
public static IChannel genchannel;
|
public static IChannel genchannel;
|
||||||
public static IChannel issuechannel;
|
public static IChannel issuechannel;
|
||||||
|
public static IChannel debugchannel;
|
||||||
public static IChannel chatchannel;
|
public static IChannel chatchannel;
|
||||||
|
|
||||||
public static boolean Test = true;
|
public static boolean Test = true;
|
||||||
|
@ -93,7 +94,8 @@ public class DiscordPlugin extends JavaPlugin implements IListener<ReadyEvent> {
|
||||||
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
|
||||||
issuechannel = devServer.getChannelByID("219643416496046081"); // server_issues
|
issuechannel = devServer.getChannelByID("219643416496046081"); // server-issues
|
||||||
|
debugchannel = devServer.getChannelByID("250332016199860224"); // debug-channel
|
||||||
chatchannel = mainServer.getChannelByID("249663564057411596"); // minecraft_chat
|
chatchannel = mainServer.getChannelByID("249663564057411596"); // minecraft_chat
|
||||||
dc.changeStatus(Status.game("on TBMC"));
|
dc.changeStatus(Status.game("on TBMC"));
|
||||||
} else {
|
} else {
|
||||||
|
@ -101,6 +103,7 @@ public class DiscordPlugin extends JavaPlugin implements IListener<ReadyEvent> {
|
||||||
annchannel = devServer.getChannelByID("239519012529111040"); // bottest
|
annchannel = devServer.getChannelByID("239519012529111040"); // bottest
|
||||||
genchannel = devServer.getChannelByID("239519012529111040"); // bottest
|
genchannel = devServer.getChannelByID("239519012529111040"); // bottest
|
||||||
issuechannel = devServer.getChannelByID("239519012529111040"); // bottest
|
issuechannel = devServer.getChannelByID("239519012529111040"); // bottest
|
||||||
|
debugchannel = devServer.getChannelByID("239519012529111040"); //bottest
|
||||||
chatchannel = devServer.getChannelByID("248185455508455424"); // minecraft_chat_test
|
chatchannel = devServer.getChannelByID("248185455508455424"); // minecraft_chat_test
|
||||||
dc.changeStatus(Status.game("testing"));
|
dc.changeStatus(Status.game("testing"));
|
||||||
}
|
}
|
||||||
|
@ -117,6 +120,7 @@ public class DiscordPlugin extends JavaPlugin implements IListener<ReadyEvent> {
|
||||||
genchannel.unpin(msgs.get(i));
|
genchannel.unpin(msgs.get(i));
|
||||||
}
|
}
|
||||||
TBMCCoreAPI.SendUnsentExceptions();
|
TBMCCoreAPI.SendUnsentExceptions();
|
||||||
|
TBMCCoreAPI.SendUnsentDebugMessages();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue