mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-23 09:37:50 +01:00
Add Balance Update Event.
This commit is contained in:
parent
f677d6a411
commit
caa3ac88aa
@ -13,6 +13,7 @@ import java.util.GregorianCalendar;
|
|||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import net.ess3.api.IEssentials;
|
import net.ess3.api.IEssentials;
|
||||||
|
import net.ess3.api.events.UserBalanceUpdateEvent;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -135,7 +136,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es
|
|||||||
@Override
|
@Override
|
||||||
public void giveMoney(final BigDecimal value)
|
public void giveMoney(final BigDecimal value)
|
||||||
{
|
{
|
||||||
giveMoney(value, (CommandSource) null);
|
giveMoney(value, (CommandSource)null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -183,7 +184,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es
|
|||||||
@Override
|
@Override
|
||||||
public void takeMoney(final BigDecimal value)
|
public void takeMoney(final BigDecimal value)
|
||||||
{
|
{
|
||||||
takeMoney(value, (CommandSource) null);
|
takeMoney(value, (CommandSource)null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -466,6 +467,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
super.setMoney(value);
|
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);
|
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 New Issue
Block a user