diff --git a/NOTICE b/NOTICE
index 499fd266..94d212c8 100644
--- a/NOTICE
+++ b/NOTICE
@@ -11,7 +11,7 @@ Source Code: https://github.com/TownyAdvanced/FlagWar/blob/main/LICENSE
FlagWar originally developed under the title "CellWar", then later incorporated into Towny, by Chris Holland.
(https://github.com/Zren/CellWar | https://github.com/Zren/Towny)
-Towny has developed and maintained by TownyAdvanced since 2011. (https://github.com/TownyAdvanced/Towny)
+Towny has been developed and maintained by TownyAdvanced since 2011. (https://github.com/TownyAdvanced/Towny)
Any prior code found on the com.palmergames.* classpath remains under previous copyrights, and
Towny's Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
@@ -38,13 +38,19 @@ Towny is licensed under the Creative Commons Attribution-NonCommercial-NoDerivs
Full License: https://github.com/TownyAdvanced/Towny/blob/master/LICENSE.MD
Source Code: https://github.com/TownyAdvanced/Towny/
Copyright © 2011-2012 Chris Holland
-Copyright © 2012-2022 TownyAdvanced
+Copyright © 2012-2026 TownyAdvanced
-/ DecentHolograms (Soft Dependency) /
+/ DecentHolograms (API, Soft Dependency) /
DecentHolograms is licensed under the GNU General Public License Version 3, or any later version.
Full License: https://github.com/DecentSoftware-eu/DecentHolograms/blob/main/LICENSE
Source Code: https://github.com/DecentSoftware-eu/DecentHolograms/
-Copyright © 2021-2024 DecentSoftware and Contributors (https://github.com/DecentSoftware-eu/DecentHolograms/graphs/contributors)
+Copyright © 2021-2026 DecentSoftware and Contributors (https://github.com/DecentSoftware-eu/DecentHolograms/graphs/contributors)
+
+/ CMILib & CMI-API (API, Soft Dependency) /
+Provided publicly for optional interoperability with CMI.
+Source Code - CMILib: https://github.com/Zrips/CMILib
+Source Code - CMI-API: https://github.com/Zrips/CMI-API
+Copyright © 2017-2026 Zrips, All Rights Reserved
// Annotations //
@@ -52,22 +58,22 @@ Copyright © 2021-2024 DecentSoftware and Contributors (https://github.com/Decen
JetBrains annotations are provided under version 2 of the Apache License. (Apache-2)
Full License: https://github.com/JetBrains/java-annotations/blob/master/LICENSE.txt
Source Code: https://github.com/JetBrains/java-annotations
-Copyright © 2000-2022 JetBrains s.r.o.
+Copyright © 2000-2026 JetBrains s.r.o.
/ SpotBugs Annotations (compile-only) /
Annotations for SpotBugs (or FindBugs) are licensed under the GNU Lesser General Public License,
version 2.1 or later. (LGPL-2.1 [or later]).
Full License: https://github.com/spotbugs/spotbugs/blob/master/LICENSE
Source Code: https://github.com/spotbugs/spotbugs/tree/master/spotbugs-annotations
-Copyright © 2005, University of Maryland (as part of FindBugs)
+Copyright © 2005, University of Maryland
// Metrics //
/ bStats /
bStats metrics are provided as a service to the plugin community.
As of version 3.0.0, it is provided under the permissive MIT license.
If you don't want bStats to collect data from your server, you can disable it in the bStats config file.
-This file can be found in the /plugins/bStats/ folder on the running server.
+This file can be found in the './plugins/bStats/' folder on servers using this plugin.
Privacy Policy: https://bstats.org/privacy-policy
Full License: https://github.com/Bastian/bStats-Metrics/blob/master/LICENSE
Source Code: https://github.com/Bastian/bStats-Metrics
-Copyright © 2016-2022 Bastian Oppermann (AKA BtoBastian)
+Copyright © 2016-2026 Bastian Oppermann (AKA BtoBastian)
diff --git a/pom.xml b/pom.xml
index ef04bf8e..54834d75 100644
--- a/pom.xml
+++ b/pom.xml
@@ -133,6 +133,18 @@
2.9.9
provided
+
+ com.github.Zrips
+ CMILib
+ 1.5.8.1
+ provided
+
+
+ com.github.Zrips
+ CMI-API
+ 9.7.14.3
+ provided
+
diff --git a/src/main/java/io/github/townyadvanced/flagwar/util/HologramUtil.java b/src/main/java/io/github/townyadvanced/flagwar/util/HologramUtil.java
index 31be3d85..a3b683e5 100644
--- a/src/main/java/io/github/townyadvanced/flagwar/util/HologramUtil.java
+++ b/src/main/java/io/github/townyadvanced/flagwar/util/HologramUtil.java
@@ -16,10 +16,14 @@
package io.github.townyadvanced.flagwar.util;
+import com.Zrips.CMI.CMI;
+import com.Zrips.CMI.Modules.Display.CMIBillboard;
+import com.Zrips.CMI.Modules.Holograms.CMIHologram;
import eu.decentsoftware.holograms.api.DHAPI;
import eu.decentsoftware.holograms.api.holograms.Hologram;
import io.github.townyadvanced.flagwar.FlagWar;
import io.github.townyadvanced.flagwar.config.FlagWarConfig;
+import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.plugin.Plugin;
@@ -52,9 +56,17 @@ public static void drawHologram(final String name,
.getPlugin("DecentHolograms");
if (decentHolograms != null && decentHolograms.isEnabled()) {
drawDecentHolograms(name, location, settings, lifeTime);
- } else {
- Messaging.debug("Tried to draw a hologram (%s), but no supported hologram plugins loaded.", name);
+ return;
+ }
+
+ // CMI - Common paid alternative to EssentialsX. Use as last resort, add other alternatives above this point.
+ Plugin cmi = FlagWar.getInstance().getServer().getPluginManager().getPlugin("cmi");
+ if (cmi != null && cmi.isEnabled()) {
+ drawCMIHolograms(name, location, settings, lifeTime);
+ return;
}
+
+ Messaging.debug("Tried to draw a hologram (%s), but no supported hologram plugins loaded.", name);
}
/**
@@ -99,21 +111,72 @@ private static void drawDecentHolograms(final String name,
}
}
- //Teleport
+ // Teleport to new offset
final double hOffset = 0.5d;
final double vOffset = 0.9d;
final double textHeight = 0.23d;
hologram.setLocation(location.add(hOffset, vOffset + (hologram.getPage(0).size() * textHeight), hOffset));
- //Set Visible
+ // Set Visible
hologram.setDefaultVisibleState(true);
}
+ /**
+ * Draw hologram with CMI.
+ * @param name Hologram Name
+ * @param location Hologram Location
+ * @param settings Settings
+ * @param lifetime (Remaining) life span of hologram
+ */
+ private static void drawCMIHolograms(final String name,
+ final Location location,
+ final List> settings,
+ final Duration lifetime) {
+ CMIHologram hologram = new CMIHologram(name, location);
+ hologram.setNewDisplayMethod(true);
+ hologram.setBillboard(CMIBillboard.CENTER);
+
+ // Self-Destruct - backup to #destroyHologram()
+ double[] tps = Bukkit.getTPS(); // Will use 5-minute average of running server.
+ int bufferTicks = (int) Math.round(tps[0]) * 2; // add 2s, in case the average is slower than current tick rate.
+ hologram.setSelfDestructIn((Math.toIntExact(lifetime.toSeconds()) * (int) Math.round(tps[0])) + bufferTicks);
+
+ // Add Lines
+ for (Map.Entry holoSetting : settings) {
+ String type = holoSetting.getKey();
+ String data = holoSetting.getValue();
+
+ switch (type) {
+ case "item" -> {
+ Material material = Material.matchMaterial(data);
+ if (material != null) {
+ // Need working confirmation that this actually adds an icon.
+ hologram.setLine(0, "ICON:" + material.name());
+ }
+ }
+ case "text" -> hologram.setLine(1, data);
+ case "timer" -> hologram.setLine(2, FormatUtil.time(lifetime, data));
+ default -> hologram.addLine("");
+ }
+ }
+
+ // Offset
+ final double hOffset = 0.5d;
+ final double vOffset = 0.9d;
+ final double textHeight = 0.23d;
+ hologram.moveTo(location.add(hOffset, vOffset + (hologram.getPage(0).getHeight() * textHeight), hOffset));
+
+ // Register / Draw
+ CMI.getInstance().getHologramManager().addHologram(hologram);
+ hologram.update();
+ }
+
/**
* Destroys a given hologram by name.
* @param name Hologram name (Cell String)
*/
public static void destroyHologram(final String name) {
+ // DecentHolograms
Plugin decentHolograms = FlagWar.getInstance().getServer().getPluginManager()
.getPlugin("DecentHolograms");
if (decentHolograms != null && decentHolograms.isEnabled()) {
@@ -121,9 +184,20 @@ public static void destroyHologram(final String name) {
if (hologram != null) {
hologram.destroy();
}
- } else {
- Messaging.debug("Tried to destroy a hologram (%s), but no supported plugins are in use.", name);
+ return;
+ }
+
+ // CMI
+ Plugin cmi = FlagWar.getInstance().getServer().getPluginManager().getPlugin("cmi");
+ if (cmi != null && cmi.isEnabled()) {
+ CMIHologram hologram = CMI.getInstance().getHologramManager().getByName(name);
+ if (hologram != null) {
+ hologram.remove();
+ }
+ return;
}
+
+ Messaging.debug("Tried to destroy a hologram (%s), but no supported plugins are in use.", name);
}
/**
@@ -132,16 +206,28 @@ public static void destroyHologram(final String name) {
* @param lifeTime Flag duration
*/
public static void updateHologramTimer(final String name, final Duration lifeTime) {
+ // DecentHolograms
Plugin decentHolograms = FlagWar.getInstance().getServer().getPluginManager()
.getPlugin("DecentHolograms");
if (decentHolograms != null && decentHolograms.isEnabled()) {
Hologram hologram = DHAPI.getHologram(name);
-
if (hologram != null) {
DHAPI.setHologramLine(hologram, 2, FormatUtil.time(lifeTime, FlagWarConfig.getTimerText()));
}
- } else {
- Messaging.debug("Tried to update a hologram's timer (%s), but no supported plugins are in use.", name);
+ return;
}
+
+ // CMI
+ Plugin cmi = FlagWar.getInstance().getServer().getPluginManager().getPlugin("cmi");
+ if (cmi != null && cmi.isEnabled()) {
+ CMIHologram hologram = CMI.getInstance().getHologramManager().getByName(name);
+ if (hologram != null) {
+ hologram.setLine(2, FormatUtil.time(lifeTime, FlagWarConfig.getTimerText()));
+ hologram.refresh();
+ }
+ return;
+ }
+
+ Messaging.debug("Tried to update a hologram's timer (%s), but no supported plugins are in use.", name);
}
}
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
index 0dbf7e1c..dbb2ae76 100644
--- a/src/main/resources/plugin.yml
+++ b/src/main/resources/plugin.yml
@@ -20,6 +20,7 @@ folia-supported: true
softdepend:
- DecentHolograms
+ - CMI
depend:
- Towny