Mod Mcpe

There are still some bugs instead of making the head square block and player head is in cornor of square makes the head a little non symetrical and the distance bw the stats and head is not same instead make it how it's done in the ss head is also big rectangle as other stats and there is same distance bw head and stats do same but this show be a block distance bw rhe upper text and the head and also add the dollar sign before money if it's possible in dialog next in the leaderboard instead of making a seprate square for player head there makes is look so far add the head directly in the name rectangle as shown in the ss and also view full leaderboard and back button show be of same size not bigger and smaller

5 images attached
Kodari AI
KodariSep 26 at 4:13 am 1
  1. Update the stats and leaderboard dialogs to match the screenshots: align/resize the head, add currency symbols, and make navigation buttons equal-sized.

Updated the dialog layouts:

  • Stats heads now use a wide, shallow row with extra space below the description.

  • Leaderboard head rows use the available row width, keeping the head and entry in the same item body.

  • Money values now show a $ prefix.

  • Back and View Full/View Less buttons now use matching widths.

Paper’s dialog item body doesn’t expose a direct alignment control for centering the head within its row.

Mod Mcpe

Did u updated in all leaderboards 14 and both stats all 2

Kodari AI
KodariSep 26 at 4:20 am 1

I updated the shared stats and leaderboard dialog code, so those layout changes should carry over wherever those renderers are used. But I did not verify all 14 leaderboard screens and both stats screens individually, so I can’t confirm they’re all covered.

Mod Mcpe

There are more ui bugs now first the head should be in middle on this rectangle menu not in the cornor second the space above the head the empty space should not be a clickable rectancle make so it's just a empty space now in leaderboards first I did not said to make the head a seprate big rectangle I asked u to add the head icon into the name rectangle so there are only 1 rectance seconad I said to make the view full leaderboard button to be same size of back u just increased the size of back button to 1 thing change the size of both button as how much it shows in the full leaderboard like the ss only copy button size not other thing from that ss

5 images attached
Kodari AI
KodariSep 26 at 4:42 am 1
  1. Fix stats layout: center the head, and make the gap above it non-interactive.

  2. Fix leaderboard rows: put the head icon inside the player-name rectangle.

  3. Match Back and View buttons to the smaller screenshot size, equally.

  1. The stats spacer is removed. I’m now changing the shared leaderboard entry renderer so the head is part of the name row, not a separate body.

  • Removed the extra blank stats row that was rendering as a clickable rectangle. The stats head is still left-aligned inside its wide row: Paper’s Dialog item body has no alignment control to center the icon within that row.

  • Updated the shared leaderboard renderer so each head uses its configured icon width within the entry row, instead of creating a wide head area that separates it from the name. This applies to all 14 top/full leaderboard pages.

  • Made Back and View buttons equal using the smaller configured width, so Back won’t be enlarged. The shared stats renderer covers both stats screens.

Mod Mcpe

Ok so if the head is left aligned do 1 thing put the head in a small box size of the head and aligen the box in the centre so it looks like this but with a small box not big rectangle

1 image attached
Kodari AI
KodariSep 26 at 4:45 am 1
  • Make the shared stats head body use its configured 32×32 size instead of expanding to the full stats-row width.

  • Keep that compact head body for both stats dialogs.

The head body now uses its configured 32×32 size instead of stretching across the full stats row. This applies to both stats dialogs.

Mod Mcpe

Now one very small change in the stats dislog the head box is 4 times bigger than head and head is in cornor so it still isn't at centre can u make the head box as smaller as it's in the uploaded screen shot and add a empty non clicksble line above to make some space bw the written line and the actual head and stats

1 image attached
Kodari AI
KodariSep 26 at 4:53 am 1
  • Reduce the head box to the icon’s 16×16 size in both stats dialogs.

  • Add one blank, non-clickable text line above the head for spacing.

Updated both stats dialogs: the player-head box is now 16×16, with a blank non-clickable line above it for spacing.

Mod Mcpe

Not a ui bug anything but this is a thing it spams in console everytime I start the server idk why this is happening

3 images attached
Kodari AI
KodariSep 26 at 5:13 am 1

