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,11 +172,13 @@ public class BungeeCore extends Plugin {
@Override @Override
public void onDisable(){ public void onDisable(){
if (SteamwarDiscordBotConfig.loaded) {
try { try {
SteamwarDiscordBot.instance().getJda().shutdown(); SteamwarDiscordBot.instance().getJda().shutdown();
} catch (Throwable e) { } catch (Throwable e) {
getLogger().log(Level.SEVERE, "Could not shutdown discord bot", e); getLogger().log(Level.SEVERE, "Could not shutdown discord bot", e);
} }
}
errorLogger.unregister(); errorLogger.unregister();
Statement.closeAll(); Statement.closeAll();
@ -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,11 +54,13 @@ public class ServerTeamchatCommand extends BasicCommand {
String msg = msgBuilder.toString(); String msg = msgBuilder.toString();
msg = ChatColor.translateAlternateColorCodes('&', msg); msg = ChatColor.translateAlternateColorCodes('&', msg);
if (SteamwarDiscordBot.instance() != null) {
try { try {
SteamwarDiscordBot.instance().getServerTeamChatListener().send("<t:" + (System.currentTimeMillis() / 1000) + "> " + (player.getName() + "» " + msg).replaceAll("§[a-f0-9r]", "")); SteamwarDiscordBot.instance().getServerTeamChatListener().send("<t:" + (System.currentTimeMillis() / 1000) + "> " + (player.getName() + "» " + msg).replaceAll("§[a-f0-9r]", ""));
} catch (Exception e) { } catch (Exception e) {
BungeeCore.get().getLogger().log(Level.SEVERE, "Could not send stc message to discord", e); BungeeCore.get().getLogger().log(Level.SEVERE, "Could not send stc message to discord", e);
} }
}
sendToTeam(msg, player); sendToTeam(msg, player);
} }
} }

Datei anzeigen

@ -212,11 +212,13 @@ public class ChatListener extends BasicListener {
msg = "§" + team.getTeamColor() + team.getTeamKuerzel() + " §r" + msg; msg = "§" + team.getTeamColor() + team.getTeamKuerzel() + " §r" + msg;
} }
if (SteamwarDiscordBot.instance() != null) {
try { try {
SteamwarDiscordBot.instance().getIngameChatListener().send("<t:" + (System.currentTimeMillis() / 1000) + "> " + msg.replaceAll("§[a-f0-9r]", "")); SteamwarDiscordBot.instance().getIngameChatListener().send("<t:" + (System.currentTimeMillis() / 1000) + "> " + msg.replaceAll("§[a-f0-9r]", ""));
} catch (Exception e) { } catch (Exception e) {
BungeeCore.get().getLogger().log(Level.SEVERE, "Could not send chat message to discord", 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);
if(!(targetServer == null || targetServer.getType() != Servertype.ARENA || targetServer.getServer() != target.getServer().getInfo())) continue; if(!(targetServer == null || targetServer.getType() != Servertype.ARENA || targetServer.getServer() != target.getServer().getInfo())) continue;

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,6 +97,7 @@ public class ConnectionListener extends BasicListener {
newPlayers.remove(player.getUniqueId()); newPlayers.remove(player.getUniqueId());
} }
if(SteamwarDiscordBotConfig.loaded)
DiscordRanks.update(user); DiscordRanks.update(user);
} }

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