@@ -3,7 +3,9 @@ package dev.slne.surf.essentials.command
33import dev.jorel.commandapi.kotlindsl.*
44import dev.slne.surf.essentials.service.worldService
55import dev.slne.surf.essentials.util.permission.EssentialsPermissionRegistry
6+ import dev.slne.surf.essentials.util.util.isFolia
67import dev.slne.surf.surfapi.core.api.messages.adventure.sendText
8+ import org.bukkit.Bukkit
79import org.bukkit.World
810
911fun worldCommand () = commandTree(" world" ) {
@@ -15,6 +17,14 @@ fun worldCommand() = commandTree("world") {
1517 anyExecutor { executor, args ->
1618 val world: World by args
1719
20+ if (Bukkit .getServer().isFolia()) {
21+ executor.sendText {
22+ appendPrefix()
23+ error(" Dieser Befehl wird auf Folia-Servern nicht unterstützt." )
24+ }
25+ return @anyExecutor
26+ }
27+
1828 if (worldService.isLocked(world)) {
1929 executor.sendText {
2030 appendPrefix()
@@ -40,6 +50,14 @@ fun worldCommand() = commandTree("world") {
4050 anyExecutor { executor, args ->
4151 val world: World by args
4252
53+ if (Bukkit .getServer().isFolia()) {
54+ executor.sendText {
55+ appendPrefix()
56+ error(" Dieser Befehl wird auf Folia-Servern nicht unterstützt." )
57+ }
58+ return @anyExecutor
59+ }
60+
4361 if (! worldService.isLocked(world)) {
4462 executor.sendText {
4563 appendPrefix()
@@ -65,12 +83,20 @@ fun worldCommand() = commandTree("world") {
6583 playerExecutor { player, args ->
6684 val world: World by args
6785
68- player.teleport(world.spawnLocation)
6986 player.sendText {
7087 appendPrefix()
71- success (" Du wurdest in die Welt " )
88+ info (" Du wirst in die Welt " )
7289 variableValue(world.name)
73- success(" teleportiert." )
90+ info(" teleportiert..." )
91+ }
92+
93+ player.teleportAsync(world.spawnLocation).thenRun {
94+ player.sendText {
95+ appendPrefix()
96+ success(" Du wurdest in die Welt " )
97+ variableValue(world.name)
98+ success(" teleportiert." )
99+ }
74100 }
75101 }
76102 }
@@ -81,6 +107,15 @@ fun worldCommand() = commandTree("world") {
81107 withPermission(EssentialsPermissionRegistry .WORLD_COMMAND_CREATE )
82108 anyExecutor { executor, args ->
83109 val name: String by args
110+
111+ if (Bukkit .getServer().isFolia()) {
112+ executor.sendText {
113+ appendPrefix()
114+ error(" Dieser Befehl wird auf Folia-Servern nicht unterstützt." )
115+ }
116+ return @anyExecutor
117+ }
118+
84119 worldService.create(executor, name, null , null , null , null , null )
85120 }
86121 }
@@ -91,6 +126,15 @@ fun worldCommand() = commandTree("world") {
91126 withPermission(EssentialsPermissionRegistry .WORLD_COMMAND_DELETE )
92127 anyExecutor { executor, args ->
93128 val world: World by args
129+
130+ if (Bukkit .getServer().isFolia()) {
131+ executor.sendText {
132+ appendPrefix()
133+ error(" Dieser Befehl wird auf Folia-Servern nicht unterstützt." )
134+ }
135+ return @anyExecutor
136+ }
137+
94138 worldService.delete(executor, world)
95139 }
96140 }
@@ -101,6 +145,16 @@ fun worldCommand() = commandTree("world") {
101145 withPermission(EssentialsPermissionRegistry .WORLD_COMMAND_LOAD )
102146 anyExecutor { executor, args ->
103147 val name: String by args
148+
149+ if (Bukkit .getServer().isFolia()) {
150+ executor.sendText {
151+ appendPrefix()
152+ error(" Dieser Befehl wird auf Folia-Servern nicht unterstützt." )
153+ }
154+ return @anyExecutor
155+ }
156+
157+
104158 worldService.load(executor, name)
105159 }
106160 }
@@ -111,6 +165,15 @@ fun worldCommand() = commandTree("world") {
111165 withPermission(EssentialsPermissionRegistry .WORLD_COMMAND_UNLOAD )
112166 anyExecutor { executor, args ->
113167 val world: World by args
168+
169+ if (Bukkit .getServer().isFolia()) {
170+ executor.sendText {
171+ appendPrefix()
172+ error(" Dieser Befehl wird auf Folia-Servern nicht unterstützt." )
173+ }
174+ return @anyExecutor
175+ }
176+
114177 worldService.unload(executor, world)
115178 }
116179 }
0 commit comments