CommandNPC
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.
-
View User Profile
-
Send Message
Posted Sep 6, 2014@messageofdeath
they right/left click the NPC but nothing happens. Is there a permission i am missing because i am using it with mob arena and i added the correct permission to join the arenas, but players cant click on the npc to join. The only command i see is the commandnpc.admin but i dont want players to be able to make the npcs
-
View User Profile
-
Send Message
Posted Sep 5, 2014v1.7.2 Early release repost
http://dev.bukkit.org/bukkit-plugins/cmdnpc/files/12-command-npc-v1-7-2/
-
View User Profile
-
Send Message
Posted Sep 5, 2014@DJoptic
commandnpc.admin
-
View User Profile
-
Send Message
Posted Sep 5, 2014@LihPeu
No, the problem is how would I get the permission from the developers code. Most of the time it's hard coded using the check player.hasPermission(String);
Add me on Skype: messageofdeath, to make this conversation you know, more convenient
-
View User Profile
-
Send Message
Posted Sep 2, 2014@messageofdeath
Thanks, I don't believe it matters how they setup perms, the hasPermission() method will be fine.
if (player.hasPermission(String) | player.isOP{
run command
}else {
tempOP
run command
deOP
}
-
View User Profile
-
Send Message
Posted Sep 1, 2014@messageofdeath
@messageofdeath
Whats the permission for someone to use the NPC's?
-
View User Profile
-
Send Message
Posted Sep 1, 2014@LihPeu
Sure, I'll go ahead and add it now and update the plugin when it's time for v1.8
EDIT: Actually, I don't know where to start to find the permissions for commands because not all developers put their permissions in the plugin.yml and just check it with player.hasPermission(String), so I guess just keeping it like this should be fine for now.
-
View User Profile
-
Send Message
Posted Sep 1, 2014@messageofdeath
Thanks for the update and fix, I don't want to seem like a nag but would you mind adding a check to see if they player has permission for the command due to run? If they do have permission they will not require tempOP making the plugin safer. In our case the players have permission to run the commands, the npc makes it faster and fun.
-
View User Profile
-
Send Message
Posted Aug 31, 2014@Derekd98
What do you mean?
-
View User Profile
-
Send Message
Posted Aug 31, 2014Players cant use the commands on the npcs and they have the permission to use the command. Is there another command for this plugin?
-
View User Profile
-
Send Message
Posted Aug 31, 2014@LihPeu
The delayed loop is precautionary if the code before it fails. I use player.chat("/" + command) because it allows for other plugins that have commands that aren't officially on the server like ChestCommands.
EDIT: I fixed the issue by adding a check to see if their online before it runs the deop method.
http://dev.bukkit.org/bukkit-plugins/cmdnpc/files/12-command-npc-v1-7-2/
-
View User Profile
-
Send Message
Posted Aug 23, 2014@messageofdeath Thanks for the quick update, I will give it a try. One other problem I have noticed is players with macro buttons on their peripherals can spam the interaction, causing the console to spam which leads to tick loss. Could I suggest a cool-down of maybe half a tick and maybe use "event.getPlayer().performCommand(arg0)" to remove the message sent to the console?
Thanks again!
Oh and one other bug, if a player is kicked when interacting by nocheat for example, a null exception will occur due to the player being null in the delayed deop code. Is the delay necessary? I use a similar OP and deOP method to overriding perms without a delay. Would it be possible to check if they player has the permission first, as the command I have used the players have permissions for and do not require tempOP. If something went wrong and the plugin failed to deop, that would be a big problem.
-
View User Profile
-
Send Message
Posted Aug 22, 2014@LihPeu
Make sure to use v1.7.1, which is the latest version. It should be fixed.
-
View User Profile
-
Send Message
Posted Aug 22, 2014@antoinefunloup
Thanks
-
View User Profile
-
Send Message
Posted Aug 22, 2014@Ajaxan
I will be willing to add this into the next update. I can just reuse code from PaidRanks and that Id system for this. Thanks for your feedback :D
-
View User Profile
-
Send Message
Posted Aug 22, 2014It's a so great plugin !
-
View User Profile
-
Send Message
Posted Aug 21, 2014Great plugin! I'm currently using it to create an interactive tutorial and its made the process much more interesting and easy. Two things I'd suggest to make the plugin much easier to use would be a way to list currently added commands and a way to delete/remove a certain command.
The list command would be something like /npc listcmds. This command would simply display the command and args along with the options for console and perms. Finally, a number would be displayed before/after each command for use in the delete/remove command.
The delete/remove command would be somthing like /npc removecmd <#>. The command would require you to use /npc listcmds to get the number associated with the command. then you could simply delete it by using the right number with the remove command.
Hopefully you agree with these suggestions and would be willing to implement them!
-
View User Profile
-
Send Message
Posted Aug 21, 2014Hey,
Thanks for the plugin, I have small issue. The plugin click event logic causes me to loose my OP status, can you please add a check to see if the player is already OP and not deop them.
Thanks.
-
View User Profile
-
Send Message
Posted Aug 20, 2014@Renecate
They should work since I added the new functionality while running them on the player. Not sure about console though. But it should work for player runned commands
-
View User Profile
-
Send Message
Posted Aug 20, 2014@RednecksFTW
I fixed this due to a bug on my side for not including the plugin.yml with the plugin. You downloaded v1.7, the latest but not approved yet is v1.7.1
http://dev.bukkit.org/bukkit-plugins/cmdnpc/files/11-command-npc-v1-7-1/