Fixed Shops not taking items :D
This commit is contained in:
@ -3,6 +3,7 @@ package rip.tilly.bedwars.utils;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
|
||||
public class PlayerUtil {
|
||||
@ -28,4 +29,17 @@ public class PlayerUtil {
|
||||
((CraftPlayer) player).getHandle().getDataWatcher().watch(9, (byte) 0);
|
||||
player.updateInventory();
|
||||
}
|
||||
|
||||
public static void minusAmount(Player p, ItemStack i, int amount) {
|
||||
if (i.getAmount() - amount <= 0) {
|
||||
if (p.getInventory().getItemInHand().equals(i)) {
|
||||
p.getInventory().setItemInHand(null);
|
||||
} else {
|
||||
p.getInventory().removeItem(i);
|
||||
}
|
||||
return;
|
||||
}
|
||||
i.setAmount(i.getAmount() - amount);
|
||||
p.updateInventory();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user