cjcool3003

please create me a minecraft plugin that adds npcs but instead of players it adds blocks/player heads as the npcs. a npc can be deleted with /bnpc delete [id] the id is the custom ID given when created to create a npc type /bnpc create [id] [type] [url]. the [id] is a custom id that can be given to the npc (with no spaces) the [type] lets staff specsify wether they want it a spesific block or a player head, if its PLAYER_HEAD they can enter in the [url] which is the minecraft texture URL like http://textures.minecraft.net/texture/30aedc156c7a1e99e3618d7b5bf74055066148c93fafa0065f6ae7b0bc074aee which will give the head the texture once the command is entered please create the npc right where the player is standing. please add another command called /bnpc edit [id]. there will be multiple options like "command [command]" which is the command executed when the npc is left or right clicked. "scale [scale]" lets the staff member change the scale of it. "block [block]" which changes the block. "url [url]" which lets staff edit the url of the player head. "move" which moves the npc to the current position. "rotate [degrees]" rotate the npc however many degrees. "visability distance [block]" lets the staff set the visibility distance of the npc. please also add /bnpc reload which reloads the plugin. please make all the commands require the permission bnpc.admin and call the plugin B-NPC

Kodari AI
KodariAug 3 at 9:03 am 13
BNpcPlugin
B-NPC is a staff-managed Minecraft plugin that creates interactive block and custom-textured player-head NPCs at a player’s location. Administrators can create, delete, move, rotate, resize, and configure visibility for NPCs through the /bnpc command. NPC clicks execute configurable console commands, while persistent YAML storage keeps every NPC’s location, appearance, scale, rotation, visibility distance, texture URL, and command across restarts. All management actions require the bnpc.admin permission.

Plan:

  1. Create the Paper plugin scaffold and metadata for B-NPC.

  2. Add persistent NPC data, entity spawning, display transformations, texture handling, and click execution.

  3. Add /bnpc create, delete, edit, and reload command handling with permissions and tab completion.

  4. Register listeners for right- and left-click interaction entities.

BNpc
B-NPC adds persistent, staff-managed NPC displays made from blocks or custom-textured player heads. Administrators create NPCs at their current location, assign click commands, change scale, block type, head texture, position, rotation, and visibility distance, then remove or reload them through the bnpc command. NPC data persists across restarts, supports left- and right-click activation, and uses display entities for lightweight, configurable in-world presentation.

B-NPC has been created with:

  • Persistent block and textured player-head display NPCs

  • /bnpc create, delete, edit, and reload

  • Configurable click commands, scale, block type, texture URL, position, rotation, and visibility distance

  • Left- and right-click activation

  • bnpc.admin permission protection

  • YAML persistence across restarts

  • Paper 1.21 and Java 21 project setup

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
9 770
src/main/java/com/kodari/bnpc/BNpcPlugin.java
package com.kodari.bnpc;

import com.kodari.bnpc.command.BNpcCommand;
import com.kodari.bnpc.listener.BNpcListener;
import com.kodari.bnpc.npc.NpcManager;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

public class BNpcPlugin extends JavaPlugin {
    private NpcManager npcManager;

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

        this.npcManager = new NpcManager(this);
        this.npcManager.load();

        BNpcCommand command = new BNpcCommand(this, this.npcManager);
        if (getCommand("bnpc") != null) {
            getCommand("bnpc").setExecutor(command);
            getCommand("bnpc").setTabCompleter(command);
        }

        Bukkit.getPluginManager().registerEvents(new BNpcListener(this.npcManager), this);
    }

    @Override
    public void onDisable() {
        if (this.npcManager != null) {
            this.npcManager.save();
        }
    }

    public void reloadPlugin() {
        reloadConfig();
        this.npcManager.reload();
    }
}