geforkt von SteamWar/BungeeCore
Merge pull request 'Add better AlertCommand' (#233) from BetterAlert into master
Reviewed-on: SteamWar/BungeeCore#233 Reviewed-by: Lixfel <lixfel@steamwar.de>
Dieser Commit ist enthalten in:
Commit
8c58c1a1d4
@ -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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren