Added @ Coder ping for exceptions
This commit is contained in:
parent
355ba01929
commit
1ae389c2aa
1 changed files with 8 additions and 1 deletions
|
@ -10,7 +10,9 @@ import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
|
|
||||||
import buttondevteam.discordplugin.DiscordPlugin;
|
import buttondevteam.discordplugin.DiscordPlugin;
|
||||||
|
import buttondevteam.lib.TBMCCoreAPI;
|
||||||
import buttondevteam.lib.TBMCExceptionEvent;
|
import buttondevteam.lib.TBMCExceptionEvent;
|
||||||
|
import sx.blah.discord.handle.obj.IRole;
|
||||||
|
|
||||||
public class ExceptionListener implements Listener {
|
public class ExceptionListener implements Listener {
|
||||||
private List<Throwable> lastthrown = new ArrayList<>();
|
private List<Throwable> lastthrown = new ArrayList<>();
|
||||||
|
@ -35,9 +37,14 @@ public class ExceptionListener implements Listener {
|
||||||
e.setHandled();
|
e.setHandled();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static IRole coderRole;
|
||||||
|
|
||||||
private static void SendException(Throwable e, String sourcemessage) {
|
private static void SendException(Throwable e, String sourcemessage) {
|
||||||
try {
|
try {
|
||||||
StringBuilder sb = new StringBuilder();
|
if (coderRole == null)
|
||||||
|
coderRole = DiscordPlugin.devServer.getRolesByName("Coder").get(0);
|
||||||
|
StringBuilder sb = TBMCCoreAPI.IsTestServer() ? new StringBuilder()
|
||||||
|
: new StringBuilder(coderRole.mention()).append("\n");
|
||||||
sb.append(sourcemessage).append("\n");
|
sb.append(sourcemessage).append("\n");
|
||||||
sb.append("```").append("\n");
|
sb.append("```").append("\n");
|
||||||
String stackTrace = Arrays.stream(ExceptionUtils.getStackTrace(e).split("\\n"))
|
String stackTrace = Arrays.stream(ExceptionUtils.getStackTrace(e).split("\\n"))
|
||||||
|
|
Loading…
Reference in a new issue