From dd7b23f1d3514549688797a9bb010564e5072e80 Mon Sep 17 00:00:00 2001 From: connorhartley Date: Tue, 23 Apr 2024 21:37:33 +1200 Subject: [PATCH 1/8] add ping markers module --- .../ApolloPlayerRequestPingEvent.java | 82 +++++++++ .../apollo/module/pingmarker/PingMarker.java | 103 ++++++++++++ .../module/pingmarker/PingMarkerModule.java | 111 +++++++++++++ .../module/pingmarker/PingMarkerType.java | 58 +++++++ .../apollo/recipients/Recipients.java | 14 ++ .../apollo/ApolloBukkitPlatform.java | 3 + .../pingmarker/PingMarkerModuleImpl.java | 157 ++++++++++++++++++ 7 files changed, 528 insertions(+) create mode 100644 api/src/main/java/com/lunarclient/apollo/event/pingmarker/ApolloPlayerRequestPingEvent.java create mode 100644 api/src/main/java/com/lunarclient/apollo/module/pingmarker/PingMarker.java create mode 100644 api/src/main/java/com/lunarclient/apollo/module/pingmarker/PingMarkerModule.java create mode 100644 api/src/main/java/com/lunarclient/apollo/module/pingmarker/PingMarkerType.java create mode 100644 common/src/main/java/com/lunarclient/apollo/module/pingmarker/PingMarkerModuleImpl.java diff --git a/api/src/main/java/com/lunarclient/apollo/event/pingmarker/ApolloPlayerRequestPingEvent.java b/api/src/main/java/com/lunarclient/apollo/event/pingmarker/ApolloPlayerRequestPingEvent.java new file mode 100644 index 00000000..7a2b7dd9 --- /dev/null +++ b/api/src/main/java/com/lunarclient/apollo/event/pingmarker/ApolloPlayerRequestPingEvent.java @@ -0,0 +1,82 @@ +/* + * This file is part of Apollo, licensed under the MIT License. + * + * Copyright (c) 2023 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.event.pingmarker; + +import com.lunarclient.apollo.common.location.ApolloLocation; +import com.lunarclient.apollo.event.EventCancellable; +import com.lunarclient.apollo.module.pingmarker.PingMarkerType; +import com.lunarclient.apollo.player.ApolloPlayer; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import lombok.Setter; +import lombok.experimental.FieldDefaults; +import lombok.experimental.NonFinal; +import org.jetbrains.annotations.Nullable; + +/** + * Represents an event that is fired when the player requests a ping. + * + * @since 1.1.3 + */ +@Getter +@RequiredArgsConstructor +@FieldDefaults(level = AccessLevel.PRIVATE, makeFinal = true) +public final class ApolloPlayerRequestPingEvent implements EventCancellable { + + /** + * The player sending the ping request. + * + * @return the source player + * @since 1.1.3 + */ + ApolloPlayer player; + + /** + * The {@link PingMarkerType} for this request. + * + * @return the ping marker type + * @since 1.1.3 + */ + @Nullable PingMarkerType type; + + /** + * The source {@link ApolloLocation} for this request. + * + * @return the source location + * @since 1.1.3 + */ + ApolloLocation source; + + /** + * The target {@link ApolloLocation} for this request. + * + * @return the target location + * @since 1.1.3 + */ + ApolloLocation target; + + @NonFinal @Setter boolean cancelled; + +} diff --git a/api/src/main/java/com/lunarclient/apollo/module/pingmarker/PingMarker.java b/api/src/main/java/com/lunarclient/apollo/module/pingmarker/PingMarker.java new file mode 100644 index 00000000..aa04f526 --- /dev/null +++ b/api/src/main/java/com/lunarclient/apollo/module/pingmarker/PingMarker.java @@ -0,0 +1,103 @@ +/* + * This file is part of Apollo, licensed under the MIT License. + * + * Copyright (c) 2023 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.pingmarker; + +import com.lunarclient.apollo.common.icon.Icon; +import com.lunarclient.apollo.common.location.ApolloLocation; +import java.awt.Color; +import java.time.Duration; +import java.util.UUID; +import lombok.Builder; +import lombok.Getter; +import org.jetbrains.annotations.Nullable; + +/** + * Represents a ping marker which can be shown on the client. + * + * @since 1.1.3 + */ +@Getter +@Builder +public final class PingMarker { + + /** + * Returns the marker {@link UUID}. + * + * @return the ping marker id + * @since 1.1.3 + */ + UUID id; + + /** + * Returns the {@link PingMarkerType}. + * + * @return the ping marker type + * @since 1.1.3 + */ + @Nullable PingMarkerType type; + + /** + * Returns the marker {@link ApolloLocation}. + * + * @return the ping marker location + * @since 1.1.3 + */ + ApolloLocation location; + + /** + * Returns the marker {@link Color}. + * + * @return the ping marker color + * @since 1.1.3 + */ + Color color; + + /** + * Returns the marker {@link Duration}. + * + * @return the ping marker duration + * @since 1.1.3 + */ + Duration duration; + + /** + * Returns whether the marker should animate. + * + * @return the ping marker focus state + * @since 1.1.3 + */ + boolean focus; + + /** + * Returns the ping marker {@link Icon}. + * + *

Can be any of the icons found in {@link com.lunarclient.apollo.common.icon} package, + * for the most common use case, use {@link com.lunarclient.apollo.common.icon.ItemStackIcon}.

+ * + * @return the ping marker icon + * @since 1.1.3 + */ + Icon icon; + +} diff --git a/api/src/main/java/com/lunarclient/apollo/module/pingmarker/PingMarkerModule.java b/api/src/main/java/com/lunarclient/apollo/module/pingmarker/PingMarkerModule.java new file mode 100644 index 00000000..b9e4b5d4 --- /dev/null +++ b/api/src/main/java/com/lunarclient/apollo/module/pingmarker/PingMarkerModule.java @@ -0,0 +1,111 @@ +/* + * This file is part of Apollo, licensed under the MIT License. + * + * Copyright (c) 2023 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.pingmarker; + +import com.lunarclient.apollo.module.ApolloModule; +import com.lunarclient.apollo.module.ModuleDefinition; +import com.lunarclient.apollo.recipients.Recipients; +import java.util.UUID; +import org.jetbrains.annotations.ApiStatus; + +/** + * Represents the ping marker module. + * + * @since 1.0.0 + */ +@ApiStatus.NonExtendable +@ModuleDefinition(id = "ping_marker", name = "Ping Marker") +public abstract class PingMarkerModule extends ApolloModule { + + /** + * Sends the {@link PingMarkerType} to the {@link Recipients}. + * + * @param recipients the recipients that are receiving the packet + * @param type the marker type + * @since 1.1.3 + */ + public abstract void setMarkerType(Recipients recipients, PingMarkerType type); + + /** + * Removes the {@link PingMarkerType} from the {@link Recipients}. + * + * @param recipients the recipients that are receiving the packet + * @param name the marker type name + * @since 1.1.3 + */ + public abstract void removeMarkerType(Recipients recipients, String name); + + /** + * Removes the {@link PingMarkerType} from the {@link Recipients}. + * + * @param recipients the recipients that are receiving the packet + * @param type the marker type + * @since 1.1.3 + */ + public abstract void removeMarkerType(Recipients recipients, PingMarkerType type); + + /** + * Resets all {@link PingMarkerType}s for the {@link Recipients}. + * + * @param recipients the recipients that are receiving the packet + * @since 1.1.3 + */ + public abstract void resetMarkerType(Recipients recipients); + + /** + * Displays the {@link PingMarker} to the {@link Recipients}. + * + * @param recipients the recipients that are receiving the packet + * @param marker the marker + * @since 1.1.3 + */ + public abstract void displayMarker(Recipients recipients, PingMarker marker); + + /** + * Removes the {@link PingMarker} from the {@link Recipients}. + * + * @param recipients the recipients that are receiving the packet + * @param markerId the marker id + * @since 1.1.3 + */ + public abstract void removeMarker(Recipients recipients, UUID markerId); + + /** + * Removes the {@link PingMarker} from the {@link Recipients}. + * + * @param recipients the recipients that are receiving the packet + * @param marker the marker + * @since 1.1.3 + */ + public abstract void removeMarker(Recipients recipients, PingMarker marker); + + /** + * Resets all {@link PingMarker}s for the {@link Recipients}. + * + * @param recipients the recipients that are receiving the packet + * @since 1.1.3 + */ + public abstract void resetMarkers(Recipients recipients); + +} diff --git a/api/src/main/java/com/lunarclient/apollo/module/pingmarker/PingMarkerType.java b/api/src/main/java/com/lunarclient/apollo/module/pingmarker/PingMarkerType.java new file mode 100644 index 00000000..d54fa31e --- /dev/null +++ b/api/src/main/java/com/lunarclient/apollo/module/pingmarker/PingMarkerType.java @@ -0,0 +1,58 @@ +/* + * This file is part of Apollo, licensed under the MIT License. + * + * Copyright (c) 2023 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.pingmarker; + +import com.lunarclient.apollo.common.icon.Icon; +import lombok.Builder; +import lombok.Getter; + +/** + * Represents a ping marker type which can be shown on the client. + * + * @since 1.1.3 + */ +@Getter +@Builder +public final class PingMarkerType { + + /** + * Returns the ping marker type {@link String} name. + * + * @return the ping marker type name + * @since 1.1.3 + */ + String name; + + /** + * Returns the ping marker {@link Icon}. + * + *

Can be any of the icons found in {@link com.lunarclient.apollo.common.icon} package, + * for the most common use case, use {@link com.lunarclient.apollo.common.icon.ItemStackIcon}.

+ * + * @return the ping marker icon + * @since 1.1.3 + */ + Icon icon; + +} diff --git a/api/src/main/java/com/lunarclient/apollo/recipients/Recipients.java b/api/src/main/java/com/lunarclient/apollo/recipients/Recipients.java index dbf3da03..596cc334 100644 --- a/api/src/main/java/com/lunarclient/apollo/recipients/Recipients.java +++ b/api/src/main/java/com/lunarclient/apollo/recipients/Recipients.java @@ -24,6 +24,8 @@ package com.lunarclient.apollo.recipients; import com.lunarclient.apollo.Apollo; +import com.lunarclient.apollo.player.ApolloPlayer; +import com.lunarclient.apollo.world.ApolloWorld; import java.util.function.Consumer; /** @@ -56,6 +58,18 @@ static ForwardingRecipients ofEveryone() { return () -> Apollo.getPlayerManager().getPlayers(); } + /** + * Creates a {@link ForwardingRecipients} instance representing apollo + * players in the same world as the provided {@link ApolloPlayer}. + * + * @param player the apollo player + * @return a {@code ForwardingRecipients} instance representing players in the world + * @since 1.1.3 + */ + static ForwardingRecipients ofWorld(ApolloPlayer player) { + return () -> player.getWorld().map(ApolloWorld::getPlayers).orElseGet(() -> Apollo.getPlayerManager().getPlayers()); + } + /** * Performs the given action on recipients. * diff --git a/bukkit/src/main/java/com/lunarclient/apollo/ApolloBukkitPlatform.java b/bukkit/src/main/java/com/lunarclient/apollo/ApolloBukkitPlatform.java index 502797a9..5d0df53c 100644 --- a/bukkit/src/main/java/com/lunarclient/apollo/ApolloBukkitPlatform.java +++ b/bukkit/src/main/java/com/lunarclient/apollo/ApolloBukkitPlatform.java @@ -57,6 +57,8 @@ import com.lunarclient.apollo.module.notification.NotificationModuleImpl; import com.lunarclient.apollo.module.packetenrichment.PacketEnrichmentImpl; import com.lunarclient.apollo.module.packetenrichment.PacketEnrichmentModule; +import com.lunarclient.apollo.module.pingmarker.PingMarkerModule; +import com.lunarclient.apollo.module.pingmarker.PingMarkerModuleImpl; import com.lunarclient.apollo.module.richpresence.RichPresenceModule; import com.lunarclient.apollo.module.richpresence.RichPresenceModuleImpl; import com.lunarclient.apollo.module.serverrule.ServerRuleModule; @@ -127,6 +129,7 @@ public void onEnable() { .addModule(NickHiderModule.class, new NickHiderModuleImpl()) .addModule(NotificationModule.class, new NotificationModuleImpl()) .addModule(PacketEnrichmentModule.class, new PacketEnrichmentImpl()) + .addModule(PingMarkerModule.class, new PingMarkerModuleImpl()) .addModule(RichPresenceModule.class, new RichPresenceModuleImpl()) .addModule(ServerRuleModule.class) .addModule(StaffModModule.class, new StaffModModuleImpl()) diff --git a/common/src/main/java/com/lunarclient/apollo/module/pingmarker/PingMarkerModuleImpl.java b/common/src/main/java/com/lunarclient/apollo/module/pingmarker/PingMarkerModuleImpl.java new file mode 100644 index 00000000..b8df3c60 --- /dev/null +++ b/common/src/main/java/com/lunarclient/apollo/module/pingmarker/PingMarkerModuleImpl.java @@ -0,0 +1,157 @@ +/* + * This file is part of Apollo, licensed under the MIT License. + * + * Copyright (c) 2023 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.pingmarker; + +import com.lunarclient.apollo.event.ApolloReceivePacketEvent; +import com.lunarclient.apollo.event.EventBus; +import com.lunarclient.apollo.event.pingmarker.ApolloPlayerRequestPingEvent; +import com.lunarclient.apollo.network.NetworkTypes; +import com.lunarclient.apollo.pingmarker.v1.DisplayPlayerPingMessage; +import com.lunarclient.apollo.pingmarker.v1.RemovePingMarkerTypeMessage; +import com.lunarclient.apollo.pingmarker.v1.RemovePlayerPingMessage; +import com.lunarclient.apollo.pingmarker.v1.RequestPlayerPingMessage; +import com.lunarclient.apollo.pingmarker.v1.ResetPingMarkerTypesMessage; +import com.lunarclient.apollo.pingmarker.v1.ResetPlayerPingMessage; +import com.lunarclient.apollo.pingmarker.v1.SetPingMarkerTypeMessage; +import com.lunarclient.apollo.player.AbstractApolloPlayer; +import com.lunarclient.apollo.recipients.Recipients; +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.ConcurrentHashMap; +import lombok.NonNull; + +/** + * Provides the ping marker module. + * + * @since 1.1.3 + */ +public final class PingMarkerModuleImpl extends PingMarkerModule { + + private final Map markerTypes = new ConcurrentHashMap<>(); + + /** + * Creates a new instance of {@link PingMarkerModuleImpl}. + * + * @since 1.1.3 + */ + public PingMarkerModuleImpl() { + super(); + + this.handle(ApolloReceivePacketEvent.class, this::onReceivePacket); + } + + @Override + public void setMarkerType(@NonNull Recipients recipients, @NonNull PingMarkerType type) { + SetPingMarkerTypeMessage message = SetPingMarkerTypeMessage.newBuilder() + .setId(type.getName()) + .setIcon(NetworkTypes.toProtobuf(type.getIcon())) + .build(); + + this.markerTypes.put(type.getName(), type); + + recipients.forEach(player -> ((AbstractApolloPlayer) player).sendPacket(message)); + } + + @Override + public void removeMarkerType(@NonNull Recipients recipients, @NonNull PingMarkerType type) { + this.removeMarkerType(recipients, type.getName()); + } + + @Override + public void removeMarkerType(@NonNull Recipients recipients, @NonNull String name) { + RemovePingMarkerTypeMessage message = RemovePingMarkerTypeMessage.newBuilder() + .setId(name) + .build(); + + this.markerTypes.remove(name); + + recipients.forEach(player -> ((AbstractApolloPlayer) player).sendPacket(message)); + } + + @Override + public void resetMarkerType(@NonNull Recipients recipients) { + ResetPingMarkerTypesMessage message = ResetPingMarkerTypesMessage.getDefaultInstance(); + + this.markerTypes.clear(); + + recipients.forEach(player -> ((AbstractApolloPlayer) player).sendPacket(message)); + } + + @Override + public void displayMarker(@NonNull Recipients recipients, @NonNull PingMarker marker) { + PingMarkerType type = marker.getType(); + + DisplayPlayerPingMessage.Builder messageBuilder = DisplayPlayerPingMessage.newBuilder() + .setId(NetworkTypes.toProtobuf(marker.getId())) + .setLocation(NetworkTypes.toProtobuf(marker.getLocation())) + .setColor(NetworkTypes.toProtobuf(marker.getColor())) + .setIcon(NetworkTypes.toProtobuf(marker.getIcon())) + .setDuration(NetworkTypes.toProtobuf(marker.getDuration())) + .setFocus(marker.isFocus()); + + if (type != null) { + messageBuilder.setType(type.getName()); + } + + recipients.forEach(player -> ((AbstractApolloPlayer) player).sendPacket(messageBuilder.build())); + } + + @Override + public void removeMarker(@NonNull Recipients recipients, @NonNull PingMarker marker) { + this.removeMarker(recipients, marker.getId()); + } + + @Override + public void removeMarker(@NonNull Recipients recipients, @NonNull UUID markerId) { + RemovePlayerPingMessage message = RemovePlayerPingMessage.newBuilder() + .setId(NetworkTypes.toProtobuf(markerId)) + .build(); + + recipients.forEach(player -> ((AbstractApolloPlayer) player).sendPacket(message)); + } + + @Override + public void resetMarkers(@NonNull Recipients recipients) { + ResetPlayerPingMessage message = ResetPlayerPingMessage.getDefaultInstance(); + recipients.forEach(player -> ((AbstractApolloPlayer) player).sendPacket(message)); + } + + private void onReceivePacket(ApolloReceivePacketEvent event) { + event.unpack(RequestPlayerPingMessage.class).ifPresent(packet -> { + ApolloPlayerRequestPingEvent playerRequestPingEvent = new ApolloPlayerRequestPingEvent( + event.getPlayer(), + this.markerTypes.get(packet.getType()), + NetworkTypes.fromProtobuf(packet.getSourceLocation()), + NetworkTypes.fromProtobuf(packet.getTargetLocation()) + ); + + EventBus.EventResult result = EventBus.getBus().post(playerRequestPingEvent); + + for (Throwable throwable : result.getThrowing()) { + throwable.printStackTrace(); + } + }); + } + +} From e3ec9886b7825c6d7312933a745798e647be7f4a Mon Sep 17 00:00:00 2001 From: connorhartley Date: Mon, 6 May 2024 22:37:29 +1200 Subject: [PATCH 2/8] add initial ping marker example --- .../apollo/example/ApolloExamplePlugin.java | 3 ++ .../example/listeners/PlayerListener.java | 10 ++++ .../example/modules/PingMarkerExample.java | 53 +++++++++++++++++++ 3 files changed, 66 insertions(+) create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/PingMarkerExample.java diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/ApolloExamplePlugin.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/ApolloExamplePlugin.java index 5088e289..968ae3df 100644 --- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/ApolloExamplePlugin.java +++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/ApolloExamplePlugin.java @@ -63,6 +63,7 @@ import com.lunarclient.apollo.example.modules.NametagExample; import com.lunarclient.apollo.example.modules.NickHiderExample; import com.lunarclient.apollo.example.modules.NotificationExample; +import com.lunarclient.apollo.example.modules.PingMarkerExample; import com.lunarclient.apollo.example.modules.RichPresenceExample; import com.lunarclient.apollo.example.modules.ServerRuleExample; import com.lunarclient.apollo.example.modules.StaffModExample; @@ -96,6 +97,7 @@ public class ApolloExamplePlugin extends JavaPlugin { private NametagExample nametagExample; private NickHiderExample nickHiderExample; private NotificationExample notificationExample; + private PingMarkerExample pingMarkerExample; private RichPresenceExample richPresenceExample; private ServerRuleExample serverRuleExample; private StaffModExample staffModExample; @@ -136,6 +138,7 @@ private void registerModuleExamples() { this.nametagExample = new NametagExample(); this.nickHiderExample = new NickHiderExample(); this.notificationExample = new NotificationExample(); + this.pingMarkerExample = new PingMarkerExample(); this.richPresenceExample = new RichPresenceExample(); this.serverRuleExample = new ServerRuleExample(); this.staffModExample = new StaffModExample(); diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/listeners/PlayerListener.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/listeners/PlayerListener.java index 4ab8e097..a46a1f51 100644 --- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/listeners/PlayerListener.java +++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/listeners/PlayerListener.java @@ -25,10 +25,12 @@ import com.lunarclient.apollo.event.ApolloListener; import com.lunarclient.apollo.event.Listen; +import com.lunarclient.apollo.event.pingmarker.ApolloPlayerRequestPingEvent; import com.lunarclient.apollo.event.player.ApolloRegisterPlayerEvent; import com.lunarclient.apollo.example.ApolloExamplePlugin; import com.lunarclient.apollo.example.modules.TeamExample; import com.lunarclient.apollo.player.ApolloPlayer; +import com.lunarclient.apollo.world.ApolloWorld; import org.bukkit.entity.Player; public class PlayerListener implements ApolloListener { @@ -51,4 +53,12 @@ private void onApolloRegister(ApolloRegisterPlayerEvent event) { this.plugin.getWaypointExample().displayWaypointExample(player); } + @Listen + private void onPingMarker(ApolloPlayerRequestPingEvent event) { + ApolloWorld world = event.getPlayer().getWorld().orElse(null); + if (world == null) return; + + this.plugin.getPingMarkerExample().displayMarkerExample(event.getType(), event.getTarget(), world.getPlayers()); + } + } diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/PingMarkerExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/PingMarkerExample.java new file mode 100644 index 00000000..74ae3b44 --- /dev/null +++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/PingMarkerExample.java @@ -0,0 +1,53 @@ +/* + * This file is part of Apollo, licensed under the MIT License. + * + * Copyright (c) 2023 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.modules; + +import com.lunarclient.apollo.Apollo; +import com.lunarclient.apollo.common.location.ApolloLocation; +import com.lunarclient.apollo.module.pingmarker.PingMarker; +import com.lunarclient.apollo.module.pingmarker.PingMarkerModule; +import com.lunarclient.apollo.module.pingmarker.PingMarkerType; +import com.lunarclient.apollo.player.ApolloPlayer; +import com.lunarclient.apollo.recipients.Recipients; +import java.awt.Color; +import java.time.Duration; +import java.util.Collection; +import java.util.UUID; + +public class PingMarkerExample { + + private final PingMarkerModule pingMarkerModule = Apollo.getModuleManager().getModule(PingMarkerModule.class); + + public void displayMarkerExample(PingMarkerType type, ApolloLocation location, Collection players) { + this.pingMarkerModule.displayMarker(Recipients.of(players), PingMarker.builder() + .id(UUID.randomUUID()) + .type(type) + .location(location) + .color(Color.WHITE) + .duration(Duration.ofSeconds(3)) + .focus(true) + .build()); + } + +} From 23e121052570a72bb539f961e7e2a4605580c4ca Mon Sep 17 00:00:00 2001 From: connorhartley Date: Mon, 20 May 2024 00:15:07 +1200 Subject: [PATCH 3/8] add icon to example --- .../apollo/example/modules/PingMarkerExample.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/PingMarkerExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/PingMarkerExample.java index 74ae3b44..0e684d88 100644 --- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/PingMarkerExample.java +++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/PingMarkerExample.java @@ -24,6 +24,7 @@ package com.lunarclient.apollo.example.modules; import com.lunarclient.apollo.Apollo; +import com.lunarclient.apollo.common.icon.SimpleResourceLocationIcon; import com.lunarclient.apollo.common.location.ApolloLocation; import com.lunarclient.apollo.module.pingmarker.PingMarker; import com.lunarclient.apollo.module.pingmarker.PingMarkerModule; @@ -45,6 +46,11 @@ public void displayMarkerExample(PingMarkerType type, ApolloLocation location, C .type(type) .location(location) .color(Color.WHITE) + .icon(SimpleResourceLocationIcon.builder() + .resourceLocation("lunar:icons/fluent-black-circle-icon.svg") + .size(12) + .build() + ) .duration(Duration.ofSeconds(3)) .focus(true) .build()); From 335b3b988d6486966a768bfe2ca0cd192030a050 Mon Sep 17 00:00:00 2001 From: ItsNature Date: Mon, 5 May 2025 17:48:57 +0200 Subject: [PATCH 4/8] Deploy as 1.1.9-SNAPSHOT --- gradle.properties | 2 +- scripts/deploy.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index e00f89ab..105b3394 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ group=com.lunarclient -version=1.1.8 +version=1.1.9-SNAPSHOT description=The API for interacting with Lunar Client players. org.gradle.parallel=true diff --git a/scripts/deploy.sh b/scripts/deploy.sh index e78c0132..cb44b3e2 100755 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -1,7 +1,7 @@ #!/bin/bash set -eo pipefail -VERSION="1.1.8" +VERSION="1.1.9-SNAPSHOT" REMOTE_USER="ubuntu" REMOTE_HOST="147.135.8.94" From ce85264d92dbfb515969668a1ae50580c776c8ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Bu=C4=8Dari=C4=87?= Date: Tue, 13 May 2025 01:35:30 +0200 Subject: [PATCH 5/8] Glow Module - Add Scoreborard Team Color Fallback (#209) * Add documentation & API method for scoreboard color fallback * Add info callout for scoreboard team color --- .../apollo/module/glow/GlowModule.java | 14 ++++++++++++++ .../apollo/module/glow/GlowModuleImpl.java | 19 ++++++++++++++----- docs/developers/modules/glow.mdx | 5 +++++ 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/api/src/main/java/com/lunarclient/apollo/module/glow/GlowModule.java b/api/src/main/java/com/lunarclient/apollo/module/glow/GlowModule.java index e4118a14..aa4b6e79 100644 --- a/api/src/main/java/com/lunarclient/apollo/module/glow/GlowModule.java +++ b/api/src/main/java/com/lunarclient/apollo/module/glow/GlowModule.java @@ -47,6 +47,20 @@ public boolean isClientNotify() { /** * Overrides the glow effect for the glowingPlayer, visible by the viewers. * + *

If no color is specified, the glowing color will match the player's scoreboard team color.

+ * + * + * @param recipients the recipients that are receiving the packet + * @param glowingPlayer the UUID of the player whose glowing effect will be overwrote + * @since 1.1.9 + */ + public abstract void overrideGlow(Recipients recipients, UUID glowingPlayer); + + /** + * Overrides the glow effect for the glowingPlayer, visible by the viewers. + * + *

If the {@code color} parameter is {@code null}, the glowing color will match the player's scoreboard team color.

+ * * @param recipients the recipients that are receiving the packet * @param glowingPlayer the UUID of the player whose glowing effect will be overwrote * @param color the new color glowingPlayer should glow in. diff --git a/common/src/main/java/com/lunarclient/apollo/module/glow/GlowModuleImpl.java b/common/src/main/java/com/lunarclient/apollo/module/glow/GlowModuleImpl.java index cc832417..e74d9486 100644 --- a/common/src/main/java/com/lunarclient/apollo/module/glow/GlowModuleImpl.java +++ b/common/src/main/java/com/lunarclient/apollo/module/glow/GlowModuleImpl.java @@ -32,6 +32,7 @@ import java.awt.Color; import java.util.UUID; import lombok.NonNull; +import org.jetbrains.annotations.Nullable; /** * Provides the glow module. @@ -41,12 +42,20 @@ public final class GlowModuleImpl extends GlowModule { @Override - public void overrideGlow(@NonNull Recipients recipients, @NonNull UUID glowingPlayer, @NonNull Color color) { - OverrideGlowEffectMessage message = OverrideGlowEffectMessage.newBuilder() - .setPlayerUuid(NetworkTypes.toProtobuf(glowingPlayer)) - .setColor(NetworkTypes.toProtobuf(color)) - .build(); + public void overrideGlow(@NonNull Recipients recipients, @NonNull UUID glowingPlayer) { + this.overrideGlow(recipients, glowingPlayer, null); + } + + @Override + public void overrideGlow(@NonNull Recipients recipients, @NonNull UUID glowingPlayer, @Nullable Color color) { + OverrideGlowEffectMessage.Builder builder = OverrideGlowEffectMessage.newBuilder() + .setPlayerUuid(NetworkTypes.toProtobuf(glowingPlayer)); + + if (color != null) { + builder.setColor(NetworkTypes.toProtobuf(color)); + } + OverrideGlowEffectMessage message = builder.build(); recipients.forEach(player -> ((AbstractApolloPlayer) player).sendPacket(message)); } diff --git a/docs/developers/modules/glow.mdx b/docs/developers/modules/glow.mdx index ec71a80f..c9d9dc7c 100644 --- a/docs/developers/modules/glow.mdx +++ b/docs/developers/modules/glow.mdx @@ -23,6 +23,10 @@ The glow module allows you to take advantage of the vanilla Minecraft Glow Effec ## Integration + + If no color is specified, the glow effect will default to the player's scoreboard team color. + + ### Sample Code Explore each integration by cycling through each tab, to find the best fit for your requirements and needs. @@ -65,6 +69,7 @@ public void resetGlowEffectsExample(Player viewer) { 2. `UUID target` - The player or living entity you want to display the glow effect on. 3. `Color glowColor` + - If `null` is passed (or if no color is specified), the glow effect will default to the target's scoreboard team color. - How you'll dictate the color of the glow effect, see the [colors page](/apollo/developers/utilities/colors) for more. From 51e4d2c6ae63308d11151bf48273e72e3279632a Mon Sep 17 00:00:00 2001 From: Colin McDonald Date: Wed, 14 May 2025 18:33:49 -0400 Subject: [PATCH 6/8] chore: update to new Maven repo (#212) * chore: update to new Maven repo * fix: use specific proto version * docs: update apollo-protos versions --------- Co-authored-by: ItsNature --- .github/workflows/deploy.yml | 4 ++-- .../src/main/kotlin/apollo.publish-conventions.gradle.kts | 2 +- docs/developers/lightweight/protobuf/getting-started.mdx | 6 +++--- gradle/libs.versions.toml | 2 +- settings.gradle.kts | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index d409c815..cac2568a 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -17,8 +17,8 @@ jobs: - name: Configure Google Cloud credentials uses: google-github-actions/auth@v1 with: - workload_identity_provider: 'projects/271010089174/locations/global/workloadIdentityPools/github/providers/github-oidc' - service_account: 'github-actions@moonsworth-299m4oir.iam.gserviceaccount.com' + workload_identity_provider: 'projects/266324743316/locations/global/workloadIdentityPools/github/providers/github-oidc' + service_account: 'github-actions@mw-lunarclient-maven-repo.iam.gserviceaccount.com' - name: Setup Java uses: actions/setup-java@v3 diff --git a/build-logic/src/main/kotlin/apollo.publish-conventions.gradle.kts b/build-logic/src/main/kotlin/apollo.publish-conventions.gradle.kts index 6a8d3ced..4d8f9582 100644 --- a/build-logic/src/main/kotlin/apollo.publish-conventions.gradle.kts +++ b/build-logic/src/main/kotlin/apollo.publish-conventions.gradle.kts @@ -13,7 +13,7 @@ java { publishing { repositories.maven { - url = uri("artifactregistry://us-maven.pkg.dev/moonsworth-299m4oir/maven-public") + url = uri("artifactregistry://us-maven.pkg.dev/mw-lunarclient-maven-repo/public") } publications.create("mavenJava") { diff --git a/docs/developers/lightweight/protobuf/getting-started.mdx b/docs/developers/lightweight/protobuf/getting-started.mdx index c06832c9..3330c63c 100644 --- a/docs/developers/lightweight/protobuf/getting-started.mdx +++ b/docs/developers/lightweight/protobuf/getting-started.mdx @@ -26,7 +26,7 @@ Available fields for each message, including their types, are available on the B com.lunarclient apollo-protos - 1.0-SNAPSHOT + 0.0.2 ``` @@ -41,7 +41,7 @@ Available fields for each message, including their types, are available on the B } dependencies { - api 'com.lunarclient:apollo-protos:1.0-SNAPSHOT' + api 'com.lunarclient:apollo-protos:0.0.2' } ``` @@ -55,7 +55,7 @@ Available fields for each message, including their types, are available on the B } dependencies { - api("com.lunarclient:apollo-protos:1.0-SNAPSHOT") + api("com.lunarclient:apollo-protos:0.0.2") } ``` diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 4ac0dc24..60742f48 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 = "1.0-SNAPSHOT" +protobuf = "0.0.2" gson = "2.10.1" shadow = "8.1.1" spotless = "6.13.0" diff --git a/settings.gradle.kts b/settings.gradle.kts index 9a815b02..7aa5d2a4 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -19,7 +19,7 @@ dependencyResolutionManagement { repositories { maven("https://repo.papermc.io/repository/maven-public/") maven("https://oss.sonatype.org/content/repositories/snapshots") - maven("https://us-maven.pkg.dev/moonsworth-299m4oir/maven-public") + maven("https://us-maven.pkg.dev/mw-lunarclient-maven-repo/public") mavenCentral() mavenLocal() } From 756ea70572d74f046c1deebfeca0c2780dfde383 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Bu=C4=8Dari=C4=87?= Date: Wed, 28 May 2025 19:57:26 +0200 Subject: [PATCH 7/8] Update summon command examples (#211) --- .../apollo/example/module/impl/GlintExample.java | 10 +++++----- .../apollo/example/module/impl/InventoryExample.java | 10 +++++----- .../apollo/example/module/impl/SaturationExample.java | 6 +++--- docs/developers/modules/glint.mdx | 10 +++++----- docs/developers/modules/inventory.mdx | 10 +++++----- docs/developers/modules/saturation.mdx | 6 +++--- 6 files changed, 26 insertions(+), 26 deletions(-) diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/GlintExample.java b/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/GlintExample.java index 12108c99..1f10cdb7 100644 --- a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/GlintExample.java +++ b/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/GlintExample.java @@ -44,11 +44,11 @@ public boolean glintModuleExample(Player player) { } public void glintModuleCommandExample(Player player) { - player.performCommand("summon item ~ ~1 ~ {Item:{id:\"minecraft:diamond_helmet\",Count:1b,tag:{lunar:{glint:\"#FF5733\"}}}}"); - player.performCommand("summon item ~ ~1 ~ {Item:{id:\"minecraft:diamond_helmet\",Count:1b,tag:{lunar:{glint:\"#33FF57\"}}}}"); - player.performCommand("summon item ~ ~1 ~ {Item:{id:\"minecraft:diamond_helmet\",Count:1b,tag:{lunar:{glint:\"#3357FF\"}}}}"); - player.performCommand("summon item ~ ~1 ~ {Item:{id:\"minecraft:diamond_helmet\",Count:1b,tag:{lunar:{glint:\"#FFD700\"}}}}"); - player.performCommand("summon item ~ ~1 ~ {Item:{id:\"minecraft:diamond_helmet\",Count:1b,tag:{lunar:{glint:\"-16711936\"}}}}"); + player.performCommand("summon item ~ ~1 ~ {Item:{id:\"minecraft:diamond_helmet\",Count:1b,components:{\"minecraft:custom_data\":{lunar:{glint:\"#FF5733\"}}}}}"); + player.performCommand("summon item ~ ~1 ~ {Item:{id:\"minecraft:diamond_helmet\",Count:1b,components:{\"minecraft:custom_data\":{lunar:{glint:\"#33FF57\"}}}}}"); + player.performCommand("summon item ~ ~1 ~ {Item:{id:\"minecraft:diamond_helmet\",Count:1b,components:{\"minecraft:custom_data\":{lunar:{glint:\"#3357FF\"}}}}}"); + player.performCommand("summon item ~ ~1 ~ {Item:{id:\"minecraft:diamond_helmet\",Count:1b,components:{\"minecraft:custom_data\":{lunar:{glint:\"#FFD700\"}}}}}"); + player.performCommand("summon item ~ ~1 ~ {Item:{id:\"minecraft:diamond_helmet\",Count:1b,components:{\"minecraft:custom_data\":{lunar:{glint:\"-16711936\"}}}}}"); } public void glintModuleNMSExample(Player player) { diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/InventoryExample.java b/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/InventoryExample.java index acc3a923..fa2995ac 100644 --- a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/InventoryExample.java +++ b/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/InventoryExample.java @@ -45,11 +45,11 @@ public boolean inventoryModuleExample(Player player) { } public void inventoryModuleCommandExample(Player player) { - player.performCommand("summon item ~ ~1 ~ {Item:{id:\"minecraft:stone\",Count:1b,tag:{display:{Name:\"\\\"§c§lUNCLICKABLE\\\"\"},lunar:{unclickable:true}}}}"); - player.performCommand("summon item ~ ~1 ~ {Item:{id:\"minecraft:paper\",Count:1b,tag:{display:{Name:\"\\\"§9§lCOPY TO CLIPBOARD\\\"\"},lunar:{unclickable:true,copyToClipboard:\"lunarclient.com\"}}}}"); - player.performCommand("summon item ~ ~1 ~ {Item:{id:\"minecraft:torch\",Count:1b,tag:{display:{Name:\"\\\"§6§lOPEN URL\\\"\"},lunar:{unclickable:true,openUrl:\"https://lunarclient.com\"}}}}"); - player.performCommand("summon item ~ ~1 ~ {Item:{id:\"minecraft:book\",Count:1b,tag:{display:{Name:\"\\\"§2§lSUGGEST COMMAND\\\"\"},lunar:{unclickable:true,suggestCommand:\"/apollo\"}}}}"); - player.performCommand("summon item ~ ~1 ~ {Item:{id:\"minecraft:writable_book\",Count:1b,tag:{display:{Name:\"\\\"§d§lRUN COMMAND\\\"\"},lunar:{unclickable:true,runCommand:\"/apollo\"}}}}"); + player.performCommand("summon item ~ ~1 ~ {Item:{id:\"minecraft:stone\",Count:1b,components:{\"minecraft:custom_name\":\"UNCLICKABLE\",\"minecraft:custom_data\":{lunar:{unclickable:true}}}}}"); + player.performCommand("summon item ~ ~1 ~ {Item:{id:\"minecraft:paper\",Count:1b,components:{\"minecraft:custom_name\":\"COPY TO CLIPBOARD\",\"minecraft:custom_data\":{lunar:{unclickable:true,copyToClipboard:\"lunarclient.com\"}}}}}"); + player.performCommand("summon item ~ ~1 ~ {Item:{id:\"minecraft:torch\",Count:1b,components:{\"minecraft:custom_name\":\"OPEN URL\",\"minecraft:custom_data\":{lunar:{unclickable:true,openUrl:\"https://lunarclient.com\"}}}}}"); + player.performCommand("summon item ~ ~1 ~ {Item:{id:\"minecraft:book\",Count:1b,components:{\"minecraft:custom_name\":\"SUGGEST COMMAND\",\"minecraft:custom_data\":{lunar:{unclickable:true,suggestCommand:\"/apollo\"}}}}}"); + player.performCommand("summon item ~ ~1 ~ {Item:{id:\"minecraft:writable_book\",Count:1b,components:{\"minecraft:custom_name\":\"RUN COMMAND\",\"minecraft:custom_data\":{lunar:{unclickable:true,runCommand:\"/apollo\"}}}}}"); } public void inventoryModuleNMSExample(Player player) { diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/SaturationExample.java b/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/SaturationExample.java index c7f61292..705b1b2e 100644 --- a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/SaturationExample.java +++ b/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/SaturationExample.java @@ -44,9 +44,9 @@ public boolean saturationModuleExample(Player player) { } public void saturationModuleCommandExample(Player player) { - player.performCommand("summon item ~ ~1 ~ {Item:{id:\"minecraft:apple\",Count:1b,tag:{lunar:{hunger:22,saturation:3}}}}"); - player.performCommand("summon item ~ ~1 ~ {Item:{id:\"minecraft:apple\",Count:1b,tag:{lunar:{hunger:7,saturation:7}}}}"); - player.performCommand("summon item ~ ~1 ~ {Item:{id:\"minecraft:apple\",Count:1b,tag:{lunar:{hunger:30,saturation:26}}}}"); + player.performCommand("summon item ~ ~1 ~ {Item:{id:\"minecraft:apple\",Count:1b,components:{\"minecraft:custom_data\":{lunar:{hunger:22,saturation:3}}}}}"); + player.performCommand("summon item ~ ~1 ~ {Item:{id:\"minecraft:apple\",Count:1b,components:{\"minecraft:custom_data\":{lunar:{hunger:7,saturation:7}}}}}"); + player.performCommand("summon item ~ ~1 ~ {Item:{id:\"minecraft:apple\",Count:1b,components:{\"minecraft:custom_data\":{lunar:{hunger:30,saturation:26}}}}}"); } public void saturationModuleNMSExample(Player player) { diff --git a/docs/developers/modules/glint.mdx b/docs/developers/modules/glint.mdx index a1af4cfb..eb60f50c 100644 --- a/docs/developers/modules/glint.mdx +++ b/docs/developers/modules/glint.mdx @@ -39,15 +39,15 @@ Explore each integration by cycling through each tab, to find the best fit for y **Custom Glint** -`/summon item ~ ~1 ~ {Item:{id:"minecraft:diamond_helmet",Count:1b,tag:{lunar:{glint:"#FF5733"}}}}` +`/summon item ~ ~1 ~ {Item:{id:"minecraft:diamond_helmet",Count:1b,components:{"minecraft:custom_data":{lunar:{glint:"#FF5733"}}}}}` -`/summon item ~ ~1 ~ {Item:{id:"minecraft:diamond_helmet",Count:1b,tag:{lunar:{glint:"#33FF57"}}}}` +`/summon item ~ ~1 ~ {Item:{id:"minecraft:diamond_helmet",Count:1b,components:{"minecraft:custom_data":{lunar:{glint:"#33FF57"}}}}}` -`/summon item ~ ~1 ~ {Item:{id:"minecraft:diamond_helmet",Count:1b,tag:{lunar:{glint:"#3357FF"}}}}` +`/summon item ~ ~1 ~ {Item:{id:"minecraft:diamond_helmet",Count:1b,components:{"minecraft:custom_data":{lunar:{glint:"#3357FF"}}}}}` -`/summon item ~ ~1 ~ {Item:{id:"minecraft:diamond_helmet",Count:1b,tag:{lunar:{glint:"#FFD700"}}}}` +`/summon item ~ ~1 ~ {Item:{id:"minecraft:diamond_helmet",Count:1b,components:{"minecraft:custom_data":{lunar:{glint:"#FFD700"}}}}}` -`/summon item ~ ~1 ~ {Item:{id:"minecraft:diamond_helmet",Count:1b,tag:{lunar:{glint:"-16711936"}}}}` +`/summon item ~ ~1 ~ {Item:{id:"minecraft:diamond_helmet",Count:1b,components:{"minecraft:custom_data":{lunar:{glint:"-16711936"}}}}}` diff --git a/docs/developers/modules/inventory.mdx b/docs/developers/modules/inventory.mdx index 1cbfd74b..10c51b00 100644 --- a/docs/developers/modules/inventory.mdx +++ b/docs/developers/modules/inventory.mdx @@ -28,23 +28,23 @@ Explore each integration by cycling through each tab, to find the best fit for y **Unclickable Item** -`/summon item ~ ~1 ~ {Item:{id:"minecraft:stone",Count:1b,tag:{display:{Name:"§c§lUNCLICKABLE"},lunar:{unclickable:true}}}}` +`/summon item ~ ~1 ~ {Item:{id:"minecraft:stone",Count:1b,components:{"minecraft:custom_name":"UNCLICKABLE","minecraft:custom_data":{lunar:{unclickable:true}}}}}` **Copy To Clipboard Item** -`/summon item ~ ~1 ~ {Item:{id:"minecraft:paper",Count:1b,tag:{display:{Name:"§9§lCOPY TO CLIPBOARD"},lunar:{unclickable:true,copyToClipboard:"lunarclient.com"}}}}` +`/summon item ~ ~1 ~ {Item:{id:"minecraft:paper",Count:1b,components:{"minecraft:custom_name":"COPY TO CLIPBOARD","minecraft:custom_data":{lunar:{unclickable:true,copyToClipboard:"lunarclient.com"}}}}}` **Open URL Item** -`/summon item ~ ~1 ~ {Item:{id:"minecraft:torch",Count:1b,tag:{display:{Name:"§6§lOPEN URL"},lunar:{unclickable:true,openUrl:"https://lunarclient.com"}}}}` +`/summon item ~ ~1 ~ {Item:{id:"minecraft:torch",Count:1b,components:{"minecraft:custom_name":"OPEN URL","minecraft:custom_data":{lunar:{unclickable:true,openUrl:"https://lunarclient.com"}}}}}` **Suggest Command Item** -`/summon item ~ ~1 ~ {Item:{id:"minecraft:book",Count:1b,tag:{display:{Name:"§2§lSUGGEST COMMAND"},lunar:{unclickable:true,suggestCommand:"/apollo"}}}}` +`/summon item ~ ~1 ~ {Item:{id:"minecraft:book",Count:1b,components:{"minecraft:custom_name":"SUGGEST COMMAND","minecraft:custom_data":{lunar:{unclickable:true,suggestCommand:"/apollo"}}}}}` **Run Command Item** -`/summon item ~ ~1 ~ {Item:{id:"minecraft:writable_book",Count:1b,tag:{display:{Name:"§d§lRUN COMMAND"},lunar:{unclickable:true,runCommand:"/apollo"}}}}` +`/summon item ~ ~1 ~ {Item:{id:"minecraft:writable_book",Count:1b,components:{"minecraft:custom_name":"RUN COMMAND","minecraft:custom_data":{lunar:{unclickable:true,runCommand:"/apollo"}}}}}` diff --git a/docs/developers/modules/saturation.mdx b/docs/developers/modules/saturation.mdx index 40e3ccf9..af52e661 100644 --- a/docs/developers/modules/saturation.mdx +++ b/docs/developers/modules/saturation.mdx @@ -40,11 +40,11 @@ Explore each integration by cycling through each tab, to find the best fit for y **Custom Saturation & Hunger** -`/summon item ~ ~1 ~ {Item:{id:"minecraft:apple",Count:1b,tag:{lunar:{hunger:22,saturation:3}}}}` +`/summon item ~ ~1 ~ {Item:{id:"minecraft:apple",Count:1b,components:{"minecraft:custom_data":{lunar:{hunger:22,saturation:3}}}}}` -`/summon item ~ ~1 ~ {Item:{id:"minecraft:apple",Count:1b,tag:{lunar:{hunger:7,saturation:7}}}}` +`/summon item ~ ~1 ~ {Item:{id:"minecraft:apple",Count:1b,components:{"minecraft:custom_data":{lunar:{hunger:7,saturation:7}}}}}` -`/summon item ~ ~1 ~ {Item:{id:"minecraft:apple",Count:1b,tag:{lunar:{hunger:30,saturation:26}}}}` +`/summon item ~ ~1 ~ {Item:{id:"minecraft:apple",Count:1b,components:{"minecraft:custom_data":{lunar:{hunger:30,saturation:26}}}}}` From ef6b65cd1ebc9ba3639ffa86ee4e0b687a86ae4b Mon Sep 17 00:00:00 2001 From: ItsNature Date: Tue, 15 Jul 2025 20:34:54 +0200 Subject: [PATCH 8/8] Examples & Docs (WIP) --- ...va => ApolloPlayerRequestMarkerEvent.java} | 14 +-- .../apollo/module/pingmarker/PingMarker.java | 16 ++-- .../module/pingmarker/PingMarkerModule.java | 18 ++-- .../module/pingmarker/PingMarkerType.java | 6 +- .../apollo/recipients/Recipients.java | 2 +- .../example/api/ApolloApiExamplePlatform.java | 2 + .../api/listener/ApolloPlayerApiListener.java | 10 --- .../api/module/PingMarkerApiExample.java | 84 ++++++++++++++++++ .../src/main/resources/plugin.yml | 2 + .../apollo/example/ApolloExamplePlugin.java | 4 + .../example/command/PingMarkerCommand.java | 67 ++++++++++++++ .../module/impl/PingMarkerExample.java | 35 ++++++++ .../json/ApolloJsonExamplePlatform.java | 2 + .../json/module/PingMarkerJsonExample.java | 54 ++++++++++++ .../src/main/resources/plugin.yml | 2 + .../proto/ApolloProtoExamplePlatform.java | 2 + .../proto/module/PingMarkerProtoExample.java | 54 ++++++++++++ .../src/main/resources/plugin.yml | 2 + .../pingmarker/PingMarkerModuleImpl.java | 14 +-- docs/developers/modules/_meta.json | 1 + docs/developers/modules/pingmarker.mdx | 88 +++++++++++++++++++ .../apollo/ApolloFoliaPlatform.java | 3 + 22 files changed, 439 insertions(+), 43 deletions(-) rename api/src/main/java/com/lunarclient/apollo/event/pingmarker/{ApolloPlayerRequestPingEvent.java => ApolloPlayerRequestMarkerEvent.java} (92%) create mode 100644 bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/PingMarkerApiExample.java create mode 100644 bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/PingMarkerCommand.java create mode 100644 bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/PingMarkerExample.java create mode 100644 bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/PingMarkerJsonExample.java create mode 100644 bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/PingMarkerProtoExample.java create mode 100644 docs/developers/modules/pingmarker.mdx diff --git a/api/src/main/java/com/lunarclient/apollo/event/pingmarker/ApolloPlayerRequestPingEvent.java b/api/src/main/java/com/lunarclient/apollo/event/pingmarker/ApolloPlayerRequestMarkerEvent.java similarity index 92% rename from api/src/main/java/com/lunarclient/apollo/event/pingmarker/ApolloPlayerRequestPingEvent.java rename to api/src/main/java/com/lunarclient/apollo/event/pingmarker/ApolloPlayerRequestMarkerEvent.java index 7a2b7dd9..ebaab565 100644 --- a/api/src/main/java/com/lunarclient/apollo/event/pingmarker/ApolloPlayerRequestPingEvent.java +++ b/api/src/main/java/com/lunarclient/apollo/event/pingmarker/ApolloPlayerRequestMarkerEvent.java @@ -36,20 +36,20 @@ import org.jetbrains.annotations.Nullable; /** - * Represents an event that is fired when the player requests a ping. + * Represents an event that is fired when the player requests a ping marker. * - * @since 1.1.3 + * @since 1.1.9 */ @Getter @RequiredArgsConstructor @FieldDefaults(level = AccessLevel.PRIVATE, makeFinal = true) -public final class ApolloPlayerRequestPingEvent implements EventCancellable { +public final class ApolloPlayerRequestMarkerEvent implements EventCancellable { /** * The player sending the ping request. * * @return the source player - * @since 1.1.3 + * @since 1.1.9 */ ApolloPlayer player; @@ -57,7 +57,7 @@ public final class ApolloPlayerRequestPingEvent implements EventCancellable { * The {@link PingMarkerType} for this request. * * @return the ping marker type - * @since 1.1.3 + * @since 1.1.9 */ @Nullable PingMarkerType type; @@ -65,7 +65,7 @@ public final class ApolloPlayerRequestPingEvent implements EventCancellable { * The source {@link ApolloLocation} for this request. * * @return the source location - * @since 1.1.3 + * @since 1.1.9 */ ApolloLocation source; @@ -73,7 +73,7 @@ public final class ApolloPlayerRequestPingEvent implements EventCancellable { * The target {@link ApolloLocation} for this request. * * @return the target location - * @since 1.1.3 + * @since 1.1.9 */ ApolloLocation target; diff --git a/api/src/main/java/com/lunarclient/apollo/module/pingmarker/PingMarker.java b/api/src/main/java/com/lunarclient/apollo/module/pingmarker/PingMarker.java index aa04f526..97b18269 100644 --- a/api/src/main/java/com/lunarclient/apollo/module/pingmarker/PingMarker.java +++ b/api/src/main/java/com/lunarclient/apollo/module/pingmarker/PingMarker.java @@ -35,7 +35,7 @@ /** * Represents a ping marker which can be shown on the client. * - * @since 1.1.3 + * @since 1.1.9 */ @Getter @Builder @@ -45,7 +45,7 @@ public final class PingMarker { * Returns the marker {@link UUID}. * * @return the ping marker id - * @since 1.1.3 + * @since 1.1.9 */ UUID id; @@ -53,7 +53,7 @@ public final class PingMarker { * Returns the {@link PingMarkerType}. * * @return the ping marker type - * @since 1.1.3 + * @since 1.1.9 */ @Nullable PingMarkerType type; @@ -61,7 +61,7 @@ public final class PingMarker { * Returns the marker {@link ApolloLocation}. * * @return the ping marker location - * @since 1.1.3 + * @since 1.1.9 */ ApolloLocation location; @@ -69,7 +69,7 @@ public final class PingMarker { * Returns the marker {@link Color}. * * @return the ping marker color - * @since 1.1.3 + * @since 1.1.9 */ Color color; @@ -77,7 +77,7 @@ public final class PingMarker { * Returns the marker {@link Duration}. * * @return the ping marker duration - * @since 1.1.3 + * @since 1.1.9 */ Duration duration; @@ -85,7 +85,7 @@ public final class PingMarker { * Returns whether the marker should animate. * * @return the ping marker focus state - * @since 1.1.3 + * @since 1.1.9 */ boolean focus; @@ -96,7 +96,7 @@ public final class PingMarker { * for the most common use case, use {@link com.lunarclient.apollo.common.icon.ItemStackIcon}.

* * @return the ping marker icon - * @since 1.1.3 + * @since 1.1.9 */ Icon icon; diff --git a/api/src/main/java/com/lunarclient/apollo/module/pingmarker/PingMarkerModule.java b/api/src/main/java/com/lunarclient/apollo/module/pingmarker/PingMarkerModule.java index b9e4b5d4..6f53984d 100644 --- a/api/src/main/java/com/lunarclient/apollo/module/pingmarker/PingMarkerModule.java +++ b/api/src/main/java/com/lunarclient/apollo/module/pingmarker/PingMarkerModule.java @@ -32,7 +32,7 @@ /** * Represents the ping marker module. * - * @since 1.0.0 + * @since 1.1.9 */ @ApiStatus.NonExtendable @ModuleDefinition(id = "ping_marker", name = "Ping Marker") @@ -43,7 +43,7 @@ public abstract class PingMarkerModule extends ApolloModule { * * @param recipients the recipients that are receiving the packet * @param type the marker type - * @since 1.1.3 + * @since 1.1.9 */ public abstract void setMarkerType(Recipients recipients, PingMarkerType type); @@ -52,7 +52,7 @@ public abstract class PingMarkerModule extends ApolloModule { * * @param recipients the recipients that are receiving the packet * @param name the marker type name - * @since 1.1.3 + * @since 1.1.9 */ public abstract void removeMarkerType(Recipients recipients, String name); @@ -61,7 +61,7 @@ public abstract class PingMarkerModule extends ApolloModule { * * @param recipients the recipients that are receiving the packet * @param type the marker type - * @since 1.1.3 + * @since 1.1.9 */ public abstract void removeMarkerType(Recipients recipients, PingMarkerType type); @@ -69,7 +69,7 @@ public abstract class PingMarkerModule extends ApolloModule { * Resets all {@link PingMarkerType}s for the {@link Recipients}. * * @param recipients the recipients that are receiving the packet - * @since 1.1.3 + * @since 1.1.9 */ public abstract void resetMarkerType(Recipients recipients); @@ -78,7 +78,7 @@ public abstract class PingMarkerModule extends ApolloModule { * * @param recipients the recipients that are receiving the packet * @param marker the marker - * @since 1.1.3 + * @since 1.1.9 */ public abstract void displayMarker(Recipients recipients, PingMarker marker); @@ -87,7 +87,7 @@ public abstract class PingMarkerModule extends ApolloModule { * * @param recipients the recipients that are receiving the packet * @param markerId the marker id - * @since 1.1.3 + * @since 1.1.9 */ public abstract void removeMarker(Recipients recipients, UUID markerId); @@ -96,7 +96,7 @@ public abstract class PingMarkerModule extends ApolloModule { * * @param recipients the recipients that are receiving the packet * @param marker the marker - * @since 1.1.3 + * @since 1.1.9 */ public abstract void removeMarker(Recipients recipients, PingMarker marker); @@ -104,7 +104,7 @@ public abstract class PingMarkerModule extends ApolloModule { * Resets all {@link PingMarker}s for the {@link Recipients}. * * @param recipients the recipients that are receiving the packet - * @since 1.1.3 + * @since 1.1.9 */ public abstract void resetMarkers(Recipients recipients); diff --git a/api/src/main/java/com/lunarclient/apollo/module/pingmarker/PingMarkerType.java b/api/src/main/java/com/lunarclient/apollo/module/pingmarker/PingMarkerType.java index d54fa31e..d088df5b 100644 --- a/api/src/main/java/com/lunarclient/apollo/module/pingmarker/PingMarkerType.java +++ b/api/src/main/java/com/lunarclient/apollo/module/pingmarker/PingMarkerType.java @@ -30,7 +30,7 @@ /** * Represents a ping marker type which can be shown on the client. * - * @since 1.1.3 + * @since 1.1.9 */ @Getter @Builder @@ -40,7 +40,7 @@ public final class PingMarkerType { * Returns the ping marker type {@link String} name. * * @return the ping marker type name - * @since 1.1.3 + * @since 1.1.9 */ String name; @@ -51,7 +51,7 @@ public final class PingMarkerType { * for the most common use case, use {@link com.lunarclient.apollo.common.icon.ItemStackIcon}.

* * @return the ping marker icon - * @since 1.1.3 + * @since 1.1.9 */ Icon icon; diff --git a/api/src/main/java/com/lunarclient/apollo/recipients/Recipients.java b/api/src/main/java/com/lunarclient/apollo/recipients/Recipients.java index 596cc334..74825cb3 100644 --- a/api/src/main/java/com/lunarclient/apollo/recipients/Recipients.java +++ b/api/src/main/java/com/lunarclient/apollo/recipients/Recipients.java @@ -64,7 +64,7 @@ static ForwardingRecipients ofEveryone() { * * @param player the apollo player * @return a {@code ForwardingRecipients} instance representing players in the world - * @since 1.1.3 + * @since 1.1.9 */ static ForwardingRecipients ofWorld(ApolloPlayer player) { return () -> player.getWorld().map(ApolloWorld::getPlayers).orElseGet(() -> Apollo.getPlayerManager().getPlayers()); diff --git a/bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/ApolloApiExamplePlatform.java b/bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/ApolloApiExamplePlatform.java index a078c371..50c37824 100644 --- a/bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/ApolloApiExamplePlatform.java +++ b/bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/ApolloApiExamplePlatform.java @@ -44,6 +44,7 @@ import com.lunarclient.apollo.example.api.module.NametagApiExample; import com.lunarclient.apollo.example.api.module.NickHiderApiExample; import com.lunarclient.apollo.example.api.module.NotificationApiExample; +import com.lunarclient.apollo.example.api.module.PingMarkerApiExample; import com.lunarclient.apollo.example.api.module.RichPresenceApiExample; import com.lunarclient.apollo.example.api.module.ServerRuleApiExample; import com.lunarclient.apollo.example.api.module.StaffModApiExample; @@ -92,6 +93,7 @@ public void registerModuleExamples() { this.setNametagExample(new NametagApiExample()); this.setNickHiderExample(new NickHiderApiExample()); this.setNotificationExample(new NotificationApiExample()); + this.setPingMarkerExample(new PingMarkerApiExample()); this.setRichPresenceExample(new RichPresenceApiExample()); this.setServerRuleExample(new ServerRuleApiExample()); this.setStaffModExample(new StaffModApiExample()); diff --git a/bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/listener/ApolloPlayerApiListener.java b/bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/listener/ApolloPlayerApiListener.java index 0afe3016..53a89c20 100644 --- a/bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/listener/ApolloPlayerApiListener.java +++ b/bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/listener/ApolloPlayerApiListener.java @@ -26,12 +26,10 @@ import com.lunarclient.apollo.event.ApolloListener; import com.lunarclient.apollo.event.EventBus; import com.lunarclient.apollo.event.Listen; -import com.lunarclient.apollo.event.pingmarker.ApolloPlayerRequestPingEvent; import com.lunarclient.apollo.event.player.ApolloRegisterPlayerEvent; import com.lunarclient.apollo.example.ApolloExamplePlugin; import com.lunarclient.apollo.example.api.module.TeamApiExample; import com.lunarclient.apollo.player.ApolloPlayer; -import com.lunarclient.apollo.world.ApolloWorld; import org.bukkit.entity.Player; public class ApolloPlayerApiListener implements ApolloListener { @@ -65,12 +63,4 @@ private void onApolloRegister(ApolloRegisterPlayerEvent event) { this.example.getWaypointExample().displayWaypointExample(player); } - @Listen - private void onPingMarker(ApolloPlayerRequestPingEvent event) { - ApolloWorld world = event.getPlayer().getWorld().orElse(null); - if (world == null) return; - - this.plugin.getPingMarkerExample().displayMarkerExample(event.getType(), event.getTarget(), world.getPlayers()); - } - } diff --git a/bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/PingMarkerApiExample.java b/bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/PingMarkerApiExample.java new file mode 100644 index 00000000..f5fece62 --- /dev/null +++ b/bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/PingMarkerApiExample.java @@ -0,0 +1,84 @@ +/* + * This file is part of Apollo, licensed under the MIT License. + * + * Copyright (c) 2023 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.BukkitApollo; +import com.lunarclient.apollo.common.icon.SimpleResourceLocationIcon; +import com.lunarclient.apollo.example.module.impl.PingMarkerExample; +import com.lunarclient.apollo.module.pingmarker.PingMarker; +import com.lunarclient.apollo.module.pingmarker.PingMarkerModule; +import com.lunarclient.apollo.player.ApolloPlayer; +import com.lunarclient.apollo.recipients.Recipients; +import java.awt.Color; +import java.time.Duration; +import java.util.Optional; +import java.util.UUID; +import org.bukkit.Location; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; + +public class PingMarkerApiExample extends PingMarkerExample { + + private final PingMarkerModule pingMarkerModule = Apollo.getModuleManager().getModule(PingMarkerModule.class); + + @Override + public void displayMarkerResourceExample(Player player) { + Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(player.getUniqueId()); + + apolloPlayerOpt.ifPresent(apolloPlayer -> { + Location location = this.findTargetLocation(player); + + if (location == null) { + return; + } + + this.pingMarkerModule.displayMarker(Recipients.ofWorld(apolloPlayer), PingMarker.builder() + .id(UUID.randomUUID()) + .type(null) // TODO: add another example with a specific type + .location(BukkitApollo.toApolloLocation(location)) + .color(Color.WHITE) + .icon(SimpleResourceLocationIcon.builder() + .resourceLocation("lunar:icons/fluent-black-circle-icon.svg") + .size(12) + .build() + ) + .duration(Duration.ofSeconds(5)) + .focus(true) + .build()); + }); + + } + + private Location findTargetLocation(Player player) { + Block targetBlock = player.getTargetBlockExact(30); + + if (targetBlock == null) { + return null; + } + + return targetBlock.getLocation().add(0.5D, 0.5D, 0.5D); + } + +} diff --git a/bukkit-example-api/src/main/resources/plugin.yml b/bukkit-example-api/src/main/resources/plugin.yml index 0c9392a2..48ab36a3 100644 --- a/bukkit-example-api/src/main/resources/plugin.yml +++ b/bukkit-example-api/src/main/resources/plugin.yml @@ -43,6 +43,8 @@ commands: description: "Nick Hider!" notification: description: "Notifications!" + pingmarker: + description: "Ping Marker!" richpresence: description: "Rich Presence!" saturation: diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/ApolloExamplePlugin.java b/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/ApolloExamplePlugin.java index 996c9472..02e74fe1 100644 --- a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/ApolloExamplePlugin.java +++ b/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/ApolloExamplePlugin.java @@ -40,6 +40,7 @@ import com.lunarclient.apollo.example.command.NametagCommand; import com.lunarclient.apollo.example.command.NickHiderCommand; import com.lunarclient.apollo.example.command.NotificationCommand; +import com.lunarclient.apollo.example.command.PingMarkerCommand; import com.lunarclient.apollo.example.command.RichPresenceCommand; import com.lunarclient.apollo.example.command.SaturationCommand; import com.lunarclient.apollo.example.command.ServerRuleCommand; @@ -69,6 +70,7 @@ import com.lunarclient.apollo.example.module.impl.NametagExample; import com.lunarclient.apollo.example.module.impl.NickHiderExample; import com.lunarclient.apollo.example.module.impl.NotificationExample; +import com.lunarclient.apollo.example.module.impl.PingMarkerExample; import com.lunarclient.apollo.example.module.impl.RichPresenceExample; import com.lunarclient.apollo.example.module.impl.SaturationExample; import com.lunarclient.apollo.example.module.impl.ServerRuleExample; @@ -108,6 +110,7 @@ public abstract class ApolloExamplePlugin extends JavaPlugin { private NametagExample nametagExample; private NickHiderExample nickHiderExample; private NotificationExample notificationExample; + private PingMarkerExample pingMarkerExample; private RichPresenceExample richPresenceExample; private SaturationExample saturationExample; private ServerRuleExample serverRuleExample; @@ -157,6 +160,7 @@ private void registerCommonCommands() { this.getCommand("nametag").setExecutor(new NametagCommand()); this.getCommand("nickhider").setExecutor(new NickHiderCommand()); this.getCommand("notification").setExecutor(new NotificationCommand()); + this.getCommand("pingmarker").setExecutor(new PingMarkerCommand()); this.getCommand("richpresence").setExecutor(new RichPresenceCommand()); this.getCommand("saturation").setExecutor(new SaturationCommand()); this.getCommand("serverrule").setExecutor(new ServerRuleCommand()); diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/PingMarkerCommand.java b/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/PingMarkerCommand.java new file mode 100644 index 00000000..eb3eda9a --- /dev/null +++ b/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/PingMarkerCommand.java @@ -0,0 +1,67 @@ +/* + * This file is part of Apollo, licensed under the MIT License. + * + * Copyright (c) 2023 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.PingMarkerExample; +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 PingMarkerCommand 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: /pingmarker "); + return true; + } + + PingMarkerExample pingMarkerExample = ApolloExamplePlugin.getInstance().getPingMarkerExample(); + + switch (args[0].toLowerCase()) { + case "displayresource": { + pingMarkerExample.displayMarkerResourceExample(player); + player.sendMessage("Displaying a ping marker with a resource...."); + break; + } + + default: { + player.sendMessage("Usage: /pingmarker "); + break; + } + } + + return true; + } +} diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/PingMarkerExample.java b/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/PingMarkerExample.java new file mode 100644 index 00000000..6ddbd97b --- /dev/null +++ b/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/PingMarkerExample.java @@ -0,0 +1,35 @@ +/* + * This file is part of Apollo, licensed under the MIT License. + * + * Copyright (c) 2023 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 PingMarkerExample extends ApolloModuleExample { + + // TODO: displayMarkerItemExample + + public abstract void displayMarkerResourceExample(Player player); + +} diff --git a/bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/ApolloJsonExamplePlatform.java b/bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/ApolloJsonExamplePlatform.java index e5c90754..df7d7eba 100644 --- a/bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/ApolloJsonExamplePlatform.java +++ b/bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/ApolloJsonExamplePlatform.java @@ -41,6 +41,7 @@ import com.lunarclient.apollo.example.json.module.NametagJsonExample; import com.lunarclient.apollo.example.json.module.NickHiderJsonExample; import com.lunarclient.apollo.example.json.module.NotificationJsonExample; +import com.lunarclient.apollo.example.json.module.PingMarkerJsonExample; import com.lunarclient.apollo.example.json.module.RichPresenceJsonExample; import com.lunarclient.apollo.example.json.module.ServerRuleJsonExample; import com.lunarclient.apollo.example.json.module.StaffModJsonExample; @@ -82,6 +83,7 @@ public void registerModuleExamples() { this.setNametagExample(new NametagJsonExample()); this.setNickHiderExample(new NickHiderJsonExample()); this.setNotificationExample(new NotificationJsonExample()); + this.setPingMarkerExample(new PingMarkerJsonExample()); this.setRichPresenceExample(new RichPresenceJsonExample()); this.setServerRuleExample(new ServerRuleJsonExample()); this.setStaffModExample(new StaffModJsonExample()); diff --git a/bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/PingMarkerJsonExample.java b/bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/PingMarkerJsonExample.java new file mode 100644 index 00000000..e5528cd6 --- /dev/null +++ b/bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/PingMarkerJsonExample.java @@ -0,0 +1,54 @@ +/* + * This file is part of Apollo, licensed under the MIT License. + * + * Copyright (c) 2023 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.lunarclient.apollo.example.module.impl.PingMarkerExample; +import org.bukkit.Location; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; + +public class PingMarkerJsonExample extends PingMarkerExample { + + @Override + public void displayMarkerResourceExample(Player player) { + Location location = this.findTargetLocation(player); + + if (location == null) { + return; + } + + // TODO + } + + private Location findTargetLocation(Player player) { + Block targetBlock = player.getTargetBlockExact(30); + + if (targetBlock == null) { + return null; + } + + return targetBlock.getLocation().add(0.5D, 0.5D, 0.5D); + } + +} diff --git a/bukkit-example-json/src/main/resources/plugin.yml b/bukkit-example-json/src/main/resources/plugin.yml index ba7d9d64..c015bc3c 100644 --- a/bukkit-example-json/src/main/resources/plugin.yml +++ b/bukkit-example-json/src/main/resources/plugin.yml @@ -41,6 +41,8 @@ commands: description: "Nick Hider!" notification: description: "Notifications!" + pingmarker: + description: "Ping Marker!" richpresence: description: "Rich Presence!" saturation: diff --git a/bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/ApolloProtoExamplePlatform.java b/bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/ApolloProtoExamplePlatform.java index 97074a1b..951691f3 100644 --- a/bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/ApolloProtoExamplePlatform.java +++ b/bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/ApolloProtoExamplePlatform.java @@ -41,6 +41,7 @@ import com.lunarclient.apollo.example.proto.module.NametagProtoExample; import com.lunarclient.apollo.example.proto.module.NickHiderProtoExample; import com.lunarclient.apollo.example.proto.module.NotificationProtoExample; +import com.lunarclient.apollo.example.proto.module.PingMarkerProtoExample; import com.lunarclient.apollo.example.proto.module.RichPresenceProtoExample; import com.lunarclient.apollo.example.proto.module.ServerRuleProtoExample; import com.lunarclient.apollo.example.proto.module.StaffModProtoExample; @@ -82,6 +83,7 @@ public void registerModuleExamples() { this.setNametagExample(new NametagProtoExample()); this.setNickHiderExample(new NickHiderProtoExample()); this.setNotificationExample(new NotificationProtoExample()); + this.setPingMarkerExample(new PingMarkerProtoExample()); this.setRichPresenceExample(new RichPresenceProtoExample()); this.setServerRuleExample(new ServerRuleProtoExample()); this.setStaffModExample(new StaffModProtoExample()); diff --git a/bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/PingMarkerProtoExample.java b/bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/PingMarkerProtoExample.java new file mode 100644 index 00000000..a0ff0d99 --- /dev/null +++ b/bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/PingMarkerProtoExample.java @@ -0,0 +1,54 @@ +/* + * This file is part of Apollo, licensed under the MIT License. + * + * Copyright (c) 2023 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.PingMarkerExample; +import org.bukkit.Location; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; + +public class PingMarkerProtoExample extends PingMarkerExample { + + @Override + public void displayMarkerResourceExample(Player player) { + Location location = this.findTargetLocation(player); + + if (location == null) { + return; + } + + // TODO + } + + private Location findTargetLocation(Player player) { + Block targetBlock = player.getTargetBlockExact(30); + + if (targetBlock == null) { + return null; + } + + return targetBlock.getLocation().add(0.5D, 0.5D, 0.5D); + } + +} diff --git a/bukkit-example-proto/src/main/resources/plugin.yml b/bukkit-example-proto/src/main/resources/plugin.yml index 0ccac43d..79ab284f 100644 --- a/bukkit-example-proto/src/main/resources/plugin.yml +++ b/bukkit-example-proto/src/main/resources/plugin.yml @@ -41,6 +41,8 @@ commands: description: "Nick Hider!" notification: description: "Notifications!" + pingmarker: + description: "Ping Marker!" richpresence: description: "Rich Presence!" saturation: diff --git a/common/src/main/java/com/lunarclient/apollo/module/pingmarker/PingMarkerModuleImpl.java b/common/src/main/java/com/lunarclient/apollo/module/pingmarker/PingMarkerModuleImpl.java index b8df3c60..cbe36a93 100644 --- a/common/src/main/java/com/lunarclient/apollo/module/pingmarker/PingMarkerModuleImpl.java +++ b/common/src/main/java/com/lunarclient/apollo/module/pingmarker/PingMarkerModuleImpl.java @@ -25,7 +25,7 @@ import com.lunarclient.apollo.event.ApolloReceivePacketEvent; import com.lunarclient.apollo.event.EventBus; -import com.lunarclient.apollo.event.pingmarker.ApolloPlayerRequestPingEvent; +import com.lunarclient.apollo.event.pingmarker.ApolloPlayerRequestMarkerEvent; import com.lunarclient.apollo.network.NetworkTypes; import com.lunarclient.apollo.pingmarker.v1.DisplayPlayerPingMessage; import com.lunarclient.apollo.pingmarker.v1.RemovePingMarkerTypeMessage; @@ -44,7 +44,7 @@ /** * Provides the ping marker module. * - * @since 1.1.3 + * @since 1.1.9 */ public final class PingMarkerModuleImpl extends PingMarkerModule { @@ -53,7 +53,7 @@ public final class PingMarkerModuleImpl extends PingMarkerModule { /** * Creates a new instance of {@link PingMarkerModuleImpl}. * - * @since 1.1.3 + * @since 1.1.9 */ public PingMarkerModuleImpl() { super(); @@ -139,14 +139,18 @@ public void resetMarkers(@NonNull Recipients recipients) { private void onReceivePacket(ApolloReceivePacketEvent event) { event.unpack(RequestPlayerPingMessage.class).ifPresent(packet -> { - ApolloPlayerRequestPingEvent playerRequestPingEvent = new ApolloPlayerRequestPingEvent( + ApolloPlayerRequestMarkerEvent playerRequestPingEvent = new ApolloPlayerRequestMarkerEvent( event.getPlayer(), this.markerTypes.get(packet.getType()), NetworkTypes.fromProtobuf(packet.getSourceLocation()), NetworkTypes.fromProtobuf(packet.getTargetLocation()) ); - EventBus.EventResult result = EventBus.getBus().post(playerRequestPingEvent); + EventBus.EventResult result = EventBus.getBus().post(playerRequestPingEvent); + + if (!result.getEvent().isCancelled()) { + // TODO + } for (Throwable throwable : result.getThrowing()) { throwable.printStackTrace(); diff --git a/docs/developers/modules/_meta.json b/docs/developers/modules/_meta.json index 1ee0d74d..7784f20f 100644 --- a/docs/developers/modules/_meta.json +++ b/docs/developers/modules/_meta.json @@ -17,6 +17,7 @@ "nickhider": "Nick Hider", "notification": "Notification", "packetenrichment": "Packet Enrichment", + "pingmarker": "Ping Marker", "richpresence": "Rich Presence", "saturation": "Saturation", "serverrule": "Server Rule", diff --git a/docs/developers/modules/pingmarker.mdx b/docs/developers/modules/pingmarker.mdx new file mode 100644 index 00000000..b8dc3cbe --- /dev/null +++ b/docs/developers/modules/pingmarker.mdx @@ -0,0 +1,88 @@ +import { Tab, Tabs } from 'nextra-theme-docs' +import { Callout } from 'nextra-theme-docs' + +# Ping Marker Module + +## Overview + +TODO + +![Ping Marker Module Example](https://i.imgur.com) + +## Integration + +### Sample Code +Explore each integration by cycling through each tab, to find the best fit for your requirements and needs. + + + + + +### Display a Ping Marker with a resource + +```java +public void displayMarkerResourceExample(Player player) { + Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(player.getUniqueId()); + + apolloPlayerOpt.ifPresent(apolloPlayer -> { + Location location = this.findTargetLocation(player); + + if (location == null) { + return; + } + + this.pingMarkerModule.displayMarker(Recipients.ofWorld(apolloPlayer), PingMarker.builder() + .id(UUID.randomUUID()) + .type(null) + .location(BukkitApollo.toApolloLocation(location)) + .color(Color.WHITE) + .icon(SimpleResourceLocationIcon.builder() + .resourceLocation("lunar:icons/fluent-black-circle-icon.svg") + .size(12) + .build() + ) + .duration(Duration.ofSeconds(5)) + .focus(true) + .build()); + }); + +} + +private Location findTargetLocation(Player player) { + Block targetBlock = player.getTargetBlockExact(30); + + if (targetBlock == null) { + return null; + } + + return targetBlock.getLocation().add(0.5D, 0.5D, 0.5D); +} +``` + +### `PingMarkerType` Options + +### `PingMarker` Options + + + + + +### Display a Ping Marker with a resource + +```java + +``` + + + + + +### Display a Ping Marker with a resource + +```java + +``` + + + + diff --git a/folia/src/main/java/com/lunarclient/apollo/ApolloFoliaPlatform.java b/folia/src/main/java/com/lunarclient/apollo/ApolloFoliaPlatform.java index f0341a7c..5d11c97a 100644 --- a/folia/src/main/java/com/lunarclient/apollo/ApolloFoliaPlatform.java +++ b/folia/src/main/java/com/lunarclient/apollo/ApolloFoliaPlatform.java @@ -57,6 +57,8 @@ import com.lunarclient.apollo.module.notification.NotificationModuleImpl; import com.lunarclient.apollo.module.packetenrichment.PacketEnrichmentImpl; import com.lunarclient.apollo.module.packetenrichment.PacketEnrichmentModule; +import com.lunarclient.apollo.module.pingmarker.PingMarkerModule; +import com.lunarclient.apollo.module.pingmarker.PingMarkerModuleImpl; import com.lunarclient.apollo.module.richpresence.RichPresenceModule; import com.lunarclient.apollo.module.richpresence.RichPresenceModuleImpl; import com.lunarclient.apollo.module.serverrule.ServerRuleModule; @@ -130,6 +132,7 @@ public void onEnable() { .addModule(NickHiderModule.class, new NickHiderModuleImpl()) .addModule(NotificationModule.class, new NotificationModuleImpl()) .addModule(PacketEnrichmentModule.class, new PacketEnrichmentImpl()) + .addModule(PingMarkerModule.class, new PingMarkerModuleImpl()) .addModule(RichPresenceModule.class, new RichPresenceModuleImpl()) .addModule(ServerRuleModule.class) .addModule(StaffModModule.class, new StaffModModuleImpl())