Skip to content
This repository was archived by the owner on Dec 10, 2025. It is now read-only.

Commit 7bdbc0c

Browse files
Copilottwisti-dev
andcommitted
Fix enum IDs to start at 0 for ByIdMap.continuous
Co-authored-by: twisti-dev <[email protected]>
1 parent 43140f6 commit 7bdbc0c

File tree

2 files changed

+16
-16
lines changed
  • surf-cloud-api/surf-cloud-api-common/src/main/kotlin/dev/slne/surf/cloud/api/common/server/state
  • surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network

2 files changed

+16
-16
lines changed

surf-cloud-api/surf-cloud-api-common/src/main/kotlin/dev/slne/surf/cloud/api/common/server/state/ServerState.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import dev.slne.surf.cloud.api.common.netty.network.codec.ByteBufCodecs
44
import dev.slne.surf.cloud.api.common.util.ByIdMap
55

66
enum class ServerState(val id: Int, val allowJoin: Boolean) {
7-
RESTARTING(1, false),
8-
LOBBY(2, true),
9-
ONLINE(3, true),
10-
OFFLINE(4, false);
7+
RESTARTING(0, false),
8+
LOBBY(1, true),
9+
ONLINE(2, true),
10+
OFFLINE(3, false);
1111

1212
companion object {
1313
val BY_ID = ByIdMap.continuous(

surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/DisconnectionDetails.kt

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,18 @@ enum class DisconnectReason(
2929
val message: String,
3030
val shouldRestart: Boolean = true
3131
) {
32-
UNKNOWN(1, "Disconnected", true),
33-
TIMEOUT(2, "Timed out", true),
34-
INTERNAL_EXCEPTION(3, "Internal exception", true),
35-
END_OF_STREAM(4, "End of stream", true),
36-
SERVER_ID_FETCHED(5, "Server ID fetched", false),
37-
CLIENT_SHUTDOWN(6, "Client shutdown", false),
38-
CLIENT_NAME_ALREADY_EXISTS(7, "Client name already exists", false),
39-
SERVER_SHUTDOWN(8, "Server is shutting down", true),
40-
OUTDATED_SERVER(9, "Outdated server", false),
41-
OUTDATED_CLIENT(10, "Outdated client", false),
42-
PROXY_ALREADY_CONNECTED(11, "Proxy already connected", false),
43-
TOOK_TOO_LONG(12, "Took too long to log in", false);
32+
UNKNOWN(0, "Disconnected", true),
33+
TIMEOUT(1, "Timed out", true),
34+
INTERNAL_EXCEPTION(2, "Internal exception", true),
35+
END_OF_STREAM(3, "End of stream", true),
36+
SERVER_ID_FETCHED(4, "Server ID fetched", false),
37+
CLIENT_SHUTDOWN(5, "Client shutdown", false),
38+
CLIENT_NAME_ALREADY_EXISTS(6, "Client name already exists", false),
39+
SERVER_SHUTDOWN(7, "Server is shutting down", true),
40+
OUTDATED_SERVER(8, "Outdated server", false),
41+
OUTDATED_CLIENT(9, "Outdated client", false),
42+
PROXY_ALREADY_CONNECTED(10, "Proxy already connected", false),
43+
TOOK_TOO_LONG(11, "Took too long to log in", false);
4444

4545
companion object {
4646
val BY_ID = ByIdMap.continuous(

0 commit comments

Comments
 (0)