Skip to content

Commit 95a89f7

Browse files
Feature - Markers Module (#293)
* Add Marker API classes * Marker Module Impl * Add examples and docs # Conflicts: # example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/util/JsonPacketUtil.java # example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/util/ProtobufPacketUtil.java * Rename loot chest example to display block example * Publish branch * add marker overview gif * add overview gif to marker docs * Relocate compact mode callout * Remove dead repo * Update markers gif * Use apollo-protos 0.2.0 * Apply changes from optimizations PR * Remove temp publish --------- Co-authored-by: Trentin <25537885+TrentinTheKid@users.noreply.github.com>
1 parent f53ffa5 commit 95a89f7

35 files changed

Lines changed: 2472 additions & 2 deletions

File tree

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
/*
2+
* This file is part of Apollo, licensed under the MIT License.
3+
*
4+
* Copyright (c) 2026 Moonsworth
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all
14+
* copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
package com.lunarclient.apollo.module.marker;
25+
26+
import com.lunarclient.apollo.common.location.ApolloLocation;
27+
import com.lunarclient.apollo.module.marker.display.MarkerFlag;
28+
import com.lunarclient.apollo.module.marker.target.BlockMarkerTarget;
29+
import com.lunarclient.apollo.module.marker.target.EntityMarkerTarget;
30+
import com.lunarclient.apollo.module.marker.target.ItemMarkerTarget;
31+
import com.lunarclient.apollo.module.marker.target.MarkerTarget;
32+
import com.lunarclient.apollo.module.marker.target.PlayerMarkerTarget;
33+
import java.awt.Color;
34+
import java.time.Duration;
35+
import java.util.UUID;
36+
import lombok.Builder;
37+
import lombok.Getter;
38+
import org.jetbrains.annotations.NotNull;
39+
import org.jetbrains.annotations.Nullable;
40+
41+
/**
42+
* Represents a marker which can be shown on the client.
43+
*
44+
* @since 1.2.8
45+
*/
46+
@Getter
47+
@Builder
48+
public final class Marker {
49+
50+
/**
51+
* Returns the marker {@link String} id.
52+
*
53+
* @return the marker id
54+
* @since 1.2.8
55+
*/
56+
@NotNull String id;
57+
58+
/**
59+
* Returns the marker {@link ApolloLocation}.
60+
*
61+
* @return the marker location
62+
* @since 1.2.8
63+
*/
64+
@NotNull ApolloLocation location;
65+
66+
/**
67+
* Returns the marker owner's {@link UUID}.
68+
*
69+
* <p>Used to show the owner head.</p>
70+
*
71+
* @return the owner uuid
72+
* @since 1.2.8
73+
*/
74+
@NotNull UUID ownerId;
75+
76+
/**
77+
* Returns the marker owner's {@link String} name.
78+
*
79+
* @return the owner name
80+
* @since 1.2.8
81+
*/
82+
@NotNull String ownerName;
83+
84+
/**
85+
* Returns the {@link MarkerFlag} (icon shape and base color) of this marker.
86+
*
87+
* @return the marker flag
88+
* @since 1.2.8
89+
*/
90+
@NotNull MarkerFlag flag;
91+
92+
/**
93+
* Returns the {@link Color} override for this marker's {@link #flag}.
94+
*
95+
* <p>Leave {@code null} to use the player's own configured color for the
96+
* selected flag.</p>
97+
*
98+
* @return the flag color override, or {@code null} to defer to the player's setting
99+
* @since 1.2.8
100+
*/
101+
@Builder.Default
102+
@Nullable Color color = null;
103+
104+
/**
105+
* Returns the {@link MarkerTarget} describing what this marker marks.
106+
*
107+
* <p>Drives the description icon and text shown on the client. One of
108+
* {@link ItemMarkerTarget}, {@link BlockMarkerTarget}, {@link EntityMarkerTarget}
109+
* or {@link PlayerMarkerTarget}.</p>
110+
*
111+
* @return the marker target
112+
* @since 1.2.8
113+
*/
114+
@NotNull MarkerTarget target;
115+
116+
/**
117+
* Returns the {@link Duration} the marker remains visible.
118+
*
119+
* <p>Leave {@code null} to defer to the player's configured marker
120+
* duration.</p>
121+
*
122+
* @return the duration, or {@code null} to defer to the player's setting
123+
* @since 1.2.8
124+
*/
125+
@Builder.Default
126+
@Nullable Duration duration = null;
127+
128+
/**
129+
* Returns whether a popup notification is shown when this marker first appears.
130+
*
131+
* @return whether an in-game notification is shown
132+
* @since 1.2.8
133+
*/
134+
@Builder.Default
135+
boolean inGameNotification = false;
136+
137+
/**
138+
* Returns whether a chat message is sent when this marker first appears.
139+
*
140+
* @return whether an in-game chat message is sent
141+
* @since 1.2.8
142+
*/
143+
@Builder.Default
144+
boolean chatNotify = false;
145+
146+
/**
147+
* Returns whether the player can middle-click to remove this marker.
148+
*
149+
* @return the middle-click removal state
150+
* @since 1.2.8
151+
*/
152+
@Builder.Default
153+
boolean middleClickRemove = true;
154+
155+
/**
156+
* Returns the {@link MarkerStyle} overrides applied to this marker.
157+
*
158+
* <p>Set to a built {@link MarkerStyle} to drive the marker's appearance
159+
* from the server; leave {@code null} to defer entirely to the player's
160+
* own Markers mod settings.</p>
161+
*
162+
* @return the style overrides, or {@code null} when no override is sent
163+
* @since 1.2.8
164+
*/
165+
@Builder.Default
166+
@Nullable MarkerStyle style = null;
167+
168+
}
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
/*
2+
* This file is part of Apollo, licensed under the MIT License.
3+
*
4+
* Copyright (c) 2026 Moonsworth
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all
14+
* copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
package com.lunarclient.apollo.module.marker;
25+
26+
import com.lunarclient.apollo.module.ApolloModule;
27+
import com.lunarclient.apollo.module.ModuleDefinition;
28+
import com.lunarclient.apollo.recipients.Recipients;
29+
import org.jetbrains.annotations.ApiStatus;
30+
31+
/**
32+
* Represents the marker module.
33+
*
34+
* @since 1.2.8
35+
*/
36+
@ApiStatus.NonExtendable
37+
@ModuleDefinition(id = "marker", name = "Marker")
38+
public abstract class MarkerModule extends ApolloModule {
39+
40+
/**
41+
* Displays the {@link Marker} to the {@link Recipients}.
42+
*
43+
* @param recipients the recipients that are receiving the packet
44+
* @param marker the marker
45+
* @since 1.2.8
46+
*/
47+
public abstract void displayMarker(Recipients recipients, Marker marker);
48+
49+
/**
50+
* Removes the {@link Marker} from the {@link Recipients}.
51+
*
52+
* @param recipients the recipients that are receiving the packet
53+
* @param markerId the marker id
54+
* @since 1.2.8
55+
*/
56+
public abstract void removeMarker(Recipients recipients, String markerId);
57+
58+
/**
59+
* Removes the {@link Marker} from the {@link Recipients}.
60+
*
61+
* @param recipients the recipients that are receiving the packet
62+
* @param marker the marker
63+
* @since 1.2.8
64+
*/
65+
public abstract void removeMarker(Recipients recipients, Marker marker);
66+
67+
/**
68+
* Resets all {@link Marker}s for the {@link Recipients}.
69+
*
70+
* @param recipients the recipients that are receiving the packet
71+
* @since 1.2.8
72+
*/
73+
public abstract void resetMarkers(Recipients recipients);
74+
75+
}
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
/*
2+
* This file is part of Apollo, licensed under the MIT License.
3+
*
4+
* Copyright (c) 2026 Moonsworth
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all
14+
* copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
package com.lunarclient.apollo.module.marker;
25+
26+
import com.lunarclient.apollo.module.marker.display.MarkerDescriptionDisplay;
27+
import com.lunarclient.apollo.module.marker.display.MarkerDisplayCondition;
28+
import com.lunarclient.apollo.module.marker.display.MarkerOwnerDisplay;
29+
import lombok.Builder;
30+
import lombok.Getter;
31+
import org.jetbrains.annotations.NotNull;
32+
33+
/**
34+
* Overrides for a marker's appearance, owner/description display and text on the Lunar client.
35+
*
36+
* @since 1.2.8
37+
*/
38+
@Getter
39+
@Builder
40+
public final class MarkerStyle {
41+
42+
/**
43+
* The scale applied to the marker.
44+
*
45+
* <p>Accepts {@code 0.5F} to {@code 2.0F}.</p>
46+
*
47+
* @since 1.2.8
48+
*/
49+
@Builder.Default
50+
float scale = 1.0F;
51+
52+
/**
53+
* Whether the marker plays its hover animations.
54+
*
55+
* @since 1.2.8
56+
*/
57+
@Builder.Default
58+
boolean animateMarkerOnHover = true;
59+
60+
/**
61+
* Whether the marker uses the compact single-row layout.
62+
*
63+
* <p>When {@code true}, {@link #ownerDisplay}, {@link #descriptionDisplay} and
64+
* {@link #ownerSuffix} are ignored; the compact layout always uses the owner head,
65+
* description icon and shows no suffix.</p>
66+
*
67+
* @since 1.2.8
68+
*/
69+
@Builder.Default
70+
boolean compactMode = false;
71+
72+
/**
73+
* Whether a shadow is drawn behind the marker's text.
74+
*
75+
* @since 1.2.8
76+
*/
77+
@Builder.Default
78+
boolean textShadow = true;
79+
80+
/**
81+
* The suffix appended after the owner name.
82+
*
83+
* <p>Set to an empty {@link String} to show no suffix.</p>
84+
*
85+
* @since 1.2.8
86+
*/
87+
@Builder.Default
88+
@NotNull String ownerSuffix = "'s Marker";
89+
90+
/**
91+
* How the marker's owner is displayed.
92+
*
93+
* @since 1.2.8
94+
*/
95+
@Builder.Default
96+
@NotNull MarkerOwnerDisplay ownerDisplay = MarkerOwnerDisplay.HEAD;
97+
98+
/**
99+
* When the marker's owner is shown.
100+
*
101+
* @since 1.2.8
102+
*/
103+
@Builder.Default
104+
@NotNull MarkerDisplayCondition showOwner = MarkerDisplayCondition.ALWAYS;
105+
106+
/**
107+
* When the marker's coordinates are shown.
108+
*
109+
* @since 1.2.8
110+
*/
111+
@Builder.Default
112+
@NotNull MarkerDisplayCondition showCoordinates = MarkerDisplayCondition.NEVER;
113+
114+
/**
115+
* When the distance from the player to the marker is shown.
116+
*
117+
* @since 1.2.8
118+
*/
119+
@Builder.Default
120+
@NotNull MarkerDisplayCondition showDistance = MarkerDisplayCondition.HOVER;
121+
122+
/**
123+
* When the marker's description (what was marked) is shown.
124+
*
125+
* @since 1.2.8
126+
*/
127+
@Builder.Default
128+
@NotNull MarkerDisplayCondition showDescription = MarkerDisplayCondition.HOVER;
129+
130+
/**
131+
* How the marker's description is displayed.
132+
*
133+
* @since 1.2.8
134+
*/
135+
@Builder.Default
136+
@NotNull MarkerDescriptionDisplay descriptionDisplay = MarkerDescriptionDisplay.ICON;
137+
138+
}

0 commit comments

Comments
 (0)