mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-11 20:00:46 +00:00
Update exp trade signs on purchase.
This commit is contained in:
parent
d3dd8208ef
commit
fc1ccda0fe
2 changed files with 15 additions and 4 deletions
|
@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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())
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue