Skip to content

Commit

Permalink
Fix issue that prevent from importing player own private map
Browse files Browse the repository at this point in the history
  • Loading branch information
EpiCanard committed Sep 25, 2022
1 parent b558528 commit 9105529
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ case class ImportCommand(mapRepository: MapRepository)(implicit ec: ExecutionCon
(for {
player <- EitherT.fromEither[Future](getPlayer(commandContext))
args <- EitherT.fromEither[Future](parseArguments(commandContext, player))
restrictVisibility = Option.unless(Permission.AdminImportMap.isSetOn(player))(Visibility.Public)
restrictVisibility = Visibility.getRestrictVisibility(commandContext, args.owner, Permission.AdminImportMap)
mapViewWithData <- EitherT(
mapRepository
.findMapViewWithData(args.owner.getUniqueId, args.mapName, commandContext.server, restrictVisibility)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ object Visibility extends Enum[Visibility] with CirceEnumInsensitive[Visibility]

val values = findValues

def getRestrictVisibility(commandContext: CommandContext, owner: OfflinePlayer, adminPermission: Permission) =
def getRestrictVisibility(
commandContext: CommandContext,
owner: OfflinePlayer,
adminPermission: Permission
): Option[Visibility] =
CommandContext
.getPlayerOpt(commandContext)
.filter(player => owner.getUniqueId != player.getUniqueId && !adminPermission.isSetOn(player))
Expand Down

0 comments on commit 9105529

Please sign in to comment.