This commit is contained in:
Brianna 2019-07-20 11:28:20 -04:00
parent 0f8611403c
commit 87d9565818
1 changed files with 11 additions and 6 deletions

View File

@ -1,7 +1,7 @@
package com.songoda.epicheads.economy;
import com.songoda.epicheads.utils.Methods;
import org.bukkit.entity.Player;
import org.bukkit.OfflinePlayer;
import org.bukkit.inventory.ItemStack;
public class ItemEconomy implements Economy {
@ -19,9 +19,9 @@ public class ItemEconomy implements Economy {
}
@Override
public boolean hasBalance(Player player, double cost) {
public boolean hasBalance(OfflinePlayer player, double cost) {
int amount = convertAmount(cost);
for (ItemStack item : player.getInventory().getContents()) {
for (ItemStack item : player.getPlayer().getInventory().getContents()) {
if (!isItem(item))
continue;
if (amount <= item.getAmount())
@ -33,9 +33,9 @@ public class ItemEconomy implements Economy {
@Override
public boolean withdrawBalance(Player player, double cost) {
public boolean withdrawBalance(OfflinePlayer player, double cost) {
int amount = convertAmount(cost);
ItemStack[] contents = player.getInventory().getContents();
ItemStack[] contents = player.getPlayer().getInventory().getContents();
for (int index = 0; index < contents.length; ++index) {
ItemStack item = contents[index];
if (!isItem(item))
@ -52,9 +52,14 @@ public class ItemEconomy implements Economy {
}
if (amount != 0)
return false;
player.getInventory().setContents(contents);
player.getPlayer().getInventory().setContents(contents);
return true;
}
@Override
public boolean deposit(OfflinePlayer player, double amount) {
return false;
}
}