From eb81ffc9d86735c4eebe7d8b5c3c4a7170590ce5 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Fri, 17 Jun 2022 09:53:04 +0200 Subject: [PATCH 1/2] Optimize MsgCommand Optimize RCommand --- .../steamwar/bungeecore/commands/MsgCommand.java | 14 +------------- src/de/steamwar/bungeecore/commands/RCommand.java | 14 +------------- 2 files changed, 2 insertions(+), 26 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/MsgCommand.java b/src/de/steamwar/bungeecore/commands/MsgCommand.java index dcbc792f..8dd8e50a 100644 --- a/src/de/steamwar/bungeecore/commands/MsgCommand.java +++ b/src/de/steamwar/bungeecore/commands/MsgCommand.java @@ -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 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()) { diff --git a/src/de/steamwar/bungeecore/commands/RCommand.java b/src/de/steamwar/bungeecore/commands/RCommand.java index 13914d8d..77553510 100644 --- a/src/de/steamwar/bungeecore/commands/RCommand.java +++ b/src/de/steamwar/bungeecore/commands/RCommand.java @@ -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 getValidator() { - return (sender, value, messageSender) -> { - if (value.length == 0) { - messageSender.send("R_USAGE"); - return false; - } - return true; - }; - } } From 1ce88d071c190a19014b060da1a25428efbb402d Mon Sep 17 00:00:00 2001 From: yoyosource Date: Fri, 17 Jun 2022 09:53:30 +0200 Subject: [PATCH 2/2] Update CommonCore --- CommonCore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CommonCore b/CommonCore index c4ed8948..4e46e05a 160000 --- a/CommonCore +++ b/CommonCore @@ -1 +1 @@ -Subproject commit c4ed8948ad5bb2cb8414ee2d3408e52928237908 +Subproject commit 4e46e05a3b0c627a34631848874fc56d14ba56e4