SteamWar/BungeeCore
Archiviert
13
2

Hotfix SWCommand
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
yoyosource 2022-06-16 22:53:25 +02:00
Ursprung c6a68fa2a1
Commit 5eaa87885d
3 geänderte Dateien mit 15 neuen und 8 gelöschten Zeilen

@ -1 +1 @@
Subproject commit b1328695a1a30c062d066ff564a9112fde668b3e Subproject commit 09a9d8980b0186e7e5e17c14ef651a9684bc8651

Datei anzeigen

@ -19,8 +19,8 @@
package de.steamwar.bungeecore.commands; package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.Message;
import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommand;
import de.steamwar.command.TypeValidator;
import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.connection.ProxiedPlayer;
import static de.steamwar.bungeecore.Storage.lastChats; import static de.steamwar.bungeecore.Storage.lastChats;
@ -32,11 +32,18 @@ public class RCommand extends SWCommand {
} }
@Register(description = "R_USAGE") @Register(description = "R_USAGE")
public void genericCommand(ProxiedPlayer player, String... message) { public void genericCommand(ProxiedPlayer player, @Validator String... message) {
if (message.length == 0) {
Message.send("R_USAGE", player);
return;
}
MsgCommand.msg(player, lastChats.get(player), message); MsgCommand.msg(player, lastChats.get(player), message);
} }
@ClassValidator(String[].class)
public TypeValidator<String[]> getValidator() {
return (sender, value, messageSender) -> {
if (value.length == 0) {
messageSender.accept("R_USAGE", new Object[0]);
return false;
}
return true;
};
}
} }

Datei anzeigen

@ -21,5 +21,5 @@ package de.steamwar.command;
import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.CommandSender;
public interface Validator<T> extends AbstractValidator<CommandSender, T> { public interface TypeValidator<T> extends AbstractValidator<CommandSender, T> {
} }