Skip to content

Commit 0a43259

Browse files
committed
feat: handshake message and add missing docs
1 parent e75ee08 commit 0a43259

File tree

6 files changed

+33
-13
lines changed

6 files changed

+33
-13
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import com.mcdiamondfire.proto.messages.clientbound.plot.*;
66
import com.mcdiamondfire.proto.messages.clientbound.server.*;
77
import com.mcdiamondfire.proto.messages.serverbound.player.*;
8+
import com.mcdiamondfire.proto.messages.serverbound.server.C2SModAPIConnect;
89

910
import java.util.*;
1011

@@ -22,6 +23,7 @@ public final class ModAPIMessages {
2223

2324
// Server.
2425
registerMessage(S2CServerInfo.class, "s2c_server_info");
26+
registerMessage(S2CConnectionResult.class, "s2c_connection_result");
2527
registerMessage(S2CServerBooster.class, "s2c_server_booster");
2628

2729
// Plot.

src/main/proto/clientbound_player.proto

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,18 +82,18 @@ message S2CChestReference {
8282

8383
// A standard return value, which contains the value and descriptions fields.
8484
message Standard {
85-
Value value_type = 1;
86-
repeated string descriptions = 2;
85+
Value value_type = 1; // The value type of the return value.
86+
repeated string descriptions = 2; // The description of the return value as a list of serialized components in JSON format.
8787
}
8888

8989
// A simple return value, which only contains a text field.
9090
message Simple {
91-
string text = 1;
91+
string text = 1; // The text of the return value as a serialized component in JSON format.
9292
}
9393

9494
oneof return_value_type {
95-
Standard standard_value = 1;
96-
Simple simple_value = 2;
95+
Standard standard_value = 1; // A standard return value.
96+
Simple simple_value = 2; // A simple return value.
9797
}
9898
}
9999

src/main/proto/clientbound_plot.proto

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ message S2CPlotInfo {
3434
MISCELLANEOUS = 12; // Plots that don't really fit the other categories!
3535
}
3636

37+
// Represents a cuboid region in the world.
3738
message Region {
3839
WorldLocation min = 1; // The minimum corner of the region.
3940
WorldLocation max = 2; // The maximum corner of the region.
@@ -59,6 +60,7 @@ message S2CPlotInfo {
5960
// error is true if the operation failed (see each operation for details),
6061
// template is not empty only if a get operation succeeded.
6162
message S2CCodeOperationResult {
63+
// Represents an error that occurred while performing a code operation.
6264
enum Error {
6365
NONE = 0; // No error, the operation succeeded.
6466
NO_PERMISSION = 1; // The player does not have developer permissions on the plot.
@@ -101,6 +103,7 @@ message S2CPlotLineStarters {
101103
// Sent when a line starter is added or removed from the plot,
102104
// requires the player to have developer permissions on the plot.
103105
message S2CPlotLineStarterUpdate {
106+
// Represents an action performed on a line starter.
104107
enum Action {
105108
ADD = 0; // A line starter was added.
106109
REMOVE = 1; // A line starter was removed.

src/main/proto/clientbound_server.proto

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ syntax = "proto3";
33
option java_package = "com.mcdiamondfire.proto.messages.clientbound.server";
44
option java_multiple_files = true;
55

6-
// Sent when the player joins the server.
6+
// Sent when the player joins the server, the server is ready to accept a S2CModAPIConnect message.
77
message S2CServerInfo {
88
// Represents a server type.
99
enum DFServerType {
@@ -22,6 +22,16 @@ message S2CServerInfo {
2222
DFServerType server_type = 4; // The type of the server.
2323
}
2424

25+
// Sent as a response to a C2SModAPIConnect message.
26+
message S2CConnectionResult {
27+
enum Error {
28+
NONE = 0; // No error, the connection was successful.
29+
INVALID_PROTOCOL = 1; // The given protocol version is invalid.
30+
INCOMPATIBLE_PROTOCOL = 2; // The given protocol version is incompatible with the server.
31+
}
32+
optional Error error = 1; // The error, if any.
33+
}
34+
2535
// Sent when the player joins the server.
2636
message S2CServerBooster {
2737
// Represents an active booster.

src/main/proto/serverbound_player.proto

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,3 @@ option java_multiple_files = true;
99
message C2SPlayerTeleport {
1010
WorldLocation location = 1; // The location to teleport to.
1111
}
12-
13-
// Notifies the server you are interested in receiving ModAPI messages.
14-
// This must be sent before any ModAPI messages are sent by the client.
15-
// If the protocol versions are major version incompatible, the request will be voided.
16-
message C2SModAPIConnect {
17-
string protocol_version = 1; // The version of the protocol the client is using.
18-
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
syntax = "proto3";
2+
import "data_type.proto";
3+
4+
option java_package = "com.mcdiamondfire.proto.messages.serverbound.server";
5+
option java_multiple_files = true;
6+
7+
// Notifies the server you are interested in receiving ModAPI messages.
8+
// This must be sent before any ModAPI messages are sent by the client.
9+
// A S2CConnectionResult message will be sent in response.
10+
message C2SModAPIConnect {
11+
string protocol_version = 1; // The version of the protocol the client is using.
12+
}

0 commit comments

Comments
 (0)