Package com.jubiman.customplayerlib
Class CustomPlayersHandler<T extends CustomPlayer>
java.lang.Object
com.jubiman.customplayerlib.CustomPlayersHandler<T>
- Type Parameters:
T
- your CustomPlayer class
- Direct Known Subclasses:
CustomPlayersHandlerTickable
Handler for handling custom players in your mod
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCustomPlayersHandler
(Class<T> clazz, String name) Constructs the storage class for custom players -
Method Summary
Modifier and TypeMethodDescriptionget
(long auth) A null safe way to get a player from the map, adds player if they don't exist yetIterate through the keys (player auths).void
loadEnter
(necesse.engine.save.LoadData loadData) Load player from saved data.void
loadExit
(necesse.engine.save.LoadData loadData) Load player from saved data.void
save
(necesse.engine.save.SaveData saveData, necesse.engine.network.server.ServerClient player) Save player's data.void
stop()
When switching worlds or on server stop this will be called to avoid overwriting data in other (older) worldsIterate through the values.
-
Field Details
-
name
The name of the handler (usually tied to the mod name)
-
-
Constructor Details
-
CustomPlayersHandler
Constructs the storage class for custom players- Parameters:
clazz
- the class extending CustomPlayername
- the name of the class, used for creating a save component
-
-
Method Details
-
get
A null safe way to get a player from the map, adds player if they don't exist yet- Parameters:
auth
- the authentication of the player's ServerClient- Returns:
- the object belonging to the player
-
keyIterator
Iterate through the keys (player auths).- Returns:
- a set of all keys (all player auths )
-
valueIterator
Iterate through the values.- Returns:
- a collection of all values (all CustomPlayers)
-
save
public void save(necesse.engine.save.SaveData saveData, necesse.engine.network.server.ServerClient player) Save player's data.- Parameters:
saveData
- the parent save object (usually ServerClient)player
- the player to save
-
loadEnter
public void loadEnter(necesse.engine.save.LoadData loadData) Load player from saved data. Gets called before the rest of the player is loaded.- Parameters:
loadData
- data to load from (should be the same as where you save, usually ServerClient)
-
loadExit
public void loadExit(necesse.engine.save.LoadData loadData) Load player from saved data. Gets called after the rest of the player is loaded.- Parameters:
loadData
- data to load from (should be the same as where you save, usually ServerClient)
-
stop
public void stop()When switching worlds or on server stop this will be called to avoid overwriting data in other (older) worlds
-