aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java
diff options
context:
space:
mode:
authorBuildTools <james.jenour@protonmail.com>2021-01-28 23:36:00 +0800
committerBuildTools <james.jenour@protonmail.com>2021-01-28 23:36:00 +0800
commit659a0e4981640802058d9eef35fec16fab82c5f2 (patch)
tree062c599660c17cdbc843cb2734f3b797a017dfee /src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java
parent64959d248b383375274628b5e8d83cd7f9c4e96d (diff)
downloadnotenoughupdates-659a0e4981640802058d9eef35fec16fab82c5f2.tar.gz
notenoughupdates-659a0e4981640802058d9eef35fec16fab82c5f2.tar.bz2
notenoughupdates-659a0e4981640802058d9eef35fec16fab82c5f2.zip
PRE12
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java b/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java
index 3e44dbda..1e29fb5e 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java
@@ -45,6 +45,7 @@ public class SBInfo {
public void onWorldChange(WorldEvent.Load event) {
lastLocRaw = -1;
locraw = null;
+ mode = null;
}
@SubscribeEvent
@@ -53,9 +54,10 @@ public class SBInfo {
try {
JsonObject obj = NotEnoughUpdates.INSTANCE.manager.gson.fromJson(event.message.getUnformattedText(), JsonObject.class);
if(obj.has("server")) {
- if(System.currentTimeMillis() - lastLocRaw < 5000) event.setCanceled(true);
+ if(true || System.currentTimeMillis() - lastLocRaw < 5000) event.setCanceled(true);
if(obj.has("gametype") && obj.has("mode") && obj.has("map")) {
locraw = obj;
+ mode = locraw.get("mode").getAsString();
}
}
} catch(Exception e) {
@@ -65,10 +67,10 @@ public class SBInfo {
}
public String getLocation() {
- if(locraw == null) {
+ if(mode == null) {
return null;
}
- return locraw.get("mode").getAsString();
+ return mode;
}
public void tick() {