SteamWar/BungeeCore
Archiviert
13
2

Fix Discord bot shutdown, fight broadcasts, ErrorLogger, autoreconnect
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: Lixfel <git-5w3l@lixfel.de>
Dieser Commit ist enthalten in:
Lixfel 2024-06-28 13:24:12 +02:00
Ursprung 5d9d5de237
Commit 0ef4fc147c
6 geänderte Dateien mit 14 neuen und 19 gelöschten Zeilen

Datei anzeigen

@ -72,7 +72,9 @@ public class ErrorLogger extends AbstractAppender {
SWException.log(message, stacktrace);
}
private static final List<String> filteredMessages = List.of();
private static final List<String> filteredMessages = List.of(
"read timed out"
);
private static final List<String> filteredStacktraces = List.of(
"ErrorLogger",
"Connection reset by peer"

Datei anzeigen

@ -250,7 +250,7 @@ public class VelocityCore implements ReloadablePlugin {
@Override
public void onProxyShutdown(ProxyShutdownEvent event) {
try {
DiscordBot.withBot(bot -> bot.getJda().shutdown());
DiscordBot.withBot(bot -> bot.getJda().shutdownNow());
} catch (Throwable e) {
logger.log(Level.SEVERE, "Could not shutdown discord bot", e);
}

Datei anzeigen

@ -51,7 +51,7 @@ public class ChallengeCommand extends SWCommand {
challenges.remove(p);
new ServerStarter().arena(mode, map).blueLeader(sender.getPlayer()).redLeader(target).callback(
arena -> Chatter.broadcast().system("CHALLENGE_BROADCAST", "CHALLENGE_BROADCAST_HOVER", ClickEvent.runCommand("/arena " + arena.getServer().getName()), mode.getGameName(), p, target)
arena -> Chatter.broadcast().system("CHALLENGE_BROADCAST", new Message("CHALLENGE_BROADCAST_HOVER"), ClickEvent.runCommand("/arena " + arena.getServer().getName()), mode.getGameName(), p, target)
).start();
}else{
if(!challenges.containsKey(p)){

Datei anzeigen

@ -130,7 +130,7 @@ public class FightCommand extends SWCommand {
public void fight(@Validator("arenaPlayer") PlayerChatter sender, @Mapper("nonHistoricArenaMode") @OptionalValue("") @AllowNull ArenaMode arenaMode, @Mapper("arenaMap") @OptionalValue("") @AllowNull String map) {
createArena(sender, "/fight ", true, arenaMode, map, false,
(p, mode, m) -> new ServerStarter().arena(mode, m).blueLeader(p.getPlayer()).callback(
arena -> Chatter.broadcast().system("FIGHT_BROADCAST", "FIGHT_BROADCAST_HOVER", ClickEvent.runCommand("/arena " + arena.getServer().getName()), mode.getGameName(), p.getPlayer().getUsername())
arena -> Chatter.broadcast().system("FIGHT_BROADCAST", new Message("FIGHT_BROADCAST_HOVER"), ClickEvent.runCommand("/arena " + arena.getServer().getName()), mode.getGameName(), p.getPlayer().getUsername())
).start()
);
}

Datei anzeigen

@ -19,11 +19,12 @@
package de.steamwar.velocitycore.commands;
import de.steamwar.velocitycore.ArenaMode;
import de.steamwar.velocitycore.ServerStarter;
import de.steamwar.command.SWCommand;
import de.steamwar.messages.Chatter;
import de.steamwar.messages.Message;
import de.steamwar.messages.PlayerChatter;
import de.steamwar.velocitycore.ArenaMode;
import de.steamwar.velocitycore.ServerStarter;
import net.kyori.adventure.text.event.ClickEvent;
public class HistoricCommand extends SWCommand {
@ -34,7 +35,7 @@ public class HistoricCommand extends SWCommand {
@Register
public void historic(@Validator("arenaPlayer") PlayerChatter player, @Mapper("historicArenaMode") @OptionalValue("") @AllowNull ArenaMode arenaMode, @Mapper("arenaMap") @OptionalValue("") @AllowNull String map) {
FightCommand.createArena(player, "/historic ", true, arenaMode, map, true, (p, mode, m) -> new ServerStarter().arena(mode, m).blueLeader(p.getPlayer()).callback(
arena -> Chatter.broadcast().system("HISTORIC_BROADCAST", "HISTORIC_BROADCAST_HOVER", ClickEvent.runCommand("/arena " + arena.getServer().getName()), mode.getGameName(), p.getPlayer())
arena -> Chatter.broadcast().system("HISTORIC_BROADCAST", new Message("HISTORIC_BROADCAST_HOVER"), ClickEvent.runCommand("/arena " + arena.getServer().getName()), mode.getGameName(), p.getPlayer())
).start());
}
}

Datei anzeigen

@ -23,12 +23,14 @@ import com.velocitypowered.api.event.Subscribe;
import com.velocitypowered.api.event.connection.DisconnectEvent;
import com.velocitypowered.api.event.connection.PostLoginEvent;
import com.velocitypowered.api.event.permission.PermissionsSetupEvent;
import com.velocitypowered.api.event.player.KickedFromServerEvent;
import com.velocitypowered.api.permission.Tristate;
import com.velocitypowered.api.proxy.Player;
import de.steamwar.messages.Chatter;
import de.steamwar.messages.Message;
import de.steamwar.persistent.Servertype;
import de.steamwar.persistent.Subserver;
import de.steamwar.velocitycore.VelocityCore;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.UserPerm;
import de.steamwar.velocitycore.commands.ChallengeCommand;
import de.steamwar.velocitycore.commands.CheckCommand;
import de.steamwar.velocitycore.commands.ModCommand;
@ -36,10 +38,6 @@ import de.steamwar.velocitycore.commands.MsgCommand;
import de.steamwar.velocitycore.discord.DiscordBot;
import de.steamwar.velocitycore.discord.util.DiscordRanks;
import de.steamwar.velocitycore.mods.ModUtils;
import de.steamwar.messages.Chatter;
import de.steamwar.messages.Message;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.UserPerm;
import net.kyori.adventure.text.event.ClickEvent;
import java.util.HashSet;
@ -95,12 +93,6 @@ public class ConnectionListener extends BasicListener {
DiscordBot.withBot(bot -> DiscordRanks.update(user));
}
/** To redirect players to the lobby in case of server closure. */ //TODO still necessary?
@Subscribe
public void onServerKickEvent(KickedFromServerEvent e) {
e.setResult(KickedFromServerEvent.RedirectPlayer.create(VelocityCore.get().getConfig().lobbyserver(), e.getServerKickReason().orElse(null)));
}
@Subscribe
public void onDisconnect(DisconnectEvent e){
ChallengeCommand.remove(e.getPlayer());