diff options
| author | Lulonaut <lulonaut@tutanota.de> | 2022-11-12 13:13:05 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-12 13:13:05 +0100 |
| commit | 9d0d62d66698f1d3833e7335ba81d059233709c1 (patch) | |
| tree | b3240f4fe9fb38ef36b84690f8c508a4e2af4e88 /src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java | |
| parent | 5f521c98519a636e6139113887cdc2e223300333 (diff) | |
| download | notenoughupdates-9d0d62d66698f1d3833e7335ba81d059233709c1.tar.gz notenoughupdates-9d0d62d66698f1d3833e7335ba81d059233709c1.tar.bz2 notenoughupdates-9d0d62d66698f1d3833e7335ba81d059233709c1.zip | |
Show slayer overlay in "None" location (#437)
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.java | 27 |
1 files changed, 22 insertions, 5 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 b8e8312d..ec7ec404 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java @@ -78,6 +78,7 @@ public class SBInfo { public IChatComponent header; public String location = ""; + public String lastLocation = ""; public String date = ""; public String time = ""; public String objective = ""; @@ -279,11 +280,26 @@ public class SBInfo { } public void setLocation(String location) { - location = location == null ? location :location.intern(); - if (!Objects.equals(this.mode, location)) { - MinecraftForge.EVENT_BUS.post(new LocationChangeEvent(location, this.mode)); + location = location == null ? location : location.intern(); + if (!Objects.equals(mode, location)) { + MinecraftForge.EVENT_BUS.post(new LocationChangeEvent(location, mode)); } - this.mode = location; + mode = location; + } + + /** + * @return the current location as displayed on the scoreboard + */ + public String getScoreboardLocation() { + return location; + } + + /** + * @return the previous location as displayed on the scoreboard + * @see #getScoreboardLocation() + */ + public String getLastScoreboardLocation() { + return lastLocation; } private static final String profilePrefix = "\u00a7r\u00a7e\u00a7lProfile: \u00a7r\u00a7a"; @@ -426,8 +442,9 @@ public class SBInfo { String l = Utils.cleanColour(line).replaceAll("[^A-Za-z0-9() ]", "").trim(); if (!l.equals(location)) { new ScoreboardLocationChangeListener(location, l); + lastLocation = location; + location = l; } - location = l; break; } } |
