geforkt von SteamWar/BungeeCore
Merge pull request 'Fix possible exceptions' (#302) from DiscordBotFix into master
Reviewed-on: SteamWar/BungeeCore#302 Reviewed-by: Lixfel <lixfel@steamwar.de>
Dieser Commit ist enthalten in:
Commit
373ee6344e
@ -51,7 +51,7 @@ public class AlertCommand extends BasicCommand {
|
||||
}
|
||||
|
||||
Message.broadcast("ALERT", ChatColor.translateAlternateColorCodes('&', s));
|
||||
if (discordAnnounce) {
|
||||
if (discordAnnounce && SteamwarDiscordBot.instance() != null) {
|
||||
SteamwarDiscordBot.instance().getAnnouncementListener().announce(s);
|
||||
}
|
||||
}
|
||||
|
@ -54,10 +54,12 @@ public class ServerTeamchatCommand extends BasicCommand {
|
||||
String msg = msgBuilder.toString();
|
||||
msg = ChatColor.translateAlternateColorCodes('&', msg);
|
||||
|
||||
try {
|
||||
SteamwarDiscordBot.instance().getServerTeamChatListener().send("<t:" + (System.currentTimeMillis() / 1000) + "> " + (player.getName() + "» " + msg).replaceAll("§[a-f0-9r]", ""));
|
||||
} catch (Exception e) {
|
||||
BungeeCore.get().getLogger().log(Level.SEVERE, "Could not send stc message to discord", e);
|
||||
if (SteamwarDiscordBot.instance() != null) {
|
||||
try {
|
||||
SteamwarDiscordBot.instance().getServerTeamChatListener().send("<t:" + (System.currentTimeMillis() / 1000) + "> " + (player.getName() + "» " + msg).replaceAll("§[a-f0-9r]", ""));
|
||||
} catch (Exception e) {
|
||||
BungeeCore.get().getLogger().log(Level.SEVERE, "Could not send stc message to discord", e);
|
||||
}
|
||||
}
|
||||
sendToTeam(msg, player);
|
||||
}
|
||||
|
@ -212,10 +212,12 @@ public class ChatListener extends BasicListener {
|
||||
msg = "§" + team.getTeamColor() + team.getTeamKuerzel() + " §r" + msg;
|
||||
}
|
||||
|
||||
try {
|
||||
SteamwarDiscordBot.instance().getIngameChatListener().send("<t:" + (System.currentTimeMillis() / 1000) + "> " + msg.replaceAll("§[a-f0-9r]", ""));
|
||||
} catch (Exception e) {
|
||||
BungeeCore.get().getLogger().log(Level.SEVERE, "Could not send chat message to discord", e);
|
||||
if (SteamwarDiscordBot.instance() != null) {
|
||||
try {
|
||||
SteamwarDiscordBot.instance().getIngameChatListener().send("<t:" + (System.currentTimeMillis() / 1000) + "> " + msg.replaceAll("§[a-f0-9r]", ""));
|
||||
} catch (Exception e) {
|
||||
BungeeCore.get().getLogger().log(Level.SEVERE, "Could not send chat message to discord", e);
|
||||
}
|
||||
}
|
||||
for(ProxiedPlayer target : ProxyServer.getInstance().getPlayers()){
|
||||
Subserver targetServer = Subserver.getSubserver(target);
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren