Skip to content

Commit d70d917

Browse files
committed
feat: refine handshake process again
1 parent 46d4c7f commit d70d917

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

src/main/java/com/mcdiamondfire/proto/ModAPIMessages.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public final class ModAPIMessages {
2222
// Client-bound.
2323

2424
// Server.
25-
registerMessage(S2CHello.class, "s2c_hlelo");
25+
registerMessage(S2CHello.class, "s2c_hello");
2626
registerMessage(S2CHandshakeResponse.class, "s2c_handshake_response");
2727
registerMessage(S2CServerBooster.class, "s2c_server_booster");
2828

@@ -35,8 +35,6 @@ public final class ModAPIMessages {
3535
registerMessage(S2CPlotProfiling.class, "s2c_plot_profiling");
3636

3737
// Player.
38-
registerMessage(S2CPlayerCurrency.class, "s2c_player_currency");
39-
registerMessage(S2CPlayerPermissions.class, "s2c_player_permissions");
4038
registerMessage(S2CPlayerSwitchMode.class, "s2c_player_switch_mode");
4139
registerMessage(S2CChestReference.class, "s2c_chest_reference");
4240

src/main/proto/clientbound_player.proto

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,14 @@ import "data_type.proto";
44
option java_package = "com.mcdiamondfire.proto.messages.clientbound.player";
55
option java_multiple_files = true;
66

7-
// Sent when the player joins the server.
8-
message S2CPlayerCurrency {
7+
// Represents general information about the player.
8+
message PlayerInfo {
9+
PlayerCurrency currency = 1; // The player's currency information.
10+
PlayerPermissions permissions = 2; // The player's permissions.
11+
}
12+
13+
// Represents the player's currency information.
14+
message PlayerCurrency {
915
// Represents an unclaimed ticket bundle.
1016
message TicketBundle {
1117
string event_name = 1; // The name of the event the bundle is from.
@@ -19,8 +25,8 @@ message S2CPlayerCurrency {
1925
int32 sparks = 4; // The amount of sparks the player has.
2026
}
2127

22-
// Sent when the player joins the server, admins will have all permissions set to their highest level.
23-
message S2CPlayerPermissions {
28+
// Represents the player's permissions, admins will have all permissions set to their highest level.
29+
message PlayerPermissions {
2430
int32 donor = 1; // The donor rank level of the player. (Noble, Emperor, Mythic, Overlord)
2531
int32 vip = 2; // The VIP rank level of the player. (VIP)
2632
int32 qa = 3; // The QA rank level of the player. (QA)

src/main/proto/clientbound_server.proto

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
syntax = "proto3";
2+
import "clientbound_player.proto";
23

34
option java_package = "com.mcdiamondfire.proto.messages.clientbound.server";
45
option java_multiple_files = true;
@@ -35,9 +36,13 @@ message S2CHandshakeResponse {
3536
INCOMPATIBLE_PROTOCOL = 2; // The given protocol version is incompatible with the server.
3637
ALREADY_CONNECTED = 3; // The player is already connected.
3738
}
39+
message Success {
40+
ServerInfo server_info = 1; // The server info.
41+
PlayerInfo player_info = 2; // The player's info.
42+
}
3843
oneof result {
3944
Error error = 1; // The error that occurred, if any.
40-
ServerInfo server_info = 2; // The server info, if the connection was successful.
45+
Success success = 2; // The server and player info, if the connection was successful.
4146
}
4247
}
4348

0 commit comments

Comments
 (0)