Add support for WG Custom Flag, dynmap-boost, for setting resolution boost for regions

recommended 0.50
Mike Primm 12 years ago
parent fc6e3fe7ef
commit 2c6d1b273f
  1. BIN
      WGCustomFlags-1.5.2.jar
  2. 7
      pom.xml
  3. 41
      src/main/java/org/dynmap/worldguard/DynmapWorldGuardPlugin.java
  4. 2
      src/main/resources/config.yml
  5. 1
      src/main/resources/plugin.yml

Binary file not shown.

@ -81,5 +81,12 @@
<scope>system</scope>
<systemPath>${project.basedir}/worldedit-5.5.6.jar</systemPath>
</dependency>
<dependency>
<groupId>com.sk89q</groupId>
<artifactId>WGCustomFlags</artifactId>
<version>1.5.2</version>
<scope>system</scope>
<systemPath>${project.basedir}/WGCustomFlags-1.5.2.jar</systemPath>
</dependency>
</dependencies>
</project>

@ -24,10 +24,12 @@ import org.dynmap.markers.AreaMarker;
import org.dynmap.markers.MarkerAPI;
import org.dynmap.markers.MarkerSet;
import com.mewin.WGCustomFlags.WGCustomFlagsPlugin;
import com.sk89q.worldedit.BlockVector;
import com.sk89q.worldedit.BlockVector2D;
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
import com.sk89q.worldguard.domains.DefaultDomain;
import com.sk89q.worldguard.protection.flags.BooleanFlag;
import com.sk89q.worldguard.protection.flags.Flag;
import com.sk89q.worldguard.protection.managers.RegionManager;
import com.sk89q.worldguard.protection.regions.ProtectedPolygonalRegion;
@ -36,10 +38,12 @@ import com.sk89q.worldguard.protection.regions.ProtectedRegion;
public class DynmapWorldGuardPlugin extends JavaPlugin {
private static Logger log;
private static final String DEF_INFOWINDOW = "<div class=\"infowindow\"><span style=\"font-size:120%;\">%regionname%</span><br /> Owner <span style=\"font-weight:bold;\">%playerowners%</span><br />Flags<br /><span style=\"font-weight:bold;\">%flags%</span></div>";
public static final String BOOST_FLAG = "dynmap-boost";
Plugin dynmap;
DynmapAPI api;
MarkerAPI markerapi;
WorldGuardPlugin wg;
BooleanFlag boost_flag;
FileConfiguration cfg;
MarkerSet set;
@ -68,7 +72,6 @@ public class DynmapWorldGuardPlugin extends JavaPlugin {
String fillcolor;
double fillopacity;
String label;
boolean boost;
AreaStyle(FileConfiguration cfg, String path, AreaStyle def) {
strokecolor = cfg.getString(path+".strokeColor", def.strokecolor);
@ -78,7 +81,6 @@ public class DynmapWorldGuardPlugin extends JavaPlugin {
fillcolor = cfg.getString(path+".fillColor", def.fillcolor);
fillopacity = cfg.getDouble(path+".fillOpacity", def.fillopacity);
label = cfg.getString(path+".label", null);
boost = cfg.getBoolean(path+".boost", def.boost);
}
AreaStyle(FileConfiguration cfg, String path) {
@ -88,7 +90,6 @@ public class DynmapWorldGuardPlugin extends JavaPlugin {
strokeweight = cfg.getInt(path+".strokeWeight", 3);
fillcolor = cfg.getString(path+".fillColor", "#FF0000");
fillopacity = cfg.getDouble(path+".fillOpacity", 0.35);
boost = cfg.getBoolean(path+".boost", false);
}
}
@ -200,7 +201,10 @@ public class DynmapWorldGuardPlugin extends JavaPlugin {
if(as.label != null) {
m.setLabel(as.label);
}
m.setBoostFlag(as.boost);
if (boost_flag != null) {
Boolean b = region.getFlag(boost_flag);
m.setBoostFlag((b == null)?false:b.booleanValue());
}
}
/* Handle specific region */
@ -330,6 +334,8 @@ public class DynmapWorldGuardPlugin extends JavaPlugin {
wg = (WorldGuardPlugin)p;
getServer().getPluginManager().registerEvents(new OurServerListener(), this);
registerCustomFlags();
/* If both enabled, activate */
if(dynmap.isEnabled() && wg.isEnabled())
activate();
@ -342,6 +348,33 @@ public class DynmapWorldGuardPlugin extends JavaPlugin {
}
}
private WGCustomFlagsPlugin getWGCustomFlags()
{
Plugin plugin = getServer().getPluginManager().getPlugin("WGCustomFlags");
if (plugin == null || !(plugin instanceof WGCustomFlagsPlugin))
{
return null;
}
return (WGCustomFlagsPlugin) plugin;
}
private void registerCustomFlags() {
try {
WGCustomFlagsPlugin cf = getWGCustomFlags();
if (cf != null) {
BooleanFlag bf = new BooleanFlag(BOOST_FLAG);
cf.addCustomFlag(bf);
boost_flag = bf;
}
} catch (Exception x) {
}
if (boost_flag == null) {
log.info("Custom flag '" + BOOST_FLAG + "' not registered - WGCustomFlags not found");
}
}
private boolean reload = false;
private void activate() {

@ -26,7 +26,6 @@ regionstyle:
fillColor: "#FF0000"
fillOpacity: 0.35
unownedStrokeColor: "#00FF00"
boost: false
# 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
@ -41,7 +40,6 @@ hiddenregions: [ ]
custstyle:
customregion1:
strokeColor: "#00FF00"
boost: true
# Optional per-owner overrides for regionstyle (lower priority than custstyle) - works for group or user names
ownerstyle:

@ -3,4 +3,5 @@ main: org.dynmap.worldguard.DynmapWorldGuardPlugin
version: "${project.version}"
author: mikeprimm
depend: [ dynmap, WorldGuard ]
softdepend: [ WGCustomFlags ]

Loading…
Cancel
Save