Archiviert
1
0

Merge branch 'master' into bot_upload

Dieser Commit ist enthalten in:
Chaoscaot 2022-03-06 17:49:44 +01:00
Commit 5249b0aee6
6 geänderte Dateien mit 24 neuen und 16 gelöschten Zeilen

Datei anzeigen

@ -172,10 +172,12 @@ public class BungeeCore extends Plugin {
@Override @Override
public void onDisable(){ public void onDisable(){
try { if (SteamwarDiscordBotConfig.loaded) {
SteamwarDiscordBot.instance().getJda().shutdown(); try {
} catch (Throwable e) { SteamwarDiscordBot.instance().getJda().shutdown();
getLogger().log(Level.SEVERE, "Could not shutdown discord bot", e); } catch (Throwable e) {
getLogger().log(Level.SEVERE, "Could not shutdown discord bot", e);
}
} }
errorLogger.unregister(); errorLogger.unregister();
@ -278,7 +280,7 @@ public class BungeeCore extends Plugin {
config.getString("db.password") config.getString("db.password")
); );
if (config.getSection("discord") != null) { if (config.contains("discord")) {
SteamwarDiscordBotConfig.loadConfig(config.getSection("discord")); SteamwarDiscordBotConfig.loadConfig(config.getSection("discord"));
} }

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);

Datei anzeigen

@ -23,6 +23,7 @@ import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.Message;
import de.steamwar.bungeecore.Servertype; import de.steamwar.bungeecore.Servertype;
import de.steamwar.bungeecore.Subserver; import de.steamwar.bungeecore.Subserver;
import de.steamwar.bungeecore.bot.config.SteamwarDiscordBotConfig;
import de.steamwar.bungeecore.bot.util.DiscordRanks; import de.steamwar.bungeecore.bot.util.DiscordRanks;
import de.steamwar.bungeecore.commands.ChallengeCommand; import de.steamwar.bungeecore.commands.ChallengeCommand;
import de.steamwar.bungeecore.commands.CheckCommand; import de.steamwar.bungeecore.commands.CheckCommand;
@ -96,7 +97,8 @@ public class ConnectionListener extends BasicListener {
newPlayers.remove(player.getUniqueId()); newPlayers.remove(player.getUniqueId());
} }
DiscordRanks.update(user); if(SteamwarDiscordBotConfig.loaded)
DiscordRanks.update(user);
} }
/** To redirect players to the lobby in case of server closure. */ /** To redirect players to the lobby in case of server closure. */

Datei anzeigen

@ -61,7 +61,7 @@ public class Forge extends BasicListener {
@EventHandler @EventHandler
public void onServerConnected(LoginEvent event){ public void onServerConnected(LoginEvent event){
if(event.getConnection().getVersion() < 340) return; //1.13+ if(event.getConnection().getVersion() < 341) return; //1.13+
//fml:handshake without mods, channels and registries //fml:handshake without mods, channels and registries
//for more information see https://wiki.vg/Minecraft_Forge_Handshake#FML2_protocol_.281.13_-_Current.29 //for more information see https://wiki.vg/Minecraft_Forge_Handshake#FML2_protocol_.281.13_-_Current.29