Solved Not access command message not where it should be

Discussion in 'Bukkit Help' started by Vextricity, Aug 30, 2014.

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

    Vextricity

    Okay so I can't seem to figure out why this is happening. It's probably just something that I'm not realizing, but I'm not sure.

    Basically the plugin is working fine, but every time I type "/heal", it gives me the no permission message.

    [​IMG]

    I thought I had everything in the right place, so I'm not really sure what's up with this.

    Code:
            if (cmd.getName().equalsIgnoreCase("heal"))
               
            {
           
                if (args.length == 0)
                       
                {
                   
                    if (sender instanceof Player)
                       
                    {
                       
                        Player player = (Player) sender;
                       
                        if (player.hasPermission("auth.heal"))
                           
                        {
                               
                            player.setFoodLevel(22);
                            player.setHealthScale(20);
                            player.setHealth(20);
                            player.sendMessage(ChatColor.GRAY + "You have been healed!");
                               
                        }
                           
                        else
                               
                        {
                               
                            sender.sendMessage(ChatColor.translateAlternateColorCodes('&', getConfig().getString("noPermissionMessage").replaceAll("%command%", label).replaceAll("%playername%", sender.getName())));
     
                               
                        }
                       
                    }
                   
                    else
                       
                    {
                       
                        Usage(sender, label, args);
                       
                    }
                       
                }
                   
                else if (args.length == 1)
                       
                {
                       
                    if (sender.hasPermission("auth.heal.others"))
                           
                    {
                       
                        if (args[0].equals(args[0]))
                           
                        {
                           
                            Player onplayer=Bukkit.getPlayer(args[0]);
     
                            OfflinePlayer ofplayer=Bukkit.getOfflinePlayer(args[0]);
                           
                            if (!(ofplayer.isOnline()))
                               
                            {
                                   
                                sender.sendMessage(ChatColor.translateAlternateColorCodes('&', getConfig().getString("playerNotOnline").replaceAll("%command%", label).replaceAll("%playername%", ofplayer.getName())));
                               
                            }   
                               
                            else if (onplayer.isOnline())
                                   
                            {
                                   
                                onplayer.setFoodLevel(22);
                                onplayer.setHealth(20);
                                sender.sendMessage(ChatColor.WHITE + args[0] + ChatColor.GRAY + " has been healed!");
                                onplayer.sendMessage(ChatColor.WHITE + sender.getName() + ChatColor.GRAY + " has healed you!");
                               
                                   
                            }
                           
                        }
                           
                    }   
                   
                    else
                       
                    {
                       
                        sender.sendMessage(ChatColor.translateAlternateColorCodes('&', getConfig().getString("noPermissionMessage").replaceAll("%command%", label).replaceAll("%playername%", sender.getName())));
                       
                    }
                       
                }
               
                else
                   
                {
                   
                    Usage(sender, label, args);
                   
                }
               
            }
     
  2. Offline

    Laxer21117

    Are you an OP?
     
  3. Offline

    Vextricity


    Yeah, I am. I actually did have the right permissions and stuff, but I figured it out. Basically I had an else statement at the end of the command that said, so if the player didn't type that specific command it would announce the no permission message. I fixed it, thanks anyways :)
     
  4. Offline

    Laxer21117

    Vextricity

    Oh right! Haha! I can't believe I missed that :p Well I am happy the problem is solved.
     
Thread Status:
Not open for further replies.

Share This Page