Need Help getting a player's name

Discussion in 'Plugin Development' started by Cr4zYB0Y, Feb 4, 2013.

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

    Cr4zYB0Y

    Hi,

    i haven't worked with java for long time, so i can't remember most bukkit basics.
    I am actually working on a manabar for mmoInfo and AncientRPG to learn the basics again.

    My problem is that i need to get the playername to retrieve the value for the current and the max mana. (Replace "<name>" in the following code by the code to get the playername)
    Code:
    PlayerData.getPlayerData(<name>).getManasystem().curmana
    Hope anyone can help me with that and that i explained it well...
    If you give me a code snippet i should be able to understand bukkit again... :)

    Greetings Cr4zYB0Y
     
  2. Offline

    Frazz86

    Give us the full method kinda unsure what you're trying to do?
    If its in a Player Event, use e.getPlayer().getName() if its in an entity event you need to check if e.getEntity() is an instance of a player than cast e.getEntity() as a player then get the name from there.
     
  3. Offline

    ZeusAllMighty11

    Bukkit.getServer().getPlayer(String name);
     
  4. Offline

    avatarDr

    Bukkit.getPlayerExact() would be better. Always better.
     
  5. Offline

    Cr4zYB0Y

    Hi,

    thanks for those quick responses.
    It was a great help. but i have another problem.
    i tried with that snippets but i get these errors:
    ZeusAllMighty11: "cannot find symbol String", " ')' expected" and "cannot find symbol name"
    avatarDr: "method getPlayerExact cannot be applied to given types. Required: String; Found: no arguements; Reason: actual and formal arguement lists differ in length"
    I will try to fix that when i am at home from work. The code is nearly the same as mmoInfoHealth ( https://github.com/mmoMinecraftDev/mmoInfoHealth )
     
Thread Status:
Not open for further replies.

Share This Page