WINDOWS Defendero

Stworz mi plugin o nazwie PluginCustomItems komenda /PluginCustomItems additem nazwa potem /PluginCustomItem giveitem nazwa

Kodari AI
KodariSep 7 at 2:26 pm 1
CustomItemManager
CustomItemManager is a Minecraft plugin that enables server administrators to create and distribute custom items. The plugin provides two primary commands: /customitemmanager additem <name> which registers a new custom item with configurable properties such as display name, description, and attributes, and /customitemmanager giveitem <name> which grants the specified custom item to the executing player. Items are stored persistently in a configuration file, allowing for easy management and retrieval. The plugin integrates seamlessly with the Spigot/Paper API, offering a lightweight and efficient solution for enhancing gameplay with unique, server-defined items. Administrators can quickly expand their item library without restarting the server, providing dynamic content and rewarding player engagement.

[Generation stopped]

WINDOWS Defendero

Stworz mi plugin o nazwie PluginCustomItems komenda /PluginCustomItems additem nazwa potem /PluginCustomItem giveitem nazwa na wersje Bukkit 1.21.8

Kodari AI
KodariSep 7 at 2:28 pm 1
  1. Utworzę strukturę projektu Gradle dla Bukkit 1.21.8.

  2. Dodam komendy /PluginCustomItems additem <nazwa> i /PluginCustomItem giveitem <nazwa>.

  3. Zapiszę przedmiot trzymany w ręce do trwałego pliku items.yml i dodam tab-complete oraz komunikaty błędów.

Utworzono plugin PluginCustomItems dla Bukkit 1.21.8.

Komendy:

  • /PluginCustomItems additem <nazwa> — zapisuje przedmiot trzymany w głównej ręce.

  • /PluginCustomItem giveitem <nazwa> — daje zapisany przedmiot graczowi.

Dodatkowo:

  • przedmioty zapisują się w plugins/PluginCustomItems/items.yml,

  • nazwy są automatycznie zamieniane na małe litery,

  • dodawanie przedmiotów wymaga uprawnienia plugincustomitems.admin,

  • dodano podstawowy tab-complete,

  • komendy działają również w małych literach, np. /plugincustomitems additem miecz.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
6 257
src/main/java/pl/plugincustomitems/PluginCustomItems.java
package pl.plugincustomitems;

import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.java.JavaPlugin;

public final class PluginCustomItems extends JavaPlugin {

    private ItemStorage itemStorage;

    @Override
    public void onEnable() {
        this.itemStorage = new ItemStorage(this);

        CustomItemCommand command = new CustomItemCommand(this, itemStorage);
        registerCommand("plugincustomitems", command);
        registerCommand("plugincustomitem", command);

        getLogger().info("PluginCustomItems zostal wlaczony.");
    }

    private void registerCommand(String name, CustomItemCommand command) {
        PluginCommand pluginCommand = getCommand(name);
        if (pluginCommand == null) {
            throw new IllegalStateException("Komenda " + name + " nie jest zdefiniowana w plugin.yml");
        }

        pluginCommand.setExecutor(command);
        pluginCommand.setTabCompleter(command);
    }

    public ItemStorage getItemStorage() {
        return itemStorage;
    }
}