Class O2PlayerCommon
java.lang.Object
net.pottercraft.ollivanders2.player.O2PlayerCommon
Player common functions.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final doubleMultiplier for spell casting, when using someone else's wand, strength is halvedstatic final doubleMultiplier for spell casting, when using their destined wand, this is 1, so no effect.static final doubleMultiplier for spell casting, when using the Elder wand, strength is doubled -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@NotNull List<org.bukkit.entity.Player> Get a list of all the sorted online players@NotNull org.bukkit.entity.EntityTypegetAnimagusForm(@NotNull UUID pid) Get the animagus form for this player, check by uuid so this can be run for players who are not online toostatic voidgivePlayerKit(@NotNull org.bukkit.entity.Player player, @NotNull List<org.bukkit.inventory.ItemStack> kit) Gives a player an item stackstatic booleanhasPotionEffect(@NotNull org.bukkit.entity.Player player, @NotNull org.bukkit.potion.PotionEffectType effectType) Does a player have a particular potion effect?booleanisAllowedAnimagusForm(@NotNull org.bukkit.entity.EntityType form) Determine if an EntityType is an allowed Animagus form.static booleanisInvisible(@NotNull org.bukkit.entity.Player player) Is this player invisible?static voidrestoreFullHealth(@NotNull org.bukkit.entity.Player player) Restore a player to full healthdoublewandCheck(@NotNull org.bukkit.entity.Player player) Checks what kind of wand a player holds in their primary hand.doublewandCheck(@NotNull org.bukkit.entity.Player player, @NotNull org.bukkit.inventory.EquipmentSlot hand) Checks what kind of wand a player holds.static booleanwearingInvisibilityCloak(@NotNull org.bukkit.entity.Player player) Does the player have the Cloak of Invisibility
-
Field Details
-
rightWand
public static final double rightWandMultiplier for spell casting, when using their destined wand, this is 1, so no effect.- See Also:
-
wrongWand
public static final double wrongWandMultiplier for spell casting, when using the Elder wand, strength is doubled- See Also:
-
elderWand
public static final double elderWandMultiplier for spell casting, when using someone else's wand, strength is halved- See Also:
-
-
Constructor Details
-
O2PlayerCommon
Constructor- Parameters:
plugin- a reference to the MC plugin
-
-
Method Details
-
getAnimagusForm
Get the animagus form for this player, check by uuid so this can be run for players who are not online too- Parameters:
pid- the id of the player to check- Returns:
- the animagus form for this player - should always be the same since it is based on a hash of their PID
-
isAllowedAnimagusForm
public boolean isAllowedAnimagusForm(@NotNull @NotNull org.bukkit.entity.EntityType form) Determine if an EntityType is an allowed Animagus form.- Parameters:
form- the animagus form to check- Returns:
- true if this is an allowed form, false otherwise
-
wandCheck
public double wandCheck(@NotNull @NotNull org.bukkit.entity.Player player) Checks what kind of wand a player holds in their primary hand. Returns a value based on the wand and its relation to the player.Assumes:holdsWand has already been checked
- Parameters:
player- player being checked. The player must be holding a wand.- Returns:
- 2 - the wand is not player's type AND/OR is not allied to player.
1 - the wand is player's type and is allied to player OR the wand is the elder wand and is not allied to player.
0.5 - the wand is the elder wand and is allied to player.
-
wandCheck
public double wandCheck(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull org.bukkit.inventory.EquipmentSlot hand) Checks what kind of wand a player holds. Returns a value based on the wand and its relation to the player.Assumes: player is holding a wand in the equipment slot passed in.
- Parameters:
player- player being checked. The player must be holding a wand.hand- the hand that is holding the wand to check.- Returns:
- 2 - The wand is not player's type AND/OR is not allied to player
>1 - The wand is player's type and is allied to player OR the wand is the elder wand and is not allied to player
0.5 - The wand is the elder wand and is allied to player.
-
restoreFullHealth
public static void restoreFullHealth(@NotNull @NotNull org.bukkit.entity.Player player) Restore a player to full health- Parameters:
player- the player to restore
-
getAllOnlineSortedPlayers
Get a list of all the sorted online players- Returns:
- the list of sorted online players
-
givePlayerKit
public static void givePlayerKit(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull List<org.bukkit.inventory.ItemStack> kit) Gives a player an item stack- Parameters:
player- the player to give the items tokit- the items to give
-
hasPotionEffect
public static boolean hasPotionEffect(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull org.bukkit.potion.PotionEffectType effectType) Does a player have a particular potion effect?- Parameters:
player- the player to checkeffectType- the potion effect type to check for- Returns:
- true if the player has this potion effect, false otherwise
-
wearingInvisibilityCloak
public static boolean wearingInvisibilityCloak(@NotNull @NotNull org.bukkit.entity.Player player) Does the player have the Cloak of Invisibility- Parameters:
player- player to be checked- Returns:
- true if yes, false if no
-
isInvisible
public static boolean isInvisible(@NotNull @NotNull org.bukkit.entity.Player player) Is this player invisible?- Parameters:
player- the player to check- Returns:
- true if they are either wearing an invisibility cloak or have an invisibility potion effect, false otherwise
-