mirror of
https://github.com/MassiveCraft/Factions.git
synced 2024-11-30 14:13:52 +01:00
When you have the "claimsMustBeConnected" option enabled, it now works on a world-by-world basis, so if you have claims in one world you can still make claims in other worlds
This commit is contained in:
parent
8f1606beba
commit
94d1dc210c
@ -120,6 +120,19 @@ public class Board {
|
|||||||
return getFactionCoordCount(faction.getId());
|
return getFactionCoordCount(faction.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int getFactionCoordCountInWorld(Faction faction, String worldName) {
|
||||||
|
int factionId = faction.getId();
|
||||||
|
int ret = 0;
|
||||||
|
Iterator<Entry<FLocation, Integer>> iter = flocationIds.entrySet().iterator();
|
||||||
|
while (iter.hasNext()) {
|
||||||
|
Entry<FLocation, Integer> entry = iter.next();
|
||||||
|
if (entry.getValue() == factionId && entry.getKey().getWorldName().equals(worldName)) {
|
||||||
|
ret += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------//
|
//----------------------------------------------//
|
||||||
// Map generation
|
// Map generation
|
||||||
//----------------------------------------------//
|
//----------------------------------------------//
|
||||||
|
@ -506,7 +506,7 @@ public class FPlayer {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Conf.claimsMustBeConnected && myFaction.getLandRounded() > 0 && !Board.isConnectedLocation(flocation, myFaction)) {
|
if (Conf.claimsMustBeConnected && myFaction.getLandRoundedInWorld(flocation.getWorldName()) > 0 && !Board.isConnectedLocation(flocation, myFaction)) {
|
||||||
sendMessage("You can only claim additional land which is connected to your first claim!");
|
sendMessage("You can only claim additional land which is connected to your first claim!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -225,6 +225,10 @@ public class Faction {
|
|||||||
return Board.getFactionCoordCount(this);
|
return Board.getFactionCoordCount(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getLandRoundedInWorld(String worldName) {
|
||||||
|
return Board.getFactionCoordCountInWorld(this, worldName);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasLandInflation() {
|
public boolean hasLandInflation() {
|
||||||
return this.getLandRounded() > this.getPowerRounded();
|
return this.getLandRounded() > this.getPowerRounded();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user