Improve SWUtils.giveItemToPlayer
Dieser Commit ist enthalten in:
Ursprung
56a4db93f5
Commit
613b5d3f75
@ -29,6 +29,14 @@ import java.util.List;
|
|||||||
public class SWUtils {
|
public class SWUtils {
|
||||||
|
|
||||||
public static void giveItemToPlayer(Player player, ItemStack itemStack) {
|
public static void giveItemToPlayer(Player player, ItemStack itemStack) {
|
||||||
|
for (int i = 0; i < player.getInventory().getSize(); i++) {
|
||||||
|
ItemStack current = player.getInventory().getItem(i);
|
||||||
|
if (current != null && current.isSimilar(itemStack)) {
|
||||||
|
player.getInventory().setItem(i, null);
|
||||||
|
itemStack = current;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
ItemStack current = player.getInventory().getItemInMainHand();
|
ItemStack current = player.getInventory().getItemInMainHand();
|
||||||
player.getInventory().setItemInMainHand(itemStack);
|
player.getInventory().setItemInMainHand(itemStack);
|
||||||
if (current.getType() != Material.AIR) {
|
if (current.getType() != Material.AIR) {
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren