HammySwords

Discussion in 'Archived: Plugin Requests' started by Evilhammy, Feb 22, 2014.

  1. Offline

    Evilhammy

    Hi, I am a fairly new plugin developer and I have made one (possibly) successful plugin, and one unsuccessful plugin. I was wondering if someone could tell me how to make a plugin command execute another command. Ex.: {/sword wood} uses /give {player} woodsword
    Also, for my Swords plugin (the one in the example) I was wondering if someone could help me make an inventory menu. Ex.: {/swords} makes a menu pop up and there is a selection of swords. If you click on the wood sword it executes /give {player} woodsword and then makes the menu go away. There would also be a stone sword, etc. Each sword would have it's own permissions (HammySwords.wood would be the perm for getting the woodsword, HammySwords.wood.others would allow you to give other players a woodsword, etc. It would also have HammySwords.* for all of the plugin permissions.) Each sword needs a 6-hour cooldown. I know it's alot, but I just can't find anything to tell me how to do this. The name of the plugin is HammySwords. Here's what I have done, feel free to correct anything/everything!

    I also haven't put in the commands! I can't really figure that out without adding the /give etc.

    Oops, forgot to say what I made so far.
    Code:java
    1.  
    2. package at.ua.evilhammy;
    3. import org.bukkit.plugin.java.JavaPlugin;
    4.  
    5. public class {HammySwords} extends JavaPlugin {
    6.  
    7. @Override
    8. public void onEnable(){
    9. getLogger().info("onEnable has been invoked!");
    10. }
    11.  
    12. @Override
    13. public void onDisable() {
    14. getLogger().info("onDisable has been invoked!");
    15.  
    16. }
    17. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){
    18. if(cmd.getName().equalsIgnoreCase("basic")){
    19. return true;
    20. }
    21. return false;
    22. }
    23.  
    24. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){
    25. if (sender instanceof Player) {
    26. Player player = (Player) sender;
    27. } else {
    28. sender.sendMessage("You must be a player!");
    29. return false;
    30.  
    31. return false; }}
    32.  
    33. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){
    34. if (args.length > 4) {
    35. sender.sendMessage("Uh oh, you used too many arguments! Look over it again and fix it!");
    36. return false;
    37. }
    38. if (args.length < 2) {
    39. sender.sendMessage("Uh oh, you didn't use enough arguments! Look over it again and fix it!");
    40. return false;
    41. }
    42. }
    43.  
    44. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){
    45. Player target = (Bukkit.getServer().getPlayer(args[0]));
    46. if (target == null) {
    47. sender.sendMessage(args[0] + " is not online right now! Wait for them to come back on!");
    48. return false;
    49. }
    50. return false;}}
    51.  

    Here's my plugin.yml

    Code:
     
    name: {HammySwords}
    main: {HammySwords}.{HammySwords.java}
    version: {1.0}
    commands:
       basic:
          description: This is a plugin created by Evilhammy which allows you to select a sword to have every now and then.
          usage: /sword [player]
          permission: hammyswords.basic
          permission-message: You don't have permission to do that!
    permissions:
        hammyswords.*:
            description: Gives access to all HammySwords commands.
            children:
                : true
                hammyswords.wood: true
                hammyswords.stone: true
                hammyswords.iron: true
                hammyswords.gold: true
                hammyswords.diamond: true
        hammyswords.wood:
            description: Allows a player to get a wooden sword.
            default: op
        hammyswords.stone:
            description: Allows a player to get a stone sword.
            default: op
        hammyswords.iron:
            description: Allows a player to get an iron sword.
            default: op
        hammyswords.gold:
            description: Allows a player to get a gold sword.
            default: op
        hammyswords.diamond:
            description: Allows a player to get a diamond sword.
            default: op 
     
  2. Evilhammy Well, it's an wrong section, but I can help you with the inventory.
     

Share This Page