diff options
author | KHobbits <rob@khobbits.co.uk> | 2011-12-13 04:52:09 +0000 |
---|---|---|
committer | KHobbits <rob@khobbits.co.uk> | 2011-12-13 04:52:09 +0000 |
commit | fc1ccda0feb7acd6a4ac9fa0aceed0bbb21eae2c (patch) | |
tree | a54c209e845f1cd465ceaa7d5b4ab91d62539fcb | |
parent | d3dd8208ef32259cb5f27c3ccd0269e098882fa9 (diff) | |
download | Essentials-fc1ccda0feb7acd6a4ac9fa0aceed0bbb21eae2c.tar Essentials-fc1ccda0feb7acd6a4ac9fa0aceed0bbb21eae2c.tar.gz Essentials-fc1ccda0feb7acd6a4ac9fa0aceed0bbb21eae2c.tar.lz Essentials-fc1ccda0feb7acd6a4ac9fa0aceed0bbb21eae2c.tar.xz Essentials-fc1ccda0feb7acd6a4ac9fa0aceed0bbb21eae2c.zip |
Update exp trade signs on purchase.
-rw-r--r-- | Essentials/src/com/earth2me/essentials/User.java | 5 | ||||
-rw-r--r-- | Essentials/src/com/earth2me/essentials/signs/SignTrade.java | 14 |
2 files changed, 15 insertions, 4 deletions
diff --git a/Essentials/src/com/earth2me/essentials/User.java b/Essentials/src/com/earth2me/essentials/User.java index 6f389f749..b16570374 100644 --- a/Essentials/src/com/earth2me/essentials/User.java +++ b/Essentials/src/com/earth2me/essentials/User.java @@ -551,14 +551,13 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser } @Override - public void setXP(int l) { + public void setXP(final int exp) { base.setExp(0); base.setLevel(0); base.setTotalExperience(0); - for(int i=0;i<l; ++i) { + for(int i=0;i<exp; ++i) { base.giveExp(1); } - this.sendMessage("new exp: " + base.getExp() + " total exp: " + base.getTotalExperience()); } } diff --git a/Essentials/src/com/earth2me/essentials/signs/SignTrade.java b/Essentials/src/com/earth2me/essentials/signs/SignTrade.java index 9296eb6f4..943a14a83 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignTrade.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignTrade.java @@ -6,7 +6,8 @@ import org.bukkit.inventory.ItemStack; //TODO: Sell Enchantment on Trade signs? public class SignTrade extends EssentialsSign -{ +{ + public SignTrade() { super("Trade"); @@ -267,6 +268,11 @@ public class SignTrade extends EssentialsSign { changeAmount(sign, index, -item.getAmount(), ess); } + final Integer exp = trade.getExperience(); + if (exp != null) + { + changeAmount(sign, index, -exp.intValue(), ess); + } } protected final void addAmount(final ISign sign, final int index, final Trade trade, final IEssentials ess) throws SignException @@ -281,10 +287,16 @@ public class SignTrade extends EssentialsSign { changeAmount(sign, index, item.getAmount(), ess); } + final Integer exp = trade.getExperience(); + if (exp != null) + { + changeAmount(sign, index, exp.intValue(), ess); + } } private void changeAmount(final ISign sign, final int index, final double value, final IEssentials ess) throws SignException { + final String line = sign.getLine(index).trim(); if (line.isEmpty()) { |