Class PlayerWrapper

java.lang.Object
me.deecaad.weaponmechanics.wrappers.EntityWrapper
me.deecaad.weaponmechanics.wrappers.PlayerWrapper

public class PlayerWrapper extends EntityWrapper
Wraps a Player object to simplify per-player data/methods that are used by WeaponMechanics. Also contains useful API functionality for plugins who want to check if an entity is scoped, reloading, etc.
  • Constructor Details

    • PlayerWrapper

      public PlayerWrapper(org.bukkit.entity.Player player)
  • Method Details

    • getPlayer

      public org.bukkit.entity.Player getPlayer()
    • rightClicked

      public void rightClicked()
    • didDoubleSneak

      public boolean didDoubleSneak()
    • droppedWeapon

      public void droppedWeapon()
    • getLastDropWeaponTime

      public long getLastDropWeaponTime()
    • inventoryDrop

      public void inventoryDrop()
    • getLastInventoryDropTime

      public long getLastInventoryDropTime()
    • getMessageHelper

      public MessageHelper getMessageHelper()
    • getRecoilController

      public RecoilController getRecoilController()
    • convertedAmmo

      public void convertedAmmo()
    • getLastAmmoConvert

      public long getLastAmmoConvert()
    • isRightClicking

      public boolean isRightClicking()
      Description copied from class: EntityWrapper
      Returns true if the entity is a player, and the player has right-clicked in the past 4 ticks (+- 25 milliseconds). This method also considers the player's ping (Player.getPing()) to determine if they are still right-clicking.

      While this method is usually quite inaccurate (can be up to 4 ticks late!), it is 100% accurate when the player is blocking (swords in 1.8, shields in 1.9+).

      Overrides:
      isRightClicking in class EntityWrapper
      Returns:
      true when the player is right-clicking.
      See Also:
      • HumanEntity.isBlocking()
    • isSneaking

      public boolean isSneaking()
      Description copied from class: EntityWrapper
      Returns true if the entity is a player, and the player is in sneak mode.
      Overrides:
      isSneaking in class EntityWrapper
      Returns:
      true when the player is sneaking.
      See Also:
      • Player.isSneaking()
    • isCrawling

      public boolean isCrawling()
      Returns true if the player is 'crawling'.
      Returns:
      true when the player is 'crawling'.
    • isSprinting

      public boolean isSprinting()
      Description copied from class: EntityWrapper
      Returns true if the entity is a player, and the player is sprinting.
      Overrides:
      isSprinting in class EntityWrapper
      Returns:
      true when the player is sprinting.
      See Also:
      • Player.isSprinting()
    • isPlayer

      public boolean isPlayer()
      Overrides:
      isPlayer in class EntityWrapper
    • getStatsData

      @Nullable public StatsData getStatsData()
      Returns:
      the stats data or null if disabled or not yet synced
    • getStatsDataUnsafe

      public StatsData getStatsDataUnsafe()
      This method might not be safe to use nor should be used. Use getStatsData() instead. By unsafe I mean that this object might not have been synced yet.
      Returns:
      the unsafe stats data object