SteamWar/BungeeCore
Archiviert
13
2

Fix DC Command regex, DC Ranks, no current server
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 10:12:30 +02:00
Ursprung 6a42b802e7
Commit c803fe2796
6 geänderte Dateien mit 10 neuen und 8 gelöschten Zeilen

Datei anzeigen

@ -23,6 +23,7 @@ import com.velocitypowered.api.command.CommandSource;
import com.velocitypowered.api.event.ResultedEvent;
import com.velocitypowered.api.event.connection.LoginEvent;
import com.velocitypowered.api.proxy.Player;
import com.velocitypowered.api.proxy.ServerConnection;
import de.steamwar.persistent.Servertype;
import de.steamwar.persistent.Subserver;
import de.steamwar.velocitycore.VelocityCore;
@ -62,7 +63,7 @@ public interface Chatter {
static ChatterGroup globalChat() {
return new ChatterGroup(Stream.concat(Stream.of(Chatter.console()), allPlayers().filter(player -> {
Subserver subserver = Subserver.getSubserver(player);
return subserver == null || !(subserver.getType() == Servertype.ARENA && subserver.getServer() == player.getCurrentServer().get().getServerInfo());
return subserver == null || !(subserver.getType() == Servertype.ARENA && subserver.getServer() == player.getCurrentServer().map(ServerConnection::getServerInfo).orElse(null));
}).map(Chatter::of)));
}

Datei anzeigen

@ -187,7 +187,7 @@ public class DiscordBot {
updateCommands
.addCommands(getCommands()
.keySet().stream()
.filter(command -> command.matches("^[\\w-]+$."))
.filter(command -> command.matches("^[\\w-]+$"))
.map(command -> new CommandData(command, "SteamWar Command").addOptions(new OptionData(OptionType.STRING, ARGUMENT_NAME, "SteamWar arguments", false)))
.toArray(CommandData[]::new))
.complete();

Datei anzeigen

@ -92,11 +92,11 @@ public class DiscordTicketHandler extends ListenerAdapter {
.append("<t:").append(message.getTimeCreated().toInstant().getEpochSecond()).append("> ")
.append("**").append(message.getAuthor().getName()).append("**: ")
.append(message.getContentRaw())
.append("\n\n");
.append("\n");
if(!message.getAttachments().isEmpty()) {
message.getAttachments().forEach(attachment -> stringBuilder.append(attachment.getUrl()));
stringBuilder.append("\n\n");
stringBuilder.append("\n");
}
return stringBuilder;
@ -158,7 +158,7 @@ public class DiscordTicketHandler extends ListenerAdapter {
//ignored
}
receivers.system("DISCORD_TICKET_MESSAGE", new Message("DISCORD_TICKET_HOVER"), ClickEvent.openUrl(event.getMessage().getJumpUrl()), event.getChannel().getName(), event.getAuthor().getName(), event.getMessage().getContentRaw());
receivers.prefixless("DISCORD_TICKET_MESSAGE", new Message("DISCORD_TICKET_HOVER"), ClickEvent.openUrl(event.getMessage().getJumpUrl()), event.getChannel().getName(), event.getAuthor().getName(), event.getMessage().getContentRaw());
}
}
}

Datei anzeigen

@ -49,7 +49,7 @@ public class DiscordRanks {
.filter(role -> !role.getId().equals(prefixRole))
.forEach(role -> guild.removeRoleFromMember(member, role).queue());
if (member.getRoles().stream().noneMatch(role -> role.getId().equals(prefixRole)))
if (member.getRoles().stream().noneMatch(role -> role.getId().equals(prefixRole)) && guild.getRoleById(prefixRole) != null)
guild.addRoleToMember(member, guild.getRoleById(prefixRole)).queue();
}, e -> {
if(e instanceof ErrorResponseException err && err.getErrorCode() == 10007)

Datei anzeigen

@ -20,6 +20,7 @@
package de.steamwar.velocitycore.tablist;
import com.velocitypowered.api.proxy.Player;
import com.velocitypowered.api.proxy.ServerConnection;
import com.velocitypowered.api.proxy.server.RegisteredServer;
import de.steamwar.persistent.Servertype;
import de.steamwar.persistent.Subserver;
@ -55,7 +56,7 @@ public class TablistBuild implements TablistPart {
@Override
public void print(Chatter viewer, Player player, List<Item> tablist, List<Item> direct) {
RegisteredServer server = player.getCurrentServer().orElseThrow().getServer();
RegisteredServer server = player.getCurrentServer().map(ServerConnection::getServer).orElse(null);
if(players.keySet().stream().anyMatch(info -> server != info)) {
tablist.add(new Item(null, "", TablistServer.GRAY));
tablist.add(new Item(null, viewer.parseToLegacy("TABLIST_BAU"), TablistServer.LIGHT_GRAY));

Datei anzeigen

@ -69,7 +69,7 @@ public class TablistServer implements TablistPart {
@Override
public void print(Chatter viewer, Player player, List<Item> tablist, List<Item> direct) {
boolean onServer = player.getCurrentServer().orElseThrow().getServer() == server;
boolean onServer = player.getCurrentServer().map(ServerConnection::getServer).orElse(null) == server;
List<Item> items = onServer ? direct : tablist;
if(!onServer) {