-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
61 changed files
with
477 additions
and
382 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ybuild/pcbridge/http/responses/Account.kt → ...citybuild/pcbridge/http/models/Account.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...itybuild/pcbridge/http/responses/Badge.kt → ...ctcitybuild/pcbridge/http/models/Badge.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...d/pcbridge/http/responses/DonationPerk.kt → ...uild/pcbridge/http/models/DonationPerk.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...d/pcbridge/http/responses/DonationTier.kt → ...uild/pcbridge/http/models/DonationTier.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...itybuild/pcbridge/http/responses/Group.kt → ...ctcitybuild/pcbridge/http/models/Group.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...itybuild/pcbridge/http/responses/IPBan.kt → ...ctcitybuild/pcbridge/http/models/IPBan.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...tybuild/pcbridge/http/responses/Player.kt → ...tcitybuild/pcbridge/http/models/Player.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...uild/pcbridge/http/responses/PlayerBan.kt → ...tybuild/pcbridge/http/models/PlayerBan.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ild/pcbridge/http/responses/PlayerData.kt → ...ybuild/pcbridge/http/models/PlayerData.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
pcbridge-http/src/main/kotlin/com/projectcitybuild/pcbridge/http/models/RemoteConfig.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
@file:Suppress("ktlint:standard:max-line-length") | ||
|
||
package com.projectcitybuild.pcbridge.http.models | ||
|
||
import com.google.gson.annotations.SerializedName | ||
import kotlinx.serialization.Serializable | ||
|
||
/** | ||
* Key-values for the plugin fetched from the PCB web backend | ||
*/ | ||
@Serializable | ||
data class RemoteConfigKeyValues( | ||
val localization: Localization = Localization(), | ||
val chat: Chat = Chat(), | ||
val warps: Warps = Warps(), | ||
val integrations: Integrations = Integrations(), | ||
val announcements: Announcements = Announcements(), | ||
val messages: Messages = Messages(), | ||
) { | ||
@Serializable | ||
data class Localization( | ||
@SerializedName("time_zone") | ||
val timeZone: String = "UTC", | ||
val locale: String = "en-us", | ||
) | ||
|
||
@Serializable | ||
data class Chat( | ||
@SerializedName("badge_icon") | ||
val badgeIcon: String = "<color:yellow>★</color>", | ||
) | ||
|
||
@Serializable | ||
data class Warps( | ||
@SerializedName("items_per_page") | ||
val itemsPerPage: Int = 15, | ||
) | ||
|
||
@Serializable | ||
data class Integrations( | ||
@SerializedName("dynmap_warp_icon_name") | ||
val dynmapWarpIconName: String = "portal", | ||
) | ||
|
||
@Serializable | ||
data class Announcements( | ||
@SerializedName("interval_in_mins") | ||
val intervalInMins: Int = 30, | ||
val messages: List<String> = emptyList(), | ||
) | ||
|
||
@Serializable | ||
data class Messages( | ||
val join: String = "<color:green><b>+</b></color> <name> <color:gray>joined the server</color>", | ||
val leave: String = "<color:red><b>-</b></color> <name> <color:gray>left the server (online for <time_online>)</color>", | ||
@SerializedName("first_time_join") | ||
val firstTimeJoin: String = "<color:AA00AA><b>✦ Welcome §f%name%§d to the server!</b></color>", | ||
val welcome: String = "<b>Welcome to PCB!</b>", | ||
) | ||
} | ||
|
||
@Serializable | ||
data class RemoteConfigVersion( | ||
val version: Int, | ||
val config: RemoteConfigKeyValues, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
...dge-http/src/main/kotlin/com/projectcitybuild/pcbridge/http/services/ConfigHttpService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.projectcitybuild.pcbridge.http.services | ||
|
||
import com.projectcitybuild.pcbridge.http.models.RemoteConfigVersion | ||
import com.projectcitybuild.pcbridge.http.parsing.ResponseParser | ||
import com.projectcitybuild.pcbridge.http.pcb | ||
import kotlinx.coroutines.Dispatchers | ||
import kotlinx.coroutines.withContext | ||
import retrofit2.Retrofit | ||
|
||
class ConfigHttpService( | ||
private val retrofit: Retrofit, | ||
private val responseParser: ResponseParser, | ||
) { | ||
suspend fun get(): RemoteConfigVersion = | ||
withContext(Dispatchers.IO) { | ||
responseParser.parse(retrofit.pcb()::getConfig) | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
...ge/http/services/pcb/PlayerHttpService.kt → ...bridge/http/services/PlayerHttpService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../http/services/pcb/RegisterHttpService.kt → ...idge/http/services/RegisterHttpService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...http/services/pcb/TelemetryHttpService.kt → ...dge/http/services/TelemetryHttpService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.