mirror of
https://github.com/MassiveCraft/Factions.git
synced 2024-11-27 04:35:21 +01:00
Bugfixes and awesome probably complete money commands.
This commit is contained in:
parent
0888e027ad
commit
98260c75de
31
plugin.yml
31
plugin.yml
@ -31,6 +31,7 @@ permissions:
|
||||
factions.kick.any: true
|
||||
factions.ownershipbypass: true
|
||||
factions.kit.fullplayer:
|
||||
default: true
|
||||
description: Can also create new factions.
|
||||
children:
|
||||
factions.kit.halfplayer: true
|
||||
@ -57,8 +58,10 @@ permissions:
|
||||
factions.money.balance: true
|
||||
factions.money.balance.any: true
|
||||
factions.money.deposit: true
|
||||
factions.money.pay: true
|
||||
factions.money.withdraw: true
|
||||
factions.money.f2f: true
|
||||
factions.money.f2p: true
|
||||
factions.money.p2f: true
|
||||
factions.noboom: true
|
||||
factions.open: true
|
||||
factions.owner: true
|
||||
@ -121,26 +124,32 @@ permissions:
|
||||
description: show the territory map, and set optional auto update
|
||||
factions.mod:
|
||||
description: give or revoke moderator rights
|
||||
factions.money.*:
|
||||
children:
|
||||
factions.money.balance: true
|
||||
factions.money.balance.any: true
|
||||
factions.money.deposit: true
|
||||
factions.money.pay: true
|
||||
factions.money.withdraw: true
|
||||
factions.money.withdraw.any: true
|
||||
factions.money.balance:
|
||||
description: show your factions current money balance
|
||||
factions.money.balance.any:
|
||||
description: show money balance for factions other than your own
|
||||
factions.money.deposit:
|
||||
description: deposit money into a faction bank
|
||||
factions.money.pay:
|
||||
description: pay another faction from your bank
|
||||
factions.money.withdraw:
|
||||
description: withdraw money from your faction bank
|
||||
factions.money.withdraw.any:
|
||||
description: withdraw money from your factions other than your own
|
||||
factions.money.f2f:
|
||||
description: transfer money from faction to faction
|
||||
factions.money.f2p:
|
||||
description: transfer money from faction to player
|
||||
factions.money.p2f:
|
||||
description: transfer money from player to faction
|
||||
factions.money.*:
|
||||
children:
|
||||
factions.money.balance: true
|
||||
factions.money.balance.any: true
|
||||
factions.money.deposit: true
|
||||
factions.money.withdraw: true
|
||||
factions.money.withdraw.any: true
|
||||
factions.money.f2f: true
|
||||
factions.money.f2p: true
|
||||
factions.money.p2f: true
|
||||
factions.noboom:
|
||||
description: toggle explosions (peaceful factions only)
|
||||
factions.open:
|
||||
|
@ -74,7 +74,7 @@ public class FPlayers extends PlayerEntityCollection<FPlayer>
|
||||
{
|
||||
for (FPlayer fplayer : this.get())
|
||||
{
|
||||
if (fplayer.getId().equalsIgnoreCase(playername) || fplayer.getId().startsWith(playername))
|
||||
if (fplayer.getId().equalsIgnoreCase(playername) || fplayer.getId().toLowerCase().startsWith(playername.toLowerCase()))
|
||||
{
|
||||
return fplayer;
|
||||
}
|
||||
|
@ -60,27 +60,27 @@ public class CmdHelp extends FCommand
|
||||
ArrayList<String> pageLines;
|
||||
|
||||
pageLines = new ArrayList<String>();
|
||||
pageLines.add( p.cmdBase.cmdHelp.getUseageTemplate() );
|
||||
pageLines.add( p.cmdBase.cmdList.getUseageTemplate() );
|
||||
pageLines.add( p.cmdBase.cmdShow.getUseageTemplate() );
|
||||
pageLines.add( p.cmdBase.cmdPower.getUseageTemplate() );
|
||||
pageLines.add( p.cmdBase.cmdJoin.getUseageTemplate() );
|
||||
pageLines.add( p.cmdBase.cmdLeave.getUseageTemplate() );
|
||||
pageLines.add( p.cmdBase.cmdChat.getUseageTemplate() );
|
||||
pageLines.add( p.cmdBase.cmdHome.getUseageTemplate() );
|
||||
pageLines.add( p.cmdBase.cmdHelp.getUseageTemplate(true) );
|
||||
pageLines.add( p.cmdBase.cmdList.getUseageTemplate(true) );
|
||||
pageLines.add( p.cmdBase.cmdShow.getUseageTemplate(true) );
|
||||
pageLines.add( p.cmdBase.cmdPower.getUseageTemplate(true) );
|
||||
pageLines.add( p.cmdBase.cmdJoin.getUseageTemplate(true) );
|
||||
pageLines.add( p.cmdBase.cmdLeave.getUseageTemplate(true) );
|
||||
pageLines.add( p.cmdBase.cmdChat.getUseageTemplate(true) );
|
||||
pageLines.add( p.cmdBase.cmdHome.getUseageTemplate(true) );
|
||||
pageLines.add( p.txt.parse("<i>Learn how to create a faction on the next page.") );
|
||||
helpPages.add(pageLines);
|
||||
|
||||
pageLines = new ArrayList<String>();
|
||||
pageLines.add( p.cmdBase.cmdCreate.getUseageTemplate() );
|
||||
pageLines.add( p.cmdBase.cmdDescription.getUseageTemplate() );
|
||||
pageLines.add( p.cmdBase.cmdTag.getUseageTemplate() );
|
||||
pageLines.add( p.cmdBase.cmdCreate.getUseageTemplate(true) );
|
||||
pageLines.add( p.cmdBase.cmdDescription.getUseageTemplate(true) );
|
||||
pageLines.add( p.cmdBase.cmdTag.getUseageTemplate(true) );
|
||||
pageLines.add( p.txt.parse("<i>You might want to close it and use invitations:" ));
|
||||
pageLines.add( p.cmdBase.cmdOpen.getUseageTemplate() );
|
||||
pageLines.add( p.cmdBase.cmdInvite.getUseageTemplate() );
|
||||
pageLines.add( p.cmdBase.cmdDeinvite.getUseageTemplate() );
|
||||
pageLines.add( p.cmdBase.cmdOpen.getUseageTemplate(true) );
|
||||
pageLines.add( p.cmdBase.cmdInvite.getUseageTemplate(true) );
|
||||
pageLines.add( p.cmdBase.cmdDeinvite.getUseageTemplate(true) );
|
||||
pageLines.add( p.txt.parse("<i>And don't forget to set your home:" ));
|
||||
pageLines.add( p.cmdBase.cmdSethome.getUseageTemplate() );
|
||||
pageLines.add( p.cmdBase.cmdSethome.getUseageTemplate(true) );
|
||||
helpPages.add(pageLines);
|
||||
|
||||
if (Econ.shouldBeUsed())
|
||||
@ -91,7 +91,7 @@ public class CmdHelp extends FCommand
|
||||
pageLines.add( p.txt.parse("<i>things, so it will need to have money deposited into it." ));
|
||||
pageLines.add( p.txt.parse("<i>To lear more use the money command." ));
|
||||
pageLines.add( "" );
|
||||
pageLines.add( p.cmdBase.cmdMoney.getUseageTemplate() );
|
||||
pageLines.add( p.cmdBase.cmdMoney.getUseageTemplate(true) );
|
||||
pageLines.add( "" );
|
||||
pageLines.add( "" );
|
||||
pageLines.add( "" );
|
||||
@ -99,23 +99,23 @@ public class CmdHelp extends FCommand
|
||||
}
|
||||
|
||||
pageLines = new ArrayList<String>();
|
||||
pageLines.add( p.cmdBase.cmdClaim.getUseageTemplate() );
|
||||
pageLines.add( p.cmdBase.cmdAutoClaim.getUseageTemplate() );
|
||||
pageLines.add( p.cmdBase.cmdUnclaim.getUseageTemplate() );
|
||||
pageLines.add( p.cmdBase.cmdUnclaimall.getUseageTemplate() );
|
||||
pageLines.add( p.cmdBase.cmdKick.getUseageTemplate() );
|
||||
pageLines.add( p.cmdBase.cmdMod.getUseageTemplate() );
|
||||
pageLines.add( p.cmdBase.cmdAdmin.getUseageTemplate() );
|
||||
pageLines.add( p.cmdBase.cmdTitle.getUseageTemplate() );
|
||||
pageLines.add( p.cmdBase.cmdClaim.getUseageTemplate(true) );
|
||||
pageLines.add( p.cmdBase.cmdAutoClaim.getUseageTemplate(true) );
|
||||
pageLines.add( p.cmdBase.cmdUnclaim.getUseageTemplate(true) );
|
||||
pageLines.add( p.cmdBase.cmdUnclaimall.getUseageTemplate(true) );
|
||||
pageLines.add( p.cmdBase.cmdKick.getUseageTemplate(true) );
|
||||
pageLines.add( p.cmdBase.cmdMod.getUseageTemplate(true) );
|
||||
pageLines.add( p.cmdBase.cmdAdmin.getUseageTemplate(true) );
|
||||
pageLines.add( p.cmdBase.cmdTitle.getUseageTemplate(true) );
|
||||
pageLines.add( p.txt.parse("<i>Player titles are just for fun. No rules connected to them." ));
|
||||
helpPages.add(pageLines);
|
||||
|
||||
pageLines = new ArrayList<String>();
|
||||
pageLines.add( p.cmdBase.cmdMap.getUseageTemplate() );
|
||||
pageLines.add( p.cmdBase.cmdBoom.getUseageTemplate() );
|
||||
pageLines.add( p.cmdBase.cmdMap.getUseageTemplate(true) );
|
||||
pageLines.add( p.cmdBase.cmdBoom.getUseageTemplate(true) );
|
||||
pageLines.add("");
|
||||
pageLines.add( p.cmdBase.cmdOwner.getUseageTemplate() );
|
||||
pageLines.add( p.cmdBase.cmdOwnerList.getUseageTemplate() );
|
||||
pageLines.add( p.cmdBase.cmdOwner.getUseageTemplate(true) );
|
||||
pageLines.add( p.cmdBase.cmdOwnerList.getUseageTemplate(true) );
|
||||
pageLines.add("");
|
||||
pageLines.add(p.txt.parse("<i>Claimed land with ownership set is further protected so"));
|
||||
pageLines.add(p.txt.parse("<i>that only the owner(s), faction admin, and possibly the"));
|
||||
@ -123,11 +123,11 @@ public class CmdHelp extends FCommand
|
||||
helpPages.add(pageLines);
|
||||
|
||||
pageLines = new ArrayList<String>();
|
||||
pageLines.add( p.cmdBase.cmdDisband.getUseageTemplate() );
|
||||
pageLines.add( p.cmdBase.cmdDisband.getUseageTemplate(true) );
|
||||
pageLines.add("");
|
||||
pageLines.add( p.cmdBase.cmdRelationAlly.getUseageTemplate() );
|
||||
pageLines.add( p.cmdBase.cmdRelationNeutral.getUseageTemplate() );
|
||||
pageLines.add( p.cmdBase.cmdRelationEnemy.getUseageTemplate() );
|
||||
pageLines.add( p.cmdBase.cmdRelationAlly.getUseageTemplate(true) );
|
||||
pageLines.add( p.cmdBase.cmdRelationNeutral.getUseageTemplate(true) );
|
||||
pageLines.add( p.cmdBase.cmdRelationEnemy.getUseageTemplate(true) );
|
||||
pageLines.add(p.txt.parse("<i>Set the relation you WISH to have with another faction."));
|
||||
pageLines.add(p.txt.parse("<i>Your default relation with other factions will be neutral."));
|
||||
pageLines.add(p.txt.parse("<i>If BOTH factions choose \"ally\" you will be allies."));
|
||||
@ -160,26 +160,26 @@ public class CmdHelp extends FCommand
|
||||
|
||||
pageLines = new ArrayList<String>();
|
||||
pageLines.add("Finally some commands for the server admins:");
|
||||
pageLines.add( p.cmdBase.cmdBypass.getUseageTemplate() );
|
||||
pageLines.add( p.cmdBase.cmdSafeclaim.getUseageTemplate() );
|
||||
pageLines.add( p.cmdBase.cmdAutoSafeclaim.getUseageTemplate() );
|
||||
pageLines.add( p.cmdBase.cmdSafeunclaimall.getUseageTemplate() );
|
||||
pageLines.add( p.cmdBase.cmdWarclaim.getUseageTemplate() );
|
||||
pageLines.add( p.cmdBase.cmdAutoWarclaim.getUseageTemplate() );
|
||||
pageLines.add( p.cmdBase.cmdWarunclaimall.getUseageTemplate() );
|
||||
pageLines.add( p.cmdBase.cmdBypass.getUseageTemplate(true) );
|
||||
pageLines.add( p.cmdBase.cmdSafeclaim.getUseageTemplate(true) );
|
||||
pageLines.add( p.cmdBase.cmdAutoSafeclaim.getUseageTemplate(true) );
|
||||
pageLines.add( p.cmdBase.cmdSafeunclaimall.getUseageTemplate(true) );
|
||||
pageLines.add( p.cmdBase.cmdWarclaim.getUseageTemplate(true) );
|
||||
pageLines.add( p.cmdBase.cmdAutoWarclaim.getUseageTemplate(true) );
|
||||
pageLines.add( p.cmdBase.cmdWarunclaimall.getUseageTemplate(true) );
|
||||
pageLines.add(p.txt.parse("<i>Note: " + p.cmdBase.cmdUnclaim.getUseageTemplate(false) + P.p.txt.parse("<i>") + " works on safe/war zones as well."));
|
||||
helpPages.add(pageLines);
|
||||
|
||||
pageLines = new ArrayList<String>();
|
||||
pageLines.add(p.txt.parse("<i>More commands for server admins:"));
|
||||
pageLines.add( p.cmdBase.cmdPeaceful.getUseageTemplate() );
|
||||
pageLines.add( p.cmdBase.cmdPermanent.getUseageTemplate() );
|
||||
pageLines.add( p.cmdBase.cmdPeaceful.getUseageTemplate(true) );
|
||||
pageLines.add( p.cmdBase.cmdPermanent.getUseageTemplate(true) );
|
||||
pageLines.add(p.txt.parse("<i>Peaceful factions are protected from PvP and land capture."));
|
||||
pageLines.add( p.cmdBase.cmdLock.getUseageTemplate() );
|
||||
pageLines.add( p.cmdBase.cmdReload.getUseageTemplate() );
|
||||
pageLines.add( p.cmdBase.cmdSaveAll.getUseageTemplate() );
|
||||
pageLines.add( p.cmdBase.cmdVersion.getUseageTemplate() );
|
||||
pageLines.add( p.cmdBase.cmdConfig.getUseageTemplate() );
|
||||
pageLines.add( p.cmdBase.cmdLock.getUseageTemplate(true) );
|
||||
pageLines.add( p.cmdBase.cmdReload.getUseageTemplate(true) );
|
||||
pageLines.add( p.cmdBase.cmdSaveAll.getUseageTemplate(true) );
|
||||
pageLines.add( p.cmdBase.cmdVersion.getUseageTemplate(true) );
|
||||
pageLines.add( p.cmdBase.cmdConfig.getUseageTemplate(true) );
|
||||
helpPages.add(pageLines);
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,9 @@ public class CmdMoney extends FCommand
|
||||
public CmdMoneyBalance cmdMoneyBalance = new CmdMoneyBalance();
|
||||
public CmdMoneyDeposit cmdMoneyDeposit = new CmdMoneyDeposit();
|
||||
public CmdMoneyWithdraw cmdMoneyWithdraw = new CmdMoneyWithdraw();
|
||||
public CmdMoneyPay cmdMoneyPay = new CmdMoneyPay();
|
||||
public CmdMoneyTransferFf cmdMoneyTransferFf = new CmdMoneyTransferFf();
|
||||
public CmdMoneyTransferFp cmdMoneyTransferFp = new CmdMoneyTransferFp();
|
||||
public CmdMoneyTransferPf cmdMoneyTransferPf = new CmdMoneyTransferPf();
|
||||
|
||||
public CmdMoney()
|
||||
{
|
||||
@ -18,7 +20,6 @@ public class CmdMoney extends FCommand
|
||||
//this.optionalArgs.put("","")
|
||||
|
||||
this.isMoneyCommand = true;
|
||||
this.isBankCommand = false;
|
||||
|
||||
senderMustBePlayer = false;
|
||||
senderMustBeMember = false;
|
||||
@ -31,7 +32,9 @@ public class CmdMoney extends FCommand
|
||||
this.addSubCommand(this.cmdMoneyBalance);
|
||||
this.addSubCommand(this.cmdMoneyDeposit);
|
||||
this.addSubCommand(this.cmdMoneyWithdraw);
|
||||
this.addSubCommand(this.cmdMoneyPay);
|
||||
this.addSubCommand(this.cmdMoneyTransferFf);
|
||||
this.addSubCommand(this.cmdMoneyTransferFp);
|
||||
this.addSubCommand(this.cmdMoneyTransferPf);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -16,8 +16,7 @@ public class CmdMoneyBalance extends FCommand
|
||||
this.optionalArgs.put("faction", "yours");
|
||||
|
||||
this.permission = Permission.MONEY_BALANCE.node;
|
||||
this.isMoneyCommand = true;
|
||||
this.isBankCommand = true;
|
||||
this.setHelpShort("show faction balance");
|
||||
|
||||
senderMustBePlayer = false;
|
||||
senderMustBeMember = false;
|
||||
|
@ -11,14 +11,14 @@ public class CmdMoneyDeposit extends FCommand
|
||||
public CmdMoneyDeposit()
|
||||
{
|
||||
super();
|
||||
this.aliases.add("d");
|
||||
this.aliases.add("deposit");
|
||||
|
||||
this.requiredArgs.add("amount");
|
||||
this.optionalArgs.put("faction", "yours");
|
||||
|
||||
this.permission = Permission.MONEY_DEPOSIT.node;
|
||||
this.isMoneyCommand = true;
|
||||
this.isBankCommand = true;
|
||||
this.setHelpShort("deposit money");
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
@ -29,7 +29,7 @@ public class CmdMoneyDeposit extends FCommand
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
double amount = this.argAsDouble(0, 0);
|
||||
double amount = this.argAsDouble(0, 0d);
|
||||
Faction faction = this.argAsFaction(1, myFaction);
|
||||
if (faction == null) return;
|
||||
Econ.transferMoney(fme, fme, faction, amount);
|
||||
|
@ -1,37 +0,0 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.integration.Econ;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
|
||||
|
||||
public class CmdMoneyPay extends FCommand
|
||||
{
|
||||
public CmdMoneyPay()
|
||||
{
|
||||
this.aliases.add("pay");
|
||||
|
||||
this.requiredArgs.add("amount");
|
||||
this.requiredArgs.add("faction");
|
||||
|
||||
//this.optionalArgs.put("", "");
|
||||
|
||||
this.permission = Permission.MONEY_PAY.node;
|
||||
this.isMoneyCommand = true;
|
||||
this.isBankCommand = true;
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = true;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
double amount = this.argAsDouble(0, 0);
|
||||
Faction faction = this.argAsFaction(1);
|
||||
if (faction == null) return;
|
||||
Econ.transferMoney(fme, myFaction, faction, amount);
|
||||
}
|
||||
}
|
40
src/com/massivecraft/factions/cmd/CmdMoneyTransferFf.java
Normal file
40
src/com/massivecraft/factions/cmd/CmdMoneyTransferFf.java
Normal file
@ -0,0 +1,40 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.iface.EconomyParticipator;
|
||||
import com.massivecraft.factions.integration.Econ;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
|
||||
|
||||
public class CmdMoneyTransferFf extends FCommand
|
||||
{
|
||||
public CmdMoneyTransferFf()
|
||||
{
|
||||
this.aliases.add("ff");
|
||||
|
||||
this.requiredArgs.add("amount");
|
||||
this.requiredArgs.add("faction");
|
||||
this.requiredArgs.add("faction");
|
||||
|
||||
//this.optionalArgs.put("", "");
|
||||
|
||||
this.permission = Permission.MONEY_F2F.node;
|
||||
this.setHelpShort("transfer f -> f");
|
||||
|
||||
senderMustBePlayer = false;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
double amount = this.argAsDouble(0, 0d);
|
||||
EconomyParticipator from = this.argAsFaction(1);
|
||||
if (from == null) return;
|
||||
EconomyParticipator to = this.argAsFaction(2);
|
||||
if (to == null) return;
|
||||
|
||||
Econ.transferMoney(fme, from, to, amount);
|
||||
}
|
||||
}
|
40
src/com/massivecraft/factions/cmd/CmdMoneyTransferFp.java
Normal file
40
src/com/massivecraft/factions/cmd/CmdMoneyTransferFp.java
Normal file
@ -0,0 +1,40 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.iface.EconomyParticipator;
|
||||
import com.massivecraft.factions.integration.Econ;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
|
||||
|
||||
public class CmdMoneyTransferFp extends FCommand
|
||||
{
|
||||
public CmdMoneyTransferFp()
|
||||
{
|
||||
this.aliases.add("fp");
|
||||
|
||||
this.requiredArgs.add("amount");
|
||||
this.requiredArgs.add("faction");
|
||||
this.requiredArgs.add("player");
|
||||
|
||||
//this.optionalArgs.put("", "");
|
||||
|
||||
this.permission = Permission.MONEY_F2P.node;
|
||||
this.setHelpShort("transfer f -> p");
|
||||
|
||||
senderMustBePlayer = false;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
double amount = this.argAsDouble(0, 0d);
|
||||
EconomyParticipator from = this.argAsFaction(1);
|
||||
if (from == null) return;
|
||||
EconomyParticipator to = this.argAsBestFPlayerMatch(2);
|
||||
if (to == null) return;
|
||||
|
||||
Econ.transferMoney(fme, from, to, amount);
|
||||
}
|
||||
}
|
40
src/com/massivecraft/factions/cmd/CmdMoneyTransferPf.java
Normal file
40
src/com/massivecraft/factions/cmd/CmdMoneyTransferPf.java
Normal file
@ -0,0 +1,40 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.iface.EconomyParticipator;
|
||||
import com.massivecraft.factions.integration.Econ;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
|
||||
|
||||
public class CmdMoneyTransferPf extends FCommand
|
||||
{
|
||||
public CmdMoneyTransferPf()
|
||||
{
|
||||
this.aliases.add("pf");
|
||||
|
||||
this.requiredArgs.add("amount");
|
||||
this.requiredArgs.add("player");
|
||||
this.requiredArgs.add("faction");
|
||||
|
||||
//this.optionalArgs.put("", "");
|
||||
|
||||
this.permission = Permission.MONEY_P2F.node;
|
||||
this.setHelpShort("transfer p -> f");
|
||||
|
||||
senderMustBePlayer = false;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
double amount = this.argAsDouble(0, 0d);
|
||||
EconomyParticipator from = this.argAsBestFPlayerMatch(1);
|
||||
if (from == null) return;
|
||||
EconomyParticipator to = this.argAsFaction(2);
|
||||
if (to == null) return;
|
||||
|
||||
Econ.transferMoney(fme, from, to, amount);
|
||||
}
|
||||
}
|
@ -6,17 +6,16 @@ import com.massivecraft.factions.struct.Permission;
|
||||
|
||||
public class CmdMoneyWithdraw extends FCommand
|
||||
{
|
||||
|
||||
public CmdMoneyWithdraw()
|
||||
{
|
||||
this.aliases.add("w");
|
||||
this.aliases.add("withdraw");
|
||||
|
||||
this.requiredArgs.add("amount");
|
||||
this.optionalArgs.put("faction", "yours");
|
||||
|
||||
this.permission = Permission.MONEY_WITHDRAW.node;
|
||||
this.isMoneyCommand = true;
|
||||
this.isBankCommand = true;
|
||||
this.setHelpShort("withdraw money");
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
@ -27,47 +26,9 @@ public class CmdMoneyWithdraw extends FCommand
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
double amount = this.argAsDouble(0, 0);
|
||||
double amount = this.argAsDouble(0, 0d);
|
||||
Faction faction = this.argAsFaction(1, myFaction);
|
||||
if (faction == null) return;
|
||||
Econ.transferMoney(fme, faction, fme, amount);
|
||||
|
||||
/*if ( ! Conf.bankMembersCanWithdraw && ! assertMinRole(Role.MODERATOR))
|
||||
{
|
||||
msg("<b>Only faction moderators or admins are able to withdraw from the bank.");
|
||||
return;
|
||||
}
|
||||
|
||||
Faction faction = myFaction;
|
||||
|
||||
double amount = this.argAsDouble(0, 0d);
|
||||
|
||||
if( amount > 0.0 )
|
||||
{
|
||||
String amountString = Econ.moneyString(amount);
|
||||
|
||||
if( amount > faction.getMoney() )
|
||||
{
|
||||
amount = faction.getMoney();
|
||||
}
|
||||
|
||||
// TODO: Improve messages.
|
||||
|
||||
faction.removeMoney(amount);
|
||||
Econ.addMoney(fme.getName(), amount);
|
||||
msg("<i>You have withdrawn "+amountString+" from "+faction.getTag()+"'s bank.");
|
||||
msg("<i>"+faction.getTag()+" now has "+Econ.moneyString(faction.getMoney()));
|
||||
P.p.log(fme.getName() + " withdrew "+amountString+" from "+faction.getTag()+"'s bank.");
|
||||
|
||||
// TODO: FAction.getOnlineMembers().
|
||||
for (FPlayer fplayer : FPlayers.i.getOnline())
|
||||
{
|
||||
if (fplayer.getFaction() == faction)
|
||||
{
|
||||
fplayer.msg("%s<i> has withdrawn %s", fme.getNameAndRelevant(fplayer), amountString);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -27,7 +27,6 @@ public abstract class FCommand extends MCommand<P>
|
||||
public boolean senderMustBeAdmin;
|
||||
|
||||
public boolean isMoneyCommand;
|
||||
public boolean isBankCommand;
|
||||
|
||||
public FCommand()
|
||||
{
|
||||
@ -38,7 +37,6 @@ public abstract class FCommand extends MCommand<P>
|
||||
|
||||
// The money commands must be disabled if money should not be used.
|
||||
isMoneyCommand = false;
|
||||
isBankCommand = false;
|
||||
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
@ -76,7 +74,7 @@ public abstract class FCommand extends MCommand<P>
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.isBankCommand && ! Conf.bankEnabled)
|
||||
if (this.isMoneyCommand && ! Conf.bankEnabled)
|
||||
{
|
||||
msg("<b>The faction bank system is diabled on this server.");
|
||||
return false;
|
||||
|
@ -16,6 +16,7 @@ import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.P;
|
||||
import com.massivecraft.factions.iface.EconomyParticipator;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
import com.massivecraft.factions.util.RelationUtil;
|
||||
|
||||
@ -95,6 +96,9 @@ public class Econ
|
||||
// Bypassing players can do any kind of transaction
|
||||
if (i instanceof FPlayer && ((FPlayer)i).isAdminBypassing()) return true;
|
||||
|
||||
// Players with the any withdraw can to.
|
||||
if (i instanceof FPlayer && Permission.MONEY_WITHDRAW_ANY.has(((FPlayer)i).getPlayer())) return true;
|
||||
|
||||
// You can deposit to anywhere you feel like. It's your loss if you can't withdraw it again.
|
||||
if (i == you) return true;
|
||||
|
||||
|
@ -34,9 +34,11 @@ public enum Permission
|
||||
MONEY_BALANCE("money.balance"),
|
||||
MONEY_BALANCE_ANY("money.balance.any"),
|
||||
MONEY_DEPOSIT("money.deposit"),
|
||||
MONEY_PAY("money.pay"),
|
||||
MONEY_WITHDRAW("money.withdraw"),
|
||||
MONEY_WITHDRAW_ANY("money.withdraw.any"),
|
||||
MONEY_F2F("money.f2f"),
|
||||
MONEY_F2P("money.f2p"),
|
||||
MONEY_P2F("money.p2f"),
|
||||
NO_BOOM("noboom"),
|
||||
OPEN("open"),
|
||||
OWNER("owner"),
|
||||
|
@ -48,7 +48,7 @@ public abstract class MCommand<T extends MPlugin>
|
||||
{
|
||||
return pdesc;
|
||||
}
|
||||
return "*no short help available*";
|
||||
return "*info unavailable*";
|
||||
}
|
||||
return this.helpShort;
|
||||
}
|
||||
@ -265,7 +265,7 @@ public abstract class MCommand<T extends MPlugin>
|
||||
if (addShortHelp)
|
||||
{
|
||||
ret.append(p.txt.parseTags(" <i>"));
|
||||
ret.append(this.helpShort);
|
||||
ret.append(this.getHelpShort());
|
||||
}
|
||||
|
||||
return ret.toString();
|
||||
@ -332,12 +332,12 @@ public abstract class MCommand<T extends MPlugin>
|
||||
}
|
||||
|
||||
// INT ======================
|
||||
public int strAsInt(String str, int def)
|
||||
public Integer strAsInt(String str, Integer def)
|
||||
{
|
||||
if (str == null) return def;
|
||||
try
|
||||
{
|
||||
int ret = Integer.parseInt(str);
|
||||
Integer ret = Integer.parseInt(str);
|
||||
return ret;
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -345,22 +345,22 @@ public abstract class MCommand<T extends MPlugin>
|
||||
return def;
|
||||
}
|
||||
}
|
||||
public int argAsInt(int idx, int def)
|
||||
public Integer argAsInt(int idx, Integer def)
|
||||
{
|
||||
return strAsInt(this.argAsString(idx), def);
|
||||
}
|
||||
public int argAsInt(int idx)
|
||||
public Integer argAsInt(int idx)
|
||||
{
|
||||
return this.argAsInt(idx, -1);
|
||||
return this.argAsInt(idx, null);
|
||||
}
|
||||
|
||||
// Double ======================
|
||||
public double strAsDouble(String str, double def)
|
||||
public Double strAsDouble(String str, Double def)
|
||||
{
|
||||
if (str == null) return def;
|
||||
try
|
||||
{
|
||||
double ret = Double.parseDouble(str);
|
||||
Double ret = Double.parseDouble(str);
|
||||
return ret;
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -368,13 +368,13 @@ public abstract class MCommand<T extends MPlugin>
|
||||
return def;
|
||||
}
|
||||
}
|
||||
public double argAsDouble(int idx, double def)
|
||||
public Double argAsDouble(int idx, Double def)
|
||||
{
|
||||
return strAsDouble(this.argAsString(idx), def);
|
||||
}
|
||||
public double argAsDouble(int idx)
|
||||
public Double argAsDouble(int idx)
|
||||
{
|
||||
return this.argAsDouble(idx, -1d);
|
||||
return this.argAsDouble(idx, null);
|
||||
}
|
||||
|
||||
// TODO: Go through the str conversion for the other arg-readers as well.
|
||||
|
@ -44,6 +44,7 @@ public class PermUtil {
|
||||
{
|
||||
for(Permission permission : p.getDescription().getPermissions())
|
||||
{
|
||||
//p.log("\""+permission.getName()+"\" = \""+permission.getDescription()+"\"");
|
||||
this.permissionDescriptions.put(permission.getName(), permission.getDescription());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user