From 803703a6e0556d25c84074371a6380d1f48a85fd Mon Sep 17 00:00:00 2001 From: yoyosource Date: Tue, 1 Feb 2022 11:29:01 +0100 Subject: [PATCH] Update SpecialItem --- src/de/steamwar/misslewars/items/SpecialItem.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/de/steamwar/misslewars/items/SpecialItem.java b/src/de/steamwar/misslewars/items/SpecialItem.java index f776115..a4c1dde 100644 --- a/src/de/steamwar/misslewars/items/SpecialItem.java +++ b/src/de/steamwar/misslewars/items/SpecialItem.java @@ -20,6 +20,8 @@ package de.steamwar.misslewars.items; import de.steamwar.misslewars.Config; +import net.md_5.bungee.api.ChatMessageType; +import net.md_5.bungee.api.chat.TextComponent; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.entity.Entity; @@ -29,6 +31,7 @@ import org.bukkit.event.entity.ProjectileLaunchEvent; import org.bukkit.inventory.ItemFlag; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.potion.PotionEffectType; import java.util.ArrayList; import java.util.List; @@ -55,10 +58,6 @@ public abstract class SpecialItem { return false; } - public ItemStack createItem(Material material, String name, int amount) { - return createItem(material, name, amount, new ArrayList<>()); - } - public ItemStack createItem(Material material, String name, int amount, List lore) { ItemStack item = new ItemStack(material, amount); ItemMeta meta = item.getItemMeta(); @@ -71,6 +70,10 @@ public abstract class SpecialItem { } public static boolean handleUse(ItemStack item, Player player) { + if (player.hasPotionEffect(PotionEffectType.LEVITATION)) { + player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText("§cDu kannst dieses Item derzeit nicht nutzen!")); + return false; + } return handleUse(item, player, missileItems) || handleUse(item, player, supportItems); }