Optimize RCommand
Dieser Commit ist enthalten in:
Ursprung
bbb0f99382
Commit
eb81ffc9d8
@ -22,7 +22,6 @@ package de.steamwar.bungeecore.commands;
|
||||
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,21 +36,10 @@ public class MsgCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register(description = "MSG_USAGE")
|
||||
public void genericCommand(ProxiedPlayer sender, ProxiedPlayer target, @Validator String... message) {
|
||||
public void genericCommand(ProxiedPlayer sender, ProxiedPlayer target, @ErrorMessage(value = "MSG_USAGE", allowEAs = false) 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()) {
|
||||
|
@ -20,7 +20,6 @@
|
||||
package de.steamwar.bungeecore.commands;
|
||||
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.TypeValidator;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
|
||||
import static de.steamwar.bungeecore.Storage.lastChats;
|
||||
@ -32,18 +31,7 @@ public class RCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register(description = "R_USAGE")
|
||||
public void genericCommand(ProxiedPlayer player, @Validator String... message) {
|
||||
public void genericCommand(ProxiedPlayer player, @ErrorMessage(value = "MSG_USAGE", allowEAs = false) String... message) {
|
||||
MsgCommand.msg(player, lastChats.get(player), message);
|
||||
}
|
||||
|
||||
@ClassValidator(value = String[].class, local = true)
|
||||
public TypeValidator<String[]> getValidator() {
|
||||
return (sender, value, messageSender) -> {
|
||||
if (value.length == 0) {
|
||||
messageSender.send("R_USAGE");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren