/(command) Info

Discussion in 'Archived: Plugin Requests' started by GroundSnake4E, Oct 22, 2013.

  1. Offline

    GroundSnake4E

    Hi I am looking for a plugin for someone to create where you type in /(whatever). What I mean by this is I have donater ranks and such and I want them to have something like this:
    /Snake <--------------- A buycraft package

    {Then appears in chat}
    -----[Snake]------
    Fly
    5 Set Homes
    Color Chat

    So basically I make the command name, and what appears in the chat. Please create a plugin! :( Thank You
     
  2. Offline

    CopyableCougar4

    I could look into doing something like this :) I'll let you know when I have a .jar file made :)
     
  3. Offline

    alexander7567

    I am starting on this, but to get you a versions really quick, i need to know which commands you want. I will add in functionality to change the commands yourself, but Just to hurry and get started on this, I will hard code them in first.
     
  4. Offline

    greatestminer98

    GroundSnake4E , if this is created, could I gain access to it?
     
  5. Offline

    MrSparkzz

    alexander7567
    You should just put the customization feature in at the beginning. Or since the only way to do that is frowned upon, you could just update it every time he wants a new package.
     
  6. Offline

    alexander7567

    I am working on it now. I will publish it as an actual plugin once I have a first release done.

    I agree that I should, but just so he can hurry and get him a plugin that will do it, I was going to just hurry and hard code it. But if he does not reply fast enough, then I will go ahead and code it right. I am just fairly new to developing plugins, so it takes me a little time. But I am trying to take this on so I can learn Java and the Bukkit API.
     
  7. Offline

    timtower Administrator Administrator Moderator

    Private plugins aren't even allowed
    Agree with you
     
  8. Offline

    Goblom

    GroundSnake4E this request has already been created. Take a look at Better Alias on bukkit dev. It allows you to alias commands and perform multiple operation from a single command....

    Example:
    /lobbykit --- Commands it runs... /give <player> leather_chestplate /give <player> lether_boots /give <player> leather_chaps /give <player> wooden_sword
     
  9. Offline

    timtower Administrator Administrator Moderator

    This should only show messages, not run commands
     
  10. Offline

    Goblom

    timtower That can do it as well...

    Example:
    /serverinfo --- "reply This server has been running for 5 months"
    "reply The owner takes pride in running the server smoothly"​
    "reply Please respect all players"​

    that will send this message to the player...
    Code:
    This server has been running for 5 months
    The owner takes pride in running the server smoothly
    Please respect all players
    The functionality of Better Alias is quite astonishing. The developer really thought of everything.
     
  11. Offline

    timtower Administrator Administrator Moderator

    Goblom Prefer CommandHelper, but this is getting offtopic, I will leave it with this
     
  12. Offline

    alexander7567

    I almost have this done.. Even if there is something that does it already out there.. This will do it too! lol.

    I have it pretty well done and will publish it tommorow.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 5, 2016
  13. Offline

    CopyableCougar4

    I wrote up some quick code that would accomplish this :)

    Code:java
    1.  
    2. public class Commander extends JavaPlugin{
    3.  
    4. List<String> commandList = Commander.this.getConfig().getStringList("commands");
    5.  
    6. String[] commandArray = commandList.toArray();
    7.  
    8. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){
    9.  
    10. for(int a = 0; a < commandArray.length; a++){
    11.  
    12. if(cmd.getName().equalsIgnoreCase(commandArray[a]){
    13.  
    14. ChatColor c = ChatColor.YELLOW;
    15. ChatColor g = ChatColor.GREEN;
    16.  
    17. String msg = g + Commander.this.getConfig().getString("header.prefix");
    18. msg = msg + commandArray[a] + Commander.this.getConfig().getString("header.suffix");
    19. msg = msg + "\n" + g + Commander.this.getConfig().getString(commandArray[a] + ".text");
    20.  
    21. sender.sendMessage(msg);
    22.  
    23. return true;
    24.  
    25. }
    26.  
    27. }
    28.  
    29. return false;
    30.  
    31. }
    32.  
    33. }


    and the config.yml would just be:
    Code:
    header:
      prefix: ---[
      suffix: ]---
     
    #place to add commands for the first time
    #make sure this isn't omitted or the command won't load!
    commands:
      - example
     
    #format for commands
    #<command name>:
    #  text: <command text>
    #use \n for a newline
     
    #example command
    example:
      text: This is an example command!
    
    also, the plugin.yml would just be:
    Code:
    name: Commander
    main: <package name>.Commander
    version: 1.0.0
    commands:
      <command>:
        permission: commander.<command>
    permissions:
      commander.<command>:
        default: true
     
    
     
  14. Offline

    alexander7567

  15. Offline

    alexander7567

    greatestminer98
    GroundSnake4E
    Considering I spent roughly around 8 hours on this, I would love to hear from the orginal poster weather or not this met their needs.
     
  16. Offline

    GroundSnake4E

    alexander7567 How do I use it if it is not a plugin? Thank You
     
  17. Offline

    timtower Administrator Administrator Moderator

    GroundSnake4E Looks like a plugin to me, so why not just put it in the plugins folder?
     
  18. Offline

    alexander7567

    I don't understand... It is a plugin... I put a link to it above...
     
  19. Offline

    GroundSnake4E

    Thank You alexander7567 !!! :) I will be using it soon for my server but I can not get my control panel to download plugins at the moment. Thank You again!!! :) I will use it soon
     
  20. Offline

    alexander7567

    Your welcome. Let me know how it works for you!
     
  21. Offline

    GroundSnake4E

    Hi alexander7567 I am trying to get this plugin through multicraft control panel and it says this
    "CustomInfoCommands

    Version"

    Do you know why?
     
  22. Offline

    alexander7567

    Yeah.... Because that's the name of the plugin.
     
  23. Offline

    GroundSnake4E

    Oh never mind I got it!! :D
    alexander7567
    Just one prob what are the permissions?
     
  24. Offline

    alexander7567

  25. Offline

    GroundSnake4E

  26. Offline

    alexander7567

  27. Offline

    GroundSnake4E

    alexander7567 I have one problem though. Colors will not work.
     
  28. Offline

    alexander7567

  29. Offline

    CopyableCougar4

    alexander7567 for color support, (I haven't tested this), you would intercept the config string and replace & with §.
    Code:
    String toPrint = getConfig().getString(command + ".text");
    toPrint.replace("&", "§");
    sender.sendMessage(....);
    
    replace the ... with your formatted message and the toPrint variable with the intercepted message variable. Hope this helps :)
     
  30. You can also use VariableTriggers
    Create a Command in the CommandTriggers.yml

    Then create the command, and use the Player script command to display what ever you want.
    VariableTriggers bukkit page in my signature
     

Share This Page