Fix handling of 1.6.8 versus latest 1.7.5 (API changes)

This commit is contained in:
Mike Primm 2012-07-31 21:49:16 -05:00
parent 1667d1072b
commit 36d7f22b9b
2 changed files with 22 additions and 10 deletions

View File

@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.dynmap</groupId> <groupId>org.dynmap</groupId>
<artifactId>Dynmap-Factions</artifactId> <artifactId>Dynmap-Factions</artifactId>
<version>0.30</version> <version>0.21</version>
<build> <build>
<resources> <resources>

View File

@ -193,24 +193,36 @@ public class DynmapFactionsPlugin extends JavaPlugin {
private String formatInfoWindow(Faction fact) { private String formatInfoWindow(Faction fact) {
String v = "<div class=\"regioninfo\">"+infowindow+"</div>"; String v = "<div class=\"regioninfo\">"+infowindow+"</div>";
v = v.replaceAll("%regionname%", ChatColor.stripColor(fact.getTag())); v = v.replace("%regionname%", ChatColor.stripColor(fact.getTag()));
FPlayer adm = fact.getFPlayerLeader(); FPlayer adm;
v = v.replaceAll("%playerowners%", (adm!=null)?adm.getName():""); try {
adm = fact.getFPlayerAdmin();
} catch (NoSuchMethodError nsme) {
adm = fact.getFPlayerLeader();
}
v = v.replace("%playerowners%", (adm!=null)?adm.getName():"");
String res = ""; String res = "";
for(FPlayer r : fact.getFPlayers()) { for(FPlayer r : fact.getFPlayers()) {
if(res.length()>0) res += ", "; if(res.length()>0) res += ", ";
res += r.getName(); res += r.getName();
} }
v = v.replaceAll("%playermembers%", res); v = v.replace("%playermembers%", res);
v = v.replaceAll("%nation%", ChatColor.stripColor(fact.getTag())); v = v.replace("%nation%", ChatColor.stripColor(fact.getTag()));
/* Build flags */ /* Build flags */
String flgs = "open: " + fact.getOpen(); String flgs = "open: " + fact.getOpen();
for(FFlag ff : FFlag.values()) { try {
flgs += "<br/>" + ff.getNicename() + ": " + fact.getFlag(ff); for(FFlag ff : FFlag.values()) {
v = v.replaceAll("%flag." + ff.name() + "%", fact.getFlag(ff)?"true":"false"); flgs += "<br/>" + ff.getNicename() + ": " + fact.getFlag(ff);
v = v.replace("%flag." + ff.name() + "%", fact.getFlag(ff)?"true":"false");
}
} catch (NoClassDefFoundError ncdfe) {
flgs += "<br/>peaceful: " + fact.isPeaceful();
v = v.replace("%flag.PEACEFUL%", fact.isPeaceful()?"true":"false");
flgs += "<br/>peacefulExplosionsEnabled: " + fact.getPeacefulExplosionsEnabled();
v = v.replace("%flag.EXPLOSIONS%", fact.getPeacefulExplosionsEnabled()?"true":"false");
} }
v = v.replaceAll("%flags%", flgs); v = v.replace("%flags%", flgs);
return v; return v;
} }