Interface IPermissions

All Known Implementing Classes:
Permissions, PermissionsView

public interface IPermissions
Permission interface.
  • Field Details

  • Method Details

    • hasPermission

      boolean hasPermission(Rank rank, @NotNull @NotNull Action action)
    • getPlayersByRank

      Set<ColonyPlayer> getPlayersByRank(Rank rank)
    • getPlayersByRank

      Set<ColonyPlayer> getPlayersByRank(@NotNull @NotNull Set<Rank> ranks)
    • getRanks

      Map<Integer,Rank> getRanks()
      Returns a map of all ranks present in the colony, identified by their ID
      Returns:
      the map
    • getRank

      Rank getRank(int id)
      Returns the rank with the given ID
      Parameters:
      id - the id
      Returns:
      the rank
    • getRankOwner

      Rank getRankOwner()
      Returns the owner rank
      Returns:
      the rank
    • getRankOfficer

      Rank getRankOfficer()
      Returns the officer rank
      Returns:
      the rank
    • getRankHostile

      Rank getRankHostile()
      Returns the hostile rank
      Returns:
      the rank
    • getRankNeutral

      Rank getRankNeutral()
      Returns the neutral rank
      Returns:
      the rank
    • getRankFriend

      Rank getRankFriend()
      Returns the friend rank
      Returns:
      the rank
    • hasPermission

      boolean hasPermission(net.minecraft.world.entity.player.Player player, Action action)
      Returns whether the player has the permission for an action.
      Parameters:
      player - Player player.
      action - Action action.
      Returns:
      true if has permission, otherwise false.
    • addPlayer

      boolean addPlayer(@NotNull @NotNull String player, Rank rank, net.minecraft.world.level.Level world)
    • addPlayer

      boolean addPlayer(@NotNull @NotNull UUID id, String name, Rank rank)
    • getOwnerName

      @NotNull @NotNull String getOwnerName()
    • isColonyMember

      boolean isColonyMember(net.minecraft.world.entity.player.Player player)
      Returns whether the player is a member of the colony.
      Parameters:
      player - Player to check.
      Returns:
      true if the player is a member of the colony.
    • alterPermission

      boolean alterPermission(Rank actor, Rank rank, @NotNull @NotNull Action action, boolean enable)
      Alters the permission through an actor, checks for allowance before altering.
      Parameters:
      actor - to check
      rank - rank to edit
      action - action to set
      enable - add/remove permission
      Returns:
      success/failure
    • getOwnerEntry

      @Nullable Map.Entry<UUID,ColonyPlayer> getOwnerEntry()
    • setOwner

      boolean setOwner(net.minecraft.world.entity.player.Player player)
    • canAlterPermission

      boolean canAlterPermission(Rank actor, Rank rank, @NotNull @NotNull Action action)
      Check if a specific permission can be altered.
      Parameters:
      actor - acting rank.
      rank - the rank to check it for.
      action - the action to check.
      Returns:
      true if so.
    • setOwnerAbandoned

      void setOwnerAbandoned()
      Sets the owner to abandoned
    • getOwner

      @NotNull @NotNull UUID getOwner()
    • getPlayers

      @NotNull @NotNull Map<UUID,ColonyPlayer> getPlayers()
      Returns an unmodifiable map of the players list.
      Returns:
      map of UUIDs and player objects.
    • setPlayerRank

      boolean setPlayerRank(UUID id, Rank rank, net.minecraft.world.level.Level world)
    • addPlayer

      boolean addPlayer(@NotNull @NotNull com.mojang.authlib.GameProfile gameprofile, Rank rank)
    • getRank

      @NotNull @NotNull Rank getRank(UUID player)
      Get the rank of a UUID.
      Parameters:
      player - UUID to check rank of.
      Returns:
      rank of the player.
    • getRank

      Rank getRank(net.minecraft.world.entity.player.Player player)
      Get the rank of a certain player.
      Parameters:
      player - the player.
      Returns:
      the rank.
    • restoreOwnerIfNull

      void restoreOwnerIfNull()
    • setPermission

      boolean setPermission(Rank rank, Action action, boolean enable)
      Sets a permission to a rank, does not include allowance checks
      Parameters:
      rank - Rank to modify
      action - permission to set
      enable - or disable permission
      Returns:
    • removePlayer

      boolean removePlayer(UUID playerID)
    • addRank

      void addRank(String name)
      Adds a rink with the given name to the colony
      Parameters:
      name - the chosen name
    • removeRank

      void removeRank(Rank rank)
      Removes the given rank from the colony
      Parameters:
      rank - the rank
    • getFilteredPlayers

      Set<ColonyPlayer> getFilteredPlayers(Predicate<Rank> p)