Skip to content

Commit e304a70

Browse files
ItsNatureTrentinTheKidLunarClientBot
authored
Version - 1.2.9 (#306)
* Deploy as `1.2.9-SNAPSHOT` * Feature - Height Limit Module (#300) * Height Limit Module * Add default height limit config entry, more callouts & update example * Document snake_case custom data keys (#301) * Add `TransferModule#ping` validation & increase `PingRequest` timeout to 10s (#302) * example(internal): npc visibility tracking (#303) * Feature - Inventory & Chat Buttons (#304) * Inventory & Chat Buttons # Conflicts: # gradle/libs.versions.toml * Add default chat & inventory buttons config option * Add button docs * Add button images to docs * Update inventory.mdx * Update chat.mdx * Remove temp gradle publish --------- Co-authored-by: Trentin <25537885+TrentinTheKid@users.noreply.github.com> * Add `NametagVisibilityOverride` to `Nametag` (#305) # Conflicts: # gradle/libs.versions.toml * Sync LunarClient Mods & Options (#307) * Sync LunarClient Mods & Options * Update version tags to 1.2.9 --------- Co-authored-by: LunarClient Bot <lc-bot@moonsworth.com> * Bump to 1.2.9 (#308) --------- Co-authored-by: Trentin <25537885+TrentinTheKid@users.noreply.github.com> Co-authored-by: LunarClient Bot <lc-bot@moonsworth.com>
1 parent 88099c9 commit e304a70

176 files changed

Lines changed: 16072 additions & 199 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

api/src/main/java/com/lunarclient/apollo/ApolloPlatform.java

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
import com.lunarclient.apollo.option.Options;
2727
import com.lunarclient.apollo.stats.ApolloStats;
28+
import java.util.concurrent.TimeUnit;
2829
import java.util.logging.Logger;
2930
import org.jetbrains.annotations.ApiStatus;
3031

@@ -92,6 +93,14 @@ public interface ApolloPlatform {
9293
*/
9394
Object getPlugin();
9495

96+
/**
97+
* Returns the platform {@link Scheduler}.
98+
*
99+
* @return the platform scheduler
100+
* @since 1.2.9
101+
*/
102+
Scheduler getScheduler();
103+
95104
/**
96105
* Represents the kind of server a platform is.
97106
*
@@ -115,4 +124,26 @@ enum Platform {
115124
VELOCITY
116125
}
117126

127+
/**
128+
* Represents the platform scheduler, running tasks through the
129+
* platform plugin's own scheduler.
130+
*
131+
* @since 1.2.9
132+
*/
133+
interface Scheduler {
134+
135+
/**
136+
* Schedules a task to run asynchronously every period, first running
137+
* after the given delay.
138+
*
139+
* @param task the task to run
140+
* @param delay the delay before the first run
141+
* @param period the period between runs
142+
* @param unit the unit of the delay and period
143+
* @since 1.2.9
144+
*/
145+
void scheduleAsyncRepeating(Runnable task, long delay, long period, TimeUnit unit);
146+
147+
}
148+
118149
}
Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
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.common.button;
25+
26+
import com.lunarclient.apollo.common.button.action.ApolloButtonAction;
27+
import com.lunarclient.apollo.common.button.action.ApolloButtonClientAction;
28+
import com.lunarclient.apollo.common.button.content.ApolloButtonContent;
29+
import com.lunarclient.apollo.common.location.HudPosition;
30+
import java.awt.Color;
31+
import lombok.Builder;
32+
import lombok.Getter;
33+
import lombok.experimental.SuperBuilder;
34+
import org.jetbrains.annotations.ApiStatus;
35+
import org.jetbrains.annotations.NotNull;
36+
import org.jetbrains.annotations.Nullable;
37+
38+
/**
39+
* Represents a button which can be shown on the client.
40+
*
41+
* @since 1.2.9
42+
*/
43+
@Getter
44+
@SuperBuilder(toBuilder = true)
45+
@ApiStatus.NonExtendable
46+
public abstract class ApolloButton {
47+
48+
/**
49+
* Returns the button {@link String} id.
50+
*
51+
* <p>Displaying another button with the same id replaces the
52+
* previous one.</p>
53+
*
54+
* @return the button id
55+
* @since 1.2.9
56+
*/
57+
@NotNull String id;
58+
59+
/**
60+
* Returns the {@link HudPosition} of this button, relative to the
61+
* top-left corner of the container it is placed in.
62+
*
63+
* <p>The button must fit inside the container: {@code 0 <= x},
64+
* {@code 0 <= y}, {@code x + width <= container width} and
65+
* {@code y + height <= container height}. See the surface type for
66+
* its container dimensions (e.g. {@code InventoryButton#BOX_WIDTH}).</p>
67+
*
68+
* @return the button position
69+
* @since 1.2.9
70+
*/
71+
@NotNull HudPosition position;
72+
73+
/**
74+
* Returns the {@link ApolloButtonSize} of this button.
75+
*
76+
* <p>Use one of the surface's suggested sizes (e.g.
77+
* {@code InventoryButton.SIZE_MEDIUM}) or a fully custom
78+
* {@link ApolloButtonSize#of(float, float)}.</p>
79+
*
80+
* @return the button size
81+
* @since 1.2.9
82+
*/
83+
@NotNull ApolloButtonSize size;
84+
85+
/**
86+
* Returns the {@link ApolloButtonShape} of this button.
87+
*
88+
* @return the button shape
89+
* @since 1.2.9
90+
*/
91+
@NotNull ApolloButtonShape shape;
92+
93+
/**
94+
* Returns the {@link ApolloButtonContent} rendered inside this button.
95+
*
96+
* <p>Built via {@code ApolloButtonContent.builder()}, appending static
97+
* components, icons or live per-player parts that are re-resolved
98+
* whenever the content is sent (see the owning module's live button
99+
* broadcast option, e.g. {@code InventoryModule#BROADCAST_LIVE_BUTTONS}).</p>
100+
*
101+
* @return the button content
102+
* @since 1.2.9
103+
*/
104+
@NotNull ApolloButtonContent content;
105+
106+
/**
107+
* Returns the {@link ApolloButtonTooltip} shown while this button is hovered.
108+
*
109+
* <p>Built via {@code ApolloButtonTooltip.of(...)} for static lines,
110+
* or {@code ApolloButtonTooltip.live(...)} for per-player lines that
111+
* are re-resolved whenever the button content is sent (see the owning
112+
* module's live button broadcast option, e.g.
113+
* {@code InventoryModule#BROADCAST_LIVE_BUTTONS}).</p>
114+
*
115+
* @return the tooltip, or {@code null} for no tooltip
116+
* @since 1.2.9
117+
*/
118+
@Builder.Default
119+
@Nullable ApolloButtonTooltip tooltip = null;
120+
121+
/**
122+
* Returns the {@link ApolloButtonAction} executed when this button
123+
* is clicked.
124+
*
125+
* <p>Built via {@link ApolloButtonAction#runCommand(String)},
126+
* {@link ApolloButtonAction#openUrl(String)} or
127+
* {@link ApolloButtonAction#clientAction(ApolloButtonClientAction)}.</p>
128+
*
129+
* @return the click action, or {@code null}
130+
* @since 1.2.9
131+
*/
132+
@Builder.Default
133+
@Nullable ApolloButtonAction onClick = null;
134+
135+
/**
136+
* Returns the background {@link Color} used while this button is hovered.
137+
*
138+
* @return the hovered background color, or {@code null}
139+
* @since 1.2.9
140+
*/
141+
@Builder.Default
142+
@Nullable Color hoveredBackgroundColor = null;
143+
144+
/**
145+
* Returns the border {@link Color} used while this button is hovered.
146+
*
147+
* @return the hovered border color, or {@code null}
148+
* @since 1.2.9
149+
*/
150+
@Builder.Default
151+
@Nullable Color hoveredBorderColor = null;
152+
153+
/**
154+
* Returns the background {@link Color} of this button.
155+
*
156+
* @return the background color
157+
* @since 1.2.9
158+
*/
159+
public abstract Color getBackgroundColor();
160+
161+
/**
162+
* Returns the border {@link Color} of this button.
163+
*
164+
* @return the border color
165+
* @since 1.2.9
166+
*/
167+
public abstract Color getBorderColor();
168+
169+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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.common.button;
25+
26+
/**
27+
* Represents the shape of a button.
28+
*
29+
* @since 1.2.9
30+
*/
31+
public enum ApolloButtonShape {
32+
ROUNDED_SQUARE,
33+
CIRCLE
34+
35+
}
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
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.common.button;
25+
26+
import lombok.AccessLevel;
27+
import lombok.Getter;
28+
import lombok.RequiredArgsConstructor;
29+
30+
/**
31+
* Represents the size of an {@link ApolloButton}, in GUI-scaled pixels.
32+
*
33+
* <p>Surface types ship suggested sizes tuned to their container
34+
* dimensions (e.g. {@code InventoryButton.SIZE_MEDIUM}); use
35+
* {@link #of(float, float)} for a fully custom size.</p>
36+
*
37+
* @since 1.2.9
38+
*/
39+
@Getter
40+
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
41+
public final class ApolloButtonSize {
42+
43+
/**
44+
* Creates a new {@link ApolloButtonSize} with the given dimensions.
45+
*
46+
* @param width the button width, must be finite and greater than 0
47+
* @param height the button height, must be finite and greater than 0
48+
* @return the button size
49+
* @since 1.2.9
50+
*/
51+
public static ApolloButtonSize of(float width, float height) {
52+
if (!(width > 0.0F) || !(height > 0.0F) || !Float.isFinite(width) || !Float.isFinite(height)) {
53+
throw new IllegalArgumentException("ApolloButtonSize dimensions must be finite and greater than 0");
54+
}
55+
56+
return new ApolloButtonSize(width, height);
57+
}
58+
59+
/**
60+
* Creates a new square {@link ApolloButtonSize}.
61+
*
62+
* @param size the button width and height, must be finite and greater than 0
63+
* @return the button size
64+
* @since 1.2.9
65+
*/
66+
public static ApolloButtonSize of(float size) {
67+
return of(size, size);
68+
}
69+
70+
/**
71+
* Returns the {@code float} button width.
72+
*
73+
* @return the button width
74+
* @since 1.2.9
75+
*/
76+
private final float width;
77+
78+
/**
79+
* Returns the {@code float} button height.
80+
*
81+
* @return the button height
82+
* @since 1.2.9
83+
*/
84+
private final float height;
85+
86+
}

0 commit comments

Comments
 (0)