Fix Discord bot shutdown, fight broadcasts, ErrorLogger, autoreconnect
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: Lixfel <git-5w3l@lixfel.de>
Dieser Commit ist enthalten in:
Ursprung
5d9d5de237
Commit
0ef4fc147c
@ -72,7 +72,9 @@ public class ErrorLogger extends AbstractAppender {
|
|||||||
SWException.log(message, stacktrace);
|
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(
|
private static final List<String> filteredStacktraces = List.of(
|
||||||
"ErrorLogger",
|
"ErrorLogger",
|
||||||
"Connection reset by peer"
|
"Connection reset by peer"
|
||||||
|
@ -250,7 +250,7 @@ public class VelocityCore implements ReloadablePlugin {
|
|||||||
@Override
|
@Override
|
||||||
public void onProxyShutdown(ProxyShutdownEvent event) {
|
public void onProxyShutdown(ProxyShutdownEvent event) {
|
||||||
try {
|
try {
|
||||||
DiscordBot.withBot(bot -> bot.getJda().shutdown());
|
DiscordBot.withBot(bot -> bot.getJda().shutdownNow());
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.log(Level.SEVERE, "Could not shutdown discord bot", e);
|
logger.log(Level.SEVERE, "Could not shutdown discord bot", e);
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ public class ChallengeCommand extends SWCommand {
|
|||||||
challenges.remove(p);
|
challenges.remove(p);
|
||||||
|
|
||||||
new ServerStarter().arena(mode, map).blueLeader(sender.getPlayer()).redLeader(target).callback(
|
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();
|
).start();
|
||||||
}else{
|
}else{
|
||||||
if(!challenges.containsKey(p)){
|
if(!challenges.containsKey(p)){
|
||||||
|
@ -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) {
|
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,
|
createArena(sender, "/fight ", true, arenaMode, map, false,
|
||||||
(p, mode, m) -> new ServerStarter().arena(mode, m).blueLeader(p.getPlayer()).callback(
|
(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()
|
).start()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -19,11 +19,12 @@
|
|||||||
|
|
||||||
package de.steamwar.velocitycore.commands;
|
package de.steamwar.velocitycore.commands;
|
||||||
|
|
||||||
import de.steamwar.velocitycore.ArenaMode;
|
|
||||||
import de.steamwar.velocitycore.ServerStarter;
|
|
||||||
import de.steamwar.command.SWCommand;
|
import de.steamwar.command.SWCommand;
|
||||||
import de.steamwar.messages.Chatter;
|
import de.steamwar.messages.Chatter;
|
||||||
|
import de.steamwar.messages.Message;
|
||||||
import de.steamwar.messages.PlayerChatter;
|
import de.steamwar.messages.PlayerChatter;
|
||||||
|
import de.steamwar.velocitycore.ArenaMode;
|
||||||
|
import de.steamwar.velocitycore.ServerStarter;
|
||||||
import net.kyori.adventure.text.event.ClickEvent;
|
import net.kyori.adventure.text.event.ClickEvent;
|
||||||
|
|
||||||
public class HistoricCommand extends SWCommand {
|
public class HistoricCommand extends SWCommand {
|
||||||
@ -34,7 +35,7 @@ public class HistoricCommand extends SWCommand {
|
|||||||
@Register
|
@Register
|
||||||
public void historic(@Validator("arenaPlayer") PlayerChatter player, @Mapper("historicArenaMode") @OptionalValue("") @AllowNull ArenaMode arenaMode, @Mapper("arenaMap") @OptionalValue("") @AllowNull String map) {
|
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(
|
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());
|
).start());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,12 +23,14 @@ import com.velocitypowered.api.event.Subscribe;
|
|||||||
import com.velocitypowered.api.event.connection.DisconnectEvent;
|
import com.velocitypowered.api.event.connection.DisconnectEvent;
|
||||||
import com.velocitypowered.api.event.connection.PostLoginEvent;
|
import com.velocitypowered.api.event.connection.PostLoginEvent;
|
||||||
import com.velocitypowered.api.event.permission.PermissionsSetupEvent;
|
import com.velocitypowered.api.event.permission.PermissionsSetupEvent;
|
||||||
import com.velocitypowered.api.event.player.KickedFromServerEvent;
|
|
||||||
import com.velocitypowered.api.permission.Tristate;
|
import com.velocitypowered.api.permission.Tristate;
|
||||||
import com.velocitypowered.api.proxy.Player;
|
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.Servertype;
|
||||||
import de.steamwar.persistent.Subserver;
|
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.ChallengeCommand;
|
||||||
import de.steamwar.velocitycore.commands.CheckCommand;
|
import de.steamwar.velocitycore.commands.CheckCommand;
|
||||||
import de.steamwar.velocitycore.commands.ModCommand;
|
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.DiscordBot;
|
||||||
import de.steamwar.velocitycore.discord.util.DiscordRanks;
|
import de.steamwar.velocitycore.discord.util.DiscordRanks;
|
||||||
import de.steamwar.velocitycore.mods.ModUtils;
|
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 net.kyori.adventure.text.event.ClickEvent;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@ -95,12 +93,6 @@ public class ConnectionListener extends BasicListener {
|
|||||||
DiscordBot.withBot(bot -> DiscordRanks.update(user));
|
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
|
@Subscribe
|
||||||
public void onDisconnect(DisconnectEvent e){
|
public void onDisconnect(DisconnectEvent e){
|
||||||
ChallengeCommand.remove(e.getPlayer());
|
ChallengeCommand.remove(e.getPlayer());
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren