File tree Expand file tree Collapse file tree 3 files changed +29
-1
lines changed
src/main/kotlin/dev/slne/surf/lobby Expand file tree Collapse file tree 3 files changed +29
-1
lines changed Original file line number Diff line number Diff line change 11package dev.slne.surf.lobby
22
33import com.github.shynixn.mccoroutine.folia.SuspendingJavaPlugin
4+ import dev.slne.surf.lobby.command.lobbyCommand
45import dev.slne.surf.lobby.config.LobbyConfig
56import dev.slne.surf.lobby.hologram.SurfHologramHook
67import dev.slne.surf.lobby.listener.DoubleJumpListener
@@ -28,6 +29,8 @@ class PaperMain : SuspendingJavaPlugin() {
2829 SpawnLocationListener .register()
2930 GameModeListener .register()
3031 WorldProtectionListener .register()
32+
33+ lobbyCommand()
3134 }
3235}
3336
Original file line number Diff line number Diff line change 1+ package dev.slne.surf.lobby.command
2+
3+ import dev.jorel.commandapi.kotlindsl.anyExecutor
4+ import dev.jorel.commandapi.kotlindsl.commandTree
5+ import dev.jorel.commandapi.kotlindsl.literalArgument
6+ import dev.slne.surf.lobby.config.LobbyConfig
7+ import dev.slne.surf.lobby.utils.PermissionRegistry
8+ import dev.slne.surf.surfapi.core.api.messages.adventure.sendText
9+
10+ fun lobbyCommand () = commandTree(" lobby" ) {
11+ withPermission(PermissionRegistry .COMMAND_LOBBY )
12+
13+ literalArgument(" reload" ) {
14+ withPermission(PermissionRegistry .COMMAND_LOBBY_RELOAD )
15+ anyExecutor { executor, _ ->
16+ LobbyConfig .reloadFromFile()
17+
18+ executor.sendText {
19+ appendPrefix()
20+ success(" Lobby configuration reloaded successfully." )
21+ }
22+ }
23+ }
24+ }
Original file line number Diff line number Diff line change @@ -7,7 +7,8 @@ object PermissionRegistry : PermissionRegistry() {
77 private const val PREFIX = " surf.lobby"
88 private const val COMMAND_PREFIX = " $PREFIX .command"
99
10- val LOBBY = create(" $COMMAND_PREFIX .lobby" )
10+ val COMMAND_LOBBY = create(" $COMMAND_PREFIX .lobby" )
11+ val COMMAND_LOBBY_RELOAD = create(" $COMMAND_PREFIX .lobby.reload" )
1112
1213 val PUSHBACK_ATTACK = create(" $PREFIX .pushback.attack" )
1314 val PUSHBACK_ITEM = create(" $PREFIX .pushback.item" )
You can’t perform that action at this time.
0 commit comments