File tree Expand file tree Collapse file tree
src/main/kotlin/dev/slne/surf/essentials/command Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11kotlin.code.style =official
22kotlin.stdlib.default.dependency =false
33org.gradle.parallel =true
4- version =1.21.11-2.0.18 -SNAPSHOT
4+ version =1.21.11-2.0.19 -SNAPSHOT
Original file line number Diff line number Diff line change @@ -11,6 +11,15 @@ import org.bukkit.entity.Player
1111fun hatCommand () = commandTree(" hat" ) {
1212 withPermission(EssentialsPermissionRegistry .HAT_COMMAND )
1313 playerExecutor { player, _ ->
14+ val helmet = player.inventory.helmet
15+ if (helmet != null && ! helmet.type.isAir) {
16+ player.sendText {
17+ appendErrorPrefix()
18+ error(" Du trägst bereits einen Hut." )
19+ }
20+ return @playerExecutor
21+ }
22+
1423 val itemInHand = player.inventory.itemInMainHand
1524 player.inventory.helmet = itemInHand
1625
@@ -30,6 +39,16 @@ fun hatCommand() = commandTree("hat") {
3039 withPermission(EssentialsPermissionRegistry .HAT_COMMAND_OTHERS )
3140 playerExecutor { executor, args ->
3241 val player: Player by args
42+ val helmet = player.inventory.helmet
43+ if (helmet != null && ! helmet.type.isAir) {
44+ executor.sendText {
45+ appendErrorPrefix()
46+ variableValue(player.name)
47+ error(" trägt bereits einen Hut." )
48+ }
49+ return @playerExecutor
50+ }
51+
3352 val itemInHand = executor.inventory.itemInMainHand
3453 player.inventory.helmet = itemInHand
3554
You can’t perform that action at this time.
0 commit comments