Class O2Players
java.lang.Object
net.pottercraft.ollivanders2.player.O2Players
Player management class for all player-specific data and functions.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@NotNull O2PlayerAdd a new O2Player.voidfixPlayerAnimagusColorVariant(@NotNull UUID pid, @NotNull String correctedVariant) Correct a player's animagus color form - for use when valueOf() on the current value fails@Nullable O2PlayerGet an O2Player by name.@Nullable O2PlayerGet an O2Player by UUIDGet a list of all player unique ids.voidLoad players from save filevoidCleanup when the plugin disables.voidonEnable()Load player and player effects on plugin enablevoidplayerSummary(@NotNull org.bukkit.command.CommandSender sender, @NotNull org.bukkit.entity.Player player) Displays a summary of player info for the Ollivanders2 pluginvoidremovePlayer(@NotNull UUID pid) Remove a playerbooleanrunAnimagus(@NotNull org.bukkit.command.CommandSender sender, @NotNull String[] args) The year subCommand for managing everything related to animagus.booleanrunSummary(@NotNull org.bukkit.command.CommandSender sender, @NotNull String[] args) Commands related to players.booleanThe year subCommand for managing everything related to years.voidWrite all players to the plugin config directoryvoidupdatePlayer(@NotNull UUID pid, @NotNull O2Player o2p) Update an existing O2Player.voidusageSummary(org.bukkit.command.CommandSender sender) Usage summary for player commandsvoidusageSummaryAdmin(org.bukkit.command.CommandSender sender) Usage summary for adminsvoidusageSummaryPlayer(org.bukkit.command.CommandSender sender) Usage summary for players
-
Field Details
-
playerEffects
Effects manager for player effects.
-
-
Constructor Details
-
O2Players
Constructor- Parameters:
plugin- the MC plugin
-
-
Method Details
-
onEnable
public void onEnable()Load player and player effects on plugin enable -
onDisable
public void onDisable()Cleanup when the plugin disables.Called when the Ollivanders2 plugin is being shut down. The O2Players manager persists all player-specific data to disk and delegates effect cleanup to the player effects manager. This ensures that player progress, achievements, and active effects are preserved across server restarts.
Shutdown Operations:
- Serialize all player data to JSON (names, wand data, souls, spells, potions, etc.)
- Write player data to persistent storage via GsonDAO
- Delegate player effect cleanup to O2Effects.onDisable()
- Player effects saves all active magical effects applied to players
- See Also:
-
addPlayer
@NotNull public @NotNull O2Player addPlayer(@NotNull @NotNull UUID pid, @NotNull @NotNull String name) Add a new O2Player.- Parameters:
pid- the UUID of this playername- the effectType of this player- Returns:
- the O2Player that was added
-
updatePlayer
Update an existing O2Player.- Parameters:
pid- the UUID of this playero2p- the O2Player object for this player
-
getPlayer
Get an O2Player by UUID- Parameters:
pid- the UUID of the player- Returns:
- the O2Player if found, null otherwise.
-
getPlayer
Get an O2Player by name. This is inefficient compared to by UUID and should only be used when UUID is not available.- Parameters:
playerName- the name of the player- Returns:
- the O2Player if found, null otherwise.
-
removePlayer
Remove a player- Parameters:
pid- the id of the player to remove
-
getPlayerIDs
Get a list of all player unique ids.- Returns:
- a list of all known player MC UUIDs
-
saveO2Players
public void saveO2Players()Write all players to the plugin config directory -
loadO2Players
public void loadO2Players()Load players from save file -
fixPlayerAnimagusColorVariant
public void fixPlayerAnimagusColorVariant(@NotNull @NotNull UUID pid, @NotNull @NotNull String correctedVariant) Correct a player's animagus color form - for use when valueOf() on the current value fails- Parameters:
pid- the player to correctcorrectedVariant- the corrected value
-
runSummary
public boolean runSummary(@NotNull @NotNull org.bukkit.command.CommandSender sender, @NotNull @NotNull String[] args) Commands related to players.- Parameters:
sender- the command senderargs- the args for the command- Returns:
- true if the command succeeded
-
usageSummary
public void usageSummary(org.bukkit.command.CommandSender sender) Usage summary for player commands- Parameters:
sender- the command sender
-
usageSummaryPlayer
public void usageSummaryPlayer(org.bukkit.command.CommandSender sender) Usage summary for players- Parameters:
sender- the command sender
-
usageSummaryAdmin
public void usageSummaryAdmin(org.bukkit.command.CommandSender sender) Usage summary for admins- Parameters:
sender- the command sender
-
runYear
public boolean runYear(@NotNull @NotNull org.bukkit.command.CommandSender sender, @NotNull @NotNull String[] args) The year subCommand for managing everything related to years.- Parameters:
sender- the player that issued the commandargs- the arguments for the command, if any- Returns:
- true unless an error occurred
-
playerSummary
public void playerSummary(@NotNull @NotNull org.bukkit.command.CommandSender sender, @NotNull @NotNull org.bukkit.entity.Player player) Displays a summary of player info for the Ollivanders2 plugin- Parameters:
sender- the player who issued the commandplayer- the player to send the info for
-
runAnimagus
public boolean runAnimagus(@NotNull @NotNull org.bukkit.command.CommandSender sender, @NotNull @NotNull String[] args) The year subCommand for managing everything related to animagus.- Parameters:
sender- the player that issued the commandargs- the arguments for the command, if any- Returns:
- true unless an error occurred
-