Update to Factions v2.7.1

This commit is contained in:
Mike Primm 2014-12-04 01:04:53 -06:00
parent fdf1a161cc
commit cc7950a0b8
6 changed files with 37 additions and 41 deletions

Binary file not shown.

BIN
Factions-2.7.1.jar Normal file

Binary file not shown.

BIN
MassiveCore-2.7.1.jar Normal file

Binary file not shown.

Binary file not shown.

10
pom.xml
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.81</version> <version>0.90</version>
<properties> <properties>
<timestamp>${maven.build.timestamp}</timestamp> <timestamp>${maven.build.timestamp}</timestamp>
<maven.build.timestamp.format>yyyyMMddHHmm</maven.build.timestamp.format> <maven.build.timestamp.format>yyyyMMddHHmm</maven.build.timestamp.format>
@ -75,16 +75,16 @@
<dependency> <dependency>
<groupId>com.massivecraft</groupId> <groupId>com.massivecraft</groupId>
<artifactId>Factions</artifactId> <artifactId>Factions</artifactId>
<version>2.5.0</version> <version>2.7.1</version>
<scope>system</scope> <scope>system</scope>
<systemPath>${project.basedir}/Factions-2.5.0.jar</systemPath> <systemPath>${project.basedir}/Factions-2.7.1.jar</systemPath>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.massivecraft</groupId> <groupId>com.massivecraft</groupId>
<artifactId>MassiveCore</artifactId> <artifactId>MassiveCore</artifactId>
<version>7.3.0</version> <version>2.7.1</version>
<scope>system</scope> <scope>system</scope>
<systemPath>${project.basedir}/MassiveCore-7.3.0.jar</systemPath> <systemPath>${project.basedir}/MassiveCore-2.7.1.jar</systemPath>
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -32,13 +32,13 @@ import org.dynmap.markers.MarkerSet;
import org.dynmap.markers.PlayerSet; import org.dynmap.markers.PlayerSet;
import com.massivecraft.factions.Factions; import com.massivecraft.factions.Factions;
import com.massivecraft.factions.FFlag; import com.massivecraft.factions.entity.BoardColl;
import com.massivecraft.factions.entity.BoardColls;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.FactionColl; import com.massivecraft.factions.entity.FactionColl;
import com.massivecraft.factions.entity.FactionColls; import com.massivecraft.factions.entity.MFlag;
import com.massivecraft.factions.entity.UPlayer; import com.massivecraft.factions.entity.MFlagColl;
import com.massivecraft.factions.event.EventFactionsChunkChange; import com.massivecraft.factions.entity.MPlayer;
import com.massivecraft.factions.event.EventFactionsChunksChange;
import com.massivecraft.factions.event.EventFactionsCreate; import com.massivecraft.factions.event.EventFactionsCreate;
import com.massivecraft.factions.event.EventFactionsDisband; import com.massivecraft.factions.event.EventFactionsDisband;
import com.massivecraft.factions.event.EventFactionsHomeChange; import com.massivecraft.factions.event.EventFactionsHomeChange;
@ -143,20 +143,18 @@ public class DynmapFactionsPlugin extends JavaPlugin {
private class PlayerSetUpdate implements Runnable { private class PlayerSetUpdate implements Runnable {
public String faction; public String faction;
public String univ; public PlayerSetUpdate(String fid) {
public PlayerSetUpdate(String univ, String fid) {
this.univ = univ;
faction = fid; faction = fid;
} }
public void run() { public void run() {
if(!stop) if(!stop)
updatePlayerSet(univ, faction); updatePlayerSet(faction);
} }
} }
private void requestUpdatePlayerSet(String univid, String factid) { private void requestUpdatePlayerSet(String factid) {
if(playersets) if(playersets)
getServer().getScheduler().scheduleSyncDelayedTask(this, new PlayerSetUpdate(univid, factid)); getServer().getScheduler().scheduleSyncDelayedTask(this, new PlayerSetUpdate(factid));
} }
private FactionsUpdate pending = null; private FactionsUpdate pending = null;
@ -170,27 +168,27 @@ public class DynmapFactionsPlugin extends JavaPlugin {
} }
} }
private void updatePlayerSet(String univid, String factid) { private void updatePlayerSet(String factid) {
/* If Wilderness or other unassociated factions (guid-style ID), skip */ /* If Wilderness or other unassociated factions (guid-style ID), skip */
if(factid.indexOf('-') >= 0) { if(factid.indexOf('-') >= 0) {
return; return;
} }
Set<String> plids = new HashSet<String>(); Set<String> plids = new HashSet<String>();
FactionColl fc = FactionColls.get().getForUniverse(univid); FactionColl fc = FactionColl.get();
Faction f = fc.getByName(factid); /* Get faction */ Faction f = fc.getByName(factid); /* Get faction */
if(f != null) { if(f != null) {
List<UPlayer> ps = f.getUPlayers(); List<MPlayer> ps = f.getMPlayers();
for(UPlayer fp : ps) { for(MPlayer fp : ps) {
plids.add(fp.getId()); plids.add(fp.getId());
} }
factid = f.getId(); factid = f.getId();
} }
String setid = "factions." + univid + "." + factid; String setid = "factions." + factid;
PlayerSet set = markerapi.getPlayerSet(setid); /* See if set exists */ PlayerSet set = markerapi.getPlayerSet(setid); /* See if set exists */
if((set == null) && (f != null)) { if((set == null) && (f != null)) {
set = markerapi.createPlayerSet(setid, true, plids, false); set = markerapi.createPlayerSet(setid, true, plids, false);
info("Added player visibility set '" + setid + "' for faction " + univid + "." + factid); info("Added player visibility set '" + setid + "' for faction " + factid);
} }
else if(f != null) { else if(f != null) {
set.setPlayers(plids); set.setPlayers(plids);
@ -207,10 +205,10 @@ public class DynmapFactionsPlugin extends JavaPlugin {
String v = "<div class=\"regioninfo\">"+infowindow+"</div>"; String v = "<div class=\"regioninfo\">"+infowindow+"</div>";
v = v.replace("%regionname%", ChatColor.stripColor(fact.getName())); v = v.replace("%regionname%", ChatColor.stripColor(fact.getName()));
v = v.replace("%description%", ChatColor.stripColor(fact.getDescription())); v = v.replace("%description%", ChatColor.stripColor(fact.getDescription()));
UPlayer adm = fact.getLeader(); MPlayer adm = fact.getLeader();
v = v.replace("%playerowners%", (adm!=null)?adm.getName():""); v = v.replace("%playerowners%", (adm!=null)?adm.getName():"");
String res = ""; String res = "";
for(UPlayer r : fact.getUPlayers()) { for(MPlayer r : fact.getMPlayers()) {
if(res.length()>0) res += ", "; if(res.length()>0) res += ", ";
res += r.getName(); res += r.getName();
} }
@ -218,10 +216,10 @@ public class DynmapFactionsPlugin extends JavaPlugin {
v = v.replace("%nation%", ChatColor.stripColor(fact.getName())); v = v.replace("%nation%", ChatColor.stripColor(fact.getName()));
/* Build flags */ /* Build flags */
String flgs = "open: " + fact.isOpen(); String flgs = "";
for(FFlag ff : FFlag.values()) { for(MFlag ff : MFlagColl.get().getAll()) {
flgs += "<br/>" + ff.getNicename() + ": " + fact.getFlag(ff); flgs += "<br/>" + ff.getName() + ": " + fact.getFlag(ff);
v = v.replace("%flag." + ff.name() + "%", fact.getFlag(ff)?"true":"false"); v = v.replace("%flag." + ff.getName() + "%", fact.getFlag(ff)?"true":"false");
} }
v = v.replace("%flags%", flgs); v = v.replace("%flags%", flgs);
return v; return v;
@ -471,10 +469,10 @@ public class DynmapFactionsPlugin extends JavaPlugin {
/* Parse into faction centric mapping, split by world */ /* Parse into faction centric mapping, split by world */
Map<String, FactionBlocks> blocks_by_faction = new HashMap<String, FactionBlocks>(); Map<String, FactionBlocks> blocks_by_faction = new HashMap<String, FactionBlocks>();
for (FactionColl fc : FactionColls.get().getColls()) { FactionColl fc = FactionColl.get();
Collection<Faction> facts = fc.getAll(); Collection<Faction> facts = fc.getAll();
for (Faction fact : facts) { for (Faction fact : facts) {
Set<PS> chunks = BoardColls.get().getChunks(fact); Set<PS> chunks = BoardColl.get().getChunks(fact);
String fid = fc.getUniverse() + "_" + fact.getId(); String fid = fc.getUniverse() + "_" + fact.getId();
FactionBlocks factblocks = blocks_by_faction.get(fid); /* Look up faction */ FactionBlocks factblocks = blocks_by_faction.get(fid); /* Look up faction */
if(factblocks == null) { /* Create faction block if first time */ if(factblocks == null) { /* Create faction block if first time */
@ -533,7 +531,6 @@ public class DynmapFactionsPlugin extends JavaPlugin {
} }
} }
} }
}
} }
blocks_by_faction.clear(); blocks_by_faction.clear();
@ -552,13 +549,12 @@ public class DynmapFactionsPlugin extends JavaPlugin {
private void updatePlayerSets() { private void updatePlayerSets() {
if(playersets) { if(playersets) {
for (FactionColl fc : FactionColls.get().getColls()) { FactionColl fc = FactionColl.get();
for(Faction f : fc.getAll()) { for(Faction f : fc.getAll()) {
if ((f == fc.getNone()) || (f == fc.getWarzone()) || (f == fc.getSafezone())) { if ((f == fc.getNone()) || (f == fc.getWarzone()) || (f == fc.getSafezone())) {
continue; continue;
}
updatePlayerSet(fc.getUniverse(), f.getId());
} }
updatePlayerSet(f.getId());
} }
} }
} }
@ -579,7 +575,7 @@ public class DynmapFactionsPlugin extends JavaPlugin {
return; return;
if(playersets) { if(playersets) {
Faction f = event.getNewFaction(); Faction f = event.getNewFaction();
requestUpdatePlayerSet(f.getUniverse(), f.getId()); requestUpdatePlayerSet(f.getId());
} }
} }
@EventHandler(priority=EventPriority.MONITOR) @EventHandler(priority=EventPriority.MONITOR)
@ -587,7 +583,7 @@ public class DynmapFactionsPlugin extends JavaPlugin {
if(event.isCancelled()) if(event.isCancelled())
return; return;
if(playersets) if(playersets)
requestUpdatePlayerSet(event.getUniverse(), event.getFactionId()); requestUpdatePlayerSet(event.getFactionId());
requestUpdateFactions(); requestUpdateFactions();
} }
@EventHandler(priority=EventPriority.MONITOR) @EventHandler(priority=EventPriority.MONITOR)
@ -596,7 +592,7 @@ public class DynmapFactionsPlugin extends JavaPlugin {
return; return;
if(playersets) { if(playersets) {
Faction f = event.getFaction(); Faction f = event.getFaction();
requestUpdatePlayerSet(f.getUniverse(), f.getId()); requestUpdatePlayerSet(f.getId());
} }
requestUpdateFactions(); requestUpdateFactions();
} }
@ -613,7 +609,7 @@ public class DynmapFactionsPlugin extends JavaPlugin {
requestUpdateFactions(); requestUpdateFactions();
} }
@EventHandler(priority=EventPriority.MONITOR) @EventHandler(priority=EventPriority.MONITOR)
public void onFactionRename(EventFactionsChunkChange event) { public void onFactionRename(EventFactionsChunksChange event) {
if(event.isCancelled()) if(event.isCancelled())
return; return;
requestUpdateFactions(); requestUpdateFactions();