From e218704d5bdae6384ce16e170505a2d5753b9e69 Mon Sep 17 00:00:00 2001 From: Christian Koop Date: Fri, 14 May 2021 16:47:53 +0200 Subject: [PATCH 1/4] Fix bulk hologram update Fixing a bug introduced in 1474980b63a9d4dd26bd84a5e433e585b54d51d5 causing some holograms to not update properly --- .../com/songoda/core/hooks/holograms/CMIHolograms.java | 9 +++------ .../hooks/holograms/HolographicDisplaysHolograms.java | 7 +++++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Core/src/main/java/com/songoda/core/hooks/holograms/CMIHolograms.java b/Core/src/main/java/com/songoda/core/hooks/holograms/CMIHolograms.java index d6841a67..6062994e 100644 --- a/Core/src/main/java/com/songoda/core/hooks/holograms/CMIHolograms.java +++ b/Core/src/main/java/com/songoda/core/hooks/holograms/CMIHolograms.java @@ -20,7 +20,7 @@ public class CMIHolograms extends Holograms { private static CMI cmi; private static HologramManager cmiHologramManager; - private static HashSet ourHolograms = new HashSet(); + private static HashSet ourHolograms = new HashSet<>(); private static Method cmi_CMIHologram_getLines; private static boolean useOldMethod; @@ -98,7 +98,7 @@ public class CMIHolograms extends Holograms { } } catch (Exception ex) { Logger.getLogger(CMIHolograms.class.getName()).log(Level.SEVERE, "CMI Hologram error!", ex); - holoLines = Collections.EMPTY_LIST; + holoLines = Collections.emptyList(); } boolean isChanged = lines.size() != holoLines.size(); if (!isChanged) { @@ -128,7 +128,6 @@ public class CMIHolograms extends Holograms { } private void createAt(Location location, List lines) { - final String id = locStr(location); CMIHologram holo = new CMIHologram(id, location); holo.setLines(lines); @@ -136,8 +135,6 @@ public class CMIHolograms extends Holograms { cmiHologramManager.addHologram(holo); holo.update(); - if (!ourHolograms.contains(id)) { - ourHolograms.add(id); - } + ourHolograms.add(id); } } diff --git a/Core/src/main/java/com/songoda/core/hooks/holograms/HolographicDisplaysHolograms.java b/Core/src/main/java/com/songoda/core/hooks/holograms/HolographicDisplaysHolograms.java index 0e6a601a..c3e4682f 100644 --- a/Core/src/main/java/com/songoda/core/hooks/holograms/HolographicDisplaysHolograms.java +++ b/Core/src/main/java/com/songoda/core/hooks/holograms/HolographicDisplaysHolograms.java @@ -2,6 +2,7 @@ package com.songoda.core.hooks.holograms; import com.gmail.filoghost.holographicdisplays.api.Hologram; import com.gmail.filoghost.holographicdisplays.api.HologramsAPI; +import com.gmail.filoghost.holographicdisplays.api.line.TextLine; import org.bukkit.Location; import org.bukkit.plugin.Plugin; @@ -56,6 +57,7 @@ public class HolographicDisplaysHolograms extends Holograms { public void bulkUpdateHolograms(Map> hologramData) { Collection holograms = HologramsAPI.getHolograms(plugin); + outerFor: for (Map.Entry> entry : hologramData.entrySet()) { Location location = fixLocation(entry.getKey()); List lines = entry.getValue(); @@ -71,7 +73,8 @@ public class HolographicDisplaysHolograms extends Holograms { if (!isChanged) { // double-check the lines for (int i = 0; !isChanged && i < lines.size(); ++i) { - isChanged = !hologram.getLine(i).toString().equals("CraftTextLine [text=" + lines.get(i) + "]"); + isChanged = !(hologram.getLine(i) instanceof TextLine) || + !((TextLine) hologram.getLine(i)).getText().equals(lines.get(i)); } } @@ -83,7 +86,7 @@ public class HolographicDisplaysHolograms extends Holograms { } } - return; + continue outerFor; } createAt(location, lines); From 9497be1a4bdab23363a387f0d126db1bf84daba2 Mon Sep 17 00:00:00 2001 From: Christian Koop Date: Fri, 16 Apr 2021 01:24:05 +0200 Subject: [PATCH 2/4] Fix NPE when using uppercase color chars in lang files (SD-7134) From 108ec6a2ede497881910110df3388cf5b5f6becf Mon Sep 17 00:00:00 2001 From: Brianna Date: Thu, 27 May 2021 09:53:45 -0500 Subject: [PATCH 3/4] Allow updating holograms in bulk This improves performance when using *HolographicDisplays* drastically on many holograms. Plugins like *EpicAnchors* might need to manage and update a lot of holograms frequently, causing SongodaCore to fetch all the holograms from the external API (My test setup reduced the time needed to update from ~30ms to ~1ms) --- .../core/hooks/holograms/HolographicDisplaysHolograms.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Core/src/main/java/com/songoda/core/hooks/holograms/HolographicDisplaysHolograms.java b/Core/src/main/java/com/songoda/core/hooks/holograms/HolographicDisplaysHolograms.java index c3e4682f..a62cd67d 100644 --- a/Core/src/main/java/com/songoda/core/hooks/holograms/HolographicDisplaysHolograms.java +++ b/Core/src/main/java/com/songoda/core/hooks/holograms/HolographicDisplaysHolograms.java @@ -57,7 +57,6 @@ public class HolographicDisplaysHolograms extends Holograms { public void bulkUpdateHolograms(Map> hologramData) { Collection holograms = HologramsAPI.getHolograms(plugin); - outerFor: for (Map.Entry> entry : hologramData.entrySet()) { Location location = fixLocation(entry.getKey()); List lines = entry.getValue(); @@ -73,8 +72,7 @@ public class HolographicDisplaysHolograms extends Holograms { if (!isChanged) { // double-check the lines for (int i = 0; !isChanged && i < lines.size(); ++i) { - isChanged = !(hologram.getLine(i) instanceof TextLine) || - !((TextLine) hologram.getLine(i)).getText().equals(lines.get(i)); + isChanged = !hologram.getLine(i).toString().equals("CraftTextLine [text=" + lines.get(i) + "]"); } } @@ -86,7 +84,7 @@ public class HolographicDisplaysHolograms extends Holograms { } } - continue outerFor; + return; } createAt(location, lines); From 853c6b2b40905fb4d6a506fe7fb51c83831cabda Mon Sep 17 00:00:00 2001 From: Brianna Date: Thu, 27 May 2021 09:55:02 -0500 Subject: [PATCH 4/4] version 2.4.54 --- Core/pom.xml | 2 +- Core/src/main/java/com/songoda/core/SongodaCore.java | 2 +- NMS/NMS-API/pom.xml | 2 +- NMS/NMS-v1_10_R1/pom.xml | 2 +- NMS/NMS-v1_11_R1/pom.xml | 2 +- NMS/NMS-v1_12_R1/pom.xml | 2 +- NMS/NMS-v1_13_R1/pom.xml | 2 +- NMS/NMS-v1_13_R2/pom.xml | 2 +- NMS/NMS-v1_14_R1/pom.xml | 2 +- NMS/NMS-v1_15_R1/pom.xml | 2 +- NMS/NMS-v1_16_R1/pom.xml | 2 +- NMS/NMS-v1_16_R2/pom.xml | 2 +- NMS/NMS-v1_16_R3/pom.xml | 2 +- NMS/NMS-v1_8_R1/pom.xml | 2 +- NMS/NMS-v1_8_R2/pom.xml | 2 +- NMS/NMS-v1_8_R3/pom.xml | 2 +- NMS/NMS-v1_9_R1/pom.xml | 2 +- NMS/NMS-v1_9_R2/pom.xml | 2 +- README.md | 4 ++-- pom.xml | 2 +- 20 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Core/pom.xml b/Core/pom.xml index b41a79cc..f44f1352 100644 --- a/Core/pom.xml +++ b/Core/pom.xml @@ -3,7 +3,7 @@ com.songoda SongodaCore-Modules - 2.4.53 + 2.4.54 ../ diff --git a/Core/src/main/java/com/songoda/core/SongodaCore.java b/Core/src/main/java/com/songoda/core/SongodaCore.java index de5986c9..31489ddc 100644 --- a/Core/src/main/java/com/songoda/core/SongodaCore.java +++ b/Core/src/main/java/com/songoda/core/SongodaCore.java @@ -56,7 +56,7 @@ public class SongodaCore { /** * This has been added as of Rev 6 */ - private final static String coreVersion = "2.4.53"; + private final static String coreVersion = "2.4.54"; /** * This is specific to the website api diff --git a/NMS/NMS-API/pom.xml b/NMS/NMS-API/pom.xml index ada3f1cb..cd474c4f 100644 --- a/NMS/NMS-API/pom.xml +++ b/NMS/NMS-API/pom.xml @@ -3,7 +3,7 @@ com.songoda SongodaCore-Modules - 2.4.53 + 2.4.54 ../../ diff --git a/NMS/NMS-v1_10_R1/pom.xml b/NMS/NMS-v1_10_R1/pom.xml index 78699f3e..a9c596a9 100644 --- a/NMS/NMS-v1_10_R1/pom.xml +++ b/NMS/NMS-v1_10_R1/pom.xml @@ -3,7 +3,7 @@ com.songoda SongodaCore-Modules - 2.4.53 + 2.4.54 ../../ diff --git a/NMS/NMS-v1_11_R1/pom.xml b/NMS/NMS-v1_11_R1/pom.xml index 4bf18fb8..528d4460 100644 --- a/NMS/NMS-v1_11_R1/pom.xml +++ b/NMS/NMS-v1_11_R1/pom.xml @@ -3,7 +3,7 @@ com.songoda SongodaCore-Modules - 2.4.53 + 2.4.54 ../../ diff --git a/NMS/NMS-v1_12_R1/pom.xml b/NMS/NMS-v1_12_R1/pom.xml index ba697e1a..f53961ee 100644 --- a/NMS/NMS-v1_12_R1/pom.xml +++ b/NMS/NMS-v1_12_R1/pom.xml @@ -3,7 +3,7 @@ com.songoda SongodaCore-Modules - 2.4.53 + 2.4.54 ../../ diff --git a/NMS/NMS-v1_13_R1/pom.xml b/NMS/NMS-v1_13_R1/pom.xml index a1660c33..97255dc8 100644 --- a/NMS/NMS-v1_13_R1/pom.xml +++ b/NMS/NMS-v1_13_R1/pom.xml @@ -3,7 +3,7 @@ com.songoda SongodaCore-Modules - 2.4.53 + 2.4.54 ../../ diff --git a/NMS/NMS-v1_13_R2/pom.xml b/NMS/NMS-v1_13_R2/pom.xml index ff01f630..dcd8d8dc 100644 --- a/NMS/NMS-v1_13_R2/pom.xml +++ b/NMS/NMS-v1_13_R2/pom.xml @@ -3,7 +3,7 @@ com.songoda SongodaCore-Modules - 2.4.53 + 2.4.54 ../../ diff --git a/NMS/NMS-v1_14_R1/pom.xml b/NMS/NMS-v1_14_R1/pom.xml index 556dd6a2..d421b324 100644 --- a/NMS/NMS-v1_14_R1/pom.xml +++ b/NMS/NMS-v1_14_R1/pom.xml @@ -3,7 +3,7 @@ com.songoda SongodaCore-Modules - 2.4.53 + 2.4.54 ../../ diff --git a/NMS/NMS-v1_15_R1/pom.xml b/NMS/NMS-v1_15_R1/pom.xml index 30403214..2199ce5a 100644 --- a/NMS/NMS-v1_15_R1/pom.xml +++ b/NMS/NMS-v1_15_R1/pom.xml @@ -3,7 +3,7 @@ com.songoda SongodaCore-Modules - 2.4.53 + 2.4.54 ../../ diff --git a/NMS/NMS-v1_16_R1/pom.xml b/NMS/NMS-v1_16_R1/pom.xml index 3f399d41..c5c2123b 100644 --- a/NMS/NMS-v1_16_R1/pom.xml +++ b/NMS/NMS-v1_16_R1/pom.xml @@ -3,7 +3,7 @@ com.songoda SongodaCore-Modules - 2.4.53 + 2.4.54 ../../ diff --git a/NMS/NMS-v1_16_R2/pom.xml b/NMS/NMS-v1_16_R2/pom.xml index 49866ad9..4475e736 100644 --- a/NMS/NMS-v1_16_R2/pom.xml +++ b/NMS/NMS-v1_16_R2/pom.xml @@ -3,7 +3,7 @@ com.songoda SongodaCore-Modules - 2.4.53 + 2.4.54 ../../ diff --git a/NMS/NMS-v1_16_R3/pom.xml b/NMS/NMS-v1_16_R3/pom.xml index 2493cb1f..1e91ce50 100644 --- a/NMS/NMS-v1_16_R3/pom.xml +++ b/NMS/NMS-v1_16_R3/pom.xml @@ -3,7 +3,7 @@ com.songoda SongodaCore-Modules - 2.4.53 + 2.4.54 ../../ diff --git a/NMS/NMS-v1_8_R1/pom.xml b/NMS/NMS-v1_8_R1/pom.xml index e268c760..466f0937 100644 --- a/NMS/NMS-v1_8_R1/pom.xml +++ b/NMS/NMS-v1_8_R1/pom.xml @@ -3,7 +3,7 @@ com.songoda SongodaCore-Modules - 2.4.53 + 2.4.54 ../../ diff --git a/NMS/NMS-v1_8_R2/pom.xml b/NMS/NMS-v1_8_R2/pom.xml index 1fff5595..d2882d3b 100644 --- a/NMS/NMS-v1_8_R2/pom.xml +++ b/NMS/NMS-v1_8_R2/pom.xml @@ -3,7 +3,7 @@ com.songoda SongodaCore-Modules - 2.4.53 + 2.4.54 ../../ diff --git a/NMS/NMS-v1_8_R3/pom.xml b/NMS/NMS-v1_8_R3/pom.xml index 5d827e3a..d08f12db 100644 --- a/NMS/NMS-v1_8_R3/pom.xml +++ b/NMS/NMS-v1_8_R3/pom.xml @@ -3,7 +3,7 @@ com.songoda SongodaCore-Modules - 2.4.53 + 2.4.54 ../../ diff --git a/NMS/NMS-v1_9_R1/pom.xml b/NMS/NMS-v1_9_R1/pom.xml index 2d3b251b..255a4ae5 100644 --- a/NMS/NMS-v1_9_R1/pom.xml +++ b/NMS/NMS-v1_9_R1/pom.xml @@ -3,7 +3,7 @@ com.songoda SongodaCore-Modules - 2.4.53 + 2.4.54 ../../ diff --git a/NMS/NMS-v1_9_R2/pom.xml b/NMS/NMS-v1_9_R2/pom.xml index 82183960..938497f0 100644 --- a/NMS/NMS-v1_9_R2/pom.xml +++ b/NMS/NMS-v1_9_R2/pom.xml @@ -3,7 +3,7 @@ com.songoda SongodaCore-Modules - 2.4.53 + 2.4.54 ../../ diff --git a/README.md b/README.md index dbfe7137..ce6fcfee 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ Maven Information com.songoda SongodaCore - 2.4.53 + 2.4.54 provided ``` @@ -37,6 +37,6 @@ repositories { * Artifact: ```groovy dependencies { - compileOnly 'com.songoda:SongodaCore:2.4.53' + compileOnly 'com.songoda:SongodaCore:2.4.54' } ``` \ No newline at end of file diff --git a/pom.xml b/pom.xml index c685205d..e521b142 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ com.songoda SongodaCore-Modules - 2.4.53 + 2.4.54 4.0.0 pom