Add options to player

Discussion in 'Plugin Development' started by MaTaMoR_, Jan 23, 2015.

Thread Status:
Not open for further replies.
  1. I was searching how to add options to a player but i can't find anything, what i mean ?
    something like :
    Code:java
    1.  
    2. Player player = (sender) Player;
    3. player.getInfo().getKills();
    4. //or
    5. player.getKills();
    6.  

    I hope somebody can help me with that .
     
  2. Online

    timtower Administrator Administrator Moderator

    @MaTaMoR_ You can make your own class to store things and put it in a hashmap<UUID,yourclass>
     
    1Rogue likes this.
  3. Yeah i know that but, ¿ how i can add that option to a player ?
     
  4. Online

    timtower Administrator Administrator Moderator

    @MaTaMoR_ "That option" what is that option in this? The method? Then you need to extend the class probably, but then your changes won't be saved unless you also do that yourself.
    The hashmap is the best way, you can make a function getInfo(Player) in your main class just fine
     
  5. Yeah but i wanna add a option "getKills()" directly to the player, there's a way to do that ?
     
  6. Online

    timtower Administrator Administrator Moderator

    @MaTaMoR_ The player object won't store that for you. getPlayer returns the player object from Bukkit, not the custom one that you need from your plugin
     
  7. I know that but when i have the system made, how i can add my custom option to the player.
     
  8. Offline

    PreFiXAUT

    @MaTaMoR_ Simply: You CANT. You would need to edit Bukkit/CrafBukkit and add this to the Player. Like @timtower said, you can create a custom Player Object, which extends Player and use this.

    My suggestion would be: Create a custom Register/Manager for that and handle the Kills for that in there.
     
  9. I CANTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT :(
    So, i'll modify bukkit ... nah xD i'll keep using the same method of always .
     
Thread Status:
Not open for further replies.

Share This Page