Class Group

All Implemented Interfaces:
org.kingdoms.abstraction.GroupOperator, org.kingdoms.abstraction.Levellable, org.kingdoms.abstraction.NamespacedFlagsContainer, Keyed<UUID>, SmartObject, org.kingdoms.constants.group.model.logs.Loggable, org.kingdoms.constants.themes.ThemeContainer, org.kingdoms.locale.provider.CascadingMessageContextProvider, org.kingdoms.locale.provider.MessageContextProvider
Direct Known Subclasses:
Kingdom, Nation

public abstract class Group extends KeyedKingdomsObject<UUID> implements org.kingdoms.abstraction.GroupOperator, org.kingdoms.abstraction.Levellable, org.kingdoms.abstraction.NamespacedFlagsContainer, org.kingdoms.constants.themes.ThemeContainer
  • Field Details

    • members

      protected final @NonNull Set<UUID> members
    • relationshipRequests

      protected @NonNull Map<UUID,KingdomRelationshipRequest> relationshipRequests
    • relations

      protected @NonNull Map<UUID,KingdomRelation> relations
    • attributes

      protected @NonNull Map<KingdomRelation,Set<org.kingdoms.constants.group.model.relationships.RelationAttribute>> attributes
    • owner

      protected @Nullable UUID owner
    • id

      protected final transient UUID id
    • name

      protected @NonNull String name
    • nexus

      protected @Nullable SimpleLocation nexus
    • home

      protected @Nullable org.kingdoms.server.location.Location home
    • shield

      protected org.kingdoms.constants.group.Shield shield
    • level

      protected int level
    • resourcePoints

      @NotNull protected @NotNull org.kingdoms.constants.economy.Balance resourcePoints
    • bank

      @NotNull protected @NotNull org.kingdoms.constants.economy.Balance bank
    • since

      protected long since
    • tag

      protected @Nullable String tag
    • ranks

      protected @NonNull RankMap ranks
    • flags

      protected org.kingdoms.constants.namespace.NamespacedFlags flags
    • taxes

      protected org.kingdoms.constants.namespace.NamespacedMap<org.kingdoms.utils.compilers.expressions.MathExpression> taxes
    • colors

      protected org.kingdoms.constants.namespace.NamespacedMap<Color> colors
    • book

      protected @NonNull Map<String,BookChapter> book
  • Constructor Details

    • Group

      public Group(@NonNull UUID id, @Nullable UUID owner, @NonNull String name, @Nullable String tag, int level, @Nullable org.kingdoms.constants.namespace.NamespacedMap<org.kingdoms.utils.compilers.expressions.MathExpression> taxes, @NonNull RankMap ranks, org.kingdoms.constants.economy.Balance resourcePoints, long since, org.kingdoms.constants.economy.Balance bank, org.kingdoms.constants.namespace.NamespacedFlags flags, org.kingdoms.constants.stats.Statistics stats, org.kingdoms.constants.group.Shield shield, @Nullable SimpleLocation nexus, @Nullable org.kingdoms.server.location.Location home, GroupBanner flag, GroupBanner banner, org.kingdoms.constants.namespace.NamespacedMap<Color> colors, @NonNull Set<UUID> members, @NonNull Map<String,BookChapter> book, Map<UUID,KingdomRelation> relations, Map<UUID,KingdomRelationshipRequest> relationshipRequests, Map<KingdomRelation,Set<org.kingdoms.constants.group.model.relationships.RelationAttribute>> attributes, @NonNull Set<UUID> mails)
    • Group

      public Group(@Nullable UUID owner, @Nullable String name)
  • Method Details

    • sendMail

      public Mail sendMail(org.bukkit.entity.Player sender, DraftMail draft)
    • sendMail

      public Mail sendMail(String subject, org.bukkit.entity.Player sender, Map<Group,MailRecipientType> recipients, List<String> message, UUID replyTo)
    • getGroup

      public Group getGroup()
      Specified by:
      getGroup in interface org.kingdoms.abstraction.GroupOperator
    • getLevel

      public int getLevel()
      This option is affected by forced levels config option if it's enabled (e.g. KingdomsConfig.GROUP_LEVELS_KINGDOMS_FORCE) The raw level is accessed from getRawLevel() but you shouldn't need to use that method in almost all cases.
      Specified by:
      getLevel in interface org.kingdoms.abstraction.Levellable
    • getRawLevel

      @Internal public final int getRawLevel()
      Same as getLevel() but it's not affected by forced levels (e.g. KingdomsConfig.GROUP_LEVELS_KINGDOMS_FORCE)
    • getShield

      public org.kingdoms.constants.group.Shield getShield()
    • setLevel

      @Internal public void setLevel(int level)
      This is a direct method that simply changes the saved level in kingdoms data. You should use changeLevel(int, Player) instead.
      Specified by:
      setLevel in interface org.kingdoms.abstraction.Levellable
    • changeLevel

      public boolean changeLevel(int newLvl, org.bukkit.entity.Player player)
      Changes the level and also upgrades the nexus structure itself. Note that the nexus must be placed.
      Parameters:
      newLvl - Can only be positive.
      player - The player responsible for this change. It simply only sends messages and checks permissions when needed.
      Returns:
      true if the upgrade succeeded, otherwise false.
    • getSentMails

      @NotNull public @Unmodifiable @NotNull List<Mail> getSentMails()
    • getReceivedMails

      @NotNull public @Unmodifiable @NotNull List<Mail> getReceivedMails()
    • getBook

      public @NonNull Map<String,BookChapter> getBook()
    • setBook

      public void setBook(@NonNull Map<String,BookChapter> book)
    • placeOrMoveNexus

      public abstract NexusMoveEvent placeOrMoveNexus(@NonNull org.kingdoms.server.location.Location loc, @Nullable KingdomPlayer kp)
    • abstractPlaceOrMoveNexus

      public @NonNull NexusMoveEvent abstractPlaceOrMoveNexus(String styleName, org.kingdoms.server.location.Location toLocation, @Nullable KingdomPlayer kp, org.kingdoms.events.KingdomsEventCallerContext<NexusMoveEvent> eventContext)
    • getKey

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

      public boolean isHidden()
    • setHidden

      public GroupHiddenStateChangeEvent setHidden(boolean hidden, @Nullable KingdomPlayer player)
    • getFlag

      public @Nullable GroupBanner getFlag()
    • getBanner

      public @Nullable GroupBanner getBanner()
    • setBanner

      public GroupBannerChangeEvent setBanner(@Nullable GroupBanner banner, KingdomPlayer player)
    • getFlags

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

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

      public GroupBannerChangeEvent setFlag(@Nullable GroupBanner flag, KingdomPlayer player)
    • getColors

      public org.kingdoms.constants.namespace.NamespacedMap<Color> getColors()
    • getThemes

      @NotNull @Experimental public @NotNull org.kingdoms.constants.namespace.NamespacedMap<Color> getThemes()
      Use getColors() instead.
      Specified by:
      getThemes in interface org.kingdoms.constants.themes.ThemeContainer
    • setColor

      public GroupColorChangeEvent setColor(org.kingdoms.constants.namespace.Namespace colorType, Color color, KingdomPlayer player)
    • toString

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

      public org.kingdoms.constants.economy.Balance getBank()
    • getResourcePoints

      public org.kingdoms.constants.economy.Balance getResourcePoints()
    • getTaxes

      @NotNull public @NotNull org.kingdoms.constants.namespace.NamespacedMap<org.kingdoms.utils.compilers.expressions.MathExpression> getTaxes()
    • getTax

      @Nullable public @Nullable org.kingdoms.utils.compilers.expressions.MathExpression getTax(@NotNull @NotNull org.kingdoms.constants.namespace.Namespace namespace)
    • setTax

      public void setTax(@NotNull @NotNull org.kingdoms.constants.namespace.Namespace namespace, org.kingdoms.utils.compilers.expressions.MathExpression value)
    • getId

      public @NonNull UUID getId()
    • getName

      public @NonNull String getName()
    • setName

      protected void setName(@NonNull String name)
    • getNexus

      public @Nullable SimpleLocation getNexus()
    • setNexus

      public void setNexus(@Nullable SimpleLocation nexus)
    • getHome

      public @Nullable org.kingdoms.server.location.Location getHome()
      Returns:
      an Location if not null.
    • setHome

      public abstract org.kingdoms.events.general.LocationChangeEvent setHome(@Nullable org.kingdoms.server.location.Location home, @Nullable KingdomPlayer player)
    • hasAttribute

      public boolean hasAttribute(@Nullable Group other, org.kingdoms.constants.group.model.relationships.RelationAttribute attribute)
    • getRelations

      public @NonNull Map<UUID,KingdomRelation> getRelations()
    • unsafeGetRelations

      @Internal @Bookmark(UNSAFE) public @Bookmark(UNSAFE) @NonNull Map<UUID,KingdomRelation> unsafeGetRelations()
    • setRelations

      public void setRelations(@NonNull Map<UUID,KingdomRelation> relations)
    • getRanks

      public @NonNull RankMap getRanks()
    • setRanks

      public void setRanks(@NonNull RankMap ranks)
    • rename

      public abstract @NonNull GroupRenameEvent rename(@NonNull String str, @Nullable KingdomPlayer renamer)
    • getRelationshipRequests

      public @NonNull Map<UUID,KingdomRelationshipRequest> getRelationshipRequests()
    • setRelationshipRequests

      public void setRelationshipRequests(@NonNull Map<UUID,KingdomRelationshipRequest> relationshipRequests)
    • getBankruptcy

      public double getBankruptcy()
    • getOwnerId

      public @Nullable UUID getOwnerId()
    • hasOwner

      public boolean hasOwner()
    • isMember

      public boolean isMember(@NonNull UUID id)
    • getMembers

      public @NonNull Set<UUID> getMembers()
    • unsafeGetMembers

      @Internal @Bookmark(UNSAFE) public @Bookmark(UNSAFE) @NonNull Set<UUID> unsafeGetMembers()
    • isFull

      public final boolean isFull()
    • countRelationships

      public int countRelationships(KingdomRelation relation)
    • setRelationShipWith

      public void setRelationShipWith(Group other, @Nullable KingdomRelation relation)
      Parameters:
      relation - Removes the relationship entirely when null or KingdomRelation.NEUTRAL
    • isPermanent

      public boolean isPermanent()
    • setPermanent

      public void setPermanent(boolean permanent)
    • requiresInvite

      public boolean requiresInvite()
    • setRequiresInvite

      public void setRequiresInvite(boolean requiresInvite)
    • getSince

      public long getSince()
    • setSince

      public void setSince(long since)
    • hashCode

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

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

      public @NonNull Map<KingdomRelation,Set<org.kingdoms.constants.group.model.relationships.RelationAttribute>> getAttributes()
    • setAttributes

      public void setAttributes(@NonNull Map<KingdomRelation,Set<org.kingdoms.constants.group.model.relationships.RelationAttribute>> attributes)
    • getTag

      public @Nullable String getTag()
    • setTag

      public void setTag(@Nullable String tag)
    • renameTag

      public org.kingdoms.events.general.GroupRenameTagEvent renameTag(@Nullable String tag, @Nullable KingdomPlayer by)
    • disband

      public GroupDisband disband(GroupDisband.Reason reason)
    • disband

      public abstract GroupDisband disband(GroupDisband.Reason reason, Runnable predataRemoval)
    • calculateTax

      public abstract double calculateTax()
    • getMaxMembers

      public abstract int getMaxMembers()
    • isHomePublic

      public boolean isHomePublic()
    • setPublicHome

      public void setPublicHome(boolean publicHome)
    • getPlayerMembers

      public abstract @NonNull List<org.bukkit.OfflinePlayer> getPlayerMembers()
    • getOnlineMembers

      public abstract @NonNull List<org.bukkit.entity.Player> getOnlineMembers()
    • getKingdomPlayers

      public abstract @NonNull List<KingdomPlayer> getKingdomPlayers()
    • updateRankNode

      public abstract void updateRankNode(@NonNull String node, @NonNull String newNode)
    • getMailIds

      public @NonNull Set<UUID> getMailIds()
    • getMails

      public @Unmodifiable @NonNull Map<UUID,Mail> getMails()
    • addMessageContextEdits

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