Skip to content

Commit 00fe42d

Browse files
committed
Generate new models, send run metadata as part of scoreboard sync
1 parent c8bcdd6 commit 00fe42d

13 files changed

+196
-114
lines changed

gradle/gradle-daemon-jvm.properties

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#This file is generated by updateDaemonJvm
2+
toolchainVersion=21

gradle/wrapper/gradle-wrapper.jar

-9 Bytes
Binary file not shown.

gradlew

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
# Darwin, MinGW, and NonStop.
5656
#
5757
# (3) This script is generated from the Groovy template
58-
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
58+
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
5959
# within the Gradle project.
6060
#
6161
# You can find Gradle at https://github.com/gradle/gradle/.

gradlew.bat

+10-10
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ set JAVA_EXE=java.exe
4343
%JAVA_EXE% -version >NUL 2>&1
4444
if %ERRORLEVEL% equ 0 goto execute
4545

46-
echo.
47-
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
48-
echo.
49-
echo Please set the JAVA_HOME variable in your environment to match the
50-
echo location of your Java installation.
46+
echo. 1>&2
47+
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
48+
echo. 1>&2
49+
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
50+
echo location of your Java installation. 1>&2
5151

5252
goto fail
5353

@@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
5757

5858
if exist "%JAVA_EXE%" goto execute
5959

60-
echo.
61-
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
62-
echo.
63-
echo Please set the JAVA_HOME variable in your environment to match the
64-
echo location of your Java installation.
60+
echo. 1>&2
61+
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
62+
echo. 1>&2
63+
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
64+
echo location of your Java installation. 1>&2
6565

6666
goto fail
6767

src/main/kotlin/org/trackedout/AgroNet.kt

