fixed hotbarRefill in creative mode

This commit is contained in:
Elias Müller 2024-08-25 17:42:57 +02:00
parent 1ef4f86a14
commit 4c4975b0a4
3 changed files with 6 additions and 4 deletions

View File

@ -1,4 +1,4 @@
package eu.mhsl.craftattack.spawn.appliances.AntiSignEdit;
package eu.mhsl.craftattack.spawn.appliances.antiSignEdit;
import eu.mhsl.craftattack.spawn.appliance.Appliance;
import eu.mhsl.craftattack.spawn.appliances.settings.Settings;

View File

@ -1,4 +1,4 @@
package eu.mhsl.craftattack.spawn.appliances.AntiSignEdit;
package eu.mhsl.craftattack.spawn.appliances.antiSignEdit;
import eu.mhsl.craftattack.spawn.appliance.ApplianceListener;
import io.papermc.paper.event.player.PlayerOpenSignEvent;

View File

@ -5,6 +5,7 @@ import eu.mhsl.craftattack.spawn.appliance.Appliance;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.inventory.Inventory;
@ -16,11 +17,12 @@ import java.util.NoSuchElementException;
public class HotbarRefill extends Appliance {
public void handleHotbarChange(Player player, ItemStack item) {
if (item.getAmount() != 1) return;
if(player.getGameMode().equals(GameMode.CREATIVE)) return;
if(item.getAmount() != 1) return;
Inventory inventory = player.getInventory();
int itemSlot = inventory.first(item);
if (itemSlot > 8) return;
if(itemSlot > 8) return;
try {
int replacementSlot = inventory.all(item.getType()).entrySet().stream()