diff --git a/api/src/main/java/com/lunarclient/apollo/module/heightlimit/HeightLimit.java b/api/src/main/java/com/lunarclient/apollo/module/heightlimit/HeightLimit.java new file mode 100644 index 00000000..78035f57 --- /dev/null +++ b/api/src/main/java/com/lunarclient/apollo/module/heightlimit/HeightLimit.java @@ -0,0 +1,70 @@ +/* + * This file is part of Apollo, licensed under the MIT License. + * + * Copyright (c) 2026 Moonsworth + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +package com.lunarclient.apollo.module.heightlimit; + +import lombok.Builder; +import lombok.Getter; +import net.kyori.adventure.text.Component; +import org.jetbrains.annotations.Nullable; +import org.jetbrains.annotations.Range; + +/** + * Represents a height limit which can be shown on the client. + * + * @since 1.2.9 + */ +@Getter +@Builder +public final class HeightLimit { + + /** + * Returns the height limit {@link String} world name. + * + * @return the height limit world name + * @since 1.2.9 + */ + String world; + + /** + * Returns the height limit {@link Integer} Y level where block placement + * is denied. + * + *

The highest buildable layer is {@code limit - 1}.

+ * + * @return the height limit + * @since 1.2.9 + */ + @Range(from = 1, to = Integer.MAX_VALUE) int limit; + + /** + * Returns the height limit {@link Component} display name. + * + *

Shown on the client's height limit HUD.

+ * + * @return the height limit display name + * @since 1.2.9 + */ + @Nullable Component displayName; + +} diff --git a/api/src/main/java/com/lunarclient/apollo/module/heightlimit/HeightLimitModule.java b/api/src/main/java/com/lunarclient/apollo/module/heightlimit/HeightLimitModule.java new file mode 100644 index 00000000..86431321 --- /dev/null +++ b/api/src/main/java/com/lunarclient/apollo/module/heightlimit/HeightLimitModule.java @@ -0,0 +1,118 @@ +/* + * This file is part of Apollo, licensed under the MIT License. + * + * Copyright (c) 2026 Moonsworth + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +package com.lunarclient.apollo.module.heightlimit; + +import com.lunarclient.apollo.module.ApolloModule; +import com.lunarclient.apollo.module.ModuleDefinition; +import com.lunarclient.apollo.option.ListOption; +import com.lunarclient.apollo.option.Option; +import com.lunarclient.apollo.recipients.Recipients; +import io.leangen.geantyref.TypeToken; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.format.NamedTextColor; +import org.jetbrains.annotations.ApiStatus; + +/** + * Represents the height limit module. + * + *

Sets the build-height limit shown by the clients Height Limit mod + * (block overlay and HUD display). The client resolves the active limit + * against the world the player is currently in.

+ * + *

This module only provides a visual indicator for the player. The + * server is still responsible for cancelling block placement above the + * height limit.

+ * + * @since 1.2.9 + */ +@ApiStatus.NonExtendable +@ModuleDefinition(id = "height_limit", name = "Height Limit") +public abstract class HeightLimitModule extends ApolloModule { + + private static final HeightLimit OVERWORLD_HEIGHT_LIMIT = HeightLimit.builder() + .world("world") + .limit(200) + .displayName(Component.text("Overworld", NamedTextColor.GOLD)) + .build(); + + /** + * Returns the default list of height limits to send to the player. + * + * @since 1.2.9 + */ + public static final ListOption DEFAULT_HEIGHT_LIMITS = Option.list() + .comment("Sets the default height limits to send to the player.") + .node("default-height-limits").type(new TypeToken>() {}) + .defaultValue(new ArrayList<>(Collections.singletonList(HeightLimitModule.OVERWORLD_HEIGHT_LIMIT))) + .build(); + + protected HeightLimitModule() { + this.registerOptions( + ApolloModule.ENABLE_OPTION_OFF, + HeightLimitModule.DEFAULT_HEIGHT_LIMITS + ); + } + + /** + * Overrides the {@link HeightLimit} for the {@link Recipients}. + * + *

Sending a height limit for an already-known world replaces + * that worlds entry.

+ * + * @param recipients the recipients that are receiving the packet + * @param heightLimit the height limit + * @since 1.2.9 + */ + public abstract void overrideHeightLimit(Recipients recipients, HeightLimit heightLimit); + + /** + * Removes the {@link HeightLimit} from the {@link Recipients}. + * + * @param recipients the recipients that are receiving the packet + * @param world the world name + * @since 1.2.9 + */ + public abstract void removeHeightLimit(Recipients recipients, String world); + + /** + * Removes the {@link HeightLimit} from the {@link Recipients}. + * + * @param recipients the recipients that are receiving the packet + * @param heightLimit the height limit + * @since 1.2.9 + */ + public abstract void removeHeightLimit(Recipients recipients, HeightLimit heightLimit); + + /** + * Resets all {@link HeightLimit}s for the {@link Recipients}. + * + * @param recipients the recipients that are receiving the packet + * @since 1.2.9 + */ + public abstract void resetHeightLimits(Recipients recipients); + +} diff --git a/common/src/main/java/com/lunarclient/apollo/module/heightlimit/HeightLimitModuleImpl.java b/common/src/main/java/com/lunarclient/apollo/module/heightlimit/HeightLimitModuleImpl.java new file mode 100644 index 00000000..e8887aed --- /dev/null +++ b/common/src/main/java/com/lunarclient/apollo/module/heightlimit/HeightLimitModuleImpl.java @@ -0,0 +1,156 @@ +/* + * This file is part of Apollo, licensed under the MIT License. + * + * Copyright (c) 2026 Moonsworth + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +package com.lunarclient.apollo.module.heightlimit; + +import com.lunarclient.apollo.ApolloManager; +import com.lunarclient.apollo.common.ApolloComponent; +import com.lunarclient.apollo.event.player.ApolloRegisterPlayerEvent; +import com.lunarclient.apollo.heightlimit.v1.OverrideHeightLimitMessage; +import com.lunarclient.apollo.heightlimit.v1.RemoveHeightLimitMessage; +import com.lunarclient.apollo.heightlimit.v1.ResetHeightLimitsMessage; +import com.lunarclient.apollo.option.config.Serializer; +import com.lunarclient.apollo.player.ApolloPlayer; +import com.lunarclient.apollo.recipients.Recipients; +import java.lang.reflect.Type; +import java.util.Arrays; +import java.util.List; +import lombok.NonNull; +import net.kyori.adventure.text.Component; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.spongepowered.configurate.ConfigurationNode; +import org.spongepowered.configurate.serialize.SerializationException; +import org.spongepowered.configurate.serialize.TypeSerializer; + +import static com.lunarclient.apollo.util.Ranges.checkStrictlyPositive; + +/** + * Provides the height limit module. + * + * @since 1.2.9 + */ +public final class HeightLimitModuleImpl extends HeightLimitModule implements Serializer { + + /** + * Creates a new instance of {@link HeightLimitModuleImpl}. + * + * @since 1.2.9 + */ + public HeightLimitModuleImpl() { + super(); + this.serializer(HeightLimit.class, new HeightLimitSerializer()); + this.handle(ApolloRegisterPlayerEvent.class, this::onPlayerRegister); + } + + @Override + public void overrideHeightLimit(@NonNull Recipients recipients, @NonNull HeightLimit heightLimit) { + OverrideHeightLimitMessage.Builder builder = OverrideHeightLimitMessage.newBuilder() + .setWorld(heightLimit.getWorld()) + .setLimit(checkStrictlyPositive(heightLimit.getLimit(), "HeightLimit#limit")); + + Component displayName = heightLimit.getDisplayName(); + if (displayName != null) { + builder.setDisplayNameAdventureJsonLines(ApolloComponent.toJson(displayName)); + } + + OverrideHeightLimitMessage message = builder.build(); + ApolloManager.getNetworkManager().sendPacket(recipients, message); + } + + @Override + public void removeHeightLimit(@NonNull Recipients recipients, @NonNull String world) { + RemoveHeightLimitMessage message = RemoveHeightLimitMessage.newBuilder() + .setWorld(world) + .build(); + + ApolloManager.getNetworkManager().sendPacket(recipients, message); + } + + @Override + public void removeHeightLimit(@NonNull Recipients recipients, @NonNull HeightLimit heightLimit) { + this.removeHeightLimit(recipients, heightLimit.getWorld()); + } + + @Override + public void resetHeightLimits(@NonNull Recipients recipients) { + ResetHeightLimitsMessage message = ResetHeightLimitsMessage.getDefaultInstance(); + ApolloManager.getNetworkManager().sendPacket(recipients, message); + } + + private void onPlayerRegister(ApolloRegisterPlayerEvent event) { + if (!this.isEnabled()) { + return; + } + + ApolloPlayer player = event.getPlayer(); + List heightLimits = this.getOptions().get(player, HeightLimitModule.DEFAULT_HEIGHT_LIMITS); + + if (heightLimits != null) { + for (HeightLimit heightLimit : heightLimits) { + this.overrideHeightLimit(player, heightLimit); + } + } + } + + private static final class HeightLimitSerializer implements TypeSerializer { + + @Override + public HeightLimit deserialize(Type type, ConfigurationNode node) throws SerializationException { + HeightLimit.HeightLimitBuilder builder = HeightLimit.builder() + .world(this.virtualNode(node, "world").getString()) + .limit(this.virtualNode(node, "limit").getInt()); + + String displayName = node.node("display-name").getString(); + if (displayName != null) { + builder.displayName(ApolloComponent.fromLegacyAmpersand(displayName)); + } + + return builder.build(); + } + + @Override + public void serialize(Type type, @Nullable HeightLimit heightLimit, ConfigurationNode node) throws SerializationException { + if (heightLimit == null) { + node.raw(null); + return; + } + + node.node("world").set(heightLimit.getWorld()); + node.node("limit").set(heightLimit.getLimit()); + + Component displayName = heightLimit.getDisplayName(); + if (displayName != null) { + node.node("display-name").set(ApolloComponent.toLegacyAmpersand(displayName)); + } + } + + private ConfigurationNode virtualNode(ConfigurationNode source, Object... path) throws SerializationException { + if (!source.hasChild(path)) { + throw new SerializationException("Required field " + Arrays.toString(path) + " not found!"); + } + + return source.node(path); + } + } + +} diff --git a/common/src/main/java/com/lunarclient/apollo/module/packetenrichment/PacketEnrichmentImpl.java b/common/src/main/java/com/lunarclient/apollo/module/packetenrichment/PacketEnrichmentImpl.java index 1446ef11..cbc97f0d 100644 --- a/common/src/main/java/com/lunarclient/apollo/module/packetenrichment/PacketEnrichmentImpl.java +++ b/common/src/main/java/com/lunarclient/apollo/module/packetenrichment/PacketEnrichmentImpl.java @@ -56,6 +56,10 @@ public PacketEnrichmentImpl() { } private void onReceivePacket(ApolloReceivePacketEvent event) { + if (!this.isEnabled()) { + return; + } + Options options = this.getOptions(); if (options.get(PacketEnrichmentModule.PLAYER_ATTACK_EVENT)) { diff --git a/common/src/main/java/com/lunarclient/apollo/module/waypoint/WaypointModuleImpl.java b/common/src/main/java/com/lunarclient/apollo/module/waypoint/WaypointModuleImpl.java index b9ed8e3b..320eab67 100644 --- a/common/src/main/java/com/lunarclient/apollo/module/waypoint/WaypointModuleImpl.java +++ b/common/src/main/java/com/lunarclient/apollo/module/waypoint/WaypointModuleImpl.java @@ -110,6 +110,10 @@ public void hideWaypoint(@NonNull Recipients recipients, @NonNull String waypoin } private void onPlayerRegister(ApolloRegisterPlayerEvent event) { + if (!this.isEnabled()) { + return; + } + ApolloPlayer player = event.getPlayer(); List waypoints = this.getOptions().get(player, WaypointModule.DEFAULT_WAYPOINTS); diff --git a/docs/developers/lightweight/protobuf.mdx b/docs/developers/lightweight/protobuf.mdx index f39b9e45..2759440a 100644 --- a/docs/developers/lightweight/protobuf.mdx +++ b/docs/developers/lightweight/protobuf.mdx @@ -26,7 +26,7 @@ Available fields for each message, including their types, are available on the B com.lunarclient apollo-protos - 0.2.0 + 0.2.1 ``` @@ -41,7 +41,7 @@ Available fields for each message, including their types, are available on the B } dependencies { - api 'com.lunarclient:apollo-protos:0.2.0' + api 'com.lunarclient:apollo-protos:0.2.1' } ``` @@ -55,7 +55,7 @@ Available fields for each message, including their types, are available on the B } dependencies { - api("com.lunarclient:apollo-protos:0.2.0") + api("com.lunarclient:apollo-protos:0.2.1") } ``` diff --git a/docs/developers/modules.mdx b/docs/developers/modules.mdx index 16803d54..1d8f8fc7 100644 --- a/docs/developers/modules.mdx +++ b/docs/developers/modules.mdx @@ -16,9 +16,11 @@ These modules are available to all servers using Apollo and do not require any p 🔗 [Entity](/apollo/developers/modules/entity)
🔗 [Glint](/apollo/developers/modules/glint)
🔗 [Glow](/apollo/developers/modules/glow)
+🔗 [Height Limit](/apollo/developers/modules/heightlimit)
🔗 [Hologram](/apollo/developers/modules/hologram)
🔗 [Inventory](/apollo/developers/modules/inventory)
🔗 [Limb](/apollo/developers/modules/limb)
+🔗 [Marker](/apollo/developers/modules/marker)
🔗 [Mod Setting](/apollo/developers/modules/modsetting)
🔗 [Nametag](/apollo/developers/modules/nametag)
🔗 [Nick Hider](/apollo/developers/modules/nickhider)
diff --git a/docs/developers/modules/_meta.json b/docs/developers/modules/_meta.json index 182a8a35..11e872d0 100644 --- a/docs/developers/modules/_meta.json +++ b/docs/developers/modules/_meta.json @@ -9,6 +9,7 @@ "entity": "Entity", "glint": "Glint", "glow": "Glow", + "heightlimit": "Height Limit", "hologram": "Hologram", "inventory": "Inventory", "limb": "Limb", diff --git a/docs/developers/modules/heightlimit.mdx b/docs/developers/modules/heightlimit.mdx new file mode 100644 index 00000000..b22148dd --- /dev/null +++ b/docs/developers/modules/heightlimit.mdx @@ -0,0 +1,202 @@ +import { Callout, Tab, Tabs } from 'nextra-theme-docs' + +# Height Limit Module + +## Overview + +The height limit module allows servers to control the build-height limit displayed by the Height Limit mod. + +- Adds the ability to set a height limit per world, rendered as a block overlay and HUD display. + + + This module is disabled by default, if you wish to use this module you will need to enable it in `config.yml`. + + + + This module only provides a visual indicator for the player, the server is still responsible for cancelling block placement above the height limit. + + +## Integration + +### Sample Code +Explore each integration by cycling through each tab, to find the best fit for your requirements and needs. + + + + + + +**Apollo API examples.** See [General](/apollo/developers/general) for common patterns and helpers. + + +### Overriding a Height Limit + +```java +public void overrideHeightLimitExample(Player viewer) { + Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId()); + + apolloPlayerOpt.ifPresent(apolloPlayer -> { + this.heightLimitModule.overrideHeightLimit(apolloPlayer, HeightLimit.builder() + .world("world_the_end") + .limit(150) + .displayName(Component.text("The End", NamedTextColor.DARK_PURPLE)) + .build() + ); + }); +} +``` + +### Removing a Height Limit + +```java +public void removeHeightLimitExample(Player viewer) { + Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId()); + apolloPlayerOpt.ifPresent(apolloPlayer -> this.heightLimitModule.removeHeightLimit(apolloPlayer, "world_the_end")); +} +``` + +### Resetting all Height Limits + +```java +public void resetHeightLimitsExample(Player viewer) { + Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId()); + apolloPlayerOpt.ifPresent(this.heightLimitModule::resetHeightLimits); +} +``` + +### `HeightLimit` Options + +`.world(String)` is the world, by name, that you wish to apply the height limit to. Sending a height limit for an already-known world replaces that worlds entry. + +```java +.world("world_the_end") +``` + +`.limit(Integer)` is the Y level where block placement is denied. The highest buildable layer is `limit - 1`. + +```java +.limit(150) +``` + +`.displayName(Component)` is the optional display name shown on the clients height limit HUD. + +```java +.displayName(Component.text("The End", NamedTextColor.DARK_PURPLE)) +``` + + + + + + +**Lightweight Protobuf examples.** See [Lightweight Protobuf](/apollo/developers/lightweight/protobuf) for setup. + + + + Make sure the server is sending the world name to the client as show in the [Player Detection](/apollo/developers/lightweight/protobuf/player-detection) example. + + +**Overriding a Height Limit** + +```java +public void overrideHeightLimitExample(Player viewer) { + OverrideHeightLimitMessage message = OverrideHeightLimitMessage.newBuilder() + .setWorld("world_the_end") + .setLimit(150) + .setDisplayNameAdventureJsonLines(AdventureUtil.toJson( + Component.text("The End", NamedTextColor.DARK_PURPLE) + )) + .build(); + + ProtobufPacketUtil.sendPacket(viewer, message); +} +``` + +**Removing a Height Limit** + +```java +public void removeHeightLimitExample(Player viewer) { + RemoveHeightLimitMessage message = RemoveHeightLimitMessage.newBuilder() + .setWorld("world_the_end") + .build(); + + ProtobufPacketUtil.sendPacket(viewer, message); +} +``` + +**Resetting all Height Limits** + +```java +public void resetHeightLimitsExample(Player viewer) { + ResetHeightLimitsMessage message = ResetHeightLimitsMessage.getDefaultInstance(); + ProtobufPacketUtil.sendPacket(viewer, message); +} +``` + + + + + + +**Lightweight JSON examples.** See [Lightweight JSON](/apollo/developers/lightweight/json) for setup. + + + + Make sure the server is sending the world name to the client as show in the [Player Detection](/apollo/developers/lightweight/json/player-detection) example. + + +**Overriding a Height Limit** + +```java +public void overrideHeightLimitExample(Player viewer) { + JsonObject message = new JsonObject(); + message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.heightlimit.v1.OverrideHeightLimitMessage"); + message.addProperty("world", "world_the_end"); + message.addProperty("limit", 150); + message.addProperty("display_name_adventure_json_lines", AdventureUtil.toJson( + Component.text("The End", NamedTextColor.DARK_PURPLE) + )); + + JsonPacketUtil.sendPacket(viewer, message); +} +``` + +**Removing a Height Limit** + +```java +public void removeHeightLimitExample(Player viewer) { + JsonObject message = new JsonObject(); + message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.heightlimit.v1.RemoveHeightLimitMessage"); + message.addProperty("world", "world_the_end"); + + JsonPacketUtil.sendPacket(viewer, message); +} +``` + +**Resetting all Height Limits** + +```java +public void resetHeightLimitsExample(Player viewer) { + JsonObject message = new JsonObject(); + message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.heightlimit.v1.ResetHeightLimitsMessage"); + + JsonPacketUtil.sendPacket(viewer, message); +} +``` + + + + + +## Available options + +- __`DEFAULT_HEIGHT_LIMITS`__ + - Sets the default height limits to send to the player. + - Values + - Type: `List` + - Default: + ```yaml + - world: world + limit: 200 + display-name: '&6Overworld' + ``` diff --git a/docs/developers/modules/waypoint.mdx b/docs/developers/modules/waypoint.mdx index d693cd68..78642822 100644 --- a/docs/developers/modules/waypoint.mdx +++ b/docs/developers/modules/waypoint.mdx @@ -433,7 +433,18 @@ public void resetWaypointsExample(Player viewer) { - Sets the default waypoints to send to the player. - Values - Type: `List` - - Default: `Empty List` + - Default: + ```yaml + - name: Spawn + location: + world: world + x: 0 + y: 100 + z: 0 + color: '#FF0000' + prevent-removal: false + hidden: false + ``` ## Automatic Waypoint Creation from Chat diff --git a/example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/ApolloApiExamplePlatform.java b/example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/ApolloApiExamplePlatform.java index 2ae26a66..ffdc2396 100644 --- a/example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/ApolloApiExamplePlatform.java +++ b/example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/ApolloApiExamplePlatform.java @@ -40,6 +40,7 @@ import com.lunarclient.apollo.example.api.module.CosmeticApiExample; import com.lunarclient.apollo.example.api.module.EntityApiExample; import com.lunarclient.apollo.example.api.module.GlowApiExample; +import com.lunarclient.apollo.example.api.module.HeightLimitApiExample; import com.lunarclient.apollo.example.api.module.HologramApiExample; import com.lunarclient.apollo.example.api.module.LimbApiExample; import com.lunarclient.apollo.example.api.module.MarkerApiExample; @@ -93,6 +94,7 @@ public void registerModuleExamples() { this.setCooldownExample(new CooldownApiExample()); this.setEntityExample(new EntityApiExample()); this.setGlowExample(new GlowApiExample()); + this.setHeightLimitExample(new HeightLimitApiExample()); this.setHologramExample(new HologramApiExample()); this.setLimbExample(new LimbApiExample()); this.setMarkerExample(new MarkerApiExample()); diff --git a/example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/HeightLimitApiExample.java b/example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/HeightLimitApiExample.java new file mode 100644 index 00000000..39955281 --- /dev/null +++ b/example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/HeightLimitApiExample.java @@ -0,0 +1,66 @@ +/* + * This file is part of Apollo, licensed under the MIT License. + * + * Copyright (c) 2026 Moonsworth + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +package com.lunarclient.apollo.example.api.module; + +import com.lunarclient.apollo.Apollo; +import com.lunarclient.apollo.example.module.impl.HeightLimitExample; +import com.lunarclient.apollo.module.heightlimit.HeightLimit; +import com.lunarclient.apollo.module.heightlimit.HeightLimitModule; +import com.lunarclient.apollo.player.ApolloPlayer; +import java.util.Optional; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.format.NamedTextColor; +import org.bukkit.entity.Player; + +public class HeightLimitApiExample extends HeightLimitExample { + + private final HeightLimitModule heightLimitModule = Apollo.getModuleManager().getModule(HeightLimitModule.class); + + @Override + public void overrideHeightLimitExample(Player viewer) { + Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId()); + + apolloPlayerOpt.ifPresent(apolloPlayer -> { + this.heightLimitModule.overrideHeightLimit(apolloPlayer, HeightLimit.builder() + .world("world_the_end") + .limit(150) + .displayName(Component.text("The End", NamedTextColor.DARK_PURPLE)) + .build() + ); + }); + } + + @Override + public void removeHeightLimitExample(Player viewer) { + Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId()); + apolloPlayerOpt.ifPresent(apolloPlayer -> this.heightLimitModule.removeHeightLimit(apolloPlayer, "world_the_end")); + } + + @Override + public void resetHeightLimitsExample(Player viewer) { + Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId()); + apolloPlayerOpt.ifPresent(this.heightLimitModule::resetHeightLimits); + } + +} diff --git a/example/bukkit/api/src/main/resources/plugin.yml b/example/bukkit/api/src/main/resources/plugin.yml index 9ba142c0..c16d024b 100644 --- a/example/bukkit/api/src/main/resources/plugin.yml +++ b/example/bukkit/api/src/main/resources/plugin.yml @@ -36,6 +36,8 @@ commands: description: "Glint!" glow: description: "Glow!" + heightlimit: + description: "Height Limit!" hologram: description: "Holograms!" inventory: diff --git a/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/ApolloExamplePlugin.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/ApolloExamplePlugin.java index c39d80f2..94092492 100644 --- a/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/ApolloExamplePlugin.java +++ b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/ApolloExamplePlugin.java @@ -34,6 +34,7 @@ import com.lunarclient.apollo.example.command.EntityCommand; import com.lunarclient.apollo.example.command.GlintCommand; import com.lunarclient.apollo.example.command.GlowCommand; +import com.lunarclient.apollo.example.command.HeightLimitCommand; import com.lunarclient.apollo.example.command.HologramCommand; import com.lunarclient.apollo.example.command.InventoryCommand; import com.lunarclient.apollo.example.command.LimbCommand; @@ -68,6 +69,7 @@ import com.lunarclient.apollo.example.module.impl.EntityExample; import com.lunarclient.apollo.example.module.impl.GlintExample; import com.lunarclient.apollo.example.module.impl.GlowExample; +import com.lunarclient.apollo.example.module.impl.HeightLimitExample; import com.lunarclient.apollo.example.module.impl.HologramExample; import com.lunarclient.apollo.example.module.impl.InventoryExample; import com.lunarclient.apollo.example.module.impl.LimbExample; @@ -114,6 +116,7 @@ public abstract class ApolloExamplePlugin extends JavaPlugin { private EntityExample entityExample; private GlintExample glintExample; private GlowExample glowExample; + private HeightLimitExample heightLimitExample; private HologramExample hologramExample; private InventoryExample inventoryExample; private LimbExample limbExample; @@ -173,6 +176,7 @@ private void registerCommonCommands() { this.getCommand("entity").setExecutor(new EntityCommand()); this.getCommand("glint").setExecutor(new GlintCommand()); this.getCommand("glow").setExecutor(new GlowCommand()); + this.getCommand("heightlimit").setExecutor(new HeightLimitCommand()); this.getCommand("hologram").setExecutor(new HologramCommand()); this.getCommand("inventory").setExecutor(new InventoryCommand()); this.getCommand("limb").setExecutor(new LimbCommand()); diff --git a/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/HeightLimitCommand.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/HeightLimitCommand.java new file mode 100644 index 00000000..7a4a3e68 --- /dev/null +++ b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/HeightLimitCommand.java @@ -0,0 +1,79 @@ +/* + * This file is part of Apollo, licensed under the MIT License. + * + * Copyright (c) 2026 Moonsworth + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +package com.lunarclient.apollo.example.command; + +import com.lunarclient.apollo.example.ApolloExamplePlugin; +import com.lunarclient.apollo.example.module.impl.HeightLimitExample; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.jetbrains.annotations.NotNull; + +public class HeightLimitCommand implements CommandExecutor { + + @Override + public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) { + if (!(sender instanceof Player)) { + sender.sendMessage("Player only!"); + return true; + } + + Player player = (Player) sender; + + if (args.length != 1) { + player.sendMessage("Usage: /heightlimit "); + return true; + } + + HeightLimitExample heightLimitExample = ApolloExamplePlugin.getInstance().getHeightLimitExample(); + + switch (args[0].toLowerCase()) { + case "override": { + heightLimitExample.overrideHeightLimitExample(player); + player.sendMessage("Overriding height limit...."); + break; + } + + case "remove": { + heightLimitExample.removeHeightLimitExample(player); + player.sendMessage("Removing height limit...."); + break; + } + + case "reset": { + heightLimitExample.resetHeightLimitsExample(player); + player.sendMessage("Resetting height limits..."); + break; + } + + default: { + player.sendMessage("Usage: /heightlimit "); + break; + } + } + + return true; + } +} diff --git a/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/HeightLimitExample.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/HeightLimitExample.java new file mode 100644 index 00000000..9246625f --- /dev/null +++ b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/HeightLimitExample.java @@ -0,0 +1,37 @@ +/* + * This file is part of Apollo, licensed under the MIT License. + * + * Copyright (c) 2026 Moonsworth + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +package com.lunarclient.apollo.example.module.impl; + +import com.lunarclient.apollo.example.module.ApolloModuleExample; +import org.bukkit.entity.Player; + +public abstract class HeightLimitExample extends ApolloModuleExample { + + public abstract void overrideHeightLimitExample(Player viewer); + + public abstract void removeHeightLimitExample(Player viewer); + + public abstract void resetHeightLimitsExample(Player viewer); + +} diff --git a/example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/ApolloJsonExamplePlatform.java b/example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/ApolloJsonExamplePlatform.java index 391c46d7..4ffba9cd 100644 --- a/example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/ApolloJsonExamplePlatform.java +++ b/example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/ApolloJsonExamplePlatform.java @@ -36,6 +36,7 @@ import com.lunarclient.apollo.example.json.module.CosmeticJsonExample; import com.lunarclient.apollo.example.json.module.EntityJsonExample; import com.lunarclient.apollo.example.json.module.GlowJsonExample; +import com.lunarclient.apollo.example.json.module.HeightLimitJsonExample; import com.lunarclient.apollo.example.json.module.HologramJsonExample; import com.lunarclient.apollo.example.json.module.LimbJsonExample; import com.lunarclient.apollo.example.json.module.MarkerJsonExample; @@ -81,6 +82,7 @@ public void registerModuleExamples() { this.setCooldownExample(new CooldownJsonExample()); this.setEntityExample(new EntityJsonExample()); this.setGlowExample(new GlowJsonExample()); + this.setHeightLimitExample(new HeightLimitJsonExample()); this.setHologramExample(new HologramJsonExample()); this.setLimbExample(new LimbJsonExample()); this.setMarkerExample(new MarkerJsonExample()); diff --git a/example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/HeightLimitJsonExample.java b/example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/HeightLimitJsonExample.java new file mode 100644 index 00000000..37f8e89d --- /dev/null +++ b/example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/HeightLimitJsonExample.java @@ -0,0 +1,66 @@ +/* + * This file is part of Apollo, licensed under the MIT License. + * + * Copyright (c) 2026 Moonsworth + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +package com.lunarclient.apollo.example.json.module; + +import com.google.gson.JsonObject; +import com.lunarclient.apollo.example.json.util.AdventureUtil; +import com.lunarclient.apollo.example.json.util.JsonPacketUtil; +import com.lunarclient.apollo.example.module.impl.HeightLimitExample; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.format.NamedTextColor; +import org.bukkit.entity.Player; + +public class HeightLimitJsonExample extends HeightLimitExample { + + @Override + public void overrideHeightLimitExample(Player viewer) { + JsonObject message = new JsonObject(); + message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.heightlimit.v1.OverrideHeightLimitMessage"); + message.addProperty("world", "world_the_end"); + message.addProperty("limit", 150); + message.addProperty("display_name_adventure_json_lines", AdventureUtil.toJson( + Component.text("The End", NamedTextColor.DARK_PURPLE) + )); + + JsonPacketUtil.sendPacket(viewer, message); + } + + @Override + public void removeHeightLimitExample(Player viewer) { + JsonObject message = new JsonObject(); + message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.heightlimit.v1.RemoveHeightLimitMessage"); + message.addProperty("world", "world_the_end"); + + JsonPacketUtil.sendPacket(viewer, message); + } + + @Override + public void resetHeightLimitsExample(Player viewer) { + JsonObject message = new JsonObject(); + message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.heightlimit.v1.ResetHeightLimitsMessage"); + + JsonPacketUtil.sendPacket(viewer, message); + } + +} diff --git a/example/bukkit/json/src/main/resources/plugin.yml b/example/bukkit/json/src/main/resources/plugin.yml index 334fe2a4..e92e59a4 100644 --- a/example/bukkit/json/src/main/resources/plugin.yml +++ b/example/bukkit/json/src/main/resources/plugin.yml @@ -32,6 +32,8 @@ commands: description: "Glint!" glow: description: "Glow!" + heightlimit: + description: "Height Limit!" hologram: description: "Holograms!" inventory: diff --git a/example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/ApolloProtoExamplePlatform.java b/example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/ApolloProtoExamplePlatform.java index 94578ad4..5c0b2a5c 100644 --- a/example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/ApolloProtoExamplePlatform.java +++ b/example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/ApolloProtoExamplePlatform.java @@ -36,6 +36,7 @@ import com.lunarclient.apollo.example.proto.module.CosmeticProtoExample; import com.lunarclient.apollo.example.proto.module.EntityProtoExample; import com.lunarclient.apollo.example.proto.module.GlowProtoExample; +import com.lunarclient.apollo.example.proto.module.HeightLimitProtoExample; import com.lunarclient.apollo.example.proto.module.HologramProtoExample; import com.lunarclient.apollo.example.proto.module.LimbProtoExample; import com.lunarclient.apollo.example.proto.module.MarkerProtoExample; @@ -81,6 +82,7 @@ public void registerModuleExamples() { this.setCooldownExample(new CooldownProtoExample()); this.setEntityExample(new EntityProtoExample()); this.setGlowExample(new GlowProtoExample()); + this.setHeightLimitExample(new HeightLimitProtoExample()); this.setHologramExample(new HologramProtoExample()); this.setLimbExample(new LimbProtoExample()); this.setMarkerExample(new MarkerProtoExample()); diff --git a/example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/HeightLimitProtoExample.java b/example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/HeightLimitProtoExample.java new file mode 100644 index 00000000..babbce5b --- /dev/null +++ b/example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/HeightLimitProtoExample.java @@ -0,0 +1,66 @@ +/* + * This file is part of Apollo, licensed under the MIT License. + * + * Copyright (c) 2026 Moonsworth + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +package com.lunarclient.apollo.example.proto.module; + +import com.lunarclient.apollo.example.module.impl.HeightLimitExample; +import com.lunarclient.apollo.example.proto.util.AdventureUtil; +import com.lunarclient.apollo.example.proto.util.ProtobufPacketUtil; +import com.lunarclient.apollo.heightlimit.v1.OverrideHeightLimitMessage; +import com.lunarclient.apollo.heightlimit.v1.RemoveHeightLimitMessage; +import com.lunarclient.apollo.heightlimit.v1.ResetHeightLimitsMessage; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.format.NamedTextColor; +import org.bukkit.entity.Player; + +public class HeightLimitProtoExample extends HeightLimitExample { + + @Override + public void overrideHeightLimitExample(Player viewer) { + OverrideHeightLimitMessage message = OverrideHeightLimitMessage.newBuilder() + .setWorld("world_the_end") + .setLimit(150) + .setDisplayNameAdventureJsonLines(AdventureUtil.toJson( + Component.text("The End", NamedTextColor.DARK_PURPLE) + )) + .build(); + + ProtobufPacketUtil.sendPacket(viewer, message); + } + + @Override + public void removeHeightLimitExample(Player viewer) { + RemoveHeightLimitMessage message = RemoveHeightLimitMessage.newBuilder() + .setWorld("world_the_end") + .build(); + + ProtobufPacketUtil.sendPacket(viewer, message); + } + + @Override + public void resetHeightLimitsExample(Player viewer) { + ResetHeightLimitsMessage message = ResetHeightLimitsMessage.getDefaultInstance(); + ProtobufPacketUtil.sendPacket(viewer, message); + } + +} diff --git a/example/bukkit/proto/src/main/resources/plugin.yml b/example/bukkit/proto/src/main/resources/plugin.yml index f74f917e..468f5d87 100644 --- a/example/bukkit/proto/src/main/resources/plugin.yml +++ b/example/bukkit/proto/src/main/resources/plugin.yml @@ -32,6 +32,8 @@ commands: description: "Glint!" glow: description: "Glow!" + heightlimit: + description: "Height Limit!" hologram: description: "Holograms!" inventory: diff --git a/extra/adventure4/src/main/java/com/lunarclient/apollo/common/ApolloComponent.java b/extra/adventure4/src/main/java/com/lunarclient/apollo/common/ApolloComponent.java index 93c11e7a..04176482 100644 --- a/extra/adventure4/src/main/java/com/lunarclient/apollo/common/ApolloComponent.java +++ b/extra/adventure4/src/main/java/com/lunarclient/apollo/common/ApolloComponent.java @@ -68,6 +68,30 @@ public static String toLegacy(@NonNull Component component) { return LegacyComponentSerializer.legacySection().serialize(component); } + /** + * Returns a new component from the provided legacy {@link String}, + * using {@code &} color codes. + * + * @param legacy the legacy string for this component + * @return the component from the legacy string + * @since 1.2.9 + */ + public static Component fromLegacyAmpersand(@NonNull String legacy) { + return LegacyComponentSerializer.legacyAmpersand().deserialize(legacy); + } + + /** + * Returns this component as a legacy {@link String}, + * using {@code &} color codes. + * + * @param component the component to make into a legacy string + * @return the legacy string for this component + * @since 1.2.9 + */ + public static String toLegacyAmpersand(@NonNull Component component) { + return LegacyComponentSerializer.legacyAmpersand().serialize(component); + } + private ApolloComponent() { } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index d83b4d64..8f52700a 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -11,7 +11,7 @@ geantyref = "1.3.11" idea = "1.1.7" jetbrains = "24.0.1" lombok = "1.18.38" -protobuf = "0.2.0" +protobuf = "0.2.1" gson = "2.10.1" shadow = "9.4.1" spotless = "8.4.0" diff --git a/platform/bukkit/src/main/java/com/lunarclient/apollo/ApolloBukkitPlatform.java b/platform/bukkit/src/main/java/com/lunarclient/apollo/ApolloBukkitPlatform.java index 6de2e988..c485822d 100644 --- a/platform/bukkit/src/main/java/com/lunarclient/apollo/ApolloBukkitPlatform.java +++ b/platform/bukkit/src/main/java/com/lunarclient/apollo/ApolloBukkitPlatform.java @@ -50,6 +50,8 @@ import com.lunarclient.apollo.module.glint.GlintModule; import com.lunarclient.apollo.module.glow.GlowModule; import com.lunarclient.apollo.module.glow.GlowModuleImpl; +import com.lunarclient.apollo.module.heightlimit.HeightLimitModule; +import com.lunarclient.apollo.module.heightlimit.HeightLimitModuleImpl; import com.lunarclient.apollo.module.hologram.HologramModule; import com.lunarclient.apollo.module.hologram.HologramModuleImpl; import com.lunarclient.apollo.module.inventory.InventoryModule; @@ -149,6 +151,7 @@ public void onEnable() { .addModule(EntityModule.class, new EntityModuleImpl()) .addModule(GlintModule.class) .addModule(GlowModule.class, new GlowModuleImpl()) + .addModule(HeightLimitModule.class, new HeightLimitModuleImpl()) .addModule(HologramModule.class, new HologramModuleImpl()) .addModule(InventoryModule.class) .addModule(LimbModule.class, new LimbModuleImpl()) diff --git a/platform/bungee/src/main/java/com/lunarclient/apollo/ApolloBungeePlatform.java b/platform/bungee/src/main/java/com/lunarclient/apollo/ApolloBungeePlatform.java index a5f50d27..74215459 100644 --- a/platform/bungee/src/main/java/com/lunarclient/apollo/ApolloBungeePlatform.java +++ b/platform/bungee/src/main/java/com/lunarclient/apollo/ApolloBungeePlatform.java @@ -46,6 +46,8 @@ import com.lunarclient.apollo.module.cosmetic.CosmeticModuleImpl; import com.lunarclient.apollo.module.entity.EntityModule; import com.lunarclient.apollo.module.entity.EntityModuleImpl; +import com.lunarclient.apollo.module.heightlimit.HeightLimitModule; +import com.lunarclient.apollo.module.heightlimit.HeightLimitModuleImpl; import com.lunarclient.apollo.module.hologram.HologramModule; import com.lunarclient.apollo.module.hologram.HologramModuleImpl; import com.lunarclient.apollo.module.limb.LimbModule; @@ -131,6 +133,7 @@ public void onEnable() { .addModule(CombatModule.class) .addModule(CooldownModule.class, new CooldownModuleImpl()) .addModule(EntityModule.class, new EntityModuleImpl()) + .addModule(HeightLimitModule.class, new HeightLimitModuleImpl()) .addModule(HologramModule.class, new HologramModuleImpl()) .addModule(LimbModule.class, new LimbModuleImpl()) .addModule(MarkerModule.class, new MarkerModuleImpl()) diff --git a/platform/folia/src/main/java/com/lunarclient/apollo/ApolloFoliaPlatform.java b/platform/folia/src/main/java/com/lunarclient/apollo/ApolloFoliaPlatform.java index 19a4878b..5255e8e3 100644 --- a/platform/folia/src/main/java/com/lunarclient/apollo/ApolloFoliaPlatform.java +++ b/platform/folia/src/main/java/com/lunarclient/apollo/ApolloFoliaPlatform.java @@ -48,6 +48,8 @@ import com.lunarclient.apollo.module.entity.EntityModuleImpl; import com.lunarclient.apollo.module.glow.GlowModule; import com.lunarclient.apollo.module.glow.GlowModuleImpl; +import com.lunarclient.apollo.module.heightlimit.HeightLimitModule; +import com.lunarclient.apollo.module.heightlimit.HeightLimitModuleImpl; import com.lunarclient.apollo.module.hologram.HologramModule; import com.lunarclient.apollo.module.hologram.HologramModuleImpl; import com.lunarclient.apollo.module.limb.LimbModule; @@ -138,6 +140,7 @@ public void onEnable() { .addModule(CooldownModule.class, new CooldownModuleImpl()) .addModule(EntityModule.class, new EntityModuleImpl()) .addModule(GlowModule.class, new GlowModuleImpl()) + .addModule(HeightLimitModule.class, new HeightLimitModuleImpl()) .addModule(HologramModule.class, new HologramModuleImpl()) .addModule(LimbModule.class, new LimbModuleImpl()) .addModule(MarkerModule.class, new MarkerModuleImpl()) diff --git a/platform/minestom/src/main/java/com/lunarclient/apollo/ApolloMinestomPlatform.java b/platform/minestom/src/main/java/com/lunarclient/apollo/ApolloMinestomPlatform.java index 8c2e26ab..b1d97ad7 100644 --- a/platform/minestom/src/main/java/com/lunarclient/apollo/ApolloMinestomPlatform.java +++ b/platform/minestom/src/main/java/com/lunarclient/apollo/ApolloMinestomPlatform.java @@ -49,6 +49,8 @@ import com.lunarclient.apollo.module.glint.GlintModule; import com.lunarclient.apollo.module.glow.GlowModule; import com.lunarclient.apollo.module.glow.GlowModuleImpl; +import com.lunarclient.apollo.module.heightlimit.HeightLimitModule; +import com.lunarclient.apollo.module.heightlimit.HeightLimitModuleImpl; import com.lunarclient.apollo.module.hologram.HologramModule; import com.lunarclient.apollo.module.hologram.HologramModuleImpl; import com.lunarclient.apollo.module.inventory.InventoryModule; @@ -171,6 +173,7 @@ public static void init(ApolloMinestomProperties properties) { .addModule(EntityModule.class, new EntityModuleImpl()) .addModule(GlintModule.class) .addModule(GlowModule.class, new GlowModuleImpl()) + .addModule(HeightLimitModule.class, new HeightLimitModuleImpl()) .addModule(HologramModule.class, new HologramModuleImpl()) .addModule(InventoryModule.class) .addModule(LimbModule.class, new LimbModuleImpl()) diff --git a/platform/velocity/src/main/java/com/lunarclient/apollo/ApolloVelocityPlatform.java b/platform/velocity/src/main/java/com/lunarclient/apollo/ApolloVelocityPlatform.java index 8d3ed35f..3b801511 100644 --- a/platform/velocity/src/main/java/com/lunarclient/apollo/ApolloVelocityPlatform.java +++ b/platform/velocity/src/main/java/com/lunarclient/apollo/ApolloVelocityPlatform.java @@ -46,6 +46,8 @@ import com.lunarclient.apollo.module.cosmetic.CosmeticModuleImpl; import com.lunarclient.apollo.module.entity.EntityModule; import com.lunarclient.apollo.module.entity.EntityModuleImpl; +import com.lunarclient.apollo.module.heightlimit.HeightLimitModule; +import com.lunarclient.apollo.module.heightlimit.HeightLimitModuleImpl; import com.lunarclient.apollo.module.hologram.HologramModule; import com.lunarclient.apollo.module.hologram.HologramModuleImpl; import com.lunarclient.apollo.module.limb.LimbModule; @@ -198,6 +200,7 @@ public void onProxyInitialization(ProxyInitializeEvent event) { .addModule(CombatModule.class) .addModule(CooldownModule.class, new CooldownModuleImpl()) .addModule(EntityModule.class, new EntityModuleImpl()) + .addModule(HeightLimitModule.class, new HeightLimitModuleImpl()) .addModule(HologramModule.class, new HologramModuleImpl()) .addModule(LimbModule.class, new LimbModuleImpl()) .addModule(MarkerModule.class, new MarkerModuleImpl())