Class PermissionsView
java.lang.Object
com.minecolonies.core.colony.permissions.PermissionsView
- All Implemented Interfaces:
IPermissions
A client side representation of the permissions.
-
Field Summary
Fields inherited from interface com.minecolonies.api.colony.permissions.IPermissions
FRIEND_RANK_ID, HOSTILE_RANK_ID, NEUTRAL_RANK_ID, OFFICER_RANK_ID, OWNER_RANK_ID -
Constructor Summary
Constructors -
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.voiddeserialize(@NotNull net.minecraft.network.FriendlyByteBuf buf) Deserialize content of class to a buffer.getFilteredPlayers(@NotNull Predicate<Rank> predicate) @NotNull UUIDgetOwner()@Nullable String@NotNull Map<UUID,ColonyPlayer> Returns an unmodifiable map of the players list.@NotNull Set<ColonyPlayer>getPlayersByRank(@NotNull Set<Rank> ranks) Gets all player by a certain set of rank.@NotNull Set<ColonyPlayer>getPlayersByRank(Rank rank) Gets all player by a certain rank.getRank(int id) Returns the rank with the given IDgetRank(@NotNull net.minecraft.world.entity.player.Player player) Get the rank of a certain player.@NotNull RankGet the rank of a UUID.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 IDGetter for the user rank.booleanhasPermission(@NotNull net.minecraft.world.entity.player.Player player, @NotNull Action action) Returns whether the player has the permission for an action.booleanhasPermission(Rank rank, @NotNull Action action) Checks if the rank has the permission to do an action.booleanhasPermission(UUID id, @NotNull Action action) Checks if the player has the permission to do an action.booleanisColonyMember(@NotNull 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, @NotNull Action action, boolean enable) Sets if the rank has the permission to do an action.booleansetPlayerRank(UUID id, Rank rank, net.minecraft.world.level.Level world)
-
Constructor Details
-
PermissionsView
public PermissionsView()
-
-
Method Details
-
getUserRank
Getter for the user rank.- Returns:
- the rank.
-
getPlayersByRank
Gets all player by a certain rank.- Specified by:
getPlayersByRankin interfaceIPermissions- Parameters:
rank- the rank.- Returns:
- set of players.
-
getPlayers
Description copied from interface:IPermissionsReturns an unmodifiable map of the players list.- Specified by:
getPlayersin interfaceIPermissions- Returns:
- map of UUIDs and player objects.
-
setPlayerRank
- Specified by:
setPlayerRankin interfaceIPermissions
-
addPlayer
- Specified by:
addPlayerin interfaceIPermissions
-
getPlayersByRank
Gets all player by a certain set of rank.- Specified by:
getPlayersByRankin interfaceIPermissions- Parameters:
ranks- the set of rank.- Returns:
- set of players.
-
getFilteredPlayers
- Specified by:
getFilteredPlayersin interfaceIPermissions
-
hasPermission
Checks if the player has the permission to do an action.- Parameters:
id- the id of the player.action- the action he is trying to execute.- Returns:
- true if so.
-
hasPermission
Checks if the rank has the permission to do an action.- Specified by:
hasPermissionin interfaceIPermissions- Parameters:
rank- the rank of the player.action- the action he is trying to execute.- Returns:
- true if so.
-
setPermission
Sets if the rank has the permission to do an action.- Specified by:
setPermissionin interfaceIPermissions- Parameters:
rank- the rank to set.action- the action he is trying to execute.enable- or disable permission- Returns:
- true if so.
-
removePlayer
- Specified by:
removePlayerin interfaceIPermissions
-
alterPermission
public boolean alterPermission(Rank actor, Rank rank, @NotNull @NotNull Action action, boolean enable) Description copied from interface:IPermissionsAlters the permission through an actor, checks for allowance before altering.- Specified by:
alterPermissionin interfaceIPermissions- Parameters:
actor- to checkrank- rank to editaction- action to setenable- add/remove permission- Returns:
- success/failure
-
canAlterPermission
Description copied from interface:IPermissionsCheck if a specific permission can be altered.- Specified by:
canAlterPermissionin interfaceIPermissions- Parameters:
actor- acting rank.rank- the rank to check it for.action- the action to check.- Returns:
- true if so.
-
getOwnerEntry
- Specified by:
getOwnerEntryin interfaceIPermissions
-
setOwner
public boolean setOwner(net.minecraft.world.entity.player.Player player) - Specified by:
setOwnerin interfaceIPermissions
-
setOwnerAbandoned
public void setOwnerAbandoned()Description copied from interface:IPermissionsSets the owner to abandoned- Specified by:
setOwnerAbandonedin interfaceIPermissions
-
getOwner
- Specified by:
getOwnerin interfaceIPermissions
-
deserialize
public void deserialize(@NotNull @NotNull net.minecraft.network.FriendlyByteBuf buf) Deserialize content of class to a buffer.- Parameters:
buf- the buffer.
-
getRank
Description copied from interface:IPermissionsGet the rank of a certain player.- Specified by:
getRankin interfaceIPermissions- Parameters:
player- the player.- Returns:
- the rank.
-
getRank
Description copied from interface:IPermissionsReturns the rank with the given ID- Specified by:
getRankin interfaceIPermissions- Parameters:
id- the id- Returns:
- the rank
-
restoreOwnerIfNull
public void restoreOwnerIfNull()- Specified by:
restoreOwnerIfNullin interfaceIPermissions
-
getRank
Description copied from interface:IPermissionsGet the rank of a UUID.- Specified by:
getRankin interfaceIPermissions- Parameters:
id- UUID to check rank of.- Returns:
- rank of the player.
-
hasPermission
public boolean hasPermission(@NotNull @NotNull net.minecraft.world.entity.player.Player player, @NotNull @NotNull Action action) Description copied from interface:IPermissionsReturns whether the player has the permission for an action.- Specified by:
hasPermissionin interfaceIPermissions- Parameters:
player-Playerplayer.action-Actionaction.- Returns:
- true if has permission, otherwise false.
-
addPlayer
public boolean addPlayer(@NotNull @NotNull String player, Rank rank, net.minecraft.world.level.Level world) - Specified by:
addPlayerin interfaceIPermissions
-
addPlayer
- Specified by:
addPlayerin interfaceIPermissions
-
getOwnerName
- Specified by:
getOwnerNamein interfaceIPermissions
-
isColonyMember
public boolean isColonyMember(@NotNull @NotNull net.minecraft.world.entity.player.Player player) Description copied from interface:IPermissionsReturns whether the player is a member of the colony.- Specified by:
isColonyMemberin interfaceIPermissions- Parameters:
player-Playerto check.- Returns:
- true if the player is a member of the colony.
-
getRanks
Description copied from interface:IPermissionsReturns a map of all ranks present in the colony, identified by their ID- Specified by:
getRanksin interfaceIPermissions- Returns:
- the map
-
getRankOwner
Description copied from interface:IPermissionsReturns the owner rank- Specified by:
getRankOwnerin interfaceIPermissions- Returns:
- the rank
-
getRankOfficer
Description copied from interface:IPermissionsReturns the officer rank- Specified by:
getRankOfficerin interfaceIPermissions- Returns:
- the rank
-
getRankFriend
Description copied from interface:IPermissionsReturns the friend rank- Specified by:
getRankFriendin interfaceIPermissions- Returns:
- the rank
-
getRankNeutral
Description copied from interface:IPermissionsReturns the neutral rank- Specified by:
getRankNeutralin interfaceIPermissions- Returns:
- the rank
-
getRankHostile
Description copied from interface:IPermissionsReturns the hostile rank- Specified by:
getRankHostilein interfaceIPermissions- Returns:
- the rank
-
addRank
Description copied from interface:IPermissionsAdds a rink with the given name to the colony- Specified by:
addRankin interfaceIPermissions- Parameters:
name- the chosen name
-
removeRank
Description copied from interface:IPermissionsRemoves the given rank from the colony- Specified by:
removeRankin interfaceIPermissions- Parameters:
rank- the rank
-