Class KingdomPlayer

All Implemented Interfaces:
Comparable<KingdomPlayer>, org.kingdoms.abstraction.GroupOperator, org.kingdoms.abstraction.InvasionOperator, KingdomOperator, org.kingdoms.abstraction.NamespacedFlagsContainer, Keyed<UUID>, SmartObject, org.kingdoms.constants.group.model.logs.Loggable, org.kingdoms.locale.provider.CascadingMessageContextProvider, org.kingdoms.locale.provider.MessageContextProvider

public class KingdomPlayer extends KeyedKingdomsObject<UUID> implements Comparable<KingdomPlayer>, org.kingdoms.abstraction.InvasionOperator, KingdomOperator, org.kingdoms.abstraction.NamespacedFlagsContainer
  • Constructor Details

    • KingdomPlayer

      public KingdomPlayer(@Nullable UUID id, @Nullable UUID kingdom, long joinedAt)
    • KingdomPlayer

      public KingdomPlayer(@NonNull UUID id, @Nullable UUID kingdom, @NonNull org.kingdoms.locale.Language language, @Nullable String rank, @Nullable String nationalRank, @NonNull String chatChannel, @Nullable String markersType, long joinedAt, double power, long lastDonationTime, double lastDonationAmount, double totalDonations, long lastPowerCheckup, @NonNull Set<UUID> readMails, @NonNull Map<UUID,KingdomInvite> invites, @Nullable Set<SimpleChunkLocation> claims, @Nullable org.kingdoms.data.Pair<Integer,Integer> mapSize, org.kingdoms.constants.namespace.NamespacedFlags flags, @NonNull Set<String> mutedChannels, Set<SimpleLocation> protectedBlocks)
  • Method Details

    • getKingdomPlayer

      public static @NonNull KingdomPlayer getKingdomPlayer(@NonNull org.bukkit.OfflinePlayer player)
    • getKingdomPlayer

      public static @NonNull KingdomPlayer getKingdomPlayer(@NonNull UUID id)
    • hasKingdom

      public boolean hasKingdom()
    • countUnreadMails

      public int countUnreadMails(Map<UUID,Mail> mails)
    • isUnreadMail

      public boolean isUnreadMail(Mail mail)
    • getPlayer

      public @Nullable org.bukkit.entity.Player getPlayer()
    • isInSameKingdomAs

      public boolean isInSameKingdomAs(KingdomPlayer kp)
    • getOfflinePlayer

      public @NonNull org.bukkit.OfflinePlayer getOfflinePlayer()
    • getKingdom

      public @Nullable Kingdom getKingdom()
      Specified by:
      getKingdom in interface KingdomOperator
    • getJailCell

      public SimpleLocation getJailCell()
    • setJailCell

      public void setJailCell(SimpleLocation jailCell)
    • getRank

      public @Nullable Rank getRank()
      Returns:
      null if getKingdom() is null
    • toString

      public String toString()
      Overrides:
      toString in class CompressedSmartObject
    • unsafeSetRank

      @Internal public void unsafeSetRank(@Nullable String rank)
    • unsafeSetNationalRank

      @Internal public void unsafeSetNationalRank(@Nullable String nationalRank)
    • changeRank

      public @NonNull org.kingdoms.events.general.ranks.PlayerRankChangeEvent changeRank(@NonNull org.kingdoms.events.general.ranks.PlayerRankChangeContext context)
    • getRankNode

      public @Nullable String getRankNode()
      This method is for internal use only.
      See Also:
    • leaveKingdom

      public KingdomLeaveEvent leaveKingdom(LeaveReason reason)
    • silentlyLeaveKingdom

      @Internal public void silentlyLeaveKingdom()
    • getLanguage

      @NotNull public @NotNull org.kingdoms.locale.Language getLanguage()
    • setLanguage

      public void setLanguage(org.kingdoms.locale.Language language)
    • joinKingdom

      public KingdomJoinEvent joinKingdom(@NonNull Kingdom kingdom)
    • joinKingdom

      public KingdomJoinEvent joinKingdom(@NonNull Kingdom kingdom, @Nullable Consumer<KingdomJoinEvent> modifier)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • getKingdomId

      public @Nullable UUID getKingdomId()
    • getKey

      public @NonNull UUID getKey()
      Specified by:
      getKey in interface Keyed<UUID>
    • getChatChannel

      public @NonNull KingdomsChatChannel getChatChannel()
    • getChatChannelId

      public @Nullable String getChatChannelId()
    • setChatChannel

      public org.kingdoms.events.members.PlayerChangeChatChannelEvent setChatChannel(@NonNull KingdomsChatChannel newChannel)
    • donate

      public @NonNull GroupResourcePointConvertEvent donate(Kingdom kingdom, double amount)
    • donate

      public @NonNull GroupResourcePointConvertEvent donate(Group group, @NotNull @NotNull org.kingdoms.managers.resourcepoints.ConvertedResourcePoints rp)
    • donate

      public @NonNull GroupResourcePointConvertEvent donate(Group group, double amount, @Nullable Collection<org.bukkit.inventory.ItemStack> originalItems, @Nullable Collection<org.bukkit.inventory.ItemStack> convertedItems, @Nullable Collection<org.bukkit.inventory.ItemStack> leftOvers)
    • hasPermission

      public boolean hasPermission(@NonNull KingdomPermission permission)
    • hasAnyPermission

      public boolean hasAnyPermission(@NonNull KingdomPermission... permissions)
    • hasNationPermission

      public boolean hasNationPermission(@NonNull KingdomPermission permission)
    • processClaims

      public void processClaims(@NonNull Set<SimpleChunkLocation> lands, boolean claimed, boolean history)
    • getLastDonationTime

      public long getLastDonationTime()
    • setLastDonationTime

      public void setLastDonationTime(long lastDonationTime)
    • claimingHistory

      public @Nullable org.kingdoms.constants.player.ClaimingHistory claimingHistory(boolean undo)
      Gets the last claiming history with the specified undo/redo state.
      Parameters:
      undo - Whether the last undo or redo history should be fetched.
    • getClaimingHistory

      @NotNull public @NotNull List<org.kingdoms.constants.player.ClaimingHistory> getClaimingHistory()
    • getId

      public @NonNull UUID getId()
    • getAutoClaim

      public Boolean getAutoClaim()
    • setAutoClaim

      public void setAutoClaim(Boolean autoClaim)
    • isInvading

      public boolean isInvading()
    • getInvasion

      public @Nullable Invasion getInvasion()
      Specified by:
      getInvasion in interface org.kingdoms.abstraction.InvasionOperator
    • setInvasion

      public void setInvasion(@Nullable Invasion invasion)
    • getReadMails

      public @NonNull Set<UUID> getReadMails()
    • setReadMails

      public void setReadMails(@NonNull Set<UUID> readMails)
    • readMail

      public void readMail(Mail mail)
    • getJoinedAt

      public long getJoinedAt()
    • getInvites

      public @NonNull Map<UUID,KingdomInvite> getInvites()
    • setInvites

      @Internal public void setInvites(@NonNull Map<UUID,KingdomInvite> invites)
    • getTotalDonations

      public double getTotalDonations()
    • setTotalDonations

      public void setTotalDonations(double totalDonations)
    • getLastDonationAmount

      public double getLastDonationAmount()
    • setLastDonationAmount

      public void setLastDonationAmount(long lastDonationAmount)
    • isHigher

      public boolean isHigher(@NonNull KingdomPlayer kp)
    • isUsingMarkers

      public boolean isUsingMarkers()
    • setUsingMarkers

      public void setUsingMarkers(boolean markers)
    • getClaims

      public @NonNull Set<SimpleChunkLocation> getClaims()
    • setClaims

      public void setClaims(@NonNull Set<SimpleChunkLocation> claims)
    • getLastPowerCheckup

      public long getLastPowerCheckup()
    • getLandHistoryPosition

      public int getLandHistoryPosition()
    • setLandHistoryPosition

      public void setLandHistoryPosition(int landHistoryPosition)
    • isAutoMap

      public boolean isAutoMap()
    • setAutoMap

      public void setAutoMap(boolean autoMap)
    • getMapSize

      public @Nullable org.kingdoms.data.Pair<Integer,Integer> getMapSize()
      Key = height Value = width
    • setMapSize

      public void setMapSize(@Nullable org.kingdoms.data.Pair<Integer,Integer> mapSize)
    • isAdmin

      public boolean isAdmin()
    • setAdmin

      public void setAdmin(boolean admin)
    • isPvp

      public boolean isPvp()
    • setPvp

      public void setPvp(boolean pvp)
    • getNationRankNode

      public @Nullable String getNationRankNode()
      This will return null if:
           The player is not in a kingdom.
           The kingdom that the player is in, is not in a nation.
           The player has the default member rank.
       
      See Also:
    • getNationRank

      public @Nullable Rank getNationRank()
      This will return null if:
           The player is not in a kingdom.
           The kingdom that the player is in, is not in a nation.
       
      See Also:
    • isFlying

      public boolean isFlying()
    • setFlying

      public void setFlying(boolean flying, @Nullable Float speed)
    • buildMap

      public KingdomsMap buildMap()
    • isSpy

      public boolean isSpy()
    • setSpy

      public void setSpy(boolean spy)
    • getMarkersType

      public @Nullable String getMarkersType()
    • setMarkersType

      public void setMarkersType(@Nullable String markersType)
    • getPower

      public double getPower()
    • addPower

      public double addPower(double power)
    • setPower

      public double setPower(double power)
    • setPower

      public double setPower(double power, boolean ignoreLimits)
    • getProtectedBlocks

      public @NonNull Set<SimpleLocation> getProtectedBlocks()
    • setProtectedBlocks

      @Internal public void setProtectedBlocks(@NonNull Set<SimpleLocation> protectedBlocks)
    • isInSneakMode

      public boolean isInSneakMode()
    • setSneakMode

      public void setSneakMode(boolean sneakMode)
    • updatePower

      public void updatePower(@Nullable Boolean online)
    • compareTo

      public int compareTo(@NonNull KingdomPlayer other)
      Specified by:
      compareTo in interface Comparable<KingdomPlayer>
    • getMutedChannels

      public @NonNull Set<String> getMutedChannels()
    • setMutedChannels

      public void setMutedChannels(@NonNull Set<String> mutedChannels)
    • addMessageContextEdits

      public void addMessageContextEdits(@NotNull @NotNull MessagePlaceholderProvider context)
      Specified by:
      addMessageContextEdits in interface org.kingdoms.locale.provider.CascadingMessageContextProvider
      Overrides:
      addMessageContextEdits in class KingdomsObject
    • getFlags

      @NotNull public @NotNull org.kingdoms.constants.namespace.NamespacedFlags getFlags()
      Specified by:
      getFlags in interface org.kingdoms.abstraction.NamespacedFlagsContainer
    • setFlags

      public void setFlags(@NotNull @NotNull org.kingdoms.constants.namespace.NamespacedFlags flags)
      Specified by:
      setFlags in interface org.kingdoms.abstraction.NamespacedFlagsContainer
    • getDataHandler

      protected org.kingdoms.data.handlers.abstraction.DataHandler<KingdomPlayer> getDataHandler()
      Description copied from class: CompressedSmartObject
      Used for serialization of the smart object into a compressed state to determine CompressedSmartObject.shouldSave()
      Overrides:
      getDataHandler in class CompressedSmartObject
    • isDataEmpty

      public boolean isDataEmpty()
      Description copied from interface: SmartObject
      Checks whether this data is absolutely empty and can be deleted from the database. The definition of "empty" depends on the implementation.
      Specified by:
      isDataEmpty in interface SmartObject
      Returns:
      true if the data is empty and should be deleted, otherwise false