mirror of
https://github.com/songoda/UltimateStacker.git
synced 2024-12-27 19:07:41 +01:00
Don't take items in creative.
This commit is contained in:
parent
e9e3cf119c
commit
51456230cf
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user