Don't take items in creative.

This commit is contained in:
Brianna 2021-05-21 15:52:33 -05:00
parent e9e3cf119c
commit 51456230cf
3 changed files with 4 additions and 15 deletions

View File

@ -162,7 +162,8 @@ public class BlockListeners implements Listener {
stack.setAmount(stack.getAmount() + itemAmount);
plugin.updateHologram(stack);
hand.takeItem(player);
if (player.getGameMode() != GameMode.CREATIVE)
hand.takeItem(player);
}
}
}

View File

@ -125,8 +125,7 @@ public class SpawnerListeners implements Listener {
creatureSpawner.update();
plugin.updateHologram(spawner);
if (player.getGameMode() != GameMode.CREATIVE) {
Methods.takeItem(player, stackSize);
}
if (player.getGameMode() != GameMode.CREATIVE)
CompatibleHand.getHand(event).takeItem(player, stackSize);
}
}

View File

@ -130,17 +130,6 @@ public class Methods {
return TextUtils.formatText(nameFormat).trim();
}
public static void takeItem(Player player, int amount) {
if (player.getGameMode() == GameMode.CREATIVE) return;
ItemStack item = player.getInventory().getItemInHand();
int result = item.getAmount() - amount;
item.setAmount(result);
player.setItemInHand(result > 0 ? item : null);
}
public static ItemStack getSpawnerItem(EntityType entityType, int amount) {
ItemStack item = CompatibleMaterial.SPAWNER.getItem();
ItemMeta meta = item.getItemMeta();