Fixes some smaller details
Adds some README info Replaces the default dynmap info popup Removes the first line break when printing flags
This commit is contained in:
parent
7c8429a65c
commit
0bcecba156
4
README.md
Normal file
4
README.md
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# Dynmap Factions
|
||||||
|
|
||||||
|
This plugin adds customizable area markers for factions, in addition to faction home markers. While faction does have
|
||||||
|
built-in faction markers, those only cover a single chunk, not the entire faction.
|
@ -35,7 +35,9 @@ import java.util.Set;
|
|||||||
public class FactionsUpdate implements Runnable {
|
public class FactionsUpdate implements Runnable {
|
||||||
|
|
||||||
private static final String DEF_INFO_WINDOW = "<div class=\"infoWindow\"><span style=\"font-size:120%;\">" +
|
private static final String DEF_INFO_WINDOW = "<div class=\"infoWindow\"><span style=\"font-size:120%;\">" +
|
||||||
"%regionName%</span><br />Flags<br /><span style=\"font-weight:bold;\">%flags%</span></div>";
|
"%regionName%</span><br/>Description: <span style=\"font-weight:bold;\">%description%</span><br/>Leader: " +
|
||||||
|
"<span style=\"font-weight:bold;\">%playerOwners%</span><br/>Members: <span style=\"font-weight:bold;\">" +
|
||||||
|
"%playerMembers%</span><br />Flags<br /><span style=\"font-weight:bold;\">%flags%</span></div>";
|
||||||
private final String infoWindow;
|
private final String infoWindow;
|
||||||
private final DynmapFactionsPlugin dynmapFactionsPlugin;
|
private final DynmapFactionsPlugin dynmapFactionsPlugin;
|
||||||
public boolean runonce;
|
public boolean runonce;
|
||||||
@ -375,11 +377,11 @@ public class FactionsUpdate implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String formatInfoWindow(Faction fact) {
|
private String formatInfoWindow(Faction fact) {
|
||||||
String v = "<div class=\"regionInfo\">" + infoWindow + "</div>";
|
String output = "<div class=\"regionInfo\">" + infoWindow + "</div>";
|
||||||
v = v.replace("%regionName%", ChatColor.stripColor(fact.getName()));
|
output = output.replace("%regionName%", ChatColor.stripColor(fact.getName()));
|
||||||
v = v.replace("%description%", ChatColor.stripColor(fact.getDescription()));
|
output = output.replace("%description%", ChatColor.stripColor(fact.getDescription() != null ? fact.getDescription() : ""));
|
||||||
MPlayer adm = fact.getLeader();
|
MPlayer adm = fact.getLeader();
|
||||||
v = v.replace("%playerOwners%", (adm != null) ? adm.getName() : "");
|
output = output.replace("%playerOwners%", (adm != null) ? adm.getName() : "");
|
||||||
StringBuilder res = new StringBuilder();
|
StringBuilder res = new StringBuilder();
|
||||||
for (MPlayer r : fact.getMPlayers()) {
|
for (MPlayer r : fact.getMPlayers()) {
|
||||||
if (!res.isEmpty()) {
|
if (!res.isEmpty()) {
|
||||||
@ -387,17 +389,18 @@ public class FactionsUpdate implements Runnable {
|
|||||||
}
|
}
|
||||||
res.append(r.getName());
|
res.append(r.getName());
|
||||||
}
|
}
|
||||||
v = v.replace("%playerMembers%", res.toString());
|
output = output.replace("%playerMembers%", res.toString());
|
||||||
|
|
||||||
v = v.replace("%nation%", ChatColor.stripColor(fact.getName()));
|
// nation is an alias for regionName
|
||||||
|
output = output.replace("%nation%", ChatColor.stripColor(fact.getName()));
|
||||||
/* Build flags */
|
/* Build flags */
|
||||||
StringBuilder flags = new StringBuilder();
|
StringBuilder flags = new StringBuilder();
|
||||||
for (MFlag ff : MFlagColl.get().getAll()) {
|
for (MFlag ff : MFlagColl.get().getAll()) {
|
||||||
flags.append("<br/>").append(ff.getName()).append(": ").append(fact.getFlag(ff));
|
flags.append(ff.getName()).append(": ").append(fact.getFlag(ff)).append("<br/>");
|
||||||
v = v.replace("%flag." + ff.getName() + "%", fact.getFlag(ff) ? "true" : "false");
|
output = output.replace("%flag." + ff.getName() + "%", fact.getFlag(ff) ? "true" : "false");
|
||||||
}
|
}
|
||||||
v = v.replace("%flags%", flags.toString());
|
output = output.replace("%flags%", flags.toString());
|
||||||
return v;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,15 +6,15 @@ update:
|
|||||||
|
|
||||||
layer:
|
layer:
|
||||||
name: "Factions"
|
name: "Factions"
|
||||||
# Make mobs layer hidden by default
|
# Make factions layer hidden by default
|
||||||
hideByDefault: false
|
hideByDefault: false
|
||||||
# ordering priority in layer menu (low goes before high - default is 0)
|
# Ordering priority in layer menu (low goes before high - default is 0)
|
||||||
layerPriority: 2
|
layerPriority: 2
|
||||||
# (optional) set minimum zoom level before layer is visible (0 = default, always visible)
|
# (optional) set minimum zoom level before layer is visible (0 = default, always visible)
|
||||||
minZoom: 0
|
minZoom: 0
|
||||||
|
|
||||||
# Format for popup - substitute values for macros
|
# Format for popup - substitute values for macros
|
||||||
infoWindow: '<div class="infoWindow"><span style="font-size:120%;">%regionName%</span><br />Flags<br /><span style="font-weight:bold;">%flags%</span></div>'
|
infoWindow: '<div class="infoWindow"><span style="font-size:120%;">%regionName%</span><br/>Description: <span style="font-weight:bold;">%description%</span><br/>Leader: <span style="font-weight:bold;">%playerOwners%</span><br/>Members: <span style="font-weight:bold;">%playerMembers%</span><br />Flags<br /><span style="font-weight:bold;">%flags%</span></div>'
|
||||||
|
|
||||||
# Allow players in faction to see one another on dynmap (only relevant if dynmap has 'player-info-protected' enabled)
|
# Allow players in faction to see one another on dynmap (only relevant if dynmap has 'player-info-protected' enabled)
|
||||||
visibilityByFaction: true
|
visibilityByFaction: true
|
||||||
|
Loading…
Reference in New Issue
Block a user