[ADMN/DEV] NSCommand 0.2 - API for custom commands and handling config files and permissions [818]

Discussion in 'Inactive/Unsupported Plugins' started by asdaarg, Apr 13, 2011.

  1. Offline

    asdaarg

    NSCommand
    Version:v0.2

    Downloads:
    NSCommand
    Source and old versions
    NSCommand on Rapidshare

    Description:

    NSCommand started out as a couple of classes I used in my plugin namespace to allow people to redefine commands as well as handle my config file and permissions associated with each command, since it started to become a major pain in the behind to introduce new commands as well as configuration options. Since then I have used the classes in all my plugins, and therefore all my plugins allow the users to change the commands to whatever they want, and it has also made it very easy for me to introduce new config options and commands. So the time has come to share them with others plugin makers to make their plugin making life easier as well as letting their users redefine their commands.

    API: How to use:
    • add the jar to your project libraries
    • put this on top of your plugin class:
      Code:
      import com.asdaarg.bukkit.NSCommand.NSCommand;
    • put this in your plugin class:
      Code:
      public static NSCommand command;
    • put this in your onEnable function:
      Code:
      command=new NSCommand(this,"config.txt",false);//true if you only want ops to use commands if permissions is not present
    • put this in your onDisable:
      Code:
      command.Disable();
    • To make a method in your plugin class a command put CMD_ in front of it, and have Player as first argument eg:
      Code:
      void CMD_fullsearch(Player p,String wrld,int size){
         }
      Make sure the function is not private
    • To make a config option just add CFG in front of a non-private variable of either an intrinsic java type (String, boolean, byte,short,int,long,float,double) or an array of such, in your plugin class e.g:
      Code:
      boolean CFGmyoption=true;
    • Create a configurable message:
      Code:
      static String MSGblahblah="blah";
      Messages differ from CFG's in that it will replace ## with ยง for colour coding, and it can only be of String type.
    NSCommand will handle the rest (register a listener, set up permissions if permissions is available, set a permissions node for each command, have all commands typed by players delegated to CMD_methods in your plugins, parsing out the variables, read config file, assign aliases to commands so users can change what to type to execute a command and set the config variables of config options, autocreate config files with the default values you have given the variables.

    Other options:
    command.hasPermission(player, permissionnode); // since you sometimes may want to have permissions not nailed to a command
    bool=command.isOpOnly();
    command.setOpOnly(bool);

    Changelog:
    Version 0.2
    • Fixed autocreated config file arrays containing first element twice
    • Added ability to save config file on the fly
    • Added ability to execute a config line on the fly
    Version 0.1.1
    • Fields do not have to be public anymore as long as they are not private
    • More tolerant behavior against malformed config files. (Just reports and ignores the malformed config option)
    Version 0.1
    • Initial Release
     
    harakiwi likes this.
  2. Offline

    Don Redhorse

    nice, another plugin I would wish we would have ages ago already as plugin functionality... THANKS!
     
  3. Offline

    MeinerHosen

    Posting here to keep tabs on this.

    A wonderful looking plugin :D
     
  4. Offline

    xGhOsTkiLLeRx

    Hey,

    possible to create a static download link for CraftBukkitUpToDate?!
    Would be great!

    Greets
     
  5. Offline

    asdaarg

    Done :)
     
  6. Offline

    xGhOsTkiLLeRx

    Thanks, downloaded 0.2
    But my console still says, it's 0.1

    Forgot to change version info?

    Greets
     
  7. Offline

    asdaarg

    Yes, thanks for notifying me. Changed it now.
     
  8. Offline

    godgodgodgo

  9. Offline

    asdaarg

    It is the correct link but the server might have been down.
     
  10. Offline

    Plague

    considered inactive
     
  11. Offline

    asdaarg

    Err... how do I activate it? It works with 740 if that was it. Nvm..
     
  12. Offline

    Plague

    yup that was it
     
  13. Offline

    mrdistractions

    Could u make a tutorial on how to do it :S im kinda confused ><!
     
  14. Offline

    Lykkepillen

    Any ETA on a testet 766 version?

    Thanks in advance! :)
     
  15. Offline

    asdaarg

    Should work with 766, sorry for not updating the number.
     
  16. Offline

    Lykkepillen

    Don't apologize for good news! :)

    Thanks for a great plugin!
     
  17. Offline

    e_zach

    does this plugin work with the #818 build at all?
     
  18. Offline

    xGhOsTkiLLeRx

    Yes it does.
    and btw: update?!

    Because the new "0.2" version is bigger then the 0.2 version before :p
     
  19. Offline

    Neils

    Is this working with 953 ?
     
  20. Offline

    Lykkepillen

    Anyone know if this works with 1060?

    Thank you :)
     
  21. Offline

    userNo99

    Can you create a more detailed installation?
    I'm no plugin dev but I'd really like to modify commands and use AntiXRay!
     
  22. Offline

    Coenwnl

    Thanks bro, this plugin fucked up my permission and now my server is fucked up, what do i do?
     
  23. Offline

    baffu

    I believe it has become inactive :(
     
  24. Offline

    CKSpoiler

    Hey, could you please update to R5? :)
     
  25. Offline

    md_5

    Long time no see asdaarg. You will notice that this thread has now been placed into the Inactive Plugin subforum.
    If you wish to revive this plugin, please ensure that you update and test compatibility with the latest recommended Bukkit build before reporting your original post, asking for it to be moved back to the release forum.

    Thanks for your time.
    md_5
     

Share This Page