Add first pass of Factions support

This commit is contained in:
Mike Primm 2011-08-29 10:31:04 +08:00 committed by mikeprimm
parent cfc758fe7d
commit f4de63e85e
5 changed files with 364 additions and 0 deletions

View file

@ -21,6 +21,7 @@ import org.dynmap.web.Json;
public class RegionsComponent extends ClientComponent {
private TownyConfigHandler towny;
private FactionsConfigHandler factions;
private String regiontype;
public RegionsComponent(final DynmapPlugin plugin, final ConfigurationNode configuration) {
@ -37,6 +38,11 @@ public class RegionsComponent extends ClientComponent {
towny = new TownyConfigHandler(configuration);
plugin.webServer.handlers.put("/standalone/towny_*", new RegionHandler(configuration));
}
/* Load special handler for Factions */
else if(regiontype.equals("Factions")) {
factions = new FactionsConfigHandler(configuration);
plugin.webServer.handlers.put("/standalone/factions_*", new RegionHandler(configuration));
}
else {
plugin.webServer.handlers.put("/standalone/" + fname.substring(0, fname.lastIndexOf('.')) + "_*", new RegionHandler(configuration));
@ -75,6 +81,11 @@ public class RegionsComponent extends ClientComponent {
outputFileName = "towny_" + wname + ".json";
webWorldPath = new File(plugin.getWebPath()+"/standalone/", outputFileName);
}
else if(regiontype.equals("Factions")) {
regionData = factions.getRegionData(wname);
outputFileName = "factions_" + wname + ".json";
webWorldPath = new File(plugin.getWebPath()+"/standalone/", outputFileName);
}
else {
if(configuration.getBoolean("useworldpath", false))
{