SteamWar/BungeeCore
Archiviert
13
2

Fix possible exceptions
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
yoyosource 2022-03-05 12:25:45 +01:00
Ursprung a0aea29b1b
Commit a5669ef7e2
3 geänderte Dateien mit 13 neuen und 9 gelöschten Zeilen

Datei anzeigen

@ -51,7 +51,7 @@ public class AlertCommand extends BasicCommand {
} }
Message.broadcast("ALERT", ChatColor.translateAlternateColorCodes('&', s)); Message.broadcast("ALERT", ChatColor.translateAlternateColorCodes('&', s));
if (discordAnnounce) { if (discordAnnounce && SteamwarDiscordBot.instance() != null) {
SteamwarDiscordBot.instance().getAnnouncementListener().announce(s); SteamwarDiscordBot.instance().getAnnouncementListener().announce(s);
} }
} }

Datei anzeigen

@ -54,10 +54,12 @@ public class ServerTeamchatCommand extends BasicCommand {
String msg = msgBuilder.toString(); String msg = msgBuilder.toString();
msg = ChatColor.translateAlternateColorCodes('&', msg); msg = ChatColor.translateAlternateColorCodes('&', msg);
try { if (SteamwarDiscordBot.instance() != null) {
SteamwarDiscordBot.instance().getServerTeamChatListener().send("<t:" + (System.currentTimeMillis() / 1000) + "> " + (player.getName() + "» " + msg).replaceAll("§[a-f0-9r]", "")); try {
} catch (Exception e) { SteamwarDiscordBot.instance().getServerTeamChatListener().send("<t:" + (System.currentTimeMillis() / 1000) + "> " + (player.getName() + "» " + msg).replaceAll("§[a-f0-9r]", ""));
BungeeCore.get().getLogger().log(Level.SEVERE, "Could not send stc message to discord", e); } catch (Exception e) {
BungeeCore.get().getLogger().log(Level.SEVERE, "Could not send stc message to discord", e);
}
} }
sendToTeam(msg, player); sendToTeam(msg, player);
} }

Datei anzeigen

@ -212,10 +212,12 @@ public class ChatListener extends BasicListener {
msg = "§" + team.getTeamColor() + team.getTeamKuerzel() + " §r" + msg; msg = "§" + team.getTeamColor() + team.getTeamKuerzel() + " §r" + msg;
} }
try { if (SteamwarDiscordBot.instance() != null) {
SteamwarDiscordBot.instance().getIngameChatListener().send("<t:" + (System.currentTimeMillis() / 1000) + "> " + msg.replaceAll("§[a-f0-9r]", "")); try {
} catch (Exception e) { SteamwarDiscordBot.instance().getIngameChatListener().send("<t:" + (System.currentTimeMillis() / 1000) + "> " + msg.replaceAll("§[a-f0-9r]", ""));
BungeeCore.get().getLogger().log(Level.SEVERE, "Could not send chat message to discord", e); } catch (Exception e) {
BungeeCore.get().getLogger().log(Level.SEVERE, "Could not send chat message to discord", e);
}
} }
for(ProxiedPlayer target : ProxyServer.getInstance().getPlayers()){ for(ProxiedPlayer target : ProxyServer.getInstance().getPlayers()){
Subserver targetServer = Subserver.getSubserver(target); Subserver targetServer = Subserver.getSubserver(target);