SteamWar/BungeeCore
Archiviert
13
2

Update MsgCommand and RCommand to new Validator API
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed

Dieser Commit ist enthalten in:
yoyosource 2022-06-16 23:10:27 +02:00
Ursprung 5eaa87885d
Commit 81913953d8
2 geänderte Dateien mit 15 neuen und 8 gelöschten Zeilen

Datei anzeigen

@ -19,10 +19,10 @@
package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.Message;
import de.steamwar.bungeecore.listeners.ChatListener;
import de.steamwar.bungeecore.sql.IgnoreSystem;
import de.steamwar.command.SWCommand;
import de.steamwar.command.TypeValidator;
import de.steamwar.messages.ChatSender;
import net.md_5.bungee.api.connection.ProxiedPlayer;
@ -37,14 +37,21 @@ public class MsgCommand extends SWCommand {
}
@Register(description = "MSG_USAGE")
public void genericCommand(ProxiedPlayer sender, ProxiedPlayer target, String... message) {
if (message.length == 0) {
Message.send("MSG_USAGE", sender);
return;
}
public void genericCommand(ProxiedPlayer sender, ProxiedPlayer target, @Validator String... message) {
msg(sender, target, message);
}
@ClassValidator(value = String[].class, local = true)
public TypeValidator<String[]> getValidator() {
return (sender, value, messageSender) -> {
if (value.length == 0) {
messageSender.send("MSG_USAGE");
return false;
}
return true;
};
}
public static void msg(ProxiedPlayer player, ProxiedPlayer target, String[] args) {
ChatSender sender = ChatSender.of(player);
if(target == null || !target.isConnected()) {

Datei anzeigen

@ -36,11 +36,11 @@ public class RCommand extends SWCommand {
MsgCommand.msg(player, lastChats.get(player), message);
}
@ClassValidator(String[].class)
@ClassValidator(value = String[].class, local = true)
public TypeValidator<String[]> getValidator() {
return (sender, value, messageSender) -> {
if (value.length == 0) {
messageSender.accept("R_USAGE", new Object[0]);
messageSender.send("R_USAGE");
return false;
}
return true;