aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/de/cowtipper/cowlection/config
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/de/cowtipper/cowlection/config')
-rw-r--r--src/main/java/de/cowtipper/cowlection/config/CredentialStorage.java20
-rw-r--r--src/main/java/de/cowtipper/cowlection/config/MooConfig.java4
2 files changed, 3 insertions, 21 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);
diff --git a/src/main/java/de/cowtipper/cowlection/config/MooConfig.java b/src/main/java/de/cowtipper/cowlection/config/MooConfig.java
index 9a9ba4b..38b7396 100644
--- a/src/main/java/de/cowtipper/cowlection/config/MooConfig.java
+++ b/src/main/java/de/cowtipper/cowlection/config/MooConfig.java
@@ -162,7 +162,7 @@ public class MooConfig {
String oldMoo = cfg.getString("moo", Configuration.CATEGORY_CLIENT, "00000000-0000-0000-0000-000000000000", "Temporary config entry, should be deleted automatically.", Utils.VALID_UUID_PATTERN);
if (StringUtils.isNotEmpty(oldMoo) && Utils.isValidUuid(oldMoo)) {
// save into new cfg:
- main.getMoo().setMooIfValid(oldMoo, false);
+ main.getMoo().setMoo(oldMoo);
}
}
@@ -333,7 +333,7 @@ public class MooConfig {
// Sub-Category: API settings
subCat = configCat.addSubCategory("API settings");
subCat.addExplanations("Some features use the official Hypixel API and therefore require your API key.",
- "Use " + EnumChatFormatting.YELLOW + "/moo apikey " + EnumChatFormatting.RESET + "to see how to request a new API key from Hypixel",
+ "Use " + EnumChatFormatting.YELLOW + "/moo apikey " + EnumChatFormatting.RESET + "to set your Hypixel API key",
"The API key is stored " + EnumChatFormatting.ITALIC + "locally " + EnumChatFormatting.ITALIC + "on your computer.");
subCat.addConfigEntry(main.getMoo().getPropIsMooValid());