From cd24b053dc25fef745d79e1fd7b75c9a738b6065 Mon Sep 17 00:00:00 2001 From: Driftay Date: Thu, 26 Mar 2020 01:11:57 -0400 Subject: [PATCH] Fixed Money Spam if Amount is 0 --- .../com/massivecraft/factions/cmd/econ/CmdMoneyDeposit.java | 5 +++++ .../massivecraft/factions/cmd/econ/CmdMoneyTransferFf.java | 6 ++++++ .../massivecraft/factions/cmd/econ/CmdMoneyTransferFp.java | 5 +++++ .../massivecraft/factions/cmd/econ/CmdMoneyTransferPf.java | 5 +++++ .../massivecraft/factions/cmd/econ/CmdMoneyWithdraw.java | 5 +++++ .../factions/listeners/FactionsPlayerListener.java | 1 + 6 files changed, 27 insertions(+) diff --git a/src/main/java/com/massivecraft/factions/cmd/econ/CmdMoneyDeposit.java b/src/main/java/com/massivecraft/factions/cmd/econ/CmdMoneyDeposit.java index c46c3b4b..2f4f251d 100644 --- a/src/main/java/com/massivecraft/factions/cmd/econ/CmdMoneyDeposit.java +++ b/src/main/java/com/massivecraft/factions/cmd/econ/CmdMoneyDeposit.java @@ -36,6 +36,11 @@ public class CmdMoneyDeposit extends FCommand { public void perform(CommandContext context) { double amount = context.argAsDouble(0, 0d); EconomyParticipator faction = context.argAsFaction(1, context.faction); + + if(amount <= 0){ + return; + } + if (faction == null) { return; } diff --git a/src/main/java/com/massivecraft/factions/cmd/econ/CmdMoneyTransferFf.java b/src/main/java/com/massivecraft/factions/cmd/econ/CmdMoneyTransferFf.java index c5cd0fdd..61120249 100644 --- a/src/main/java/com/massivecraft/factions/cmd/econ/CmdMoneyTransferFf.java +++ b/src/main/java/com/massivecraft/factions/cmd/econ/CmdMoneyTransferFf.java @@ -33,6 +33,12 @@ public class CmdMoneyTransferFf extends FCommand { @Override public void perform(CommandContext context) { double amount = context.argAsDouble(0, 0d); + + if(amount <= 0){ + return; + } + + EconomyParticipator from = context.argAsFaction(1); if (from == null) { return; diff --git a/src/main/java/com/massivecraft/factions/cmd/econ/CmdMoneyTransferFp.java b/src/main/java/com/massivecraft/factions/cmd/econ/CmdMoneyTransferFp.java index ec8fd6c7..edcbc571 100644 --- a/src/main/java/com/massivecraft/factions/cmd/econ/CmdMoneyTransferFp.java +++ b/src/main/java/com/massivecraft/factions/cmd/econ/CmdMoneyTransferFp.java @@ -32,6 +32,11 @@ public class CmdMoneyTransferFp extends FCommand { @Override public void perform(CommandContext context) { double amount = context.argAsDouble(0, 0d); + + if(amount <= 0){ + return; + } + EconomyParticipator from = context.argAsFaction(1); if (from == null) { return; diff --git a/src/main/java/com/massivecraft/factions/cmd/econ/CmdMoneyTransferPf.java b/src/main/java/com/massivecraft/factions/cmd/econ/CmdMoneyTransferPf.java index 6d0072ce..be048fbc 100644 --- a/src/main/java/com/massivecraft/factions/cmd/econ/CmdMoneyTransferPf.java +++ b/src/main/java/com/massivecraft/factions/cmd/econ/CmdMoneyTransferPf.java @@ -32,6 +32,11 @@ public class CmdMoneyTransferPf extends FCommand { @Override public void perform(CommandContext context) { double amount = context.argAsDouble(0, 0d); + + if(amount <= 0){ + return; + } + EconomyParticipator from = context.argAsBestFPlayerMatch(1); if (from == null) { return; diff --git a/src/main/java/com/massivecraft/factions/cmd/econ/CmdMoneyWithdraw.java b/src/main/java/com/massivecraft/factions/cmd/econ/CmdMoneyWithdraw.java index 79768e28..b455ee43 100644 --- a/src/main/java/com/massivecraft/factions/cmd/econ/CmdMoneyWithdraw.java +++ b/src/main/java/com/massivecraft/factions/cmd/econ/CmdMoneyWithdraw.java @@ -39,6 +39,11 @@ public class CmdMoneyWithdraw extends FCommand { @Override public void perform(CommandContext context) { double amount = context.argAsDouble(0, 0d); + + if(amount <= 0){ + return; + } + EconomyParticipator faction = context.argAsFaction(1, context.faction); if (faction == null) { return; diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java index 0c769eb0..63436d94 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java @@ -451,6 +451,7 @@ public class FactionsPlayerListener implements Listener { case CHIPPED_ANVIL: case DAMAGED_ANVIL: case BREWING_STAND: + return PermissableAction.CONTAINER; default: return null;