Skip to content

Commit

Permalink
Fix for empty items
Browse files Browse the repository at this point in the history
  • Loading branch information
Elikill58 committed May 20, 2024
1 parent 6fb8071 commit 38f8e47
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import java.util.logging.Logger;

import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
Expand Down Expand Up @@ -326,11 +327,15 @@ private static BaseComponent[] createComponent(Player to, String text, ChatColor
ComponentBuilder littleBuilder = new ComponentBuilder(text);
if(color != null && color != ChatColor.RESET) // don't add reset thing
littleBuilder.color(color);
if (action.isItem())
littleBuilder.event(Utils.createItemHover(action.getItem(), to));
else {
if (action.isItem()) {
if(action.getItem().getType().equals(Material.AIR))
littleBuilder.event(Utils.createTextHover(String.join("\n", ChatItem.getInstance().getStorage().tooltipHand)));
else
littleBuilder.event(Utils.createItemHover(action.getItem(), to));
} else {
littleBuilder.event(Utils.createTextHover(Messages.getMessage(action.getSlot().name().toLowerCase() + ".hover")));
littleBuilder.event(Utils.createRunCommand(action.getCommand()));
if(action.getCommand() != "")
littleBuilder.event(Utils.createRunCommand(action.getCommand()));
}
return littleBuilder.create();
}
Expand Down

0 comments on commit 38f8e47

Please sign in to comment.