mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-12 04:20:41 +00:00
Add Balance Update Event.
This commit is contained in:
parent
f677d6a411
commit
caa3ac88aa
2 changed files with 46 additions and 2 deletions
|
@ -13,6 +13,7 @@ import java.util.GregorianCalendar;
|
|||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import net.ess3.api.IEssentials;
|
||||
import net.ess3.api.events.UserBalanceUpdateEvent;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -135,7 +136,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es
|
|||
@Override
|
||||
public void giveMoney(final BigDecimal value)
|
||||
{
|
||||
giveMoney(value, (CommandSource) null);
|
||||
giveMoney(value, (CommandSource)null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -183,7 +184,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es
|
|||
@Override
|
||||
public void takeMoney(final BigDecimal value)
|
||||
{
|
||||
takeMoney(value, (CommandSource) null);
|
||||
takeMoney(value, (CommandSource)null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -466,6 +467,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es
|
|||
}
|
||||
}
|
||||
super.setMoney(value);
|
||||
ess.getServer().getPluginManager().callEvent(new UserBalanceUpdateEvent(this.getBase(), value));
|
||||
Trade.log("Update", "Set", "API", getName(), new Trade(value, ess), null, null, null, ess);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
package net.ess3.api.events;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
|
||||
public class UserBalanceUpdateEvent extends Event
|
||||
{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private final Player player;
|
||||
private final BigDecimal balance;
|
||||
|
||||
public UserBalanceUpdateEvent(Player player, BigDecimal balance)
|
||||
{
|
||||
this.player = player;
|
||||
this.balance = balance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public Player getPlayer()
|
||||
{
|
||||
return player;
|
||||
}
|
||||
|
||||
public BigDecimal getNewBalance()
|
||||
{
|
||||
return balance;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue