Multiple Enhancements Brought Up To Me By Frasty

This commit is contained in:
Driftay 2019-08-26 07:31:02 -04:00
parent c93d2f235a
commit 38247b17c2
4 changed files with 15 additions and 4 deletions

View File

@ -202,7 +202,8 @@ public class FLocation implements Serializable {
int lim = FLocation.chunkToRegion((int) border.getSize()) - buffer;
int diffX = chunk.getX() - x;
int diffZ = chunk.getZ() - z;
return diffX > lim || diffZ > lim || -diffX > lim - 1 || -diffZ > lim - 1;
return (diffX > lim || diffZ > lim) || (-diffX >= lim || -diffZ >= lim);
}
//----------------------------------------------//

View File

@ -70,9 +70,14 @@ public class CmdStuck extends FCommand {
// spiral task to find nearest wilderness chunk
new SpiralTask(new FLocation(me), radius * 2) {
final int buffer = P.p.getConfig().getInt("world-border.buffer", 0);
@Override
public boolean work() {
FLocation chunk = currentFLocation();
if (chunk.isOutsideWorldBorder(buffer)) {
return true;
}
Faction faction = board.getFactionAt(chunk);
int buffer = P.p.getConfig().getInt("world-border.buffer", 0);
if (faction.isWilderness() && !chunk.isOutsideWorldBorder(buffer)) {

View File

@ -376,8 +376,13 @@ public abstract class MemoryBoard extends Board {
}
public void removeFaction(String factionId) {
Collection<FLocation> flocations = factionToLandMap.removeAll(factionId);
for (FLocation floc : flocations) {
Collection<FLocation> fLocations = factionToLandMap.removeAll(factionId);
for (FPlayer fPlayer : FPlayers.getInstance().getOnlinePlayers()) {
if (fLocations.contains(fPlayer.getLastStoodAt()) && !fPlayer.isAdminBypassing() && fPlayer.isFlying()) {
fPlayer.setFlying(false);
}
}
for (FLocation floc : fLocations) {
super.remove(floc);
}
}

View File

@ -124,7 +124,7 @@ public enum TagReplacer {
case TOTAL_ONLINE:
return String.valueOf(Bukkit.getOnlinePlayers().size());
case FACTIONLESS:
return String.valueOf(Factions.getInstance().getWilderness().getFPlayersWhereOnline(true).size());
return String.valueOf(FPlayers.getInstance().getAllFPlayers().stream().filter(p -> !p.hasFaction()).count());
case MAX_ALLIES:
if (P.p.getConfig().getBoolean("max-relations.enabled", true)) {
return String.valueOf(P.p.getConfig().getInt("max-relations.ally", 10));