Add support for world-level hide/show in visibleregions and hiddenregions using "world:<worldname>" syntax

This commit is contained in:
Mike Primm 2011-12-25 05:05:22 +08:00 committed by mikeprimm
parent 74ab9442bd
commit 7dcae62dc4
2 changed files with 7 additions and 5 deletions

View File

@ -138,19 +138,19 @@ public class DynmapFactionsPlugin extends JavaPlugin {
return v; return v;
} }
private boolean isVisible(String id) { private boolean isVisible(String id, String worldname) {
if((visible != null) && (visible.size() > 0)) { if((visible != null) && (visible.size() > 0)) {
if(visible.contains(id) == false) { if((visible.contains(id) == false) && (visible.contains("world:" + worldname) == false)) {
return false; return false;
} }
} }
if((hidden != null) && (hidden.size() > 0)) { if((hidden != null) && (hidden.size() > 0)) {
if(hidden.contains(id)) if(hidden.contains(id) || hidden.contains("world:" + worldname))
return false; return false;
} }
return true; return true;
} }
private void addStyle(String resid, AreaMarker m) { private void addStyle(String resid, AreaMarker m) {
AreaStyle as = cusstyle.get(resid); AreaStyle as = cusstyle.get(resid);
if(as == null) { if(as == null) {
@ -224,7 +224,7 @@ public class DynmapFactionsPlugin extends JavaPlugin {
String desc = formatInfoWindow(fact); String desc = formatInfoWindow(fact);
/* Handle areas */ /* Handle areas */
if(isVisible(factname)) { if(isVisible(factname, world)) {
if(blocks.isEmpty()) if(blocks.isEmpty())
return; return;
LinkedList<FactionBlock> nodevals = new LinkedList<FactionBlock>(); LinkedList<FactionBlock> nodevals = new LinkedList<FactionBlock>();

View File

@ -25,9 +25,11 @@ regionstyle:
homeicon: "redflag" homeicon: "redflag"
# Optional setting to limit which regions to show, by name - if commented out, all regions are shown # Optional setting to limit which regions to show, by name - if commented out, all regions are shown
# To show all regions on a given world, add 'world:<worldname>' to the list
visibleregions: [ ] visibleregions: [ ]
# Optional setting to hide specific regions, by name # Optional setting to hide specific regions, by name
# To hide all regions on a given world, add 'world:<worldname>' to the list
hiddenregions: [ ] hiddenregions: [ ]
# Optional per-region overrides for regionstyle (any defined replace those in regionstyle) # Optional per-region overrides for regionstyle (any defined replace those in regionstyle)