summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2013-01-19 10:54:11 -0800
committerKHobbits <rob@khobbits.co.uk>2013-01-19 10:54:11 -0800
commit9566499a2f5bdf50ee9a0c450ca68b1dedb5b219 (patch)
treefb80c05e916d510212eaf3174e6705b73705deb2
parent9aeb49f6c3f72a50968923807315c88fb399b109 (diff)
parent343c3a1bdd9f12698e8317bab48c0f3d45b0d618 (diff)
downloadEssentials-9566499a2f5bdf50ee9a0c450ca68b1dedb5b219.tar
Essentials-9566499a2f5bdf50ee9a0c450ca68b1dedb5b219.tar.gz
Essentials-9566499a2f5bdf50ee9a0c450ca68b1dedb5b219.tar.lz
Essentials-9566499a2f5bdf50ee9a0c450ca68b1dedb5b219.tar.xz
Essentials-9566499a2f5bdf50ee9a0c450ca68b1dedb5b219.zip
Merge pull request #272 from GunfighterJ/2.9
/eco overhaul, adds /eco set
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandeco.java62
-rw-r--r--Essentials/src/messages.properties2
-rw-r--r--Essentials/src/messages_cs.properties2
-rw-r--r--Essentials/src/messages_da.properties2
-rw-r--r--Essentials/src/messages_de.properties2
-rw-r--r--Essentials/src/messages_en.properties2
-rw-r--r--Essentials/src/messages_es.properties2
-rw-r--r--Essentials/src/messages_fi.properties2
-rw-r--r--Essentials/src/messages_fr.properties2
-rw-r--r--Essentials/src/messages_it.properties2
-rw-r--r--Essentials/src/messages_nl.properties2
-rw-r--r--Essentials/src/messages_pl.properties2
-rw-r--r--Essentials/src/messages_pt.properties2
-rw-r--r--Essentials/src/messages_se.properties2
-rw-r--r--Essentials/src/plugin.yml2
15 files changed, 78 insertions, 12 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandeco.java b/Essentials/src/com/earth2me/essentials/commands/Commandeco.java
index dd6d6ad0d..1c391a9bd 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandeco.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandeco.java
@@ -18,6 +18,8 @@ public class Commandeco extends EssentialsCommand
@Override
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
{
+ double startingBalance = (double)ess.getSettings().getStartingBalance();
+ String start = ess.getSettings().getCurrencySymbol() + ess.getSettings().getStartingBalance();
if (args.length < 2)
{
throw new NotEnoughArgumentsException();
@@ -34,8 +36,11 @@ public class Commandeco extends EssentialsCommand
throw new NotEnoughArgumentsException(ex);
}
+ double min = ess.getSettings().getMinMoney();
+
if (args[1].contentEquals("**"))
{
+ server.broadcastMessage(_("resetBalAll", start));
for (String sUser : ess.getUserMap().getAllUniqueUsers())
{
final User player = ess.getUser(sUser);
@@ -49,17 +54,30 @@ public class Commandeco extends EssentialsCommand
if (player.canAfford(amount, false))
{
player.takeMoney(amount);
- }
+ }
+ else
+ {
+ if (player.getMoney() > 0)
+ {
+ player.setMoney(0);
+ }
+ }
break;
case RESET:
- player.setMoney(amount == 0 ? ess.getSettings().getStartingBalance() : amount);
+ player.setMoney(startingBalance);
+ break;
+
+ case SET:
+ boolean underMinimum = (player.getMoney() - amount) < min;
+ player.setMoney(underMinimum ? min : amount);
break;
}
}
}
else if (args[1].contentEquals("*"))
{
+ server.broadcastMessage(_("resetBal", start));
for (Player onlinePlayer : server.getOnlinePlayers())
{
final User player = ess.getUser(onlinePlayer);
@@ -70,15 +88,26 @@ public class Commandeco extends EssentialsCommand
break;
case TAKE:
- if (!player.canAfford(amount, false))
+ if (player.canAfford(amount))
{
- throw new Exception(_("notEnoughMoney"));
+ player.takeMoney(amount);
+ }
+ else
+ {
+ if (player.getMoney() > 0)
+ {
+ player.setMoney(0);
+ }
}
- player.takeMoney(amount);
break;
case RESET:
- player.setMoney(amount == 0 ? ess.getSettings().getStartingBalance() : amount);
+ player.setMoney(startingBalance);
+ break;
+
+ case SET:
+ boolean underMinimum = (player.getMoney() - amount) < min;
+ player.setMoney(underMinimum ? min : amount);
break;
}
}
@@ -93,15 +122,26 @@ public class Commandeco extends EssentialsCommand
break;
case TAKE:
- if (!player.canAfford(amount, false))
+ if (player.canAfford(amount))
{
- throw new Exception(_("notEnoughMoney"));
+ player.takeMoney(amount);
+ }
+ else
+ {
+ if (player.getMoney() > 0)
+ {
+ player.setMoney(0);
+ }
}
- player.takeMoney(amount, sender);
break;
case RESET:
- player.setMoney(amount == 0 ? ess.getSettings().getStartingBalance() : amount);
+ player.setMoney(startingBalance);
+ break;
+
+ case SET:
+ boolean underMinimum = (player.getMoney() - amount) < min;
+ player.setMoney(underMinimum ? min : amount);
break;
}
}
@@ -110,6 +150,6 @@ public class Commandeco extends EssentialsCommand
private enum EcoCommands
{
- GIVE, TAKE, RESET
+ GIVE, TAKE, RESET, SET
}
}
diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties
index c35e225f6..1a0fdb01f 100644
--- a/Essentials/src/messages.properties
+++ b/Essentials/src/messages.properties
@@ -490,3 +490,5 @@ fireworkColor=\u00a74You must apply a color to the firework to add an effect
holdFirework=\u00a74You must be holding a firework to add effects
invalidFireworkFormat=\u00a76The option \u00a74{0} \u00a76is not a valid value for \u00a74{1}
muteNotify=\u00a74{0} \u00a76has muted \u00a74{1}
+resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players
+resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players
diff --git a/Essentials/src/messages_cs.properties b/Essentials/src/messages_cs.properties
index a6c98d3bf..ed1bb5f31 100644
--- a/Essentials/src/messages_cs.properties
+++ b/Essentials/src/messages_cs.properties
@@ -493,3 +493,5 @@ fireworkColor=\u00a74You must apply a color to the firework to add an effect
holdFirework=\u00a74You must be holding a firework to add effects
invalidFireworkFormat=\u00a76The option \u00a74{0} \u00a76is not a valid value for \u00a74{1}
muteNotify=\u00a74{0} \u00a76has muted \u00a74{1}
+resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players
+resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players
diff --git a/Essentials/src/messages_da.properties b/Essentials/src/messages_da.properties
index c9d4870a9..3f8de42a5 100644
--- a/Essentials/src/messages_da.properties
+++ b/Essentials/src/messages_da.properties
@@ -490,3 +490,5 @@ fireworkColor=\u00a74You must apply a color to the firework to add an effect
holdFirework=\u00a74You must be holding a firework to add effects
invalidFireworkFormat=\u00a76The option \u00a74{0} \u00a76is not a valid value for \u00a74{1}
muteNotify=\u00a74{0} \u00a76has muted \u00a74{1}
+resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players
+resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players
diff --git a/Essentials/src/messages_de.properties b/Essentials/src/messages_de.properties
index a113e164a..5b3ce2162 100644
--- a/Essentials/src/messages_de.properties
+++ b/Essentials/src/messages_de.properties
@@ -490,3 +490,5 @@ fireworkColor=\u00a74You must apply a color to the firework to add an effect
holdFirework=\u00a74You must be holding a firework to add effects
invalidFireworkFormat=\u00a76The option \u00a74{0} \u00a76is not a valid value for \u00a74{1}
muteNotify=\u00a74{0} \u00a76has muted \u00a74{1}
+resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players
+resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players
diff --git a/Essentials/src/messages_en.properties b/Essentials/src/messages_en.properties
index c35e225f6..1a0fdb01f 100644
--- a/Essentials/src/messages_en.properties
+++ b/Essentials/src/messages_en.properties
@@ -490,3 +490,5 @@ fireworkColor=\u00a74You must apply a color to the firework to add an effect
holdFirework=\u00a74You must be holding a firework to add effects
invalidFireworkFormat=\u00a76The option \u00a74{0} \u00a76is not a valid value for \u00a74{1}
muteNotify=\u00a74{0} \u00a76has muted \u00a74{1}
+resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players
+resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players
diff --git a/Essentials/src/messages_es.properties b/Essentials/src/messages_es.properties
index 2349c824e..cb60230e9 100644
--- a/Essentials/src/messages_es.properties
+++ b/Essentials/src/messages_es.properties
@@ -490,3 +490,5 @@ fireworkColor=\u00a74You must apply a color to the firework to add an effect
holdFirework=\u00a74You must be holding a firework to add effects
invalidFireworkFormat=\u00a76The option \u00a74{0} \u00a76is not a valid value for \u00a74{1}
muteNotify=\u00a74{0} \u00a76has muted \u00a74{1}
+resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players
+resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players
diff --git a/Essentials/src/messages_fi.properties b/Essentials/src/messages_fi.properties
index 4f1e3b785..7f465142c 100644
--- a/Essentials/src/messages_fi.properties
+++ b/Essentials/src/messages_fi.properties
@@ -490,3 +490,5 @@ fireworkColor=\u00a74You must apply a color to the firework to add an effect
holdFirework=\u00a74You must be holding a firework to add effects
invalidFireworkFormat=\u00a76The option \u00a74{0} \u00a76is not a valid value for \u00a74{1}
muteNotify=\u00a74{0} \u00a76has muted \u00a74{1}
+resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players
+resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players
diff --git a/Essentials/src/messages_fr.properties b/Essentials/src/messages_fr.properties
index 8e0a9a9be..d664d7d15 100644
--- a/Essentials/src/messages_fr.properties
+++ b/Essentials/src/messages_fr.properties
@@ -490,3 +490,5 @@ fireworkColor=\u00a74You must apply a color to the firework to add an effect
holdFirework=\u00a74You must be holding a firework to add effects
invalidFireworkFormat=\u00a76The option \u00a74{0} \u00a76is not a valid value for \u00a74{1}
muteNotify=\u00a74{0} \u00a76has muted \u00a74{1}
+resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players
+resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players
diff --git a/Essentials/src/messages_it.properties b/Essentials/src/messages_it.properties
index cc7fcf49b..4bc2e2a29 100644
--- a/Essentials/src/messages_it.properties
+++ b/Essentials/src/messages_it.properties
@@ -490,3 +490,5 @@ fireworkColor=\u00a74You must apply a color to the firework to add an effect
holdFirework=\u00a74You must be holding a firework to add effects
invalidFireworkFormat=\u00a76The option \u00a74{0} \u00a76is not a valid value for \u00a74{1}
muteNotify=\u00a74{0} \u00a76has muted \u00a74{1}
+resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players
+resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players
diff --git a/Essentials/src/messages_nl.properties b/Essentials/src/messages_nl.properties
index 360d76db1..49bb56721 100644
--- a/Essentials/src/messages_nl.properties
+++ b/Essentials/src/messages_nl.properties
@@ -490,3 +490,5 @@ fireworkColor=\u00a74You must apply a color to the firework to add an effect
holdFirework=\u00a74You must be holding a firework to add effects
invalidFireworkFormat=\u00a76The option \u00a74{0} \u00a76is not a valid value for \u00a74{1}
muteNotify=\u00a74{0} \u00a76has muted \u00a74{1}
+resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players
+resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players
diff --git a/Essentials/src/messages_pl.properties b/Essentials/src/messages_pl.properties
index a43b5f81f..75c5f4d72 100644
--- a/Essentials/src/messages_pl.properties
+++ b/Essentials/src/messages_pl.properties
@@ -490,3 +490,5 @@ fireworkColor=\u00a74You must apply a color to the firework to add an effect
holdFirework=\u00a74You must be holding a firework to add effects
invalidFireworkFormat=\u00a76The option \u00a74{0} \u00a76is not a valid value for \u00a74{1}
muteNotify=\u00a74{0} \u00a76has muted \u00a74{1}
+resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players
+resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players
diff --git a/Essentials/src/messages_pt.properties b/Essentials/src/messages_pt.properties
index d4e935d08..b3073ed62 100644
--- a/Essentials/src/messages_pt.properties
+++ b/Essentials/src/messages_pt.properties
@@ -490,3 +490,5 @@ fireworkColor=\u00a74You must apply a color to the firework to add an effect
holdFirework=\u00a74You must be holding a firework to add effects
invalidFireworkFormat=\u00a76The option \u00a74{0} \u00a76is not a valid value for \u00a74{1}
muteNotify=\u00a74{0} \u00a76has muted \u00a74{1}
+resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players
+resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players
diff --git a/Essentials/src/messages_se.properties b/Essentials/src/messages_se.properties
index 3083a5b60..cc33a1ea3 100644
--- a/Essentials/src/messages_se.properties
+++ b/Essentials/src/messages_se.properties
@@ -490,3 +490,5 @@ fireworkColor=\u00a74You must apply a color to the firework to add an effect
holdFirework=\u00a74You must be holding a firework to add effects
invalidFireworkFormat=\u00a76The option \u00a74{0} \u00a76is not a valid value for \u00a74{1}
muteNotify=\u00a74{0} \u00a76has muted \u00a74{1}
+resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players
+resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players
diff --git a/Essentials/src/plugin.yml b/Essentials/src/plugin.yml
index 4b36f0760..0c4090918 100644
--- a/Essentials/src/plugin.yml
+++ b/Essentials/src/plugin.yml
@@ -85,7 +85,7 @@ commands:
aliases: [edepth]
eco:
description: Manages the server economy.
- usage: /<command> <give|take|reset> <player> <amount>
+ usage: /<command> <give|take|set|reset> <player> <amount>
aliases: [economy,eeco,eeconomy]
enchant:
description: Enchants the item the user is holding.