mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-11-19 00:55:32 +01:00
Fixing Sell/Buy Signs which use EXP as a currency.
This commit is contained in:
parent
a00f070400
commit
d3dd8208ef
@ -65,7 +65,7 @@ public interface IUser
|
||||
|
||||
void setJail(String jail);
|
||||
|
||||
public int getTotalExperience();
|
||||
public int getXP();
|
||||
|
||||
public void setTotalExperience(int l);
|
||||
public void setXP(int l);
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ public class Trade
|
||||
}
|
||||
|
||||
if (exp != null && exp > 0
|
||||
&& user.getTotalExperience() < exp) {
|
||||
&& user.getXP() < exp) {
|
||||
throw new ChargeException(_("notEnoughExperience"));
|
||||
}
|
||||
}
|
||||
@ -115,7 +115,7 @@ public class Trade
|
||||
}
|
||||
if (getExperience() != null)
|
||||
{
|
||||
user.setTotalExperience(user.getTotalExperience() + getExperience());
|
||||
user.setXP(user.getXP() + getExperience());
|
||||
}
|
||||
return success;
|
||||
}
|
||||
@ -154,12 +154,12 @@ public class Trade
|
||||
}
|
||||
if (getExperience() != null)
|
||||
{
|
||||
final int experience = user.getTotalExperience();
|
||||
final int experience = user.getXP();
|
||||
if (experience < getExperience() && getExperience() > 0)
|
||||
{
|
||||
throw new ChargeException(_("notEnoughExperience"));
|
||||
}
|
||||
user.setTotalExperience(experience - getExperience());
|
||||
user.setXP(experience - getExperience());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -544,4 +544,21 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||
{
|
||||
return teleportRequestTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getXP() {
|
||||
return base.getTotalExperience();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setXP(int l) {
|
||||
base.setExp(0);
|
||||
base.setLevel(0);
|
||||
base.setTotalExperience(0);
|
||||
for(int i=0;i<l; ++i) {
|
||||
base.giveExp(1);
|
||||
}
|
||||
this.sendMessage("new exp: " + base.getExp() + " total exp: " + base.getTotalExperience());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -196,4 +196,17 @@ public class User extends UserBase implements IUser
|
||||
unlock();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getXP()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setXP(int l)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user