CommandNPC
![](http://i.imgur.com/nGk5BbZ.png)
CommandNPC is a plugin inspired by the server Mineplex, which adds a new function to NPCs. It allows users to run commands by simply right clicking on a Citizens NPC. Requires Citizens 2! Now requires Java 8
Commands and Permissions
(Now supports PlaceholderAPI)
To set up the npc with the commands you need the permission 'commandnpc.admin'
Be aware that flags that require additional input like [--v price], you need 2 dashes(-)!
-
/npc cmdadd [-c console] [-o Op] [-r random] [-i ignorePermMsg] [-l ignoreMoneyMsg] [--v price] [--t clickType] [--d delay] [--cd cooldown] [--p custom.permission.node] <command...> - Add a command to be executed upon clicking the selected NPC.
-
The -c flag runs the command through the console.
-
The -o flag runs the command as an op.
- The -r flag picks a random command and executes that one command only.
- The -i flag when true, noPerm message doesn't send
- The -l flag when true, noMoney message doesn't send
- The --v flag charges the player the specified amount, when running the command. (Numeric with decimal)
-
The --p flag requires the player to have the specified permission.
- The --d flag is the amount of ticks that the command will be delayed by. (Integer input)
- The --cd flag is a cooldown for the command in ticks. (20 ticks in a second)
- The --t flag sets the clickType('left', 'right', or 'both') | This will default to the global setting in config.yml
-
-
/npc cmdinfo [id] - Gets various information about all the NPC commands
-
If you include the command 'id' it will only show information for that command.
- You get the 'id' from using the 'cmdinfo' command
-
-
/npc cmdremove <id> - Removes a specific command
- You get the 'id' from using the 'cmdinfo' command
-
/npc cmdset <id> [-c console] [-o Op] [-r random] [-m cdMsg] [-i ignorePermMsg] [-l ignoreMoneyMsg] [--v price] [--t clickType] [--d delay] [--cd cooldown] [--p custom.permission.node] [command | cdMsg...] - Set various variables for the command
-
The -c flag runs the command through the console. (This will toggle between true/false)
- The -o flag runs the command as an op. (This will toggle between true/false)
- The -r flag picks a random command and executes that one command only.
- The -m flag is when you have a cooldown amount specified. When the player is in a cooldown and attempt to use the NPC, it will send them this message. (Usage: /npc cmdset -m [cdMsg...]) Note: When using other flags the cdMsg as to be the last things within the command.
- The -i flag when true, noPerm message doesn't send
- The -l flag when true, noMoney message doesn't send
- The --v flag charges the player the specified amount, when running the command. (Numeric with decimal)
- The --p flag requires the player to have the specified permission.
- The --d flag is the amount of ticks that the command will be delayed by. (Integer input)
- The --cd flag is a cooldown for the command in ticks. (20 ticks in a second)
- The --t flag sets the clickType ('left', 'right', or 'both')
- You get the 'id' from using the 'cmdinfo' command
-
-
/npc cmdreset - Remove all commands from the selected NPC.
-
You can use '%name' in commands as a placeholder for the user who is clicking the NPC.
- This plugin now supports a BungeeCord command. You may now use 'server <serverName>' to teleport people between servers!
How to setup the NPC
-
Edit config.yml to your likings
-
Select the NPC you wish to add commands too.
-
Use the command 'cmdadd' (Syntax listed above) to add the commands you wish.
-
These commands will be saved.
-
If you wish to remove the commands simply use the 'resetcmds' command. (Syntax listed above)
Metrics by bStats
Github
===== Donations =====
If you like what you see and want to support the development of this plugin and any other plugins I decide to create, you can donate to the developers! Just check the upper right of the page.
After putting this new update on my server nothing works , no errors :( When clicking on NPC's the command is not carried out . I discovered it had replaced my commands.yml , so I put a back up of commands.yml in and it still does not work . I have also changed clicktype in the config.yml to RIGHT and still nothing .
In reply to Anemul:
Not working well -_- pls fix
its say please report this error: [see console]
java.lang.IllegalArgumentException: No enum constant me.messageofdeath.CommandNPC.Database.ClickType.Interact [05:33:08 WARN]: at java.lang.Enum.valueOf(Enum.java:238) [05:33:08 WARN]: at me.messageofdeath.CommandNPC.Database.ClickType.valueOf(ClickType.java:1) [05:33:08 WARN]: at me.messageofdeath.CommandNPC.commands.CitizenCommands.addCmd(CitizenCommands.java:28) [05:33:08 WARN]: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [05:33:08 WARN]: at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [05:33:08 WARN]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [05:33:08 WARN]: at java.lang.reflect.Method.invoke(Method.java:498) [05:33:08 WARN]: at net.citizensnpcs.api.command.CommandManager.executeMethod(CommandManager.java:152) [05:33:08 WARN]: at net.citizensnpcs.api.command.CommandManager.execute(CommandManager.java:87) [05:33:08 WARN]: at net.citizensnpcs.api.command.CommandManager.executeSafe(CommandManager.java:175) [05:33:08 WARN]: at net.citizensnpcs.Citizens.onCommand(Citizens.java:238) [05:33:08 WARN]: at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) [05:33:08 WARN]: at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141) [05:33:08 WARN]: at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchCommand(CraftServer.java:641) [05:33:08 WARN]: at net.minecraft.server.v1_8_R3.PlayerConnection.handleCommand(PlayerConnection.java:1162) [05:33:08 WARN]: at net.minecraft.server.v1_8_R3.PlayerConnection.a(PlayerConnection.java:997) [05:33:08 WARN]: at net.minecraft.server.v1_8_R3.PacketPlayInChat.a(PacketPlayInChat.java:45) [05:33:08 WARN]: at net.minecraft.server.v1_8_R3.PacketPlayInChat.a(PacketPlayInChat.java:1) [05:33:08 WARN]: at net.minecraft.server.v1_8_R3.PlayerConnectionUtils$1.run(SourceFile:13) [05:33:08 WARN]: at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [05:33:08 WARN]: at java.util.concurrent.FutureTask.run(FutureTask.java:266) [05:33:08 WARN]: at net.minecraft.server.v1_8_R3.SystemUtils.a(SourceFile:44) [05:33:08 WARN]: at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:715) [05:33:08 WARN]: at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:374) [05:33:08 WARN]: at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:654) [05:33:08 WARN]: at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:557) [05:33:08 WARN]: at java.lang.Thread.run(Thread.java:
In reply to Spyfix:
In reply to Spyfix:
In reply to Mr_Jacksonville:
Great plugin and awesome Dev, he's a ton of help and can get your questions answered.
Having Trouble
_________________
I got the plugin, and I got the command I wanted onto the mob,
But when I go into the CONFIG, I can't set 'ExecuteCommandMessage: false' it says its false in the config but it's not changing anthing InGame 'Commans Execute'
Thanks
FireKing
In reply to Forge_User_21617937:
Awesome plugin!! Could you please add a random option to execute commands like:
random: true
or even better a flag [~~r random]
In reply to by_jack:
In reply to messageofdeath:
In reply to by_jack:
When i add 3 commands to an npc and i don't have the permission for that commands i get the no permission message 3 times. Can u change that or add an option to change/disable the noperm message?
In reply to KuschelM0nsta:
Hey messageofdeath,
Your plugin looks like it'll do what I need but I'm having problems.
I want to run a few commands on each NPC, one after the other or at slightly different times I also don't want those commands or their output to be shown to players. For example
My other problem is the I want to TP players relative to their current location with something like
That command is destroyed because of the ~
Any suggestions will be appreciated.
Regards
In reply to ManOMrE:
I will see about adding a different spacer for the commands.yml file for v1.8.7
In reply to messageofdeath:
You left some debug code in your release: "Command executed"
In reply to I9hdkill: