From ac9500445090b35ad7f9d9be75b11daa06466f21 Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Fri, 17 May 2013 08:37:32 +0200 Subject: [PATCH] Fix permision to withdraw money and chunk border/connected checking. --- src/com/massivecraft/factions/entity/Board.java | 4 ++++ src/com/massivecraft/factions/entity/UPlayer.java | 4 ++-- src/com/massivecraft/factions/integration/Econ.java | 6 +++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/com/massivecraft/factions/entity/Board.java b/src/com/massivecraft/factions/entity/Board.java index 980d466c..1deadb7a 100644 --- a/src/com/massivecraft/factions/entity/Board.java +++ b/src/com/massivecraft/factions/entity/Board.java @@ -224,6 +224,8 @@ public class Board extends Entity implements BoardInterface @Override public boolean isBorderPs(PS ps) { + ps = ps.getChunk(true); + PS nearby = null; Faction faction = this.getFactionAt(ps); @@ -246,6 +248,8 @@ public class Board extends Entity implements BoardInterface @Override public boolean isConnectedPs(PS ps, Faction faction) { + ps = ps.getChunk(true); + PS nearby = null; nearby = ps.withChunkX(ps.getChunkX() +1); diff --git a/src/com/massivecraft/factions/entity/UPlayer.java b/src/com/massivecraft/factions/entity/UPlayer.java index fbcb05a0..7ac2b092 100644 --- a/src/com/massivecraft/factions/entity/UPlayer.java +++ b/src/com/massivecraft/factions/entity/UPlayer.java @@ -668,7 +668,7 @@ public class UPlayer extends SenderEntity implements EconomyParticipato ( uconf.claimsMustBeConnected && newFaction.getLandCountInWorld(ps.getWorld()) > 0 - && !BoardColls.get().isConnectedPs(ps, newFaction) + && !BoardColls.get().isConnectedPs(chunk, newFaction) && (!uconf.claimsCanBeUnconnectedIfOwnedByOtherFaction || !oldFaction.isNormal()) ) { @@ -706,7 +706,7 @@ public class UPlayer extends SenderEntity implements EconomyParticipato return false; } - if ( ! BoardColls.get().isBorderPs(ps)) + if ( ! BoardColls.get().isBorderPs(chunk)) { msg("You must start claiming land at the border of the territory."); return false; diff --git a/src/com/massivecraft/factions/integration/Econ.java b/src/com/massivecraft/factions/integration/Econ.java index e79fd5f7..a46fa6ce 100644 --- a/src/com/massivecraft/factions/integration/Econ.java +++ b/src/com/massivecraft/factions/integration/Econ.java @@ -89,7 +89,11 @@ public class Econ if (i == fI && fI == fYou) return true; // 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! ;,,; i.msg("%s lacks permission to control %s's money.", i.describeTo(i, true), you.describeTo(i));