Using PEX 1.15 and only as superpermsmanager to allow for use of the parent permission. Also changed the handling of money on faction leave as last player.

This commit is contained in:
Olof Larsson 2011-10-13 19:47:37 +02:00
parent 98260c75de
commit 88fe43d600
4 changed files with 38 additions and 40 deletions

Binary file not shown.

View File

@ -12,6 +12,10 @@ permissions:
factions.lock: true factions.lock: true
factions.reload: true factions.reload: true
factions.save: true factions.save: true
factions.*:
description: This is just an alias for factions.kit.admin
children:
factions.kit.admin: true
factions.kit.mod: factions.kit.mod:
description: All faction permissions but configuration and persistance. description: All faction permissions but configuration and persistance.
children: children:
@ -20,7 +24,7 @@ permissions:
factions.setpermanent: true factions.setpermanent: true
factions.setpeaceful: true factions.setpeaceful: true
factions.sethome.any: true factions.sethome.any: true
factions.money.withdraw.any: true factions.money.*: true
factions.kit.halfmod: factions.kit.halfmod:
description: Zones, bypassing, and kicking description: Zones, bypassing, and kicking
children: children:
@ -55,13 +59,7 @@ permissions:
factions.list: true factions.list: true
factions.map: true factions.map: true
factions.mod: true factions.mod: true
factions.money.balance: true factions.money.kit.standard: true
factions.money.balance.any: true
factions.money.deposit: true
factions.money.withdraw: true
factions.money.f2f: true
factions.money.f2p: true
factions.money.p2f: true
factions.noboom: true factions.noboom: true
factions.open: true factions.open: true
factions.owner: true factions.owner: true
@ -140,12 +138,21 @@ permissions:
description: transfer money from faction to player description: transfer money from faction to player
factions.money.p2f: factions.money.p2f:
description: transfer money from player to faction description: transfer money from player to faction
factions.money.*: factions.money.kit.standard:
children: children:
factions.money.balance: true factions.money.balance: true
factions.money.balance.any: true factions.money.balance.any: true
factions.money.deposit: true factions.money.deposit: true
factions.money.withdraw: true factions.money.withdraw: true
factions.money.f2f: true
factions.money.f2p: true
factions.money.p2f: true
factions.money.*:
children:
factions.money.kit.standard: true
factions.money.balance.any: true
factions.money.deposit: true
factions.money.withdraw: true
factions.money.withdraw.any: true factions.money.withdraw.any: true
factions.money.f2f: true factions.money.f2f: true
factions.money.f2p: true factions.money.f2p: true

View File

@ -1,5 +1,7 @@
package com.massivecraft.factions; package com.massivecraft.factions;
import java.util.ArrayList;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -593,31 +595,22 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator
{ {
double cost = Conf.econCostLeave; double cost = Conf.econCostLeave;
if ( ! Econ.modifyMoney(this, -cost, "to leave your faction.", "for leaving your faction.")) return; if ( ! Econ.modifyMoney(this, -cost, "to leave your faction.", "for leaving your faction.")) return;
/* }
// pay up
if (cost > 0.0) { // Am I the last one in the faction?
String costString = Econ.moneyString(cost); ArrayList<FPlayer> fplayers = myFaction.getFPlayers();
if ( ! Econ.deductMoney(this.getName(), cost)) { if (fplayers.size() == 1 && fplayers.get(0) == this)
msg("<b>It costs <h>%s<b> to leave your faction, which you can't currently afford.", costString); {
return; // Transfer all money
} if (Econ.shouldBeUsed())
msg("<i>You have paid <h>%s<i> to leave your faction.", costString); Econ.transferMoney(this, myFaction, this, myFaction.getAccount().balance());
}
// wait... we pay you to leave?
else if (cost < 0.0)
{
String costString = Econ.moneyString(-cost);
Econ.addMoney(this.getName(), -cost);
msg("<i>You have been paid <h>%s<i> for leaving your faction.", costString);
}*/
} }
if (myFaction.isNormal()) if (myFaction.isNormal())
{ {
//myFaction.msg("%s<i> left your faction.", this.getNameAndRelevant(myFaction));
for (FPlayer fplayer : myFaction.getFPlayersWhereOnline(true)) for (FPlayer fplayer : myFaction.getFPlayersWhereOnline(true))
{ {
fplayer.msg("%s<i> left your faction.", this.describeTo(fplayer, true)); fplayer.msg("%s<i> left %s<i>.", this.describeTo(fplayer, true), myFaction.describeTo(fplayer));
} }
} }
@ -625,10 +618,6 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator
if (myFaction.isNormal() && !perm && myFaction.getFPlayers().isEmpty()) if (myFaction.isNormal() && !perm && myFaction.getFPlayers().isEmpty())
{ {
// Transfer all money
if (Econ.shouldBeUsed())
Econ.transferMoney(this, myFaction, this, myFaction.getAccount().balance());
// Remove this faction // Remove this faction
for (FPlayer fplayer : FPlayers.i.getOnline()) for (FPlayer fplayer : FPlayers.i.getOnline())
{ {

View File

@ -89,7 +89,9 @@ public class PermUtil {
if (pex != null) if (pex != null)
{ {
return pex.has((Player)me, perm); //return pex.has((Player)me, perm);
// Since pex supports superperms we should use those instead.
return ((Player)me).hasPermission(perm);
} }
if (perm2or3 != null) if (perm2or3 != null)