SteamWar/BauSystem
Archiviert
13
0

Improve SWUtils.giveItemToPlayer

Dieser Commit ist enthalten in:
yoyosource 2021-04-01 23:00:00 +02:00
Ursprung 56a4db93f5
Commit 613b5d3f75

Datei anzeigen

@ -29,6 +29,14 @@ import java.util.List;
public class SWUtils {
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();
player.getInventory().setItemInMainHand(itemStack);
if (current.getType() != Material.AIR) {