HQService / HQFramework

A next-generation Bukkit development framework.
https://hqservice.kr
GNU General Public License v3.0
47 stars 1 forks source link

커맨드에서의 permission, isOp, hideSuggestion 오류 수정 패치 #24

Closed Cosine-A closed 1 year ago

Cosine-A commented 1 year ago

Command(isOp)

@Command(label = "처벌", isOp = true)
class PunishmentAdminCommand {

    @CommandExecutor("제재", "해당 유저를 제재합니다.")
    suspend fun applyPunishment(player: Player) {}
}

Command에서 isOp에 true를 적을 시, 모든 자식 CommandExecutor에 오피 권한이 적용됩니다 └ 플레이어가 오피 권한을 가지고 있는 경우에만 모든 처벌 명령어를 사용할 수 있습니다

Command(permission)

@Command(label = "처벌", permission = "test")
class PunishmentAdminCommand(
    private val punishmentService: PunishmentService
) {

    @CommandExecutor("제재", "해당 유저를 제재합니다.")
    suspend fun applyPunishment(player: Player) {}
}

Command에서 permission에 "test"를 적을 시, 모든 자식 CommandExecutor에 펄미션이 적용됩니다 └ 플레이어가 test 펄미션을 가지고 있는 경우에만 모든 처벌 명령어를 사용할 수 있습니다

CommandExecutor(isOp)

@Command(label = "처벌")
class PunishmentAdminCommand(
    private val punishmentService: PunishmentService
) {

    @CommandExecutor("제재", "해당 유저를 제재합니다.", isOp = true)
    suspend fun applyPunishment(
        player: Player,
        @ArgumentLabel("닉네임") targetPlayer: TargetPlayerProvider.TargetPlayer,
        @ArgumentLabel("코드") punishmentCode: PunishmentCodeProvider.PunishmentCode
    ) {}
}

CommandExecutor에서 isOp에 true를 적을 시, 해당 CommandExecutor에만 오피 권한이 적용됩니다 └ 플레이어가 오피를 가지고 있는 경우에만 명령어 사용과 자동 완성(닉네임, 코드)이 가능합니다 └ 플레이어에게 오피가 없고, isOp가 true일 시 플레이어에게 명령어가 자동으로 숨겨집니다

CommandExecutor(permission)

@Command(label = "처벌")
class PunishmentAdminCommand(
    private val punishmentService: PunishmentService
) {

    @CommandExecutor("제재", "해당 유저를 제재합니다.", permission = "test")
    suspend fun applyPunishment(
        player: Player,
        @ArgumentLabel("닉네임") targetPlayer: TargetPlayerProvider.TargetPlayer,
        @ArgumentLabel("코드") punishmentCode: PunishmentCodeProvider.PunishmentCode
    ) {}
}

CommandExecutor에서 permssion에 test를 적을 시, 해당 CommandExecutor에만 펄미션이 적용됩니다 └ 플레이어가 test 펄미션을 가지고 있는 경우에만 명령어 사용과 자동 완성(닉네임, 코드)이 가능합니다 └ 플레이어에게 test 펄미션이 없을 시, 플레이어에게 명령어가 자동으로 숨겨집니다

CommandExecutor(hideSuggestion)

@Command(label = "처벌")
class PunishmentAdminCommand(
    private val punishmentService: PunishmentService
) {

    @CommandExecutor("제재", "해당 유저를 제재합니다.", hideSuggestion = true)
    suspend fun applyPunishment(
        player: Player,
        @ArgumentLabel("닉네임") targetPlayer: TargetPlayerProvider.TargetPlayer,
        @ArgumentLabel("코드") punishmentCode: PunishmentCodeProvider.PunishmentCode
    ) {}
}

CommandExecutor에서 hideSuggestion에 true를 적을 시, 해당 CommandExecutor만 숨겨집니다 └ 플레이어가 오피를 가지고 있는 경우에만 명령어 사용과 자동 완성(닉네임, 코드)이 가능합니다 └ 플레이어에게 오피가 없고, hideSuggestion가 true일 시, 플레이어에게 명령어가 숨겨집니다

최종

isOp = 오피만 사용(루트 커맨드에서도 사용 가능) permission = 펄미션 가진 플레이어만 사용(루트 커맨드에서도 사용 가능) hideSuggestion = 명령어 숨김

isOp, permission, hideSuggestion 순으로 처리됨

vjh0107 commented 1 year ago

메소드의 이름이 hideSuggestion 을 처리하는데 hasPermission 인 점만 개선해주시면 전체적으로 필요한 패치인 것 같습니다.

vjh0107 commented 1 year ago

hideSuggestion 을 우선순위 최상위로 보내야 할 것 같습니다.

Cosine-A commented 1 year ago

감사합니다