How to Install and Use the CommandNPC Plugin
Last modified on Oct 26, 2022 in plugins
By Noah
Overview
Non-Player Characters are a very useful tool available for your Minecraft server. Creating npcs makes the server look very well-polished, and they can be used to perform functions such as teleporting players and opening custom shops. Citizens2 is the best plugin for creating npcs, but adding commands to them with Citizens alone can be a bit daunting. Luckily, CommandNPC makes creating these functions a little bit easier. This plugin will allow you to create guides, fill a village with unique characters, and create shops for your players to use among many other possibilities. This guide will help you install the plugins you need with a few quick steps, and get started with creating your unique npcs on your Apex Hosting server.
Summary
CommandNPC is an addon for the popular Citizens2 plugin. The plugin makes it a little easier to create actions and commands for any npc you create. The original plugin has been abandoned, but a new developer has created a fork of it under the name CommandNPC Reloaded. The Reloaded version of the plugin has been updated to work on the latest version of the game. It can also make use of Placeholders from PlaceholderAPI and integrate with your server’s economy.
Downloading the Plugin
- Navigate to the CommandNPC Spigot page.
- In the top-right, press the blue
Download
button. - Save the file to a safe location for later.
- Perform the same process to download the dependencies: Citizens2, Vault, and PlaceholderAPI
Once this is complete, you are ready to add the .jar files to your Minecraft server!
Server-Installation
- Navigate to the Apex Server Panel, then stop the server.
- Scroll down to the
Game File
section, then make note of the server version. - Ensure the version is plugin-compatible, such as PaperMC or Spigot. If it is not, you can change to Paper or Spigot by following our version change guide here.
- Afterwards, enter the
FTP File Access
in the left-hand menu and log in. - Locate or create the
plugins
folder, then enter it. - Press
Upload
in the top-left menu, then drag + drop the .jar file(s). - Once at 100%, return to the main panel page, then restart the server.
Usage
Before you can do anything with this plugin, you will first need to create an npc. This can be done with the Citizens plugin by running the command /npc create [name] –type [entity]
. Replace [name] with the name of the one you want the npc to use. Change [entity] to the mob or entity you want the npc to be. For example, if you wanted the character to be a cat named Morgna you would use the command:
/npc create Morgana –type cat
Once the character has been created, you can use CommandNPC to make it run commands. This can be done with the /npc cmdadd
command. For example, if we wanted Morgana to run the /give
command to give the player a fish, we would use:
/npc cmdadd -o give %name salmon 1
Commands
The -o
in the example above tells the server to run the command as though Morgana was an opped player. The %name
is a placeholder used by PlaceholderAPI to tell the plugin to target the player clicking on the npc. There are several arguments such as these that can help you customize your commands. A full list of commands and arguments can be found in the table below:
command | Usage | Example |
---|---|---|
/npc cmdadd | Adds a command to the selected character | /npc cmdadd -o tp %name 256 64 -128 |
/npc cmdinfo [id] | Displays information about a command added to an npc with the give id | /npc cmdinfo 2 |
/npc cmdremove [id] | Removes the command with the given id from an npc | /npc cmdremove 1 |
/npc cmdset [id] | Used to set variables for commands already added to an npc | /npc cmdset 2 cooldown 100 |
/npc cmdreset | Removes all of the commands added to an npc | /npc cmdreset |
Flag or Argument | Usage | Example |
---|---|---|
-o | Runs the command as an opped user | /npc cmdadd -o give %name iron_axe 1 |
-l | When enabled, players will not receive a message if they do not have enough money to use a command | /npc cmdadd -I -o –v 100 give %name iron_axe 2 |
-v | Charges the player a set amount of money in the server’s currency to run the command. | /npc cmdadd –v 100 tp %name 1000 64 -1000 |
-p | Requires the player to have a specific permission node to be able to use the command. | /npc cmdadd –p my.permission.node tp %name 192 64 -168 |
-d | Sets a delay, in ticks, for when the command will be run. | /npc cmdadd –d 300 rtp %name |
-cd | Sets a cooldown in ticks between command usage. | /npc cmdadd –cd 1200 rtp %name |
-t | Sets the type of click needed to activate the command. ‘Both’ is used by default. | /npc cmdadd -t right give %name salmon 1 |
Conclusion
Creating an npc can be a bit complicated due to the sheer number of variables they can use. CommandNPC removes a lot of the headache to make it easier to create new npcs and add commands to them. This can be a fun way to add new mechanics to your server, create minigames, or help your players navigate a large world or between multiple worlds. Npc commands are a great way to add more depth to your server than would be found in a normal SMP. With the help of this guide you can add these commands with relative ease to any npc you want to create. With some basic commands you can give your players a fun new way to interact with your server and continue enjoying the game long after you get the end credits.
Helpful Links
How to Install Plugins
Citizens Wiki
PlaceholderAPI Wiki
Plugin Installation Addon
Tick calculator
The CommandNPC Spigot page