SteamWar/BungeeCore
Archiviert
13
2

Merge pull request 'Update MsgCommand' (#389) from CommandMsg into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Reviewed-on: #389
Reviewed-by: Lixfel <lixfel@steamwar.de>
Dieser Commit ist enthalten in:
Lixfel 2022-06-16 13:14:14 +02:00
Commit 7c898ac869

Datei anzeigen

@ -21,34 +21,23 @@ package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.listeners.ChatListener; import de.steamwar.bungeecore.listeners.ChatListener;
import de.steamwar.bungeecore.sql.IgnoreSystem; import de.steamwar.bungeecore.sql.IgnoreSystem;
import de.steamwar.command.SWCommand;
import de.steamwar.messages.ChatSender; import de.steamwar.messages.ChatSender;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.connection.ProxiedPlayer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.stream.Stream; import java.util.stream.Stream;
import static de.steamwar.bungeecore.Storage.lastChats; import static de.steamwar.bungeecore.Storage.lastChats;
public class MsgCommand extends BasicCommand { public class MsgCommand extends SWCommand {
public MsgCommand() { public MsgCommand() {
super("msg", "", "w", "tell"); super("msg", "", "w", "tell");
} }
@Override @Register(description = "MSG_USAGE")
public void execute(CommandSender sender, String[] args) { public void genericCommand(ProxiedPlayer sender, ProxiedPlayer target, String... message) {
if(!(sender instanceof ProxiedPlayer)) msg(sender, target, message);
return;
if (args.length < 2) {
ChatSender.of(sender).system("MSG_USAGE");
return;
}
msg((ProxiedPlayer) sender, ProxyServer.getInstance().getPlayer(args[0]), Arrays.copyOfRange(args, 1, args.length));
} }
public static void msg(ProxiedPlayer player, ProxiedPlayer target, String[] args) { public static void msg(ProxiedPlayer player, ProxiedPlayer target, String[] args) {
@ -69,14 +58,6 @@ public class MsgCommand extends BasicCommand {
lastChats.put(target, player); lastChats.put(target, player);
} }
@Override
public Iterable<String> onTabComplete(CommandSender commandSender, String[] args) {
if(args.length == 1){
return allPlayers(args[0]);
}
return new ArrayList<>();
}
public static void remove(ProxiedPlayer player){ public static void remove(ProxiedPlayer player){
lastChats.remove(player); lastChats.remove(player);
} }