notdivyansh_90
📎 1 file 5,336 chars
📄
pasted-code-1787326880434.txt
txt 207 lines
▶
I want to make an plugin for papermc and folia supported name: ks-Stats author: kalkihere version: 1.21+ java version: 25

features:
view own and other stats with INVENTORY GUI
fully editable INVENTORY GUI

commands & permission:
/profile : to view own stats permission: stats.use
/stats : to view own stats permission: stats.use
/profile  : to view own other players stats permission: stats.view.others
/stats  : to view own other players stats permission: stats.view.others
/stats reload : to reload plugin configuration permission: stats.reload

INVENTORY GUI EXAMPLE:

INVENTORY GUI title: '🌊 Statistics | %player%'
size: 27

filler:
  material: BLACK_STAINED_GLASS_PANE
  enable: true/false
  name: ' '
  lore: []
  amount: 1

profile:
  material: SPY_GLASS
  slot: 10
  name: '�FF00&lPROFILE'
  lore:
    - '&7Statistics'
    - ''
    - '�FF00Information:'
    - '&fView various information'
    - '&fabour yourself or other players!''
    - ''
    - '&#FFFF00▶ &l&nHOVER&#FF0000 Information'

kills:
  material: NETHERITE_SWORD
  slot: 12
  name: '&#FF0000&lKILLS'
  lore:
    - '&7Statistics'
    - ''
    - '&#FF0000Information:'
    - '&fHow many time this player has'
    - '&fkilled other players?'
    - ''
    - '&#FF0000● &fKills: &#FF0000%statistic_player_kills%'
    - ''
    - '&#FFFF00▶ &l&nCLICK&#FF0000 to Refresh'

deaths:
  material: SKULL
  slot: 13
  name: '&#FFA500&lDEATHS'
  lore:
    - '&7Statistics'
    - ''
    - '&#FFA500Information:'
    - '&fHow many times this player'
    - '&fhas died?'
    - ''
    - '&#FFA500● &fDeaths: &#FFA500%statistic_deaths%'
    - ''
    - '&#FFFF00▶ &l&nCLICK&#FF0000 to Refresh'

money:
  material: EMERLED
  slot: 14
  name: '�FF00&lMONEY'
  lore:
    - '&7Statistics'
    - ''
    - '�FF00Information:'
    - '&fHow many money this'
    - '&fplayer has?'
    - ''
    - '�FF00● &fMoney: �FF00$%vault_eco_balance_formatted%'
    - ''
    - '&#FFFF00▶ &l&nCLICK&#FF0000 to Refresh'

example:
  material: example
  slot: 14
  name: '�FF00&lMONEY'
  lore:
    - '&7Statistics'
    - ''
    - '�FF00Information:'
    - '&fHow many money this'
    - '&fplayer has?'
    - ''
    - '�FF00● &fMoney: �FF00$%vault_eco_balance_formatted%'
    - ''
    - '&#FFFF00▶ &l&nCLICK&#FF0000 to Refresh'

