This commit is contained in:
坏黑
2019-07-08 14:37:31 +08:00
parent 33f3bd31b4
commit 3d6bcac699
11 changed files with 15 additions and 11 deletions

View File

@@ -0,0 +1,28 @@
package io.izzel.tlibscala.runtime
import io.izzel.taboolib.module.compat.EconomyHook
import io.izzel.taboolib.util.item.ItemBuilder
import org.bukkit.OfflinePlayer
import org.bukkit.inventory.ItemStack
class RichOfflinePlayer(private val offlinePlayer: OfflinePlayer) {
def getSkullItem: ItemStack = new ItemBuilder(offlinePlayer).build()
def getMoney: Double = EconomyHook.get(offlinePlayer)
def withdraw(x: Double): Unit = EconomyHook.remove(offlinePlayer, x)
def deposit(x: Double): Unit = EconomyHook.add(offlinePlayer, x)
def hasMoney(x: Double): Boolean = EconomyHook.get(offlinePlayer) >= x
}
object RichOfflinePlayer {
implicit def player2rich(player: OfflinePlayer): RichOfflinePlayer = new RichOfflinePlayer(player)
implicit def rich2player(player: RichOfflinePlayer): OfflinePlayer = player.offlinePlayer
}