fixed hotbarRefill in creative mode
This commit is contained in:
parent
1ef4f86a14
commit
4c4975b0a4
src/main/java/eu/mhsl/craftattack/spawn/appliances
@ -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;
|
@ -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;
|
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user