Skip to content

Commit

Permalink
Remove protobuf-java-util dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsNature committed Oct 7, 2024
1 parent a37c38b commit 23c6a8e
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 17 deletions.
2 changes: 0 additions & 2 deletions bukkit-example/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@ dependencies {

// Used for Proto Implementation
api(libs.protobuf)
api(libs.protobuf.java.util)

// Used for Proto & Json Implementation
api(libs.bundles.adventure) {
exclude("org.checkerframework")
exclude("net.kyori", "adventure-api")
exclude("net.kyori", "adventure-bom")
exclude("com.google.code.gson", "gson")
}

// Used for API Implementation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public class ApolloExamplePlugin extends JavaPlugin {
public void onEnable() {
plugin = this;

this.changeImplementationType(ApolloExampleType.API);
this.changeImplementationType(ApolloExampleType.JSON);
this.registerCommands();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.google.common.collect.Lists;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
import com.lunarclient.apollo.example.common.modules.impl.HologramExample;
import com.lunarclient.apollo.example.json.AdventureUtil;
import com.lunarclient.apollo.example.json.JsonPacketUtil;
Expand All @@ -50,7 +51,7 @@ public void displayHologramExample() {
Component.text()
.content("Type /help to get started!")
.build()
).stream().map(AdventureUtil::toJson)
).stream().map(AdventureUtil::toJson).map(JsonPrimitive::new)
.collect(JsonArray::new, JsonArray::add, JsonArray::addAll);

JsonObject message = new JsonObject();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.google.common.collect.Lists;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
import com.lunarclient.apollo.example.common.modules.impl.LimbExample;
import com.lunarclient.apollo.example.json.JsonPacketUtil;
import com.lunarclient.apollo.example.json.JsonUtil;
Expand All @@ -36,7 +37,8 @@ public class LimbJsonExample extends LimbExample {
@Override
public void hideArmorExample(Player viewer, Player target) {
// 1 = helmet, 2 = chestplate, 3 = leggings, 4 = boots
JsonArray armorPieces = Lists.newArrayList(1, 3).stream()
JsonArray armorPieces = Lists.newArrayList(1, 3)
.stream().map(JsonPrimitive::new)
.collect(JsonArray::new, JsonArray::add, JsonArray::addAll);

JsonObject message = new JsonObject();
Expand All @@ -50,7 +52,8 @@ public void hideArmorExample(Player viewer, Player target) {
@Override
public void resetArmorExample(Player viewer, Player target) {
// 1 = helmet, 2 = chestplate, 3 = leggings, 4 = boots
JsonArray armorPieces = Lists.newArrayList(1, 3).stream()
JsonArray armorPieces = Lists.newArrayList(1, 3)
.stream().map(JsonPrimitive::new)
.collect(JsonArray::new, JsonArray::add, JsonArray::addAll);

JsonObject message = new JsonObject();
Expand All @@ -64,7 +67,8 @@ public void resetArmorExample(Player viewer, Player target) {
@Override
public void hideBodyExample(Player viewer, Player target) {
// 1 = head, 2 = torso, 3 = left arm, 4 = right arm, 5 = left leg, 6 = right leg
JsonArray bodyParts = Lists.newArrayList(1, 4).stream()
JsonArray bodyParts = Lists.newArrayList(1, 4)
.stream().map(JsonPrimitive::new)
.collect(JsonArray::new, JsonArray::add, JsonArray::addAll);

JsonObject message = new JsonObject();
Expand All @@ -78,7 +82,8 @@ public void hideBodyExample(Player viewer, Player target) {
@Override
public void resetBodyExample(Player viewer, Player target) {
// 1 = head, 2 = torso, 3 = left arm, 4 = right arm, 5 = left leg, 6 = right leg
JsonArray bodyParts = Lists.newArrayList(1, 4).stream()
JsonArray bodyParts = Lists.newArrayList(1, 4)
.stream().map(JsonPrimitive::new)
.collect(JsonArray::new, JsonArray::add, JsonArray::addAll);

JsonObject message = new JsonObject();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.google.common.collect.Lists;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
import com.lunarclient.apollo.example.common.modules.impl.NametagExample;
import com.lunarclient.apollo.example.json.AdventureUtil;
import com.lunarclient.apollo.example.json.JsonPacketUtil;
Expand All @@ -50,7 +51,7 @@ public void overrideNametagExample(Player target) {
.color(NamedTextColor.RED)
.build()
)
.stream().map(AdventureUtil::toJson)
.stream().map(AdventureUtil::toJson).map(JsonPrimitive::new)
.collect(JsonArray::new, JsonArray::add, JsonArray::addAll);

JsonObject message = new JsonObject();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
import com.lunarclient.apollo.example.common.modules.impl.StaffModExample;
import com.lunarclient.apollo.example.json.JsonPacketUtil;
import java.util.stream.Stream;
Expand All @@ -40,6 +41,7 @@ public void enableStaffModsExample(Player viewer) {

// 1 = xray
JsonArray staffMods = Stream.of(1)
.map(JsonPrimitive::new)
.collect(JsonArray::new, JsonArray::add, JsonArray::addAll);

JsonObject message = new JsonObject();
Expand All @@ -53,6 +55,7 @@ public void enableStaffModsExample(Player viewer) {
public void disableStaffModsExample(Player viewer) {
// 1 = xray
JsonArray staffMods = Stream.of(1)
.map(JsonPrimitive::new)
.collect(JsonArray::new, JsonArray::add, JsonArray::addAll);

JsonObject message = new JsonObject();
Expand Down
2 changes: 1 addition & 1 deletion docs/developers/modules/hologram.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ public void displayHologramExample() {
Component.text()
.content("Type /help to get started!")
.build()
).stream().map(AdventureUtil::toJson)
).stream().map(AdventureUtil::toJson).map(JsonPrimitive::new)
.collect(JsonArray::new, JsonArray::add, JsonArray::addAll);

JsonObject message = new JsonObject();
Expand Down
12 changes: 8 additions & 4 deletions docs/developers/modules/limb.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ public void resetBodyExample(Player viewer, Player target) {
```java
public void hideArmorExample(Player viewer, Player target) {
// 1 = helmet, 2 = chestplate, 3 = leggings, 4 = boots
JsonArray armorPieces = Lists.newArrayList(1, 3).stream()
JsonArray armorPieces = Lists.newArrayList(1, 3)
.stream().map(JsonPrimitive::new)
.collect(JsonArray::new, JsonArray::add, JsonArray::addAll);

JsonObject message = new JsonObject();
Expand All @@ -200,7 +201,8 @@ public void hideArmorExample(Player viewer, Player target) {
```java
public void resetArmorExample(Player viewer, Player target) {
// 1 = helmet, 2 = chestplate, 3 = leggings, 4 = boots
JsonArray armorPieces = Lists.newArrayList(1, 3).stream()
JsonArray armorPieces = Lists.newArrayList(1, 3)
.stream().map(JsonPrimitive::new)
.collect(JsonArray::new, JsonArray::add, JsonArray::addAll);

JsonObject message = new JsonObject();
Expand All @@ -217,7 +219,8 @@ public void resetArmorExample(Player viewer, Player target) {
```java
public void hideBodyExample(Player viewer, Player target) {
// 1 = head, 2 = torso, 3 = left arm, 4 = right arm, 5 = left leg, 6 = right leg
JsonArray bodyParts = Lists.newArrayList(1, 4).stream()
JsonArray bodyParts = Lists.newArrayList(1, 4)
.stream().map(JsonPrimitive::new)
.collect(JsonArray::new, JsonArray::add, JsonArray::addAll);

JsonObject message = new JsonObject();
Expand All @@ -234,7 +237,8 @@ public void hideBodyExample(Player viewer, Player target) {
```java
public void resetBodyExample(Player viewer, Player target) {
// 1 = head, 2 = torso, 3 = left arm, 4 = right arm, 5 = left leg, 6 = right leg
JsonArray bodyParts = Lists.newArrayList(1, 4).stream()
JsonArray bodyParts = Lists.newArrayList(1, 4)
.stream().map(JsonPrimitive::new)
.collect(JsonArray::new, JsonArray::add, JsonArray::addAll);

JsonObject message = new JsonObject();
Expand Down
2 changes: 1 addition & 1 deletion docs/developers/modules/nametag.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public void overrideNametagExample(Player target) {
.color(NamedTextColor.RED)
.build()
)
.stream().map(AdventureUtil::toJson)
.stream().map(AdventureUtil::toJson).map(JsonPrimitive::new)
.collect(JsonArray::new, JsonArray::add, JsonArray::addAll);

JsonObject message = new JsonObject();
Expand Down
2 changes: 2 additions & 0 deletions docs/developers/modules/staffmod.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ public void enableStaffModsExample(Player viewer) {

// 1 = xray
JsonArray staffMods = Stream.of(1)
.map(JsonPrimitive::new)
.collect(JsonArray::new, JsonArray::add, JsonArray::addAll);

JsonObject message = new JsonObject();
Expand All @@ -119,6 +120,7 @@ public void enableStaffModsExample(Player viewer) {
public void disableStaffModsExample(Player viewer) {
// 1 = xray
JsonArray staffMods = Stream.of(1)
.map(JsonPrimitive::new)
.collect(JsonArray::new, JsonArray::add, JsonArray::addAll);

JsonObject message = new JsonObject();
Expand Down
2 changes: 0 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ idea = "1.1.7"
jetbrains = "24.0.1"
lombok = "1.18.26"
protobuf = "1.0-SNAPSHOT"
protobuf-java-util = "3.25.0"
gson = "2.10.1"
shadow = "8.1.1"
spotless = "6.13.0"
Expand All @@ -35,7 +34,6 @@ geantyref = { module = "io.leangen.geantyref:geantyref", version.ref = "geantyre

# common
protobuf = { module = "com.lunarclient:apollo-protos", version.ref = "protobuf" }
protobuf-java-util = { module = "com.google.protobuf:protobuf-java-util", version.ref = "protobuf-java-util" }
gson = { module = "com.google.code.gson:gson", version.ref = "gson" }
configurate-core = { module = "org.spongepowered:configurate-core", version.ref = "configurate" }
configurate-yaml = { module = "org.spongepowered:configurate-yaml", version.ref = "configurate" }
Expand Down

1 comment on commit 23c6a8e

@LunarClientBot
Copy link
Collaborator

@LunarClientBot LunarClientBot commented on 23c6a8e Oct 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📄 Documentation Deployment

Status:✅ Completed
Environment:preview
URL:https://6ddafc93.lunarclient-dev.pages.dev

Please sign in to comment.