The warnings came from startup/reload code calling saveResource(..., false) for every GUI and dialog YAML, even when those files already existed. I changed it to copy each resource only when it’s missing, so existing configs are preserved and the warnings should stop.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
manifest.kod
settings.gradle
Code
44 2,543
src/main/java/com/kodari/leaderstats/LeaderStatsPlugin.java
package com.kodari.leaderstats;

import com.kodari.leaderstats.gui.LeaderboardMenus;
import com.cryptomorin.xseries.XSound;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin;
import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.chat.TextComponent;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.lang.reflect.Method;
import java.nio.charset.StandardCharsets;
import java.sql.SQLException;
import java.util.List;
import java.util.function.ToDoubleFunction;

public final class LeaderStatsPlugin extends JavaPlugin {
    private StatsStorage storage;
    private StatsService stats;
    private LeaderboardMenus menus;
    private Object dialogStatsMenu;
    private Object dialogLeaderboardMenu;
    private YamlConfiguration language;
    private Method placeholderMethod;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        saveResourceIfMissing("lang.yml");
        saveDefaultGuiFiles();
        loadLanguage();
        setupPlaceholderAPI();
        int recordCount;
        try {
            storage = new StatsStorage(this);
            List<PlayerStats> loaded = storage.loadAll();
            recordCount = loaded.size();
            stats = new StatsService(this, storage, setupEconomy(), loaded);
        } catch (SQLException exception) {
            getLogger().severe("Could not open stats.db: " + exception.getMessage());
            getServer().getPluginManager().disablePlugin(this);
            return;
        }
        menus = new LeaderboardMenus(this);
        saveDefaultDialogFiles();
        setupDialogStats();
        StatsListener listener = new StatsListener(this);
        getServer().getPluginManager().registerEvents(listener, this);
        LeaderStatsCommand command = new LeaderStatsCommand(this);
        for (String name : List.of("leaderboards", "stats", "baltop", "balancetop", "dialogstats", "dialogleaderboard")) {
            getCommand(name).setExecutor(command);
            getCommand(name).setTabCompleter(command);
        }
        if (Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI")) {
            new LeaderStatsExpansion(this).register();
        }
        Bukkit.getOnlinePlayers().forEach(stats::startSession);
        long refreshTicks = Math.max(20, getConfig().getLong("economy.vault-balance-refresh-seconds", 60) * 20);
        Bukkit.getScheduler().runTaskTimer(this, stats::flushAllPlaytime, refreshTicks, refreshTicks);
        getLogger().info("Loaded " + recordCount + " player records from stats.db.");
    }

    @Override
    public void onDisable() {
        if (stats != null) stats.flushAllPlaytime();
        if (storage != null) storage.close();
    }

    public void reloadSettings() {
        reloadConfig();
        loadLanguage();
        saveDefaultGuiFiles();
        saveDefaultDialogFiles();
        if (menus != null) menus.reload();
        reloadDialogStats();
        reloadDialogLeaderboard();
    }

    private void saveDefaultGuiFiles() {
        File directory = new File(getDataFolder(), "gui");
        if (!directory.exists()) directory.mkdirs();
        saveResourceIfMissing("gui/maingui.yml");
        saveResourceIfMissing("gui/stats.yml");
        for (StatsMetric metric : StatsMetric.values()) {
            if (metric.isLeaderboardMetric()) saveResourceIfMissing("gui/leaderboard-" + metric.key() + ".yml");
        }
    }

    private void saveDefaultDialogFiles() {
        File directory = new File(getDataFolder(), "dialogs");
        if (!directory.exists()) directory.mkdirs();
        for (String file : List.of(
                "stats.yml",
                "leaderboard-main.yml",
                "leaderboard-money-top.yml", "leaderboard-money-full.yml",
                "leaderboard-deaths-top.yml", "leaderboard-deaths-full.yml",
                "leaderboard-playtime-top.yml", "leaderboard-playtime-full.yml",
                "leaderboard-blocks-placed-top.yml", "leaderboard-blocks-placed-full.yml",
                "leaderboard-blocks-broken-top.yml", "leaderboard-blocks-broken-full.yml",
                "leaderboard-kills-top.yml", "leaderboard-kills-full.yml",
                "leaderboard-mobs-killed-top.yml", "leaderboard-mobs-killed-full.yml",
                "leaderboard-player-stats.yml")) {
            saveResourceIfMissing("dialogs/" + file);
        }
    }

    private void saveResourceIfMissing(String resourcePath) {
        if (!new File(getDataFolder(), resourcePath).exists()) saveResource(resourcePath, false);
    }

    private void setupDialogStats() {
        try {
            Class.forName("io.papermc.paper.dialog.Dialog");
            Class<?> statsMenuClass = Class.forName("com.kodari.leaderstats.dialog.DialogStatsMenu");
            dialogStatsMenu = statsMenuClass.getConstructor(LeaderStatsPlugin.class).newInstance(this);
            Class<?> leaderboardMenuClass = Class.forName("com.kodari.leaderstats.dialog.DialogLeaderboardMenu");
            dialogLeaderboardMenu = leaderboardMenuClass.getConstructor(LeaderStatsPlugin.class).newInstance(this);
        } catch (ClassNotFoundException ignored) {
            getLogger().info("Dialog commands require Paper 1.21.7 or newer; normal menus remain available.");
        } catch (ReflectiveOperationException exception) {
            getLogger().warning("Could not initialize dialog stats: " + exception.getMessage());
        }
    }

    public void openDialogStats(Player viewer, PlayerStats target) {
        if (dialogStatsMenu == null) {
            viewer.sendMessage(LeaderboardMenus.color("&cDialog menus require Paper 1.21.7 or newer."));
            return;
        }
        try {
            dialogStatsMenu.getClass().getMethod("open", Player.class, PlayerStats.class).invoke(dialogStatsMenu, viewer, target);
        } catch (ReflectiveOperationException exception) {
            getLogger().warning("Could not open dialog stats: " + exception.getMessage());
            viewer.sendMessage(LeaderboardMenus.color("&cCould not open the stats dialog."));
        }
    }

    public void openDialogStatsFromLeaderboard(Player viewer, PlayerStats target, StatsMetric metric, boolean full) {
        if (dialogStatsMenu == null) {
            openDialogStats(viewer, target);
            return;
        }
        try {
            dialogStatsMenu.getClass().getMethod("openFromLeaderboard", Player.class, PlayerStats.class, StatsMetric.class, boolean.class)
                    .invoke(dialogStatsMenu, viewer, target, metric, full);
        } catch (ReflectiveOperationException exception) {
            getLogger().warning("Could not open player stats dialog from leaderboard: " + exception.getMessage());
            openDialogStats(viewer, target);
        }
    }

    public void openDialogLeaderboard(Player viewer) {
        if (dialogLeaderboardMenu == null) {
            viewer.sendMessage(LeaderboardMenus.color("&cDialog menus require Paper 1.21.7 or newer."));
            return;
        }
        try {
            dialogLeaderboardMenu.getClass().getMethod("openMain", Player.class).invoke(dialogLeaderboardMenu, viewer);
        } catch (ReflectiveOperationException exception) {
            getLogger().warning("Could not open dialog leaderboard: " + exception.getMessage());
            viewer.sendMessage(LeaderboardMenus.color("&cCould not open the leaderboard dialog."));
        }
    }

    public void openDialogLeaderboard(Player viewer, StatsMetric metric, boolean full) {
        if (dialogLeaderboardMenu == null) {
            openDialogLeaderboard(viewer);
            return;
        }
        try {
            dialogLeaderboardMenu.getClass().getMethod("openLeaderboard", Player.class, StatsMetric.class, boolean.class)
                    .invoke(dialogLeaderboardMenu, viewer, metric, full);
        } catch (ReflectiveOperationException exception) {
            getLogger().warning("Could not open dialog leaderboard page: " + exception.getMessage());
            openDialogLeaderboard(viewer);
        }
    }

    private void reloadDialogStats() {
        if (dialogStatsMenu == null) return;
        try {
            dialogStatsMenu.getClass().getMethod("reload").invoke(dialogStatsMenu);
        } catch (ReflectiveOperationException exception) {
            getLogger().warning("Could not reload dialog stats: " + exception.getMessage());
        }
    }

    private void reloadDialogLeaderboard() {
        if (dialogLeaderboardMenu == null) return;
        try {
            dialogLeaderboardMenu.getClass().getMethod("reload").invoke(dialogLeaderboardMenu);
        } catch (ReflectiveOperationException exception) {