Attempt 1 at fixing the claim permission bug.

This commit is contained in:
Olof Larsson 2013-05-13 07:21:11 +02:00
parent 509e7c1711
commit 81d79775f8
2 changed files with 45 additions and 37 deletions

View File

@ -4,7 +4,6 @@ import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
import com.massivecraft.factions.cmd.req.ReqHasFaction;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.FactionColls;
import com.massivecraft.factions.FPerm;
import com.massivecraft.factions.Perm;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.cmd.req.ReqIsPlayer;
@ -29,9 +28,6 @@ public class CmdFactionsUnclaim extends FCommand
PS chunk = PS.valueOf(me).getChunk(true);
Faction newFaction = FactionColls.get().get(me).getNone();
// FPerm
if (!FPerm.TERRITORY.has(usender, usenderFaction, true)) return;
// Apply
if (usender.tryClaim(newFaction, chunk, true, true)) return;
}

View File

@ -8,6 +8,7 @@ import org.bukkit.entity.Player;
import com.massivecraft.factions.EconomyParticipator;
import com.massivecraft.factions.FFlag;
import com.massivecraft.factions.FPerm;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Lang;
import com.massivecraft.factions.Rel;
@ -628,22 +629,29 @@ public class UPlayer extends SenderEntity<UPlayer> implements EconomyParticipato
return true;
}
if (!this.isUsingAdminMode() && newFaction.isNormal())
if (!this.isUsingAdminMode())
{
if (newFaction.isNormal())
{
int ownedLand = newFaction.getLandCount();
if (mconf.worldsNoClaiming.contains(ps.getWorld()))
{
msg("<b>Sorry, this world has land claiming disabled.");
return false;
}
if (!FPerm.TERRITORY.has(this, newFaction, true))
{
return false;
}
if (newFaction.getUPlayers().size() < uconf.claimsRequireMinFactionMembers)
{
msg("Factions must have at least <h>%s<b> members to claim land.", uconf.claimsRequireMinFactionMembers);
return false;
}
int ownedLand = newFaction.getLandCount();
if (uconf.claimedLandsMax != 0 && ownedLand >= uconf.claimedLandsMax && ! newFaction.getFlag(FFlag.INFPOWER))
{
msg("<b>Limit reached. You can't claim more land.");
@ -655,6 +663,7 @@ public class UPlayer extends SenderEntity<UPlayer> implements EconomyParticipato
msg("<b>You can't claim more land. You need more power.");
return false;
}
}
if (oldFaction.isNormal())
{
@ -689,6 +698,8 @@ public class UPlayer extends SenderEntity<UPlayer> implements EconomyParticipato
return false;
}
if (!FPerm.TERRITORY.has(this, oldFaction, false))
{
if (!oldFaction.hasLandInflation())
{
msg("%s<i> owns this land and is strong enough to keep it.", oldFaction.getName(this));
@ -702,6 +713,7 @@ public class UPlayer extends SenderEntity<UPlayer> implements EconomyParticipato
}
}
}
}
// Event
FactionsEventChunkChange event = new FactionsEventChunkChange(sender, chunk, newFaction);