Skip to content

Commit b4ff043

Browse files
committed
feat: place template serverbound
1 parent c68a6c6 commit b4ff043

File tree

3 files changed

+33
-4
lines changed

3 files changed

+33
-4
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public final class ModAPIMessages {
2727
// Plot.
2828
registerMessage(S2CPlotInfo.class, "s2c_plot_info");
2929
registerMessage(S2CCodeTemplate.class, "s2c_code_template");
30+
registerMessage(S2CPlaceTemplateResult.class, "s2c_place_template_result");
3031

3132
// Player.
3233
registerMessage(S2CPlayerCurrency.class, "s2c_player_currency");
@@ -38,11 +39,11 @@ public final class ModAPIMessages {
3839

3940
// Plot.
4041
registerMessage(C2SGetTemplate.class, "c2s_get_template");
42+
registerMessage(C2SPlaceTemplate.class, "c2s_place_template");
4143

4244
// Player.
4345
registerMessage(C2SPlayerTeleport.class, "c2s_player_teleport");
4446

45-
4647
}
4748

4849
private ModAPIMessages() {

src/main/proto/clientbound_plot.proto

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,20 @@ message S2CPlotInfo {
5252
repeated PlotPlayer players = 16; // The players currently on the plot.
5353
}
5454

55-
// Send as a response to a C2SGetTemplate message.
55+
// Sent as a response to a C2SGetTemplate message,
56+
// error is true if the player does not have developer permissions on the plot,
57+
// or if the location is not a valid code block position
5658
message S2CCodeTemplate {
57-
string json = 1; // The template as a JSON string.
59+
oneof response {
60+
string json = 1; // The template as a JSON string.
61+
bool error = 2; // Whether an error occurred while getting the template.
62+
}
63+
}
64+
65+
// Sent as a response to a C2SPlaceTemplate message,
66+
// error is true if the player does not have developer permissions on the plot,
67+
// or if the location is not a valid code block position,
68+
// or if the template overrides any blocks / exits the plot bounds.
69+
message S2CPlaceTemplateResult {
70+
bool error = 1; // Whether an error occurred while placing the template.
5871
}

src/main/proto/serverbound_plot.proto

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,22 @@ option java_package = "com.mcdiamondfire.proto.messages.serverbound.player";
55
option java_multiple_files = true;
66

77
// Requests the template at the given location,
8-
// a S2CTemplate packet will be sent as a response.
8+
// requires the player to have developer permissions on the plot,
9+
// and the location being a valid code block position.
10+
// An S2CCodeTemplate packet will be sent as a response.
911
message C2SGetTemplate {
1012
Location location = 1; // The location of the code block to get the template of.
1113
}
14+
15+
// Requests to place a template at the given location,
16+
// requires the player to have developer permissions on the plot,
17+
// the location being a valid code block position,
18+
// and that the template will not override any blocks nor exit the plot bounds.
19+
// An S2CPlaceTemplateResult packet will be sent as a response.
20+
message C2SPlaceTemplate {
21+
Location location = 1; // The location of the code block to place the template at.
22+
oneof template {
23+
string json = 2; // The template JSON string.
24+
string data = 3; // The template code data.
25+
}
26+
}

0 commit comments

Comments
 (0)