Free Diamond

create a chat hover plugin that supports luckperms and placholderapi that is interacable by clicking it will /msg the player the chat hover also shows the money kills died and playtime

Kodari AI
KodariNov 2 at 1:39 pm 3
ChatHoverInfo
A Minecraft plugin that enhances chat messages with interactive player information. When hovering over a player's name in chat, it displays detailed stats including money, kills, deaths, and playtime. The plugin integrates with PlaceholderAPI for customizable stat placeholders and LuckPerms for permission-based access control. Clicking on a player's name automatically opens a private message window using the /msg command, making communication seamless. The plugin hooks into Vault for economy support to display player balances, tracks player statistics through a built-in data system, and provides configurable hover text formatting. It supports both legacy and modern Minecraft versions with a lightweight, event-driven architecture that processes chat events efficiently without impacting server performance.
  • Format chat with LuckPerms prefixes and optional PlaceholderAPI values.

  • Show stats on hover and suggest /msg <player> on click.

  • Use Vault for balances when an economy provider is available.

Created the chat hover plugin. Clicking a player’s name suggests /msg <player>, and hovering shows their balance, player kills, deaths, and playtime.

LuckPerms and PlaceholderAPI are optional. Balances require Vault and an economy provider; /msg requires a plugin that provides that command. Customize the display in config.yml.

Free Diamond

make sure the plugin dont conflic with luckperms rank prefix

Kodari AI
KodariNov 2 at 1:40 pm 2
  • Preserve other chat formatters’ output and player display names when they supply a prefix.

  • Use the LuckPerms prefix only when this plugin is formatting a plain player name.

Updated chat formatting to preserve existing rank prefixes and avoid adding the LuckPerms prefix twice.

Chat plugins that cancel and send their own messages may still bypass the hover.

Free Diamond

make sure it the plugin dont conflic with essentialxchat

Kodari AI
KodariNov 2 at 1:43 pm 2
  • Let EssentialsXChat set the chat format first.

  • Preserve that format, including its rank prefix, while adding hover and click actions to the player name.

Updated ChatHover to load after EssentialsXChat and preserve its chat format and rank prefixes while adding hover and click actions.

Other plugins that independently cancel or send chat messages may still interfere.

Free Diamond

dont add chat on the plugin just only chat hover

Kodari AI
KodariNov 2 at 1:44 pm 2
  • Keep the server’s existing chat format and prefix.

  • Remove this plugin’s chat-format settings while retaining hover and click actions.

Removed ChatHover’s own chat formatting. It now uses the existing chat format and adds hover and click actions to the player’s display name.

The plugin still resends messages internally to attach those actions; plugins that cancel and send their own chat may bypass it.

Free Diamond

dont make it conflic with discordsrv

Kodari AI
KodariNov 2 at 1:46 pm 2
  • Let DiscordSRV observe the original chat event before ChatHover replaces the in-game message.

  • Preserve the existing hover and click behavior.

Updated ChatHover to load after DiscordSRV, so DiscordSRV’s legacy chat listener sees the original message before ChatHover adds hover actions.

ChatHover still cancels and resends chat at monitor priority, so compatibility with other chat plugins isn’t guaranteed. This change hasn’t been tested with DiscordSRV’s modern Paper chat mode.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
5 167
src/main/java/com/kodari/chathover/ChatHoverPlugin.java
package com.kodari.chathover;

import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import me.clip.placeholderapi.PlaceholderAPI;
import net.luckperms.api.LuckPerms;
import net.luckperms.api.cacheddata.CachedMetaData;
import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.HoverEvent;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.chat.hover.content.Text;
import net.milkbowl.vault.economy.Economy;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Statistic;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin;

public final class ChatHoverPlugin extends JavaPlugin implements Listener {
    @Override
    public void onEnable() {
        saveDefaultConfig();
        getServer().getPluginManager().registerEvents(this, this);
    }

