Do I have to add more?

Discussion in 'Plugin Development' started by bremdecoolste, Sep 17, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    bremdecoolste

    Well, if I do it like this:

    Code:
    name: TqTeleporting
    version: 1.0
    description: Tq's Teleportation plugin.
    author: bremdecoolste
    main: me.bremdecoolste.TqTeleporting.TqTeleporting
     
    commands:
      tpa:
        description: Send a request to teleport to the specified player.
        aliases: [tpask, tprequest]
        permission: TqTp.tpa
        permission-message: You don't have permissions to use this command.
      tpaccept:
        description: Accept a teleportation request.
        aliases: [accept, tpyes]
        permission: TqTp.tpaccept
        permission-message: You don't have permissions to use this command.
      tpdeny:
        description: Deny a teleportation request.
        aliases: [deny, tpno]
        permission: TqTp.tpdeny
        permission-message: You don't have permissions to use this command.
      heal:
        description: Heals the player
        aliases:
        permission: Tq.heal
        permission-message: You don't have permissions to use this command.
      feed:
        description: Accept a teleportation request.
        aliases:
        permission: TqTp.tpaccept
        permission-message: You don't have permissions to use this command.
      tp:
        description: Deny a teleportation request.
        aliases: [deny, tpno]
        permission: TqTp.tpdeny
        permission-message: You don't have permissions to use this command.
     
    permissions:
      Tq.tpa:
        description: Allows you to use the /tpa command.
        default: true
      Tq.tpaccept:
        description: Allows you to use the /tpaccept command.
        default: true
      Tq.tpdeny:
        description: Allows you to use the /tpdeny command.
        default: true
      Tq.tp:
        descirption: Allows you to use the /tp command
        default: false
    Does it automaticly handle the permissions? I mean, does it automatic send a message with "You dont have permissions", or do I have to make like this:

    Code:
            if(commandLabel.equalsIgnoreCase("tp"));
            {
            if(player.hasPermission("Tq.tp"))
            {
                if(args.length == 0)
                {
                    player.sendMessage(ChatColor.DARK_RED + "/tp <target>");
                }
                else if(args.length == 1);
                {
                    Player targetPlayer = player.getServer().getPlayer(args[0]);
                    Location targetPlayerLocation = targetPlayer.getLocation();
                    player.teleport(targetPlayerLocation);
                    player.sendMessage(ChatColor.GRAY + "Teleporting to " + targetPlayer.getName());
                }
                if(args.length == 2)
                {
                    Player targetPlayer1 = player.getServer().getPlayer(args[0]);
                    Player targetPlayer2 = player.getServer().getPlayer(args[1]);
                    Location targetPlayer2Location = targetPlayer2.getLocation();
                    targetPlayer1.teleport(targetPlayer2Location);
                    player.sendMessage(ChatColor.GRAY + "Teleporting " + targetPlayer1.getName() + " to " + targetPlayer2.getName());
                    targetPlayer1.sendMessage(ChatColor.GRAY + "You have been teleported to " + targetPlayer2.getName());
                }
               
            }
            else
            {
                player.sendMessage(ChatColor.DARK_RED + "You don't have permissions for this command!");
            }
            }
     
  2. Offline

    chasechocolate

  3. Offline

    bremdecoolste

    What do you mean? What would be the best thing for me to do, because, if Im running my server with ONLY this plugin, and Im doing /tpa brem, then it says "You dont hav permissions to use this command" But I cant remember I did that in java file, so that means it goes trough my plugin.yml, but there I made it that it was a default permisison? (Sorry, this is the first time I'm implementing permissions....

    Huh? When I do /tpa luuk, it says, in red,

    "You dont have permission for this command"
    "Luuk isnt online!"

    When I type: /tpaccept
    it says:
    "You odnt have permission bla bla bla"
    "You dont have any pending requests"

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 4, 2016
Thread Status:
Not open for further replies.

Share This Page