+85-69
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,13 @@ object AgroNet : ModInitializer {
5555
// Proceed with mild caution.
5656

5757
serverName = getEnvOrDefault("SERVER_NAME", InetAddress.getLocalHost().hostName)
58+
if (serverName.contains("dungeon-")) {
59+
// dungeon-1 -> d801
60+
// dungeon-14 -> d814
61+
val dungeonId = serverName.replace("dungeon-", "")
62+
serverName = "d8${dungeonId.padStart(2, '0')}"
63+
}
64+
5865
val dungaAPIPath = getEnvOrDefault("DUNGA_API", "http://localhost:3000/v1")
5966

6067
logger.info("Agronet server name: $serverName (run ID: ${runContext.runId})")
@@ -106,84 +113,90 @@ object AgroNet : ModInitializer {
106113
val removeDeckFromPlayerInventoryAction = RemoveDeckFromPlayerInventoryAction()
107114

108115
CommandRegistrationCallback.EVENT.register { dispatcher, _, _ ->
109-
dispatcher.register(literal("take-shulker")
110-
.requires { it.hasPermissionLevel(2) } // Command Blocks have permission level of 2
111-
.executes { context ->
112-
val player = context.source.player
113-
if (player != null) {
114-
removeDeckFromPlayerInventoryAction.execute(player)
115-
} else {
116-
logger.warn("Attempting to take shulker but command is not run as a player, ignoring...")
116+
dispatcher.register(
117+
literal("take-shulker")
118+
.requires { it.hasPermissionLevel(2) } // Command Blocks have permission level of 2
119+
.executes { context ->
120+
val player = context.source.player
121+
if (player != null) {
122+
removeDeckFromPlayerInventoryAction.execute(player)
123+
} else {
124+
logger.warn("Attempting to take shulker but command is not run as a player, ignoring...")
125+
}
126+
127+
1
117128
}
118-
119-
1
120-
}
121129
)
122130
}
123131

124132
CommandRegistrationCallback.EVENT.register { dispatcher, _, _ ->
125-
dispatcher.register(literal("gief-shulker")
126-
.requires { it.hasPermissionLevel(2) } // Command Blocks have permission level of 2
127-
.executes { context ->
128-
val player = context.source.player
129-
if (player != null) {
130-
addDeckToPlayerInventoryAction.execute(context.source, player)
131-
} else {
132-
logger.warn("Attempting to give shulker but command is not run as a player, ignoring...")
133-
}
134-
135-
1
136-
})
133+
dispatcher.register(
134+
literal("gief-shulker")
135+
.requires { it.hasPermissionLevel(2) } // Command Blocks have permission level of 2
136+
.executes { context ->
137+
val player = context.source.player
138+
if (player != null) {
139+
addDeckToPlayerInventoryAction.execute(context.source, player)
140+
} else {
141+
logger.warn("Attempting to give shulker but command is not run as a player, ignoring...")
142+
}
143+
144+
1
145+
})
137146
}
138147

139148
val logEventCommand = LogEventCommand(eventsApi)
140149

141150
CommandRegistrationCallback.EVENT.register { dispatcher, _, _ ->
142-
dispatcher.register(literal("log-event")
143-
.requires { it.hasPermissionLevel(2) } // Command Blocks have permission level of 2
144-
.then(
145-
argument("event", StringArgumentType.word()) // words_with_underscores
146-
.executes(logEventCommand::run)
147-
.then(
148-
argument(
149-
"count", // Number of units for this event
150-
IntegerArgumentType.integer(1)
151+
dispatcher.register(
152+
literal("log-event")
153+
.requires { it.hasPermissionLevel(2) } // Command Blocks have permission level of 2
154+
.then(
155+
argument("event", StringArgumentType.word()) // words_with_underscores
156+
.executes(logEventCommand::run)
157+
.then(
158+
argument(
159+
"count", // Number of units for this event
160+
IntegerArgumentType.integer(1)
161+
)
162+
.executes(logEventCommand::run)
151163
)
152-
.executes(logEventCommand::run)
153-
)
154-
)
164+
)
155165
)
156166
}
157167

158168
val cardInteractionCommand = CardInteractionCommand(inventoryApi, eventsApi, serverName)
159169

160170
listOf("card-bought", "card-played", "card-available").forEach { action ->
161171
CommandRegistrationCallback.EVENT.register { dispatcher, _, _ ->
162-
dispatcher.register(literal(action)
163-
.requires { it.hasPermissionLevel(2) } // Command Blocks have permission level of 2
164-
.then(
165-
argument("card", StringArgumentType.word()) // words_with_underscores
166-
.executes { context ->
167-
cardInteractionCommand.run(context, action)
168-
}
169-
)
172+
dispatcher.register(
173+
literal(action)
174+
.requires { it.hasPermissionLevel(2) } // Command Blocks have permission level of 2
175+
.then(
176+
argument("card", StringArgumentType.word()) // words_with_underscores
177+
.executes { context ->
178+
cardInteractionCommand.run(context, action)
179+
}
180+
)
170181
)
171182
}
172183
}
173184

174185
val itemInteractionCommand = CardInteractionCommand(inventoryApi, eventsApi, serverName)
175186
listOf("add-item").forEach { action ->
176187
CommandRegistrationCallback.EVENT.register { dispatcher, _, _ ->
177-
dispatcher.register(literal(action)
178-
.requires { it.hasPermissionLevel(2) } // Command Blocks have permission level of 2
179-
.then(
180-
argument("card", StringArgumentType.word())
181-
.then(argument("count", IntegerArgumentType.integer(1))
182-
.executes { context ->
183-
itemInteractionCommand.run(context, action)
184-
}
185-
)
186-
)
188+
dispatcher.register(
189+
literal(action)
190+
.requires { it.hasPermissionLevel(2) } // Command Blocks have permission level of 2
191+
.then(
192+
argument("card", StringArgumentType.word())
193+
.then(
194+
argument("count", IntegerArgumentType.integer(1))
195+
.executes { context ->
196+
itemInteractionCommand.run(context, action)
197+
}
198+
)
199+
)
187200
)
188201
}
189202
}
@@ -199,28 +212,31 @@ object AgroNet : ModInitializer {
199212
// }
200213

201214
CommandRegistrationCallback.EVENT.register { dispatcher, _, _ ->
202-
dispatcher.register(literal("update-workers")
203-
.requires(Permissions.require("trackedout.serveradmin.update-workers", 4))
204-
.executes { context ->
205-
sendRedisMessage(context.source, "server-hosts", "update-workers")
206-
1
207-
})
215+
dispatcher.register(
216+
literal("update-workers")
217+
.requires(Permissions.require("trackedout.serveradmin.update-workers", 4))
218+
.executes { context ->
219+
sendRedisMessage(context.source, "server-hosts", "update-workers")
220+
1
221+
})
208222
}
209223

210224
CommandRegistrationCallback.EVENT.register { dispatcher, _, _ ->
211-
dispatcher.register(literal("update-datapack")
212-
.requires(Permissions.require("trackedout.update-datapack", 2))
213-
.executes { context ->
214-
sendRedisMessage(context.source, "datapack-updates", "request-update")
215-
1
216-
})
225+
dispatcher.register(
226+
literal("update-datapack")
227+
.requires(Permissions.require("trackedout.update-datapack", 2))
228+
.executes { context ->
229+
sendRedisMessage(context.source, "datapack-updates", "request-update")
230+
1
231+
})
217232
}
218233

219234
if (!serverName.equals("builders", ignoreCase = true)) {
220235
CommandRegistrationCallback.EVENT.register { dispatcher, _, _ ->
221-
dispatcher.register(literal("is-dungeon-instance")
222-
.requires { it.hasPermissionLevel(2) } // Command Blocks have permission level of 2
223-
.executes { _ -> 1 })
236+
dispatcher.register(
237+
literal("is-dungeon-instance")
238+
.requires { it.hasPermissionLevel(2) } // Command Blocks have permission level of 2
239+
.executes { _ -> 1 })
224240
}
225241
}
226242

@@ -237,7 +253,7 @@ object AgroNet : ModInitializer {
237253
}
238254

239255
if (!serverName.equals("builders", ignoreCase = true)) {
240-
val scoreListener = AgroNetPlayerConnectionListener(scoreApi, claimApi, runContext, addDeckToPlayerInventoryAction)
256+
val scoreListener = AgroNetPlayerConnectionListener(scoreApi, claimApi, addDeckToPlayerInventoryAction)
241257
ServerPlayConnectionEvents.JOIN.register(scoreListener)
242258
ServerPlayConnectionEvents.DISCONNECT.register(scoreListener)
243259
ResourceManagerHelper.get(ResourceType.SERVER_DATA).registerReloadListener(scoreListener)

src/main/kotlin/org/trackedout/client/apis/EventsApi.kt

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import java.io.IOException
1919
import okhttp3.OkHttpClient
2020
import okhttp3.HttpUrl
2121

22-
import org.trackedout.client.models.Error
2322
import org.trackedout.client.models.Event
2423
import org.trackedout.client.models.EventsGet200Response
2524

src/main/kotlin/org/trackedout/client/apis/InventoryApi.kt

+24-23
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import okhttp3.HttpUrl
2222
import org.trackedout.client.models.Card
2323
import org.trackedout.client.models.Error
2424
import org.trackedout.client.models.InventoryCardsGet200Response
25+
import org.trackedout.client.models.Item
2526
import org.trackedout.client.models.StorageItemsGet200Response
2627

2728
import com.squareup.moshi.Json
@@ -401,8 +402,8 @@ class InventoryApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClie
401402
/**
402403
* Add an item to a player's deck
403404
* Add an item to a player's deck from one of the Decked Out 2 instances or the lobby server.
404-
* @param body
405-
* @return Card
405+
* @param item
406+
* @return Item
406407
* @throws IllegalStateException If the request is not correctly configured
407408
* @throws IOException Rethrows the OkHttp execute method exception
408409
* @throws UnsupportedOperationException If the API returns an informational or redirection response
@@ -411,11 +412,11 @@ class InventoryApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClie
411412
*/
412413
@Suppress("UNCHECKED_CAST")
413414
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
414-
fun storageAddItemPost(body: Card) : Card {
415-
val localVarResponse = storageAddItemPostWithHttpInfo(body = body)
415+
fun storageAddItemPost(item: Item) : Item {
416+
val localVarResponse = storageAddItemPostWithHttpInfo(item = item)
416417

417418
return when (localVarResponse.responseType) {
418-
ResponseType.Success -> (localVarResponse as Success<*>).data as Card
419+
ResponseType.Success -> (localVarResponse as Success<*>).data as Item
419420
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
420421
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
421422
ResponseType.ClientError -> {
@@ -432,29 +433,29 @@ class InventoryApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClie
432433
/**
433434
* Add an item to a player&#39;s deck
434435
* Add an item to a player&#39;s deck from one of the Decked Out 2 instances or the lobby server.
435-
* @param body
436-
* @return ApiResponse<Card?>
436+
* @param item
437+
* @return ApiResponse<Item?>
437438
* @throws IllegalStateException If the request is not correctly configured
438439
* @throws IOException Rethrows the OkHttp execute method exception
439440
*/
440441
@Suppress("UNCHECKED_CAST")
441442
@Throws(IllegalStateException::class, IOException::class)
442-
fun storageAddItemPostWithHttpInfo(body: Card) : ApiResponse<Card?> {
443-
val localVariableConfig = storageAddItemPostRequestConfig(body = body)
443+
fun storageAddItemPostWithHttpInfo(item: Item) : ApiResponse<Item?> {
444+
val localVariableConfig = storageAddItemPostRequestConfig(item = item)
444445

445-
return request<Card, Card>(
446+
return request<Item, Item>(
446447
localVariableConfig
447448
)
448449
}
449450

450451
/**
451452
* To obtain the request config of the operation storageAddItemPost
452453
*
453-
* @param body
454+
* @param item
454455
* @return RequestConfig
455456
*/
456-
fun storageAddItemPostRequestConfig(body: Card) : RequestConfig<Card> {
457-
val localVariableBody = body
457+
fun storageAddItemPostRequestConfig(item: Item) : RequestConfig<Item> {
458+
val localVariableBody = item
458459
val localVariableQuery: MultiValueMap = mutableMapOf()
459460
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
460461
localVariableHeaders["Content-Type"] = "application/json"
@@ -473,7 +474,7 @@ class InventoryApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClie
473474
/**
474475
* Delete an item
475476
* Remove an item from a player&#39;s deck. If multiple copies of this item exist, only one will be removed.
476-
* @param body
477+
* @param item
477478
* @return void
478479
* @throws IllegalStateException If the request is not correctly configured
479480
* @throws IOException Rethrows the OkHttp execute method exception
@@ -482,8 +483,8 @@ class InventoryApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClie
482483
* @throws ServerException If the API returns a server error response
483484
*/
484485
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
485-
fun storageDeleteItemPost(body: Card) : Unit {
486-
val localVarResponse = storageDeleteItemPostWithHttpInfo(body = body)
486+
fun storageDeleteItemPost(item: Item) : Unit {
487+
val localVarResponse = storageDeleteItemPostWithHttpInfo(item = item)
487488

488489
return when (localVarResponse.responseType) {
489490
ResponseType.Success -> Unit
@@ -503,28 +504,28 @@ class InventoryApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClie
503504
/**
504505
* Delete an item
505506
* Remove an item from a player&#39;s deck. If multiple copies of this item exist, only one will be removed.
506-
* @param body
507+
* @param item
507508
* @return ApiResponse<Unit?>
508509
* @throws IllegalStateException If the request is not correctly configured
509510
* @throws IOException Rethrows the OkHttp execute method exception
510511
*/
511512
@Throws(IllegalStateException::class, IOException::class)
512-
fun storageDeleteItemPostWithHttpInfo(body: Card) : ApiResponse<Unit?> {
513-
val localVariableConfig = storageDeleteItemPostRequestConfig(body = body)
513+
fun storageDeleteItemPostWithHttpInfo(item: Item) : ApiResponse<Unit?> {
514+
val localVariableConfig = storageDeleteItemPostRequestConfig(item = item)
514515

515-
return request<Card, Unit>(
516+
return request<Item, Unit>(
516517
localVariableConfig
517518
)
518519
}
519520

520521
/**
521522
* To obtain the request config of the operation storageDeleteItemPost
522523
*
523-
* @param body
524+
* @param item
524525
* @return RequestConfig
525526
*/
526-
fun storageDeleteItemPostRequestConfig(body: Card) : RequestConfig<Card> {
527-
val localVariableBody = body
527+
fun storageDeleteItemPostRequestConfig(item: Item) : RequestConfig<Item> {
528+
val localVariableBody = item
528529
val localVariableQuery: MultiValueMap = mutableMapOf()
529530
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
530531
localVariableHeaders["Content-Type"] = "application/json"

0 commit comments

Comments
 (0)