From 56bb40f03d5493f19967fd062b5bccdb7811073c Mon Sep 17 00:00:00 2001 From: LlmDl Date: Tue, 22 Aug 2023 16:32:04 -0500 Subject: [PATCH] 0.95 Add outposticon to config.yml, regenerate your config if you don't want to add `outposticon: "tower"` to the regionstyle section. Outposts will now show on the dynmap with their own icon. Closes https://github.com/TownyAdvanced/Towny/issues/5831 --- pom.xml | 2 +- .../org/dynmap/towny/DynmapTownyPlugin.java | 36 +++++++++++++++++++ src/main/resources/config.yml | 1 + 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 2cf62ab..4967915 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 org.dynmap Dynmap-Towny - 0.94 + 0.95 diff --git a/src/main/java/org/dynmap/towny/DynmapTownyPlugin.java b/src/main/java/org/dynmap/towny/DynmapTownyPlugin.java index b320681..55ef486 100644 --- a/src/main/java/org/dynmap/towny/DynmapTownyPlugin.java +++ b/src/main/java/org/dynmap/towny/DynmapTownyPlugin.java @@ -20,6 +20,7 @@ import com.palmergames.bukkit.towny.scheduling.impl.BukkitTaskScheduler; import com.palmergames.bukkit.towny.scheduling.impl.FoliaTaskScheduler; import org.bukkit.Bukkit; +import org.bukkit.Location; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.entity.Player; @@ -118,9 +119,11 @@ private static class AreaStyle { int fillcolor_wilds; String homemarker; String capitalmarker; + String outpostmarker; MarkerIcon homeicon; MarkerIcon capitalicon; MarkerIcon ruinicon; + MarkerIcon outposticon; int yc; boolean boost; @@ -176,6 +179,11 @@ private static class AreaStyle { } } ruinicon = markerapi.getMarkerIcon("warning"); + + outpostmarker = cfg.getString(path + ".outposticon", "tower"); + outposticon = markerapi.getMarkerIcon(outpostmarker); + if (outposticon == null) + outposticon = markerapi.getMarkerIcon("tower"); } public int getStrokeColor(AreaStyle cust, AreaStyle nat) { @@ -826,6 +834,34 @@ else if(!ourblks.getFlag(cur_x-1, cur_z-1)) { /* Straight? */ newmark.put(markid, home); } + + if (town.hasOutpostSpawn()) { + MarkerIcon outpostIco = defstyle.outposticon; + int i = 0; + for (Location loc : town.getAllOutpostSpawns()) { + i++; + TownBlock tblk = TownyAPI.getInstance().getTownBlock(loc); + if (tblk == null) + continue; + + double xx = townblocksize * tblk.getX() + (townblocksize / 2); + double zz = townblocksize * tblk.getZ() + (townblocksize / 2); + String outpostName = town.getName() + "_Outpost_" + i; + String outpostMarkerID = outpostName; + Marker outpostMarker = resmark.remove(outpostMarkerID); + if (outpostMarker == null) { + outpostMarker = set.createMarker(outpostMarkerID, outpostName, blk.getWorld().getName(), xx, 64, zz, outpostIco, true); + if (outpostMarker == null) + continue; + } else { + outpostMarker.setLocation(blk.getWorld().getName(), xx, 64, zz); + outpostMarker.setLabel(outpostName); + outpostMarker.setMarkerIcon(outpostIco); + } + outpostMarker.setDescription(tblk.getName() != null ? tblk.getName() : outpostName); + newmark.put(outpostMarkerID, outpostMarker); + } + } } } } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 6287887..aa7e4e7 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -42,6 +42,7 @@ regionstyle: fillOpacity: 0.35 homeicon: "blueflag" capitalicon: "king" + outposticon: "tower" fillColorShops: "#0000FF" fillColorArenas: "#FF00FF" fillColorEmbassies: "#00FFFF"