File tree Expand file tree Collapse file tree
src/main/kotlin/com/mineinabyss/extracommands Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ object ExtraBrigadierCommands {
2323 vanishCommand()
2424 viewDistanceCommands()
2525 nightVisionCommand()
26+ expCommand()
2627 mineInAbyssCommands()
2728 }
2829 }
Original file line number Diff line number Diff line change 1+ package com.mineinabyss.extracommands.commands
2+
3+ import ca.spottedleaf.moonrise.common.util.MoonriseConstants
4+ import com.mineinabyss.idofront.commands.brigadier.RootIdoCommands
5+ import com.mineinabyss.idofront.commands.brigadier.executes
6+ import com.mineinabyss.idofront.messaging.error
7+ import com.mojang.brigadier.arguments.IntegerArgumentType
8+ import com.mojang.brigadier.arguments.StringArgumentType
9+ import io.papermc.paper.command.brigadier.argument.ArgumentTypes
10+ import io.papermc.paper.command.brigadier.argument.resolvers.selector.PlayerSelectorArgumentResolver
11+
12+ fun RootIdoCommands.expCommand () {
13+ " exp" {
14+ " add" {
15+ executes(
16+ ArgumentTypes .players().named(" players" ).resolve(),
17+ IntegerArgumentType .integer().named(" amount" ).default { 0 },
18+ StringArgumentType .word().named(" type" ).default { " points" }.suggests { suggest(listOf (" levels" , " points" )) }
19+ ) { players, amount, type ->
20+ when (type) {
21+ " levels" -> players.forEach { player -> player.giveExpLevels(amount) }
22+ " points" -> players.forEach { player -> player.giveExp(amount) }
23+ else -> sender.error(" Invalid type $type , must be levels or points.." )
24+ }
25+ }
26+ }
27+ }
28+ }
You can’t perform that action at this time.
0 commit comments