@@ -15,26 +15,7 @@ fun timeCommand() = commandTree("time") {
1515 withPermission(EssentialsPermissionRegistry .TIME_COMMAND )
1616 literalArgument(" query" ) {
1717 nativeExecutor { executor, _ ->
18- val time = executor.world.fullTime / 24000L % Int .MAX_VALUE
19-
20- executor.sendText {
21- appendInfoPrefix()
22- info(" Die" )
23- appendSpace()
24- variableValue(" Zeit" )
25- appendSpace()
26- info(" in der Welt" )
27- appendSpace()
28- variableValue(executor.world.name)
29- appendSpace()
30- info(" beträgt" )
31- appendSpace()
32- variableValue(" $time Tage!" )
33- }
34- }
35-
36- literalArgument(" day" ) {
37- nativeExecutor { executor, _ ->
18+ plugin.launch(plugin.globalRegionDispatcher) {
3819 val time = executor.world.fullTime / 24000L % Int .MAX_VALUE
3920
4021 executor.sendText {
@@ -54,44 +35,71 @@ fun timeCommand() = commandTree("time") {
5435 }
5536 }
5637
57- literalArgument(" daytime " ) {
38+ literalArgument(" day " ) {
5839 nativeExecutor { executor, _ ->
59- val time = executor.world.fullTime % 24000L
40+ plugin.launch(plugin.globalRegionDispatcher) {
41+ val time = executor.world.fullTime / 24000L % Int .MAX_VALUE
42+
43+ executor.sendText {
44+ appendInfoPrefix()
45+ info(" Die" )
46+ appendSpace()
47+ variableValue(" Zeit" )
48+ appendSpace()
49+ info(" in der Welt" )
50+ appendSpace()
51+ variableValue(executor.world.name)
52+ appendSpace()
53+ info(" beträgt" )
54+ appendSpace()
55+ variableValue(" $time Tage!" )
56+ }
57+ }
58+ }
59+ }
6060
61- executor.sendText {
62- appendInfoPrefix()
63- info(" Die" )
64- appendSpace()
65- variableValue(" Tageszeit" )
66- appendSpace()
67- info(" in der Welt" )
68- appendSpace()
69- variableValue(executor.world.name)
70- appendSpace()
71- info(" beträgt" )
72- appendSpace()
73- variableValue(" $time Ticks!" )
61+ literalArgument(" daytime" ) {
62+ nativeExecutor { executor, _ ->
63+ plugin.launch(plugin.globalRegionDispatcher) {
64+ val time = executor.world.fullTime % 24000L
65+
66+ executor.sendText {
67+ appendInfoPrefix()
68+ info(" Die" )
69+ appendSpace()
70+ variableValue(" Tageszeit" )
71+ appendSpace()
72+ info(" in der Welt" )
73+ appendSpace()
74+ variableValue(executor.world.name)
75+ appendSpace()
76+ info(" beträgt" )
77+ appendSpace()
78+ variableValue(" $time Ticks!" )
79+ }
7480 }
7581 }
7682 }
7783
7884 literalArgument(" gametime" ) {
7985 nativeExecutor { executor, _ ->
80- val time = executor.world.gameTime
81-
82- executor.sendText {
83- appendInfoPrefix()
84- info(" Die" )
85- appendSpace()
86- variableValue(" Spielzeit" )
87- appendSpace()
88- info(" in der Welt" )
89- appendSpace()
90- variableValue(executor.world.name)
91- appendSpace()
92- info(" beträgt" )
93- appendSpace()
94- variableValue(" $time Ticks!" )
86+ plugin.launch(plugin.globalRegionDispatcher) {
87+ val time = executor.world.gameTime
88+
89+ executor.sendText {
90+ appendInfoPrefix()
91+ info(" Die" )
92+ appendSpace()
93+ variableValue(" Spielzeit" )
94+ appendSpace()
95+ info(" in der Welt" )
96+ appendSpace()
97+ variableValue(executor.world.name)
98+ appendSpace()
99+ info(" beträgt" )
100+ appendSpace()
101+ variableValue(" $time Ticks!" )
102+ }
95103 }
96104 }
97105 }
@@ -102,8 +110,8 @@ fun timeCommand() = commandTree("time") {
102110 nativeExecutor { executor, args ->
103111 val time: Int by args
104112
105- Bukkit .getWorlds().forEach {
106- plugin.launch(plugin.globalRegionDispatcher) {
113+ plugin.launch(plugin.globalRegionDispatcher) {
114+ Bukkit .getWorlds().forEach {
107115 it.fullTime = time.toLong()
108116 }
109117 }
@@ -123,22 +131,21 @@ fun timeCommand() = commandTree("time") {
123131 nativeExecutor { executor, args ->
124132 val namedTime: NamedTime by args
125133
126- Bukkit .getWorlds().forEach { world ->
127- val current = world.fullTime % 24000
128- val target = namedTime.ticks % 24000
134+ plugin.launch(plugin.globalRegionDispatcher) {
135+ Bukkit .getWorlds().forEach { world ->
136+ val current = world.fullTime % 24000
137+ val target = namedTime.ticks % 24000
129138
130- val diff = if (target >= current) {
131- target - current
132- } else {
133- (24000 - current) + target
134- }
139+ val diff = if (target >= current) {
140+ target - current
141+ } else {
142+ (24000 - current) + target
143+ }
135144
136- plugin.launch(plugin.globalRegionDispatcher) {
137145 world.fullTime + = diff
138146 }
139147 }
140148
141-
142149 executor.sendText {
143150 appendSuccessPrefix()
144151 success(" Die Zeit wurde auf" )
@@ -156,8 +163,8 @@ fun timeCommand() = commandTree("time") {
156163 nativeExecutor { executor, args ->
157164 val time: Int by args
158165
159- Bukkit .getWorlds().forEach {
160- plugin.launch(plugin.globalRegionDispatcher) {
166+ plugin.launch(plugin.globalRegionDispatcher) {
167+ Bukkit .getWorlds().forEach {
161168 if (time !in 100 .. 24000 ) {
162169 it.fullTime + = time
163170 } else {
0 commit comments