//client is a player and plugin.BankLoc is a Location variable called from the main class of the plugin client.distance(plugin.BankLoc) //bukkit is saying "The method distance(Location) is undefined for the type Player" //Why isn't this working?
Use getLocation() and then distance() to other location, that will return a integer number I think which is the distance between those 2 points :}
Since when ? Players have locations so getLocation() exists, are you sure you're using the right variable or even understand what you're doing ?
well I'm on shaky ground as far as understanding but I'm now also having the same problem with getPlayerListName it's acting as though these methods don't exist. For the sake of clarity here's the code I'm having problems with: Code: if(sender instanceof Player){ Player client = (Player) sender; if(getLocation(client).distance(plugin.BankLoc)<= 3){ xp = client.getTotalExperience(); client.setTotalExperience(0); if(plugin.ExpBankAccs.containsKey(getPlayerListName(client))){ } } } EDIT by Moderator: merged posts, please use the edit button instead of double posting.
Are you sure you're not forgetting the parentheses, "()" ? :} Also, it could be your editor is updating verry slowly, try saving to see if it reviews the code and no longer complains... or it may be something else that's wrong and it can't really tell what it is and it's marking good code as bad. So... post your code EDIT: yes, that code is not valid because there isn't a method getLocation() in your FILE/class, you're not calling it on the Player object this is how it should be: Code: if(sender instanceof Player) { Player client = (Player) sender; if(client.getLocation().distance(plugin.BankLoc) <= 3) { xp = client.getTotalExperience(); client.setTotalExperience(0); if(plugin.ExpBankAccs.containsKey(getPlayerListName(client))) { // ??? } } }