Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* This file is part of Apollo, licensed under the MIT License.
*
* Copyright (c) 2026 Moonsworth
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.lunarclient.apollo.common.location;

import lombok.Builder;
import lombok.Getter;

/**
* Represents a HUD element position on the client screen.
*
* @since 1.2.6
*/
@Getter
@Builder
public final class HudPosition {

/**
* Returns the {@code float} X coordinate for this HUD position.
*
* @return the x coordinate
* @since 1.2.6
*/
float x;

/**
* Returns the {@code float} Y coordinate for this HUD position.
*
* @return the y coordinate
* @since 1.2.6
*/
float y;

}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import org.jetbrains.annotations.Nullable;

/**
* Represents the {@link Cooldown} style, allowing customization of the circle start, end, edge & text color.
* Represents the {@link Cooldown} style, allowing customization of the circle start, end, edge and text color.
*
* @since 1.2.5
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
/*
* This file is part of Apollo, licensed under the MIT License.
*
* Copyright (c) 2026 Moonsworth
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.lunarclient.apollo.module.stopwatch;

import com.lunarclient.apollo.common.location.HudPosition;
import java.awt.Color;
import lombok.Builder;
import lombok.Getter;
import org.jetbrains.annotations.Nullable;

/**
* Represents a stopwatch which can be displayed on the client HUD.
*
* @since 1.2.6
*/
@Getter
@Builder
public final class Stopwatch {

/**
* Returns the stopwatch {@link String} id.
*
* @return the stopwatch id
* @since 1.2.6
*/
String id;

/**
* Returns the stopwatch {@link String} name.
*
* @return the stopwatch name
* @since 1.2.6
*/
String name;

/**
* Returns the stopwatch {@code boolean} reset on start.
*
* <p>If {@code true}, elapsed time is reset on each start.</p>
*
* @return whether to reset on start
* @since 1.2.6
*/
boolean resetOnStart;

/**
* Returns the stopwatch {@code boolean} prevent modification.
*
* <p>If {@code true}, the user cannot modify the options for this
* stopwatch on the client side.</p>
*
* @return whether modification is prevented
* @since 1.2.6
*/
boolean preventModification;

/**
* Returns the stopwatch {@code boolean} hide when stopped.
*
* <p>If {@code true}, the stopwatch is hidden from the HUD when stopped.</p>
*
* @return whether to hide when stopped
* @since 1.2.6
*/
boolean hideWhenStopped;

/**
* Returns the stopwatch {@link String} display format.
*
* <p>A format string (e.g. {@code "mm:ss"}), or {@code null}
* for the default display format.</p>
*
* @return the display format string
* @since 1.2.6
*/
@Nullable String displayFormat;

/**
* Returns the stopwatch {@link Color} text color.
*
* <p>If {@code null}, the default color (white) is used.</p>
*
* @return the text color
* @since 1.2.6
*/
@Nullable Color textColor;

/**
* Returns the stopwatch {@link HudPosition} HUD position.
*
* <p>If {@code null}, the stopwatch is auto-stacked at the default position.</p>
*
* @return the HUD position
* @since 1.2.6
*/
@Nullable HudPosition hudPosition;

}
Original file line number Diff line number Diff line change
Expand Up @@ -45,28 +45,141 @@ public Collection<ApolloPlatform.Kind> getSupportedPlatforms() {
return Arrays.asList(ApolloPlatform.Kind.SERVER, ApolloPlatform.Kind.PROXY);
}

/**
* Adds a {@link Stopwatch} to the HUD for the {@link Recipients}.
*
* @param recipients the recipients that are receiving the packet
* @param stopwatch the stopwatch to add
* @since 1.2.6
*/
public abstract void addStopwatch(Recipients recipients, Stopwatch stopwatch);

/**
* Removes the {@link Stopwatch} with the given id for the {@link Recipients}.
*
* @param recipients the recipients that are receiving the packet
* @param id the stopwatch id
* @since 1.2.6
*/
public abstract void removeStopwatch(Recipients recipients, String id);

/**
* Starts the {@link Stopwatch} with the given id for the {@link Recipients}.
*
* @param recipients the recipients that are receiving the packet
* @param id the stopwatch id
* @since 1.2.6
*/
public abstract void startStopwatch(Recipients recipients, String id);

/**
* Stops the {@link Stopwatch} with the given id for the {@link Recipients}.
*
* @param recipients the recipients that are receiving the packet
* @param id the stopwatch id
* @since 1.2.6
*/
public abstract void stopStopwatch(Recipients recipients, String id);

/**
* Resets the {@link Stopwatch} with the given id for the {@link Recipients}.
*
* @param recipients the recipients that are receiving the packet
* @param id the stopwatch id
* @since 1.2.6
*/
public abstract void resetStopwatch(Recipients recipients, String id);

/**
* Resets all {@link Stopwatch}es for the {@link Recipients}.
*
* @param recipients the recipients that are receiving the packet
* @since 1.2.6
*/
public abstract void resetStopwatches(Recipients recipients);

/**
* Adds a {@link Timer} to the HUD for the {@link Recipients}.
*
* @param recipients the recipients that are receiving the packet
* @param timer the timer to add
* @since 1.2.6
*/
public abstract void addTimer(Recipients recipients, Timer timer);

/**
* Removes the {@link Timer} with the given id for the {@link Recipients}.
*
* @param recipients the recipients that are receiving the packet
* @param id the timer id
* @since 1.2.6
*/
public abstract void removeTimer(Recipients recipients, String id);

/**
* Starts the {@link Timer} with the given id for the {@link Recipients}.
*
* @param recipients the recipients that are receiving the packet
* @param id the timer id
* @since 1.2.6
*/
public abstract void startTimer(Recipients recipients, String id);

/**
* Stops the {@link Timer} with the given id for the {@link Recipients}.
*
* @param recipients the recipients that are receiving the packet
* @param id the timer id
* @since 1.2.6
*/
public abstract void stopTimer(Recipients recipients, String id);

/**
* Resets the {@link Timer} with the given id for the {@link Recipients}.
*
* @param recipients the recipients that are receiving the packet
* @param id the timer id
* @since 1.2.6
*/
public abstract void resetTimer(Recipients recipients, String id);

/**
* Resets all {@link Timer}s for the {@link Recipients}.
*
* @param recipients the recipients that are receiving the packet
* @since 1.2.6
*/
public abstract void resetTimers(Recipients recipients);

/**
* Starts the stopwatch for the {@link Recipients}.
*
* @param recipients the recipients that are receiving the packet
* @deprecated for removal since 1.2.6, use {@link #addStopwatch(Recipients, Stopwatch)}
* and {@link #startStopwatch(Recipients, String)} instead.
* @since 1.0.0
*/
@Deprecated
public abstract void startStopwatch(Recipients recipients);

/**
* Stops the stopwatch for the {@link Recipients}.
*
* @param recipients the recipients that are receiving the packet
* @deprecated for removal since 1.2.6, use {@link #stopStopwatch(Recipients, String)} instead.
* @since 1.0.0
*/
@Deprecated
public abstract void stopStopwatch(Recipients recipients);

/**
* Resets the stopwatch for the {@link Recipients}.
*
* @param recipients the recipients that are receiving the packet
* @deprecated for removal since 1.2.6, use {@link #resetStopwatch(Recipients, String)} instead.
* @since 1.0.0
*/
@Deprecated
public abstract void resetStopwatch(Recipients recipients);

}
Loading
Loading