Solved "is not applicable for..."

Discussion in 'Spigot Plugin Development' started by GeraldFrito, Oct 10, 2019.

Thread Status:
Not open for further replies.
  1. Hello, I'm having this problem: The method getPassword(String) in the type Utli is not applicable for the arguments (boolean)

    The "Utli" class:

    Code (Java):
    public String getPassword(String name) {
            if(isRegistered(name)) {
                return decrypt(Config().getString(name+".password"));
            }else {
                return null;
            }
        }
    The command:

    Code (Java):
    if(sender instanceof Player) {
                Player player = (Player) sender;
                Utli utli = new Utli();
                if(label.equalsIgnoreCase("loguear")) {
                    if(args.length == 1) {
                        String password = args[0];
                        if(utli.isLoggedIn(player.getName())) {
                            player.sendMessage("§6» Ya has iniciado sesión");
                            return false;
                        }
                        if(!utli.isRegistered(player.getName())) {
                            player.sendMessage("§6» Tienes que registrarte primero");
                            return false;
                        }
                        if(!utli.getPassword(player.getName().equals(password))) {
                            player.sendMessage("§c» Contraseña incorrecta");
                            return false;
                        }else {
                            utli.setLoggedIn(player.getName(), true);
                            player.sendMessage("§6» Has logueado exitósamente");
                            utli.ConfigReload();
                            return true;
                        }
                    }
                }
    The error is on exactly class "command", on line says: "getPassword", give me the error above. Wha happen?
     
  2. You are providing a boolean when it requires a string. Your brackets are wrong.
     
  3. Uhm, now I see. But, how would it be correct?
     
  4. You need to add a bracket after player.getName() and remove one from the end of the line

    Code (Text):

    if(!utli.getPassword(player.getName()).equals(password)) {
     
  5. Thanks everybody, I solved with your helps.
     
Thread Status:
Not open for further replies.