aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/de
diff options
context:
space:
mode:
authorKevinthegreat <92656833+kevinthegreat1@users.noreply.github.com>2023-10-29 02:56:50 -0400
committerKevinthegreat <92656833+kevinthegreat1@users.noreply.github.com>2023-10-30 00:25:41 -0400
commitb944188297014cf0bbd5ebcb4c124b2ca77a5cee (patch)
tree81496426e05060299d1ea2b368fa8055546b0196 /src/main/java/de
parent81c6d870e9806729eb20be5e2d6c5fbe05ab8a02 (diff)
downloadSkyblocker-b944188297014cf0bbd5ebcb4c124b2ca77a5cee.tar.gz
Skyblocker-b944188297014cf0bbd5ebcb4c124b2ca77a5cee.tar.bz2
Skyblocker-b944188297014cf0bbd5ebcb4c124b2ca77a5cee.zip
Refactor TooltipInfoType#run
Diffstat (limited to 'src/main/java/de')
-rw-r--r--src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/TooltipInfoType.java19
1 files changed, 5 insertions, 14 deletions
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/TooltipInfoType.java b/src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/TooltipInfoType.java
index b786f4c1..086fcb00 100644
--- a/src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/TooltipInfoType.java
+++ b/src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/TooltipInfoType.java
@@ -82,10 +82,6 @@ public enum TooltipInfoType implements Runnable {
return data;
}
- public void setData(JsonObject data) {
- this.data = data;
- }
-
/**
* Checks if the data has the given member name and sends a warning message if data is null.
*
@@ -135,18 +131,13 @@ public enum TooltipInfoType implements Runnable {
@Override
public void run() {
try {
- if (this.cacheable) {
+ if (cacheable) {
HttpHeaders headers = Http.sendHeadRequest(address);
- long combinedHash = Http.getEtag(headers).hashCode() + Http.getLastModified(headers).hashCode();
-
- switch (this) {
- case NPC, MOTES, MUSEUM, COLOR:
- if (this.hash == combinedHash) return;
- else this.hash = combinedHash;
- }
+ long hash = Http.getEtag(headers).hashCode() + Http.getLastModified(headers).hashCode();
+ if (this.hash == hash) return;
+ else this.hash = hash;
}
-
- setData(SkyblockerMod.GSON.fromJson(Http.sendGetRequest(address), JsonObject.class));
+ data = SkyblockerMod.GSON.fromJson(Http.sendGetRequest(address), JsonObject.class);
} catch (Exception e) {
ItemTooltip.LOGGER.warn("[Skyblocker] Failed to download " + this + " prices!", e);
}