Solved Small bug.

Discussion in 'Plugin Help/Development/Requests' started by mrdude123, Mar 23, 2015.

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

    mrdude123

    So, non-ops are not able to see the message, but Ops are supposed to be able to see it, yet they cannot.
    Code:
    package me.thecerealkill3r.rekitrequest;
    
    import org.bukkit.ChatColor;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.plugin.java.JavaPlugin;
    
    public class Main extends JavaPlugin {
      
    
        public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){
            if(sender instanceof Player);{
            Player player = (Player) sender;
          
          
            if(cmd.getName().equalsIgnoreCase("RequestRekit"))
                player.sendMessage(ChatColor.GREEN + "An online operator will see to your request shortly.");
                System.out.println("[KIT]##################################### " + sender.getName() +  " needs a kit.");
                {
                    player.isOp();
                if(player.isOp() == true)
                player.sendMessage(ChatColor.RED + ("Hey, ") + sender.getName() + (" needs a kit!"));      
                else{
                    return true;
                }
            }
              
          
            return true;
            }
      
        }
      
    }
     
  2. Offline

    nverdier

    @mrdude123 You have a stray Player#isOp() that is doing nothing, The else and return true are also useless. You have a ';' after the check if the sender is an instance of a Player, which defeats the purpose of it. I suggest you learn Java, more can be found out here.
     
  3. Offline

    mrdude123

    nevermind.
     
    Last edited: Mar 23, 2015
  4. Offline

    nverdier

    Why?
     
Thread Status:
Not open for further replies.

Share This Page