Is it possible to create a new variable to a Player entity? For example, player.nickname ? If not, is it possible to attach a variable any other way to a certain player? If yes, how? :S
@chaseoes no no, i don't want to get the player's name. I want to create/attach a new variable to Player class/entity player.nickname isn't even what i'm trying to do, just an example xD
You can use a hashmap that stores player names and player nicknames, then use PlayerChatEvent coupled with Code: player.setPlayerListName(nickname); player.setDisplayName(nickname); Don't save the player's actual instance for a hashmap because memory leaks, I'm sure you've heard it all before.
@EnvisionRed ugh........... does it help if i say that i'm a kind of a noob when it comes to making plugins? :S idk what a hashmap is or how to set one... i think i understand the concept but i realy have no idea how to use it D: and i also dunno what this memory leak is about but that must be pretty bad so if u could explain it a little or just link a kind of (good) tutorial page for that it would already be awesome thanks in advance for your time \o/
Here are some great tutorial pages: http://wiki.bukkit.org/Plugin_Tutorial <- Basics of making a plugin, it tells you about hashmaps and everything http://wiki.bukkit.org/Introduction_to_the_New_Event_System <- Will teach you about event handlers.
Don't worry you will learn about Collections soon enough, they are very useful for bukkit plugins. One of the downsides of using Collections in bukkit plugins is, when the server reloads or restarts all the data stored in those Collections gets destroyed, so before disable (or every x amount of time) you should save it to a file providing that the data in the Collection is vital and should survive reloads (bans, op status, money, etc). I would suggest learning about arrays, lists, maps, sets, and all the other wonderful Collections in java, although in your case you probably don't need it right now, but I'm sure there will be a time where you will need to store some data somewhere. Hope i helped, if not you can always either reply to this or tag me with Milkywayz.
@EnvisionRed thanks for the awesome tutorial pages! Time to get some study time it seems Milkywayz thanks for the great advice and yeah, looks like saving this data somewhere is a solution i won't be able to scape. But oh well, imma get to it \o/