    @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
    public void onChat(AsyncPlayerChatEvent event) {
        UUID senderId = event.getPlayer().getUniqueId();
        String message = event.getMessage();
        String chatFormat = event.getFormat();
        String displayName = event.getPlayer().getDisplayName();
        List<UUID> recipients = new ArrayList<>();
        for (Player recipient : event.getRecipients()) {
            recipients.add(recipient.getUniqueId());
        }
        event.setCancelled(true);
        Runnable send = () -> broadcast(senderId, message, chatFormat, displayName, recipients);
        if (event.isAsynchronous()) {
            Bukkit.getScheduler().runTask(this, send);
        } else {
            send.run();
        }
    }

    private void broadcast(UUID senderId, String message, String chatFormat, String displayName, List<UUID> recipients) {
        Player player = Bukkit.getPlayer(senderId);
        if (player == null) return;

        String prefix = "";
        String suffix = "";
        if (Bukkit.getPluginManager().isPluginEnabled("LuckPerms")) {
            LuckPerms luckPerms = Bukkit.getServicesManager().load(LuckPerms.class);
            if (luckPerms != null) {
                CachedMetaData meta = luckPerms.getPlayerAdapter(Player.class).getMetaData(player);
                prefix = meta.getPrefix() == null ? "" : meta.getPrefix();
                suffix = meta.getSuffix() == null ? "" : meta.getSuffix();
            }
        }

        String money = getConfig().getString("money-unavailable", "Unavailable");
        if (Bukkit.getPluginManager().isPluginEnabled("Vault")) {
            RegisteredServiceProvider<Economy> provider = Bukkit.getServicesManager().getRegistration(Economy.class);
            if (provider != null) {
                Economy economy = provider.getProvider();
                money = economy.format(economy.getBalance(player));
            }
        }
        long seconds = player.getStatistic(Statistic.PLAY_ONE_MINUTE) / 20L;
        String playtime = (seconds / 86400) + "d " + (seconds % 86400 / 3600) + "h "
                + (seconds % 3600 / 60) + "m";
        String hover = String.join("\n", getConfig().getStringList("hover"));
        hover = format(hover, player, prefix, suffix, money, playtime);
        String nameMarker = "\u0001CHAT_HOVER_NAME\u0002";
        String messageMarker = "\u0001CHAT_HOVER_MESSAGE\u0002";
        String layout = String.format(chatFormat, nameMarker, messageMarker);

        TextComponent line = new TextComponent();
        StringBuilder rendered = new StringBuilder();
        int position = 0;
        while (position < layout.length()) {
            int nameAt = layout.indexOf(nameMarker, position);
            int messageAt = layout.indexOf(messageMarker, position);
            int next = nameAt < 0 ? messageAt : messageAt < 0 ? nameAt : Math.min(nameAt, messageAt);
            if (next < 0) next = layout.length();
            String literal = layout.substring(position, next);
            for (BaseComponent component : TextComponent.fromLegacyText(ChatColor.getLastColors(rendered.toString()) + literal)) line.addExtra(component);
            rendered.append(literal);
            if (next == layout.length()) break;
            boolean isName = next == nameAt;
            String value = isName ? displayName : message;
            TextComponent part = new TextComponent(TextComponent.fromLegacyText(ChatColor.getLastColors(rendered.toString()) + value));
            if (isName) {
                part.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
                        new Text(TextComponent.fromLegacyText(hover))));
                part.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/msg " + player.getName() + " "));
            }
            line.addExtra(part);
            rendered.append(value);
            position = next + (isName ? nameMarker.length() : messageMarker.length());
        }
        for (UUID id : recipients) {
            Player recipient = Bukkit.getPlayer(id);
            if (recipient != null) recipient.spigot().sendMessage(line);
        }
        Bukkit.getConsoleSender().sendMessage(ChatColor.stripColor(rendered.toString()));
    }

    private String format(String template, Player player, String prefix, String suffix, String money, String playtime) {
        String result = template.replace("{player}", player.getName())
                .replace("{prefix}", prefix)
                .replace("{suffix}", suffix)
                .replace("{money}", money)
                .replace("{kills}", Integer.toString(player.getStatistic(Statistic.PLAYER_KILLS)))
                .replace("{deaths}", Integer.toString(player.getStatistic(Statistic.DEATHS)))
                .replace("{playtime}", playtime);
        if (Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI")) {
            result = PlaceholderAPI.setPlaceholders(player, result);
        }
        return ChatColor.translateAlternateColorCodes('&', result);
    }
}