Fix permision to withdraw money and chunk border/connected checking.

This commit is contained in:
Olof Larsson 2013-05-17 08:37:32 +02:00
parent a79577a355
commit ac95004450
3 changed files with 11 additions and 3 deletions

View File

@ -224,6 +224,8 @@ public class Board extends Entity<Board> implements BoardInterface
@Override @Override
public boolean isBorderPs(PS ps) public boolean isBorderPs(PS ps)
{ {
ps = ps.getChunk(true);
PS nearby = null; PS nearby = null;
Faction faction = this.getFactionAt(ps); Faction faction = this.getFactionAt(ps);
@ -246,6 +248,8 @@ public class Board extends Entity<Board> implements BoardInterface
@Override @Override
public boolean isConnectedPs(PS ps, Faction faction) public boolean isConnectedPs(PS ps, Faction faction)
{ {
ps = ps.getChunk(true);
PS nearby = null; PS nearby = null;
nearby = ps.withChunkX(ps.getChunkX() +1); nearby = ps.withChunkX(ps.getChunkX() +1);

View File

@ -668,7 +668,7 @@ public class UPlayer extends SenderEntity<UPlayer> implements EconomyParticipato
( (
uconf.claimsMustBeConnected uconf.claimsMustBeConnected
&& newFaction.getLandCountInWorld(ps.getWorld()) > 0 && newFaction.getLandCountInWorld(ps.getWorld()) > 0
&& !BoardColls.get().isConnectedPs(ps, newFaction) && !BoardColls.get().isConnectedPs(chunk, newFaction)
&& (!uconf.claimsCanBeUnconnectedIfOwnedByOtherFaction || !oldFaction.isNormal()) && (!uconf.claimsCanBeUnconnectedIfOwnedByOtherFaction || !oldFaction.isNormal())
) )
{ {
@ -706,7 +706,7 @@ public class UPlayer extends SenderEntity<UPlayer> implements EconomyParticipato
return false; return false;
} }
if ( ! BoardColls.get().isBorderPs(ps)) if ( ! BoardColls.get().isBorderPs(chunk))
{ {
msg("<b>You must start claiming land at the border of the territory."); msg("<b>You must start claiming land at the border of the territory.");
return false; return false;

View File

@ -89,7 +89,11 @@ public class Econ
if (i == fI && fI == fYou) return true; if (i == fI && fI == fYou) return true;
// Factions can be controlled by those that have permissions // Factions can be controlled by those that have permissions
if (you instanceof Faction && FPerm.WITHDRAW.has(fI, fYou)) return true; if (you instanceof Faction)
{
if (i instanceof Faction && FPerm.WITHDRAW.has((Faction)i, fYou)) return true;
if (i instanceof UPlayer && FPerm.WITHDRAW.has((UPlayer)i, fYou, false)) return true;
}
// Otherwise you may not! ;,,; // Otherwise you may not! ;,,;
i.msg("<h>%s<i> lacks permission to control <h>%s's<i> money.", i.describeTo(i, true), you.describeTo(i)); i.msg("<h>%s<i> lacks permission to control <h>%s's<i> money.", i.describeTo(i, true), you.describeTo(i));