Fix DC Command regex, DC Ranks, no current server
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
6a42b802e7
Commit
c803fe2796
@ -23,6 +23,7 @@ import com.velocitypowered.api.command.CommandSource;
|
|||||||
import com.velocitypowered.api.event.ResultedEvent;
|
import com.velocitypowered.api.event.ResultedEvent;
|
||||||
import com.velocitypowered.api.event.connection.LoginEvent;
|
import com.velocitypowered.api.event.connection.LoginEvent;
|
||||||
import com.velocitypowered.api.proxy.Player;
|
import com.velocitypowered.api.proxy.Player;
|
||||||
|
import com.velocitypowered.api.proxy.ServerConnection;
|
||||||
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.velocitycore.VelocityCore;
|
||||||
@ -62,7 +63,7 @@ public interface Chatter {
|
|||||||
static ChatterGroup globalChat() {
|
static ChatterGroup globalChat() {
|
||||||
return new ChatterGroup(Stream.concat(Stream.of(Chatter.console()), allPlayers().filter(player -> {
|
return new ChatterGroup(Stream.concat(Stream.of(Chatter.console()), allPlayers().filter(player -> {
|
||||||
Subserver subserver = Subserver.getSubserver(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)));
|
}).map(Chatter::of)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,7 +187,7 @@ public class DiscordBot {
|
|||||||
updateCommands
|
updateCommands
|
||||||
.addCommands(getCommands()
|
.addCommands(getCommands()
|
||||||
.keySet().stream()
|
.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)))
|
.map(command -> new CommandData(command, "SteamWar Command").addOptions(new OptionData(OptionType.STRING, ARGUMENT_NAME, "SteamWar arguments", false)))
|
||||||
.toArray(CommandData[]::new))
|
.toArray(CommandData[]::new))
|
||||||
.complete();
|
.complete();
|
||||||
|
@ -92,11 +92,11 @@ public class DiscordTicketHandler extends ListenerAdapter {
|
|||||||
.append("<t:").append(message.getTimeCreated().toInstant().getEpochSecond()).append("> ")
|
.append("<t:").append(message.getTimeCreated().toInstant().getEpochSecond()).append("> ")
|
||||||
.append("**").append(message.getAuthor().getName()).append("**: ")
|
.append("**").append(message.getAuthor().getName()).append("**: ")
|
||||||
.append(message.getContentRaw())
|
.append(message.getContentRaw())
|
||||||
.append("\n\n");
|
.append("\n");
|
||||||
|
|
||||||
if(!message.getAttachments().isEmpty()) {
|
if(!message.getAttachments().isEmpty()) {
|
||||||
message.getAttachments().forEach(attachment -> stringBuilder.append(attachment.getUrl()));
|
message.getAttachments().forEach(attachment -> stringBuilder.append(attachment.getUrl()));
|
||||||
stringBuilder.append("\n\n");
|
stringBuilder.append("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
return stringBuilder;
|
return stringBuilder;
|
||||||
@ -158,7 +158,7 @@ public class DiscordTicketHandler extends ListenerAdapter {
|
|||||||
//ignored
|
//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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ public class DiscordRanks {
|
|||||||
.filter(role -> !role.getId().equals(prefixRole))
|
.filter(role -> !role.getId().equals(prefixRole))
|
||||||
.forEach(role -> guild.removeRoleFromMember(member, role).queue());
|
.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();
|
guild.addRoleToMember(member, guild.getRoleById(prefixRole)).queue();
|
||||||
}, e -> {
|
}, e -> {
|
||||||
if(e instanceof ErrorResponseException err && err.getErrorCode() == 10007)
|
if(e instanceof ErrorResponseException err && err.getErrorCode() == 10007)
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
package de.steamwar.velocitycore.tablist;
|
package de.steamwar.velocitycore.tablist;
|
||||||
|
|
||||||
import com.velocitypowered.api.proxy.Player;
|
import com.velocitypowered.api.proxy.Player;
|
||||||
|
import com.velocitypowered.api.proxy.ServerConnection;
|
||||||
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
||||||
import de.steamwar.persistent.Servertype;
|
import de.steamwar.persistent.Servertype;
|
||||||
import de.steamwar.persistent.Subserver;
|
import de.steamwar.persistent.Subserver;
|
||||||
@ -55,7 +56,7 @@ public class TablistBuild implements TablistPart {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void print(Chatter viewer, Player player, List<Item> tablist, List<Item> direct) {
|
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)) {
|
if(players.keySet().stream().anyMatch(info -> server != info)) {
|
||||||
tablist.add(new Item(null, "", TablistServer.GRAY));
|
tablist.add(new Item(null, "", TablistServer.GRAY));
|
||||||
tablist.add(new Item(null, viewer.parseToLegacy("TABLIST_BAU"), TablistServer.LIGHT_GRAY));
|
tablist.add(new Item(null, viewer.parseToLegacy("TABLIST_BAU"), TablistServer.LIGHT_GRAY));
|
||||||
|
@ -69,7 +69,7 @@ public class TablistServer implements TablistPart {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void print(Chatter viewer, Player player, List<Item> tablist, List<Item> direct) {
|
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;
|
List<Item> items = onServer ? direct : tablist;
|
||||||
|
|
||||||
if(!onServer) {
|
if(!onServer) {
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren