roflmuffin Posted April 29, 2014 Posted April 29, 2014 I can see how a EntityPlayer encapsulates an Inventory object etc. What would be the best way for me to associate my own object with a Player, and allow me to call it? Quote
TheGreyGhost Posted April 29, 2014 Posted April 29, 2014 Hi I've had this issue on a server which needs to keep track of temporary information about players. I did it using a "player registry" object with a HashMap with the EntityPlayer as the key and the object as the value. WeakHashMap is good for this, to make sure that unused players are removed from the class automatically, otherwise you can use an event triggered by player login & logout to the update the map. I don't think that extending EntityPlayer is likely to bring you any significant advantages unless you start putting instanceof all throughout your code, which the Java Experts assure me is a very bad idea. -TGG Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.