From 99807470ec57372b763e97d9f780838cd0b9cefe Mon Sep 17 00:00:00 2001 From: yoyosource Date: Thu, 16 Jun 2022 12:18:15 +0200 Subject: [PATCH] Update VerifyCommand --- .../bungeecore/commands/VerifyCommand.java | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/VerifyCommand.java b/src/de/steamwar/bungeecore/commands/VerifyCommand.java index cbc5430..cff943c 100644 --- a/src/de/steamwar/bungeecore/commands/VerifyCommand.java +++ b/src/de/steamwar/bungeecore/commands/VerifyCommand.java @@ -23,27 +23,25 @@ import de.steamwar.bungeecore.BungeeCore; import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.bot.AuthManager; import de.steamwar.bungeecore.sql.SteamwarUser; +import de.steamwar.command.SWCommand; +import jdk.nashorn.internal.runtime.Property; import net.dv8tion.jda.api.entities.Member; import net.md_5.bungee.api.CommandSender; +import net.md_5.bungee.api.connection.ProxiedPlayer; import java.util.Base64; -public class VerifyCommand extends BasicCommand { +public class VerifyCommand extends SWCommand { public VerifyCommand() { - super("verify", ""); + super("verify"); } - @Override - public void execute(CommandSender sender, String[] strings) { - if(strings.length < 1) { - Message.send("VERIFY_USAGE", sender); - return; - } - + @Register(description = "VERIFY_USAGE") + public void genericCommand(ProxiedPlayer sender, String code) { byte[] bytes; try { - bytes = Base64.getDecoder().decode(strings[0]); + bytes = Base64.getDecoder().decode(code); } catch (IllegalArgumentException e) { Message.send("VERIFY_INVALID", sender); return; @@ -54,7 +52,7 @@ public class VerifyCommand extends BasicCommand { return; } if(bytes[0] == 'D' && bytes[1] == 'C') { - Member member = AuthManager.connectAuth(SteamwarUser.get(sender.getName()), strings[0]); + Member member = AuthManager.connectAuth(SteamwarUser.get(sender.getName()), code); if(member != null) { BungeeCore.log(sender.getName() + " Verified with Discorduser: " + member.getIdLong()); Message.send("VERIFY_SUCCESS", sender, member.getUser().getAsTag());