Skip to content

Commit

Permalink
0.95
Browse files Browse the repository at this point in the history
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 TownyAdvanced/Towny#5831
  • Loading branch information
LlmDl committed Aug 22, 2023
1 parent 7e5cad7 commit 56bb40f
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.dynmap</groupId>
<artifactId>Dynmap-Towny</artifactId>
<version>0.94</version>
<version>0.95</version>

<build>
<resources>
Expand Down
36 changes: 36 additions & 0 deletions src/main/java/org/dynmap/towny/DynmapTownyPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
}
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ regionstyle:
fillOpacity: 0.35
homeicon: "blueflag"
capitalicon: "king"
outposticon: "tower"
fillColorShops: "#0000FF"
fillColorArenas: "#FF00FF"
fillColorEmbassies: "#00FFFF"
Expand Down

0 comments on commit 56bb40f

Please sign in to comment.