Supports hex colorcodes (for example: &#FF0000)
supports mini message colorcodes (for example: EXAMPLE, EXAMPLE)
Support INVENTORY GUI open sound enable: true/false
mutilines messages support
config.yml
messages in config.yml
fully editbale plugin 
INVENTORY GUI editbale in config.yml
placeholderapi placeholder supports
optimized plugin
messages in config.yml
dependancy: PlaceholderApi

use this config.yml

# ks-Stats Configuration
# Plugin by kalkihere

# INVENTORY GUI Settings
INVENTORY GUI:
  title: '🌊 Statistics | %player%'
  size: 27
  sound:
    open: true
    sound_name: BLOCK_NOTE_BLOCK_PLING
    volume: 1.0
    pitch: 1.0

  # Filler item
  filler:
    enabled: true
    material: BLACK_STAINED_GLASS_PANE
    name: ' '
    lore: []
    amount: 1

  # INVENTORY GUI Items
  items:
    profile:
      material: SPYGLASS
      slot: 10
      name: '�FF00&lPROFILE'
      lore:
        - '&7Statistics'
        - ''
        - '�FF00Information:'
        - '&fView various information'
        - '&fabout yourself or other players!'
        - ''
        - '&#FFFF00▶ &l&nHOVER&#FFFF00 Information'

    kills:
      material: NETHERITE_SWORD
      slot: 12
      name: '&#FF0000&lKILLS'
      lore:
        - '&7Statistics'
        - ''
        - '&#FF0000Information:'
        - '&fHow many times this player has'
        - '&fkilled other players?'
        - ''
        - '&#FF0000● &fKills: &#FF0000%statistic_player_kills%'
        - ''
        - '&#FFFF00▶ &l&nCLICK&#FFFF00 to Refresh'
    refresh-on-click: true

    deaths:
      material: SKULL
      slot: 13
      name: '&#FFA500&lDEATHS'
      lore:
        - '&7Statistics'
        - ''
        - '&#FFA500Information:'
        - '&fHow many times this player'
        - '&fhas died?'
        - ''
        - '&#FFA500● &fDeaths: &#FFA500%statistic_deaths%'
        - ''
        - '&#FFFF00▶ &l&nCLICK&#FFFF00 to Refresh'
    refresh-on-click: true

    money:
      material: EMERALD
      slot: 14
      name: '�FF00&lMONEY'
      lore:
        - '&7Statistics'
        - ''
        - '�FF00Information:'
        - '&fHow much money this'
        - '&fplayer has?'
        - ''
        - '�FF00● &fMoney: �FF00$%vault_eco_balance_formatted%'
        - ''
        - '&#FFFF00▶ &l&nCLICK&#FF0000 to Refresh'
    refresh-on-click: true

# Messages
messages:
  prefix: '�FF00[ks-Stats] '
  reloaded: '&aPlugin configuration reloaded successfully!'
  no_permission: '&cYou don''t have permission to use this command!'
  player_not_found: '&cPlayer not found!'
  invalid_usage: '&cInvalid usage! Use: /stats  or /stats reload'
  console_command: '&cThis command cannot be executed from console!'
  gui_open: '&aOpening statistics for &e%player%&a...'
Kodari AI
KodariAug 21 at 3:45 pm 2

I’ll create the Maven project, Folia-compatible scheduling and GUI foundation, configurable stats GUI/commands, PlaceholderAPI integration, and all plugin resources from scratch.

Created the ks-Stats Paper/Folia plugin from scratch with:

  • Maven build targeting Java 25 and Paper 1.21+

  • /profile, /profile <player>, /stats, /stats <player>, and /stats reload

  • Permission handling for own profiles, other players, and reloads

  • Fully configurable inventory GUI through config.yml

  • Configurable filler, materials, slots, names, lore, title, size, and sounds

  • PlaceholderAPI support for statistics, Vault economy placeholders, and player data

  • Legacy colors, hex colors, and MiniMessage formatting

  • Click-to-refresh support per GUI item

  • Inventory click and drag protection

  • Folia-compatible plugin.yml configuration

  • XSeries-based material and sound handling

Kodari can make mistakes. Review important code before using.
Files
src
pom.xml
Code
10 673
src/main/java/com/kalkihere/ksstats/KsStatsPlugin.java
package com.kalkihere.ksstats;

import com.kalkihere.ksstats.command.StatsCommand;
import com.kalkihere.ksstats.gui.GuiListener;
import com.kalkihere.ksstats.gui.GuiManager;
import com.kalkihere.ksstats.util.MessageService;
import me.clip.placeholderapi.PlaceholderAPI;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.PluginCommand;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;

public final class KsStatsPlugin extends JavaPlugin {
    private GuiManager guiManager;
    private MessageService messageService;

    @Override
    public void onEnable() {
        saveDefaultConfig();

        this.messageService = new MessageService(this);
        this.guiManager = new GuiManager(this);
        getServer().getPluginManager().registerEvents(new GuiListener(guiManager), this);

        StatsCommand statsCommand = new StatsCommand(this, false);
        StatsCommand profileCommand = new StatsCommand(this, true);
        registerCommand("stats", statsCommand);
        registerCommand("profile", profileCommand);
    }

    @Override
    public void onDisable() {
        if (guiManager != null) {
            guiManager.clear();
        }
    }

    public void openStats(Player viewer, OfflinePlayer target, boolean announce) {
        if (announce) {
            messageService.send(viewer, "gui_open", "%player%", target.getName());
        }
        guiManager.open(viewer, target);
    }

    public String placeholders(OfflinePlayer player, String text) {
        return PlaceholderAPI.setPlaceholders(player, text);
    }

    public MessageService messages() {
        return messageService;
    }

    public void reloadPlugin() {
        reloadConfig();
    }

    private void registerCommand(String name, StatsCommand executor) {
        PluginCommand command = getCommand(name);
        if (command == null) {
            throw new IllegalStateException("Command is missing from plugin.yml: " + name);
        }
        command.setExecutor(executor);
        command.setTabCompleter(executor);
    }
}