Class MemoryFPlayer

java.lang.Object
dev.kitteh.factions.data.MemoryFPlayer
All Implemented Interfaces:
FPlayer, Participator, Selectable
Direct Known Subclasses:
JSONFPlayer

@Internal @NullMarked public abstract class MemoryFPlayer extends Object implements FPlayer
Logged in players always have exactly one FPlayer instance. Logged out players may or may not have an FPlayer instance. They will always have one if they are part of a faction. This is because only players with a faction are saved to disk (in order to not waste disk space).

The FPlayer is linked to a minecraft player using the player name.

The same instance is always returned for the same player. This means you can use the == operator. No .equals method necessary.

  • Field Details

    • factionId

      protected int factionId
    • role

      protected Role role
    • titleMM

      protected String titleMM
    • titleComponent

      protected transient @Nullable net.kyori.adventure.text.Component titleComponent
    • title

      protected @Nullable String title
    • power

      protected double power
    • powerBoost

      protected double powerBoost
    • lastPowerUpdateTime

      protected long lastPowerUpdateTime
    • lastLoginTime

      protected long lastLoginTime
    • chatTarget

      protected ChatTarget chatTarget
    • ignoreAllianceChat

      protected boolean ignoreAllianceChat
    • ignoreTruceChat

      protected boolean ignoreTruceChat
    • id

      protected UUID id
    • name

      protected String name
    • monitorJoins

      protected boolean monitorJoins
    • spyingChat

      protected boolean spyingChat
    • showScoreboard

      protected boolean showScoreboard
    • warmup

      protected @Nullable WarmUpUtil.Warmup warmup
    • warmupTask

      protected int warmupTask
    • isAdminBypassing

      protected boolean isAdminBypassing
    • kills

      protected int kills
    • deaths

      protected int deaths
    • willAutoLeave

      protected boolean willAutoLeave
    • mapHeight

      protected int mapHeight
    • isFlying

      protected boolean isFlying
    • isAutoFlying

      protected boolean isAutoFlying
    • flyTrailsState

      protected boolean flyTrailsState
    • flyTrailsEffect

      protected @Nullable String flyTrailsEffect
    • seeingChunk

      protected boolean seeingChunk
    • lastStoodAt

      protected FLocation lastStoodAt
    • mapAutoUpdating

      protected transient boolean mapAutoUpdating
    • autoClaimFor

      protected transient @Nullable Faction autoClaimFor
    • autoSetZone

      protected transient @Nullable String autoSetZone
    • autoUnclaimFor

      protected transient @Nullable Faction autoUnclaimFor
    • loginPvpDisabled

      protected transient boolean loginPvpDisabled
    • lastFrostwalkerMessage

      protected transient long lastFrostwalkerMessage
    • shouldTakeFallDamage

      protected transient boolean shouldTakeFallDamage
    • offlinePlayer

      protected transient @Nullable org.bukkit.OfflinePlayer offlinePlayer
  • Constructor Details

    • MemoryFPlayer

      public MemoryFPlayer(UUID id)
  • Method Details

    • cleanupDeserialization

      public void cleanupDeserialization()
    • onLogInOut

      public void onLogInOut()
    • faction

      public Faction faction()
      Specified by:
      faction in interface FPlayer
    • getFactionId

      public int getFactionId()
    • hasFaction

      public boolean hasFaction()
      Specified by:
      hasFaction in interface FPlayer
    • faction

      public void faction(Faction faction)
      Specified by:
      faction in interface FPlayer
    • monitorJoins

      public void monitorJoins(boolean monitor)
      Specified by:
      monitorJoins in interface FPlayer
    • monitorJoins

      public boolean monitorJoins()
      Specified by:
      monitorJoins in interface FPlayer
    • role

      public Role role()
      Specified by:
      role in interface FPlayer
    • role

      public void role(Role role)
      Specified by:
      role in interface FPlayer
    • powerBoost

      public double powerBoost()
      Specified by:
      powerBoost in interface FPlayer
    • powerBoost

      public void powerBoost(double powerBoost)
      Specified by:
      powerBoost in interface FPlayer
    • autoLeaveExempt

      public boolean autoLeaveExempt()
      Specified by:
      autoLeaveExempt in interface FPlayer
    • autoLeaveExempt

      public void autoLeaveExempt(boolean exempt)
      Specified by:
      autoLeaveExempt in interface FPlayer
    • lastFrostwalkerMessageTime

      public long lastFrostwalkerMessageTime()
      Specified by:
      lastFrostwalkerMessageTime in interface FPlayer
    • updateLastFrostwalkerMessageTime

      public void updateLastFrostwalkerMessageTime()
      Specified by:
      updateLastFrostwalkerMessageTime in interface FPlayer
    • autoClaim

      public @Nullable Faction autoClaim()
      Specified by:
      autoClaim in interface FPlayer
    • autoClaim

      public void autoClaim(@Nullable Faction faction)
      Specified by:
      autoClaim in interface FPlayer
    • autoSetZone

      public @Nullable String autoSetZone()
      Specified by:
      autoSetZone in interface FPlayer
    • autoSetZone

      public void autoSetZone(@Nullable String zone)
      Specified by:
      autoSetZone in interface FPlayer
    • autoUnclaim

      public @Nullable Faction autoUnclaim()
      Specified by:
      autoUnclaim in interface FPlayer
    • autoUnclaim

      public void autoUnclaim(@Nullable Faction faction)
      Specified by:
      autoUnclaim in interface FPlayer
    • adminBypass

      public boolean adminBypass()
      Specified by:
      adminBypass in interface FPlayer
    • isVanished

      public boolean isVanished()
      Specified by:
      isVanished in interface FPlayer
    • adminBypass

      public void adminBypass(boolean val)
      Specified by:
      adminBypass in interface FPlayer
    • chatTarget

      public void chatTarget(ChatTarget chatTarget)
      Specified by:
      chatTarget in interface FPlayer
    • chatTarget

      public ChatTarget chatTarget()
      Specified by:
      chatTarget in interface FPlayer
    • ignoreAllianceChat

      public void ignoreAllianceChat(boolean ignore)
      Specified by:
      ignoreAllianceChat in interface FPlayer
    • ignoreAllianceChat

      public boolean ignoreAllianceChat()
      Specified by:
      ignoreAllianceChat in interface FPlayer
    • ignoreTruceChat

      public void ignoreTruceChat(boolean ignore)
      Specified by:
      ignoreTruceChat in interface FPlayer
    • ignoreTruceChat

      public boolean ignoreTruceChat()
      Specified by:
      ignoreTruceChat in interface FPlayer
    • spyingChat

      public void spyingChat(boolean chatSpying)
      Specified by:
      spyingChat in interface FPlayer
    • spyingChat

      public boolean spyingChat()
      Specified by:
      spyingChat in interface FPlayer
    • asOfflinePlayer

      public org.bukkit.OfflinePlayer asOfflinePlayer()
      Description copied from interface: Participator
      Gets an OfflinePlayer for the given participator.
      Specified by:
      asOfflinePlayer in interface Participator
      Returns:
      offline player representation
    • setOfflinePlayer

      public void setOfflinePlayer(@Nullable org.bukkit.entity.Player player)
    • resetFactionData

      public void resetFactionData()
      Specified by:
      resetFactionData in interface FPlayer
    • resetFactionData

      public void resetFactionData(boolean updateCommands)
      Specified by:
      resetFactionData in interface FPlayer
    • lastLogin

      public long lastLogin()
      Specified by:
      lastLogin in interface FPlayer
    • mapAutoUpdating

      public boolean mapAutoUpdating()
      Specified by:
      mapAutoUpdating in interface FPlayer
    • mapAutoUpdating

      public void mapAutoUpdating(boolean mapAutoUpdating)
      Specified by:
      mapAutoUpdating in interface FPlayer
    • loginPVPDisabled

      public boolean loginPVPDisabled()
      Specified by:
      loginPVPDisabled in interface FPlayer
    • lastStoodAt

      public FLocation lastStoodAt()
      Specified by:
      lastStoodAt in interface FPlayer
    • lastStoodAt

      public void lastStoodAt(FLocation flocation)
      Specified by:
      lastStoodAt in interface FPlayer
    • title

      public net.kyori.adventure.text.Component title()
      Specified by:
      title in interface FPlayer
    • title

      public void title(net.kyori.adventure.text.Component title)
      Specified by:
      title in interface FPlayer
    • name

      public String name()
      Specified by:
      name in interface FPlayer
    • setName

      public void setName(String name)
    • tagOrEmpty

      public String tagOrEmpty()
    • nameWithTitle

      public net.kyori.adventure.text.Component nameWithTitle()
      Specified by:
      nameWithTitle in interface FPlayer
    • nameWithTag

      public net.kyori.adventure.text.Component nameWithTag()
      Specified by:
      nameWithTag in interface FPlayer
    • kills

      public int kills()
      Specified by:
      kills in interface FPlayer
    • deaths

      public int deaths()
      Specified by:
      deaths in interface FPlayer
    • power

      public double power()
      Specified by:
      power in interface FPlayer
    • power

      public void power(double power)
      Specified by:
      power in interface FPlayer
    • alterPower

      public void alterPower(double delta)
      Specified by:
      alterPower in interface FPlayer
    • powerMax

      public double powerMax()
      Specified by:
      powerMax in interface FPlayer
    • powerMin

      public double powerMin()
      Specified by:
      powerMin in interface FPlayer
    • powerRounded

      public int powerRounded()
      Specified by:
      powerRounded in interface FPlayer
    • powerMaxRounded

      public int powerMaxRounded()
      Specified by:
      powerMaxRounded in interface FPlayer
    • powerMinRounded

      public int powerMinRounded()
      Specified by:
      powerMinRounded in interface FPlayer
    • updatePower

      public void updatePower()
      Specified by:
      updatePower in interface FPlayer
    • losePowerFromBeingOffline

      public void losePowerFromBeingOffline()
      Specified by:
      losePowerFromBeingOffline in interface FPlayer
    • onDeath

      public void onDeath()
      Specified by:
      onDeath in interface FPlayer
    • isInOwnTerritory

      public boolean isInOwnTerritory()
      Specified by:
      isInOwnTerritory in interface FPlayer
    • isInOthersTerritory

      public boolean isInOthersTerritory()
      Specified by:
      isInOthersTerritory in interface FPlayer
    • isInAllyTerritory

      public boolean isInAllyTerritory()
      Specified by:
      isInAllyTerritory in interface FPlayer
    • isInNeutralTerritory

      public boolean isInNeutralTerritory()
      Specified by:
      isInNeutralTerritory in interface FPlayer
    • isInEnemyTerritory

      public boolean isInEnemyTerritory()
      Specified by:
      isInEnemyTerritory in interface FPlayer
    • sendFactionHereMessage

      public void sendFactionHereMessage(Faction from)
      Specified by:
      sendFactionHereMessage in interface FPlayer
    • showInfoBoard

      public boolean showInfoBoard(Faction toShow)
      Check if the scoreboard should be shown. Simple method to be used by above method.
      Parameters:
      toShow - Faction to be shown.
      Returns:
      true if should show, otherwise false.
    • showScoreboard

      public boolean showScoreboard()
      Specified by:
      showScoreboard in interface FPlayer
    • showScoreboard

      public void showScoreboard(boolean show)
      Specified by:
      showScoreboard in interface FPlayer
    • leave

      public void leave(boolean makePay)
      Specified by:
      leave in interface FPlayer
    • attemptAutoSetZone

      public void attemptAutoSetZone(FLocation flocation)
      Specified by:
      attemptAutoSetZone in interface FPlayer
    • canClaimForFaction

      public boolean canClaimForFaction(Faction forFaction)
      Specified by:
      canClaimForFaction in interface FPlayer
    • canClaimForFactionAtLocation

      public boolean canClaimForFactionAtLocation(Faction forFaction, FLocation flocation, boolean notifyFailure)
      Specified by:
      canClaimForFactionAtLocation in interface FPlayer
    • attemptClaim

      public boolean attemptClaim(Faction forFaction, org.bukkit.Location location, boolean notifyFailure)
      Specified by:
      attemptClaim in interface FPlayer
    • attemptClaim

      public boolean attemptClaim(Faction forFaction, FLocation flocation, boolean notifyFailure)
      Specified by:
      attemptClaim in interface FPlayer
    • attemptUnclaim

      public boolean attemptUnclaim(Faction forFaction, FLocation flocation, boolean notifyFailure)
      Specified by:
      attemptUnclaim in interface FPlayer
    • shouldBeSaved

      public boolean shouldBeSaved()
    • msgLegacy

      public void msgLegacy(@NonNull String str, @NonNull Object @NonNull ... args)
      Description copied from interface: Participator
      Sends a String.format-able message.
      Specified by:
      msgLegacy in interface Participator
      Parameters:
      str - string
      args - args
    • asPlayer

      public @Nullable org.bukkit.entity.Player asPlayer()
      Specified by:
      asPlayer in interface FPlayer
    • isOnline

      public boolean isOnline()
      Specified by:
      isOnline in interface FPlayer
    • flightCheck

      public void flightCheck()
      Specified by:
      flightCheck in interface FPlayer
    • flying

      public boolean flying()
      Specified by:
      flying in interface FPlayer
    • flying

      public void flying(boolean fly)
      Specified by:
      flying in interface FPlayer
    • flying

      public void flying(boolean fly, boolean damage)
      Specified by:
      flying in interface FPlayer
    • autoFlying

      public boolean autoFlying()
      Specified by:
      autoFlying in interface FPlayer
    • autoFlying

      public void autoFlying(boolean autoFly)
      Specified by:
      autoFlying in interface FPlayer
    • canFlyAtLocation

      public boolean canFlyAtLocation(FLocation location)
      Specified by:
      canFlyAtLocation in interface FPlayer
    • takeFallDamage

      public boolean takeFallDamage()
      Specified by:
      takeFallDamage in interface FPlayer
    • takeFallDamage

      public void takeFallDamage(boolean fallDamage)
      Specified by:
      takeFallDamage in interface FPlayer
    • seeChunk

      public boolean seeChunk()
      Specified by:
      seeChunk in interface FPlayer
    • seeChunk

      public void seeChunk(boolean seeingChunk)
      Specified by:
      seeChunk in interface FPlayer
    • flyTrail

      public boolean flyTrail()
      Specified by:
      flyTrail in interface FPlayer
    • flyTrail

      public void flyTrail(boolean state)
      Specified by:
      flyTrail in interface FPlayer
    • flyTrailEffect

      public @Nullable String flyTrailEffect()
      Specified by:
      flyTrailEffect in interface FPlayer
    • flyTrailEffect

      public void flyTrailEffect(String effect)
      Specified by:
      flyTrailEffect in interface FPlayer
    • sendMessage

      public void sendMessage(@NonNull net.kyori.adventure.text.Component component)
      Description copied from interface: Participator
      Sends a component.
      Specified by:
      sendMessage in interface Participator
      Parameters:
      component - component
    • sendMessageLegacy

      public void sendMessageLegacy(String msg)
      Specified by:
      sendMessageLegacy in interface FPlayer
    • sendMessageLegacy

      public void sendMessageLegacy(List<String> msgs)
      Specified by:
      sendMessageLegacy in interface FPlayer
    • mapHeight

      public int mapHeight()
      Specified by:
      mapHeight in interface FPlayer
    • mapHeight

      public void mapHeight(int height)
      Specified by:
      mapHeight in interface FPlayer
    • uniqueId

      public UUID uniqueId()
      Specified by:
      uniqueId in interface FPlayer
    • cancelWarmup

      public void cancelWarmup()
      Specified by:
      cancelWarmup in interface FPlayer
    • warmup

      public @Nullable WarmUpUtil.Warmup warmup()
      Specified by:
      warmup in interface FPlayer
    • addWarmup

      public void addWarmup(WarmUpUtil.Warmup warmup, int taskId)
      Specified by:
      addWarmup in interface FPlayer