Interface IPermissions
- All Known Implementing Classes:
Permissions,PermissionsView
public interface IPermissions
Permission interface.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intIDs of the initial ranks according to their old enum values -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanbooleanvoidAdds a rink with the given name to the colonybooleanalterPermission(Rank actor, Rank rank, @NotNull Action action, boolean enable) Alters the permission through an actor, checks for allowance before altering.booleancanAlterPermission(Rank actor, Rank rank, @NotNull Action action) Check if a specific permission can be altered.@NotNull UUIDgetOwner()@NotNull String@NotNull Map<UUID, ColonyPlayer> Returns an unmodifiable map of the players list.getPlayersByRank(Rank rank) getPlayersByRank(@NotNull Set<Rank> ranks) getRank(int id) Returns the rank with the given ID@NotNull RankGet the rank of a UUID.getRank(net.minecraft.world.entity.player.Player player) Get the rank of a certain player.Returns the friend rankReturns the hostile rankReturns the neutral rankReturns the officer rankReturns the owner rankgetRanks()Returns a map of all ranks present in the colony, identified by their IDbooleanhasPermission(Rank rank, @NotNull Action action) booleanhasPermission(net.minecraft.world.entity.player.Player player, Action action) Returns whether the player has the permission for an action.booleanisColonyMember(net.minecraft.world.entity.player.Player player) Returns whether the player is a member of the colony.booleanremovePlayer(UUID playerID) voidremoveRank(Rank rank) Removes the given rank from the colonyvoidbooleansetOwner(net.minecraft.world.entity.player.Player player) voidSets the owner to abandonedbooleansetPermission(Rank rank, Action action, boolean enable) Sets a permission to a rank, does not include allowance checksbooleansetPlayerRank(UUID id, Rank rank, net.minecraft.world.level.Level world)
-
Field Details
-
OWNER_RANK_ID
static final int OWNER_RANK_IDIDs of the initial ranks according to their old enum values- See Also:
-
OFFICER_RANK_ID
static final int OFFICER_RANK_ID- See Also:
-
FRIEND_RANK_ID
static final int FRIEND_RANK_ID- See Also:
-
NEUTRAL_RANK_ID
static final int NEUTRAL_RANK_ID- See Also:
-
HOSTILE_RANK_ID
static final int HOSTILE_RANK_ID- See Also:
-
-
Method Details
-
hasPermission
-
getPlayersByRank
-
getPlayersByRank
-
getRanks
Returns a map of all ranks present in the colony, identified by their ID- Returns:
- the map
-
getRank
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
Returns whether the player has the permission for an action.- Parameters:
player-Playerplayer.action-Actionaction.- Returns:
- true if has permission, otherwise false.
-
addPlayer
-
addPlayer
-
getOwnerName
-
isColonyMember
boolean isColonyMember(net.minecraft.world.entity.player.Player player) Returns whether the player is a member of the colony.- Parameters:
player-Playerto check.- Returns:
- true if the player is a member of the colony.
-
alterPermission
Alters the permission through an actor, checks for allowance before altering.- Parameters:
actor- to checkrank- rank to editaction- action to setenable- add/remove permission- Returns:
- success/failure
-
getOwnerEntry
-
setOwner
boolean setOwner(net.minecraft.world.entity.player.Player player) -
canAlterPermission
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
-
getPlayers
Returns an unmodifiable map of the players list.- Returns:
- map of UUIDs and player objects.
-
setPlayerRank
-
addPlayer
-
getRank
Get the rank of a UUID.- Parameters:
player- UUID to check rank of.- Returns:
- rank of the player.
-
getRank
Get the rank of a certain player.- Parameters:
player- the player.- Returns:
- the rank.
-
restoreOwnerIfNull
void restoreOwnerIfNull() -
setPermission
Sets a permission to a rank, does not include allowance checks- Parameters:
rank- Rank to modifyaction- permission to setenable- or disable permission- Returns:
-
removePlayer
-
addRank
Adds a rink with the given name to the colony- Parameters:
name- the chosen name
-
removeRank
Removes the given rank from the colony- Parameters:
rank- the rank
-
getFilteredPlayers
-