Merge pull request 'Update VerifyCommand' (#407) from CommandVerify into master
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
Reviewed-on: #407 Reviewed-by: Lixfel <lixfel@steamwar.de>
Dieser Commit ist enthalten in:
Commit
dd9651d6c8
@ -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());
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren