SteamWar/BungeeCore
Archiviert
13
2

Merge remote-tracking branch 'origin/master'

Dieser Commit ist enthalten in:
yoyosource 2021-08-24 14:24:09 +02:00
Commit 8140ea3ab3
5 geänderte Dateien mit 32 neuen und 7 gelöschten Zeilen

Datei anzeigen

@ -67,7 +67,7 @@ public class SchematicsManager {
if (message == null) { if (message == null) {
message = textChannel.sendMessage(messageBuilder.build()).complete(); message = textChannel.sendMessage(messageBuilder.build()).complete();
} else { } else {
message.editMessage(messageBuilder.build()).complete(); message.editMessage(messageBuilder.build()).queue();
} }
} }
} }

Datei anzeigen

@ -63,6 +63,6 @@ public class IngameChatListener extends BasicDiscordListener {
assert textChannel != null; assert textChannel != null;
MessageBuilder messageBuilder = new MessageBuilder(); MessageBuilder messageBuilder = new MessageBuilder();
messageBuilder.append(message.replace("&", "").replace("@everyone", "`@everyone`").replace("@here", "`@here`").replaceAll("<[@#]!?\\d+>", "`$0`")); messageBuilder.append(message.replace("&", "").replace("@everyone", "`@everyone`").replace("@here", "`@here`").replaceAll("<[@#]!?\\d+>", "`$0`"));
textChannel.sendMessage(messageBuilder.build()).complete(); textChannel.sendMessage(messageBuilder.build()).queue();
} }
} }

Datei anzeigen

@ -54,6 +54,6 @@ public class ServerTeamChatListener extends BasicDiscordListener {
assert textChannel != null; assert textChannel != null;
MessageBuilder messageBuilder = new MessageBuilder(); MessageBuilder messageBuilder = new MessageBuilder();
messageBuilder.append(message.replace("&", "")); messageBuilder.append(message.replace("&", ""));
textChannel.sendMessage(messageBuilder.build()).complete(); textChannel.sendMessage(messageBuilder.build()).queue();
} }
} }

Datei anzeigen

@ -49,7 +49,7 @@ public class DiscordSchemAlert {
MessageBuilder messageBuilder = new MessageBuilder(); MessageBuilder messageBuilder = new MessageBuilder();
messageBuilder.setEmbeds(builder.build()); messageBuilder.setEmbeds(builder.build());
try { try {
dcUser.openPrivateChannel().complete().sendMessage(messageBuilder.build()).complete(); dcUser.openPrivateChannel().complete().sendMessage(messageBuilder.build()).queue();
} catch (Exception e) { } catch (Exception e) {
// Ignored // Ignored
} }
@ -70,7 +70,7 @@ public class DiscordSchemAlert {
messageBuilder.setEmbeds(builder.build()); messageBuilder.setEmbeds(builder.build());
messageBuilder.setActionRows(ActionRow.of(Button.success("tada", Emoji.fromUnicode("U+1F389")))); messageBuilder.setActionRows(ActionRow.of(Button.success("tada", Emoji.fromUnicode("U+1F389"))));
try { try {
dcUser.openPrivateChannel().complete().sendMessage(messageBuilder.build()).complete(); dcUser.openPrivateChannel().complete().sendMessage(messageBuilder.build()).queue();
} catch (Exception e) { } catch (Exception e) {
// Ignored // Ignored
} }

Datei anzeigen

@ -37,8 +37,33 @@ public class AlertCommand extends BasicCommand {
return; return;
} }
String s = String.join(" ", args); String s;
boolean discordAnnounce = false;
if (args[0].equals("-discord")) {
if (args.length == 1) {
Message.send("USAGE_ALERT", sender);
return;
}
discordAnnounce = true;
s = join(1, args);
} else {
s = join(0, args);
}
Message.broadcast("ALERT", ChatColor.translateAlternateColorCodes('&', s)); Message.broadcast("ALERT", ChatColor.translateAlternateColorCodes('&', s));
if (discordAnnounce) {
SteamwarDiscordBot.instance().getAnnouncementListener().announce(s); SteamwarDiscordBot.instance().getAnnouncementListener().announce(s);
} }
} }
private String join(int startIndex, String... strings) {
StringBuilder st = new StringBuilder();
for (int i = startIndex; i < strings.length; i++) {
if (i != startIndex) {
st.append(" ");
}
st.append(strings[i]);
}
return st.toString();
}
}