diff options
author | Cow <cow@volloeko.de> | 2023-07-22 22:32:17 +0200 |
---|---|---|
committer | Cow <cow@volloeko.de> | 2023-07-22 22:32:17 +0200 |
commit | 58234e9074b58f2c523df51171fcfa77b44f2ae8 (patch) | |
tree | 36d12e312026703e5700b25ce2cd4396684be090 /src/main/java/de/cowtipper/cowlection/config/CredentialStorage.java | |
parent | 0ce8dc4ff8fa01fa17963c2ca7577700956ecf43 (diff) | |
download | Cowlection-58234e9074b58f2c523df51171fcfa77b44f2ae8.tar.gz Cowlection-58234e9074b58f2c523df51171fcfa77b44f2ae8.tar.bz2 Cowlection-58234e9074b58f2c523df51171fcfa77b44f2ae8.zip |
Changed API key validation
Diffstat (limited to 'src/main/java/de/cowtipper/cowlection/config/CredentialStorage.java')
-rw-r--r-- | src/main/java/de/cowtipper/cowlection/config/CredentialStorage.java | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/src/main/java/de/cowtipper/cowlection/config/CredentialStorage.java b/src/main/java/de/cowtipper/cowlection/config/CredentialStorage.java index 5b1b0b1..309e76e 100644 --- a/src/main/java/de/cowtipper/cowlection/config/CredentialStorage.java +++ b/src/main/java/de/cowtipper/cowlection/config/CredentialStorage.java @@ -1,9 +1,7 @@ package de.cowtipper.cowlection.config; import de.cowtipper.cowlection.Cowlection; -import de.cowtipper.cowlection.util.ApiUtils; import de.cowtipper.cowlection.util.Utils; -import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.MathHelper; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.config.Property; @@ -131,23 +129,7 @@ public class CredentialStorage { return false; } - public void setMooIfValid(String moo, boolean commandTriggered) { - ApiUtils.fetchApiKeyInfo(moo, hyApiKey -> { - if (hyApiKey != null && hyApiKey.isSuccess()) { - // api key is valid! - Cowlection.getInstance().getMoo().setMoo(moo); - if (commandTriggered) { - Cowlection.getInstance().getChatHelper().sendMessage(EnumChatFormatting.GREEN, "[" + Cowlection.MODNAME + "] Successfully verified API key ✔"); - } - } else if (commandTriggered) { - // api key is invalid - String cause = hyApiKey != null ? hyApiKey.getCause() : null; - Cowlection.getInstance().getChatHelper().sendMessage(EnumChatFormatting.RED, "[" + Cowlection.MODNAME + "] Failed to verify API key: " + (cause != null ? cause : "unknown cause :c")); - } - }); - } - - private void setMoo(String moo) { + public void setMoo(String moo) { CredentialStorage.moo = moo; propMoo.set(moo); setMooValidity(true); |