Class O2Player
java.lang.Object
net.pottercraft.ollivanders2.player.O2Player
Ollivanders2 player
-
Constructor Summary
ConstructorsConstructorDescriptionO2Player(@NotNull UUID id, @NotNull String name, @NotNull Ollivanders2 plugin) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddSoul()Add a soul to this player.protected voidfix()Called after a player's data has been read from save to fix changes made to the plugin between versions.booleanHas this player found their destined wand?@Nullable StringGet the color variation for this animagus.@Nullable org.bukkit.entity.EntityTypeGet the Animagus form for this player.@NotNull StringGet the player's destined wand core type.@NotNull StringGet the player's destined wand wood type.@NotNull UUIDgetID()Get the player's UUID@NotNull Map<O2PotionType, Integer> Get the list of known potions for this player.@NotNull Map<O2SpellType, Integer> Get the list of known spells for this player.@Nullable O2SpellTypeGet the last spell cast by this player.@Nullable O2SpellTypeGet the wand's master spell.@NotNull StringGet the name of this player for use in commands like listing out house membership.intgetPotionCount(@NotNull O2PotionType potionType) Get the brewing count for a potion@Nullable O2SpellTypeGet the last spell cast by this player's wand.@NotNull Map<O2SpellType, Long> Get the list of recently cast spells for this player.intgetSouls()Get the number of souls this player has collected.intgetSpellCount(@NotNull O2SpellType spell) Get the casting count for a spell@Nullable org.bukkit.inventory.ItemStackReturns this player's spell journal, a book with all known spells and their level.@NotNull LonggetSpellLastCastTime(@NotNull O2SpellType spellType) Get the casting count for a spell@Nullable O2SpellTypeGet the spell currently loaded in to the player's wand.@NotNull YeargetYear()Get the year this player is in.voidincrementPotionCount(@NotNull O2PotionType potionType) Increment the potion count by 1.voidincrementSpellCount(@NotNull O2SpellType spellType) Increment the spell count by 1.protected voidinitFoundWand(boolean found) Initializer for the foundWand class variable for loading the player from saved data.booleanDetermine if this player an Animagus.booleanisMuggle()Determine if player is a muggle.booleanisOnline()Is this player currently online? For use when we have an O2Player and not a player (which has an isOnline() method in Spigot)voidonDeath()Do player onDeath actionsvoidonJoin()Do player onJoin set upvoidonQuit()Do player onQuit clean upvoidResets the known spells for this player to none.voidReset the soul count to zero.voidResets the known spells for this player to none.voidsetAnimagusForm(@NotNull org.bukkit.entity.EntityType type) Sets the Animagus form for this player.voidsetFoundWand(boolean found) Set whether the player has found their destined wand before.voidSets that this player is an Animagus.voidsetMasterSpell(@NotNull O2SpellType spell) Set the wand's mastered spell.voidsetMuggle(boolean isMuggle) Set if a player is a muggle.voidsetPlayerName(@NotNull String name) Sets the name of this player for use in commands like listing out house membership.voidsetPotionCount(@NotNull O2PotionType potionType, int count) Set the potion count for a potion.voidsetPriorIncantatem(@NotNull O2SpellType spell) Set the last spell successfully cast by this player's wand.voidsetSouls(int souls) Set the number of souls this player has collected.voidsetSpellCount(@NotNull O2SpellType spell, int count) Set the spell count for a spell.voidsetSpellRecentCastTime(@NotNull O2SpellType spellType) Set the most recent cast time for a spell.voidsetWandCore(@NotNull String core) Set the player's destined wand core type.voidsetWandSpell(@Nullable O2SpellType spell) Loads a spell in to the player's wand.voidsetWandWood(@NotNull String wood) Set the player's destined wand wood type.voidSet the year this player is in.voidDeprecated.voidshiftMasterSpell(boolean reverse) Shift the wand's master spell to the next spell.voidRemove a soul from this player.
-
Constructor Details
-
O2Player
public O2Player(@NotNull @NotNull UUID id, @NotNull @NotNull String name, @NotNull @NotNull Ollivanders2 plugin) Constructor.- Parameters:
id- the UUID of the playername- the name of the playerplugin- a reference to the plugin
-
-
Method Details
-
getDestinedWandWood
Get the player's destined wand wood type.- Returns:
- the player's destined wand wood type
-
getDestinedWandCore
Get the player's destined wand core type.- Returns:
- the player's destined wand core type
-
setWandWood
Set the player's destined wand wood type. This overrides the current value.- Parameters:
wood- sets the destined wand wood type
-
setWandCore
Set the player's destined wand core type. This overrides the current value.- Parameters:
core- set the destined wand core type
-
getPlayerName
Get the name of this player for use in commands like listing out house membership. Since player names can change, this should not be used to identify a player. Instead, use the UUID of player and the O2Players map to find their O2Player object.- Returns:
- the player's name
-
setPlayerName
Sets the name of this player for use in commands like listing out house membership.- Parameters:
name- the name to set for this player
-
getSpellCount
Get the casting count for a spell- Parameters:
spell- the spell to get a count for- Returns:
- the number of times a player has cast this spell
-
getPotionCount
Get the brewing count for a potion- Parameters:
potionType- the spell to get a count for- Returns:
- the number of times a player has cast this spell
-
getSpellLastCastTime
Get the casting count for a spell- Parameters:
spellType- the spell to get a count for- Returns:
- the number of times a player has cast this spell
-
getKnownSpells
Get the list of known spells for this player.- Returns:
- a map of all the known spells and the spell count for each.
-
getKnownPotions
Get the list of known potions for this player.- Returns:
- a map of all the known potions and potion brew count for each.
-
getRecentSpells
Get the list of recently cast spells for this player.- Returns:
- a map of all recent spells and the time they were cast.
-
setSpellCount
Set the spell count for a spell. This will override the existing values for this spell and should not be used when increment is intended.- Parameters:
spell- the spell to set the count forcount- the count to set
-
getLastSpell
Get the last spell cast by this player.- Returns:
- the last spell cast
-
setPriorIncantatem
Set the last spell successfully cast by this player's wand.- Parameters:
spell- the spell they most recently cast
-
getPriorIncantatem
Get the last spell cast by this player's wand.- Returns:
- the last spell cast by this player with a wand
-
setPotionCount
Set the potion count for a potion. This will override the existing values for this potion and should not be used when increment is intended.- Parameters:
potionType- the potion to set the count forcount- the count to set
-
setSpellRecentCastTime
Set the most recent cast time for a spell. This will override the existing values for this spell.- Parameters:
spellType- the spell to set the time for
-
setMasterSpell
Set the wand's mastered spell.- Parameters:
spell- the mastered spell
-
incrementSpellCount
Increment the spell count by 1.- Parameters:
spellType- the spell to increment
-
incrementPotionCount
Increment the potion count by 1.- Parameters:
potionType- the potion to increment
-
resetSpellCount
public void resetSpellCount()Resets the known spells for this player to none. -
resetPotionCount
public void resetPotionCount()Resets the known spells for this player to none. -
getWandSpell
Get the spell currently loaded in to the player's wand.- Returns:
- the loaded spell
-
setWandSpell
Loads a spell in to the player's wand.- Parameters:
spell- the spell to load
-
isMuggle
public boolean isMuggle()Determine if player is a muggle. Admins are never muggles.- Returns:
- true if they are a muggle, false otherwise
-
setMuggle
public void setMuggle(boolean isMuggle) Set if a player is a muggle. Admins are never muggles.- Parameters:
isMuggle- true if the player is a muggle
-
getSouls
public int getSouls()Get the number of souls this player has collected.- Returns:
- the number of souls this player has collected
-
setSouls
public void setSouls(int souls) Set the number of souls this player has collected.- Parameters:
souls- the number of souls the player has collected
-
addSoul
public void addSoul()Add a soul to this player. -
subtractSoul
public void subtractSoul()Remove a soul from this player. -
getYear
Get the year this player is in.- Returns:
- The year the player is in
-
setYear
Set the year this player is in.- Parameters:
year- The year to set them to
-
resetSouls
public void resetSouls()Reset the soul count to zero. -
initFoundWand
protected void initFoundWand(boolean found) Initializer for the foundWand class variable for loading the player from saved data. This is different from setFoundWand which triggers a found wand event.- Parameters:
found- the value to set for foundWand
-
setFoundWand
public void setFoundWand(boolean found) Set whether the player has found their destined wand before. Once a player finds their destined wand they are also no longer a muggle since they can do magic. This should not be called when loading from saved data, use initFoundWand().- Parameters:
found- set whether the player has found their destined wand
-
foundWand
public boolean foundWand()Has this player found their destined wand?- Returns:
- true if they have, false if not
-
getSpellJournal
@Nullable public @Nullable org.bukkit.inventory.ItemStack getSpellJournal()Returns this player's spell journal, a book with all known spells and their level.- Returns:
- the player's spell journal
-
shiftMasterSpell
Deprecated.Shift the wand's master spell to the next spell. -
shiftMasterSpell
public void shiftMasterSpell(boolean reverse) Shift the wand's master spell to the next spell.- Parameters:
reverse- if set to true, iterates backwards through spell list
-
getMasterSpell
Get the wand's master spell.- Returns:
- the wand's master spell
-
setIsAnimagus
public void setIsAnimagus()Sets that this player is an Animagus. -
setAnimagusForm
public void setAnimagusForm(@NotNull @NotNull org.bukkit.entity.EntityType type) Sets the Animagus form for this player.- Parameters:
type- the player's Animagus form.
-
getAnimagusForm
@Nullable public @Nullable org.bukkit.entity.EntityType getAnimagusForm()Get the Animagus form for this player.- Returns:
- the player's Animagus form or null if they are not an Animagus
-
getAnimagusColor
Get the color variation for this animagus.- Returns:
- the color variation or null if not applicable
-
isAnimagus
public boolean isAnimagus()Determine if this player an Animagus.- Returns:
- true if they have an Animagus form, false otherwise
-
getID
Get the player's UUID- Returns:
- the UUID of the player this O2Player represents
-
onJoin
public void onJoin()Do player onJoin set up -
onQuit
public void onQuit()Do player onQuit clean up -
onDeath
public void onDeath()Do player onDeath actions -
fix
protected void fix()Called after a player's data has been read from save to fix changes made to the plugin between versions. -
isOnline
public boolean isOnline()Is this player currently online? For use when we have an O2Player and not a player (which has an isOnline() method in Spigot)- Returns:
- true if they are online, false otherwise
-