diff --git a/.checkstyle/suppressions.xml b/.checkstyle/suppressions.xml index d13c7d9d..d6398acd 100644 --- a/.checkstyle/suppressions.xml +++ b/.checkstyle/suppressions.xml @@ -2,7 +2,7 @@ - + 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/api/build.gradle.kts b/api/build.gradle.kts index 38dd6aa9..4cc32fc7 100644 --- a/api/build.gradle.kts +++ b/api/build.gradle.kts @@ -7,7 +7,7 @@ setupPlatforms() setupPlatformDependency("bukkit", "bukkitJar") setupPlatformDependency("bungee", "bungeeJar") -setupPlatformDependency("velocity", "velocityJar") +setupPlatformDependency("velocity", "velocityJar", 17) setupPlatformDependency("folia", "foliaJar", 21) val main by sourceSets diff --git a/api/src/main/java/com/lunarclient/apollo/event/packetenrichment/chat/ApolloPlayerChatCloseEvent.java b/api/src/main/java/com/lunarclient/apollo/event/packetenrichment/chat/ApolloPlayerChatCloseEvent.java index d40d8b0d..26596d88 100644 --- a/api/src/main/java/com/lunarclient/apollo/event/packetenrichment/chat/ApolloPlayerChatCloseEvent.java +++ b/api/src/main/java/com/lunarclient/apollo/event/packetenrichment/chat/ApolloPlayerChatCloseEvent.java @@ -25,6 +25,7 @@ import com.lunarclient.apollo.event.Event; import com.lunarclient.apollo.module.packetenrichment.PlayerInfo; +import com.lunarclient.apollo.player.ApolloPlayer; import lombok.Value; /** @@ -35,6 +36,14 @@ @Value public class ApolloPlayerChatCloseEvent implements Event { + /** + * The player that sent the packet. + * + * @return the player + * @since 1.1.9 + */ + ApolloPlayer player; + /** * The {@code long} representing the unix timestamp * when the packet was created. diff --git a/api/src/main/java/com/lunarclient/apollo/event/packetenrichment/chat/ApolloPlayerChatOpenEvent.java b/api/src/main/java/com/lunarclient/apollo/event/packetenrichment/chat/ApolloPlayerChatOpenEvent.java index 7ea35b68..93ff8023 100644 --- a/api/src/main/java/com/lunarclient/apollo/event/packetenrichment/chat/ApolloPlayerChatOpenEvent.java +++ b/api/src/main/java/com/lunarclient/apollo/event/packetenrichment/chat/ApolloPlayerChatOpenEvent.java @@ -25,6 +25,7 @@ import com.lunarclient.apollo.event.Event; import com.lunarclient.apollo.module.packetenrichment.PlayerInfo; +import com.lunarclient.apollo.player.ApolloPlayer; import lombok.Value; /** @@ -35,6 +36,14 @@ @Value public class ApolloPlayerChatOpenEvent implements Event { + /** + * The player that sent the packet. + * + * @return the player + * @since 1.1.9 + */ + ApolloPlayer player; + /** * The {@code long} representing the unix timestamp * when the packet was created. diff --git a/api/src/main/java/com/lunarclient/apollo/event/packetenrichment/melee/ApolloPlayerAttackEvent.java b/api/src/main/java/com/lunarclient/apollo/event/packetenrichment/melee/ApolloPlayerAttackEvent.java index 55cb269a..79562edd 100644 --- a/api/src/main/java/com/lunarclient/apollo/event/packetenrichment/melee/ApolloPlayerAttackEvent.java +++ b/api/src/main/java/com/lunarclient/apollo/event/packetenrichment/melee/ApolloPlayerAttackEvent.java @@ -25,6 +25,7 @@ import com.lunarclient.apollo.event.Event; import com.lunarclient.apollo.module.packetenrichment.PlayerInfo; +import com.lunarclient.apollo.player.ApolloPlayer; import lombok.Value; /** @@ -35,6 +36,14 @@ @Value public class ApolloPlayerAttackEvent implements Event { + /** + * The player that sent the packet. + * + * @return the player + * @since 1.1.9 + */ + ApolloPlayer player; + /** * The {@code long} representing the unix timestamp * when the packet was created. diff --git a/api/src/main/java/com/lunarclient/apollo/event/packetenrichment/world/ApolloPlayerUseItemEvent.java b/api/src/main/java/com/lunarclient/apollo/event/packetenrichment/world/ApolloPlayerUseItemEvent.java index e33af940..d878e223 100644 --- a/api/src/main/java/com/lunarclient/apollo/event/packetenrichment/world/ApolloPlayerUseItemEvent.java +++ b/api/src/main/java/com/lunarclient/apollo/event/packetenrichment/world/ApolloPlayerUseItemEvent.java @@ -25,6 +25,7 @@ import com.lunarclient.apollo.event.Event; import com.lunarclient.apollo.module.packetenrichment.PlayerInfo; +import com.lunarclient.apollo.player.ApolloPlayer; import lombok.Value; /** @@ -35,6 +36,14 @@ @Value public class ApolloPlayerUseItemEvent implements Event { + /** + * The player that sent the packet. + * + * @return the player + * @since 1.1.9 + */ + ApolloPlayer player; + /** * The {@code long} representing the unix timestamp * when the packet was created. diff --git a/api/src/main/java/com/lunarclient/apollo/mods/Mods.java b/api/src/main/java/com/lunarclient/apollo/mods/Mods.java index 6ad84734..13590e31 100644 --- a/api/src/main/java/com/lunarclient/apollo/mods/Mods.java +++ b/api/src/main/java/com/lunarclient/apollo/mods/Mods.java @@ -53,10 +53,12 @@ import com.lunarclient.apollo.mods.impl.ModHurtCam; import com.lunarclient.apollo.mods.impl.ModHypixelBedwars; import com.lunarclient.apollo.mods.impl.ModHypixelMod; +import com.lunarclient.apollo.mods.impl.ModInventoryMod; import com.lunarclient.apollo.mods.impl.ModItemCounter; import com.lunarclient.apollo.mods.impl.ModItemPhysics; import com.lunarclient.apollo.mods.impl.ModItemTracker; import com.lunarclient.apollo.mods.impl.ModKeystrokes; +import com.lunarclient.apollo.mods.impl.ModKillSounds; import com.lunarclient.apollo.mods.impl.ModLighting; import com.lunarclient.apollo.mods.impl.ModMemory; import com.lunarclient.apollo.mods.impl.ModMenuBlur; @@ -93,10 +95,12 @@ import com.lunarclient.apollo.mods.impl.ModStopwatch; import com.lunarclient.apollo.mods.impl.ModTab; import com.lunarclient.apollo.mods.impl.ModTeamView; +import com.lunarclient.apollo.mods.impl.ModTierTagger; import com.lunarclient.apollo.mods.impl.ModTimeChanger; import com.lunarclient.apollo.mods.impl.ModTitles; import com.lunarclient.apollo.mods.impl.ModTntCountdown; import com.lunarclient.apollo.mods.impl.ModToggleSneak; +import com.lunarclient.apollo.mods.impl.ModTotemCounter; import com.lunarclient.apollo.mods.impl.ModUhcOverlay; import com.lunarclient.apollo.mods.impl.ModWaila; import com.lunarclient.apollo.mods.impl.ModWaypoints; @@ -178,6 +182,7 @@ public final class Mods { ModAutoTextHotkey.class, ModAutoTextActions.class, ModMumbleLink.class, + ModTotemCounter.class, Mod2dItems.class, ModBossbar.class, ModFreelook.class, @@ -195,9 +200,12 @@ public final class Mods { ModWaila.class, ModNeu.class, ModHurtCam.class, + ModTierTagger.class, ModDamageTint.class, ModSkyblock.class, ModHorseStats.class, + ModKillSounds.class, + ModInventoryMod.class, ModRadio.class ); diff --git a/api/src/main/java/com/lunarclient/apollo/mods/impl/Mod3dSkins.java b/api/src/main/java/com/lunarclient/apollo/mods/impl/Mod3dSkins.java index 26d41d83..79b1b486 100644 --- a/api/src/main/java/com/lunarclient/apollo/mods/impl/Mod3dSkins.java +++ b/api/src/main/java/com/lunarclient/apollo/mods/impl/Mod3dSkins.java @@ -55,6 +55,16 @@ public final class Mod3dSkins { .notifyClient() .build(); + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption SHOW_OTHERS = SimpleOption.builder() + .node("3d-skins", "show-others").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + /** * No documentation available. * @@ -148,6 +158,17 @@ public final class Mod3dSkins { .notifyClient() .build(); + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final NumberOption FIRST_PERSON_VOXEL_SIZE = NumberOption.number() + .node("3d-skins", "first-person-voxel-size").type(TypeToken.get(Float.class)) + .min(1.001F).max(1.3F) + .notifyClient() + .build(); + /** * No documentation available. * diff --git a/api/src/main/java/com/lunarclient/apollo/mods/impl/ModArmorstatus.java b/api/src/main/java/com/lunarclient/apollo/mods/impl/ModArmorstatus.java index 7c355b10..b209e180 100644 --- a/api/src/main/java/com/lunarclient/apollo/mods/impl/ModArmorstatus.java +++ b/api/src/main/java/com/lunarclient/apollo/mods/impl/ModArmorstatus.java @@ -66,6 +66,16 @@ public final class ModArmorstatus { .notifyClient() .build(); + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption HIDE_UNBREAKABLE_DURABILITY = SimpleOption.builder() + .node("armorstatus", "hide-unbreakable-durability").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + /** * No documentation available. * diff --git a/api/src/main/java/com/lunarclient/apollo/mods/impl/ModAutoTextHotkey.java b/api/src/main/java/com/lunarclient/apollo/mods/impl/ModAutoTextHotkey.java index 743042ca..b2339504 100644 --- a/api/src/main/java/com/lunarclient/apollo/mods/impl/ModAutoTextHotkey.java +++ b/api/src/main/java/com/lunarclient/apollo/mods/impl/ModAutoTextHotkey.java @@ -43,6 +43,17 @@ public final class ModAutoTextHotkey { .notifyClient() .build(); + /** + * Displays a notification when an input is blocked by the server. + * + * @since 1.1.9 + */ + public static final SimpleOption NOTIFY_ON_BLOCKED_INPUT = SimpleOption.builder() + .comment("Displays a notification when an input is blocked by the server") + .node("auto-text-hotkey", "notify-on-blocked-input").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + private ModAutoTextHotkey() { } diff --git a/api/src/main/java/com/lunarclient/apollo/mods/impl/ModChat.java b/api/src/main/java/com/lunarclient/apollo/mods/impl/ModChat.java index 1b817fa7..8eaf51f3 100644 --- a/api/src/main/java/com/lunarclient/apollo/mods/impl/ModChat.java +++ b/api/src/main/java/com/lunarclient/apollo/mods/impl/ModChat.java @@ -55,6 +55,26 @@ public final class ModChat { .notifyClient() .build(); + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption MODERN_CHAT_LENGTH_HYPIXEL = SimpleOption.builder() + .node("chat", "modern-chat-length-hypixel").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption LONG_CHAT_SINGLEPLAYER = SimpleOption.builder() + .node("chat", "long-chat-singleplayer").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + /** * Choose whether or not you want to stack multiple of the same messages in chat. * @@ -183,12 +203,12 @@ public final class ModChat { .build(); /** - * Displays a preview of an image when hovering over it. + * Displays a preview of an image when hovering over it.If a single message has more than one image, press CTRL to cycle through them. * * @since 1.1.3 */ public static final SimpleOption HOVER_IMAGE_PREVIEW = SimpleOption.builder() - .comment("Displays a preview of an image when hovering over it.") + .comment("Displays a preview of an image when hovering over it.If a single message has more than one image, press CTRL to cycle through them.") .node("chat", "hover-image-preview").type(TypeToken.get(Boolean.class)) .notifyClient() .build(); @@ -217,6 +237,17 @@ public final class ModChat { .notifyClient() .build(); + /** + * When your max image size is set to e.g. 50%, when you press shift, the image will expand to 100%. + * + * @since 1.1.9 + */ + public static final SimpleOption FULLSCREEN_IMAGE = SimpleOption.builder() + .comment("When your max image size is set to e.g. 50%, when you press shift, the image will expand to 100%") + .node("chat", "fullscreen-image").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + /** * No documentation available. * @@ -238,6 +269,56 @@ public final class ModChat { .notifyClient() .build(); + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption CHAT_NAME_BOLD = SimpleOption.builder() + .node("chat", "chat-name-bold").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption CHAT_NAME_ITALIC = SimpleOption.builder() + .node("chat", "chat-name-italic").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption CHAT_NAME_UNDERLINE = SimpleOption.builder() + .node("chat", "chat-name-underline").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption CHAT_NAME_STRIKETHROUGH = SimpleOption.builder() + .node("chat", "chat-name-strikethrough").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption CHAT_NAME_OBFUSCATED = SimpleOption.builder() + .node("chat", "chat-name-obfuscated").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + /** * No documentation available. * diff --git a/api/src/main/java/com/lunarclient/apollo/mods/impl/ModDirectionHud.java b/api/src/main/java/com/lunarclient/apollo/mods/impl/ModDirectionHud.java index 86fdbc10..7bd0226b 100644 --- a/api/src/main/java/com/lunarclient/apollo/mods/impl/ModDirectionHud.java +++ b/api/src/main/java/com/lunarclient/apollo/mods/impl/ModDirectionHud.java @@ -124,8 +124,8 @@ public final class ModDirectionHud { * * @since 1.0.0 */ - public static final SimpleOption USE_LEGACY_STYLE = SimpleOption.builder() - .node("direction-hud", "use-legacy-style").type(TypeToken.get(Boolean.class)) + public static final SimpleOption SHOW_MARKER = SimpleOption.builder() + .node("direction-hud", "show-marker").type(TypeToken.get(Boolean.class)) .notifyClient() .build(); @@ -134,8 +134,8 @@ public final class ModDirectionHud { * * @since 1.0.0 */ - public static final SimpleOption SHOW_MARKER = SimpleOption.builder() - .node("direction-hud", "show-marker").type(TypeToken.get(Boolean.class)) + public static final SimpleOption SHOW_MARKER_VALUE = SimpleOption.builder() + .node("direction-hud", "show-marker-value").type(TypeToken.get(Boolean.class)) .notifyClient() .build(); @@ -144,8 +144,19 @@ public final class ModDirectionHud { * * @since 1.0.0 */ - public static final SimpleOption SHOW_MARKER_VALUE = SimpleOption.builder() - .node("direction-hud", "show-marker-value").type(TypeToken.get(Boolean.class)) + public static final SimpleOption USE_LEGACY_STYLE = SimpleOption.builder() + .node("direction-hud", "use-legacy-style").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * Choose whether to show the Direction HUD when TAB is open. + * + * @since 1.1.9 + */ + public static final SimpleOption SHOW_WITH_TAB = SimpleOption.builder() + .comment("Choose whether to show the Direction HUD when TAB is open.") + .node("direction-hud", "show-with-tab").type(TypeToken.get(Boolean.class)) .notifyClient() .build(); diff --git a/api/src/main/java/com/lunarclient/apollo/mods/impl/ModInventoryMod.java b/api/src/main/java/com/lunarclient/apollo/mods/impl/ModInventoryMod.java new file mode 100644 index 00000000..64e50262 --- /dev/null +++ b/api/src/main/java/com/lunarclient/apollo/mods/impl/ModInventoryMod.java @@ -0,0 +1,72 @@ +/* + * 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.mods.impl; + +import com.lunarclient.apollo.option.NumberOption; +import com.lunarclient.apollo.option.SimpleOption; +import io.leangen.geantyref.TypeToken; + +/** + * A collection of quality of life tweaks for the inventory. + * + * @since 1.1.9 + */ +public final class ModInventoryMod { + + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption ENABLED = SimpleOption.builder() + .node("inventory-mod", "enabled").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * Useful for navigating inventory menus on servers. + * + * @since 1.1.9 + */ + public static final SimpleOption DONT_RESET_CURSOR = SimpleOption.builder() + .comment("Useful for navigating inventory menus on servers.") + .node("inventory-mod", "dont-reset-cursor").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final NumberOption RESET_CURSOR_TIMEOUT = NumberOption.number() + .node("inventory-mod", "reset-cursor-timeout").type(TypeToken.get(Float.class)) + .min(0.1F).max(5.0F) + .notifyClient() + .build(); + + private ModInventoryMod() { + } + +} diff --git a/api/src/main/java/com/lunarclient/apollo/mods/impl/ModKeystrokes.java b/api/src/main/java/com/lunarclient/apollo/mods/impl/ModKeystrokes.java index f4fe3adc..2da92ff5 100644 --- a/api/src/main/java/com/lunarclient/apollo/mods/impl/ModKeystrokes.java +++ b/api/src/main/java/com/lunarclient/apollo/mods/impl/ModKeystrokes.java @@ -91,8 +91,8 @@ public final class ModKeystrokes { * * @since 1.0.0 */ - public static final SimpleOption KEY_STROKES_MOVEMENT = SimpleOption.builder() - .node("keystrokes", "key-strokes-movement").type(TypeToken.get(Boolean.class)) + public static final SimpleOption USE_ARROWS = SimpleOption.builder() + .node("keystrokes", "use-arrows").type(TypeToken.get(Boolean.class)) .notifyClient() .build(); @@ -101,8 +101,8 @@ public final class ModKeystrokes { * * @since 1.0.0 */ - public static final SimpleOption KEY_STROKES_SPACEBAR = SimpleOption.builder() - .node("keystrokes", "key-strokes-spacebar").type(TypeToken.get(Boolean.class)) + public static final SimpleOption KEY_STROKES_MOVEMENT = SimpleOption.builder() + .node("keystrokes", "key-strokes-movement").type(TypeToken.get(Boolean.class)) .notifyClient() .build(); @@ -111,8 +111,8 @@ public final class ModKeystrokes { * * @since 1.0.0 */ - public static final SimpleOption USE_ARROWS = SimpleOption.builder() - .node("keystrokes", "use-arrows").type(TypeToken.get(Boolean.class)) + public static final SimpleOption KEY_STROKES_SPACEBAR = SimpleOption.builder() + .node("keystrokes", "key-strokes-spacebar").type(TypeToken.get(Boolean.class)) .notifyClient() .build(); @@ -146,6 +146,67 @@ public final class ModKeystrokes { .notifyClient() .build(); + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption ANIMATE = SimpleOption.builder() + .node("keystrokes", "animate").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final NumberOption DURATION = NumberOption.number() + .node("keystrokes", "duration").type(TypeToken.get(Float.class)) + .min(0.1F).max(1.0F) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption ANIMATE_COLOR = SimpleOption.builder() + .node("keystrokes", "animate-color").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption ANIMATION_START_COLOR = SimpleOption.builder() + .node("keystrokes", "animation-start-color").type(TypeToken.get(Color.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption ANIMATION_CENTER_COLOR = SimpleOption.builder() + .node("keystrokes", "animation-center-color").type(TypeToken.get(Color.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption ANIMATION_END_COLOR = SimpleOption.builder() + .node("keystrokes", "animation-end-color").type(TypeToken.get(Color.class)) + .notifyClient() + .build(); + /** * No documentation available. * @@ -229,6 +290,17 @@ public final class ModKeystrokes { .notifyClient() .build(); + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final NumberOption SPACEBAR_THICKNESS = NumberOption.number() + .node("keystrokes", "spacebar-thickness").type(TypeToken.get(Float.class)) + .min(1.0F).max(4.25F) + .notifyClient() + .build(); + private ModKeystrokes() { } diff --git a/api/src/main/java/com/lunarclient/apollo/mods/impl/ModKillSounds.java b/api/src/main/java/com/lunarclient/apollo/mods/impl/ModKillSounds.java new file mode 100644 index 00000000..2bfe7dc8 --- /dev/null +++ b/api/src/main/java/com/lunarclient/apollo/mods/impl/ModKillSounds.java @@ -0,0 +1,49 @@ +/* + * 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.mods.impl; + +import com.lunarclient.apollo.option.SimpleOption; +import io.leangen.geantyref.TypeToken; + +/** + * Allows you to change kill sounds for players. + * + * @since 1.1.9 + */ +public final class ModKillSounds { + + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption ENABLED = SimpleOption.builder() + .node("kill-sounds", "enabled").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + private ModKillSounds() { + } + +} diff --git a/api/src/main/java/com/lunarclient/apollo/mods/impl/ModPackDisplay.java b/api/src/main/java/com/lunarclient/apollo/mods/impl/ModPackDisplay.java index 883d4931..bdd8d5b2 100644 --- a/api/src/main/java/com/lunarclient/apollo/mods/impl/ModPackDisplay.java +++ b/api/src/main/java/com/lunarclient/apollo/mods/impl/ModPackDisplay.java @@ -61,8 +61,8 @@ public final class ModPackDisplay { * * @since 1.0.0 */ - public static final SimpleOption TEXT_SHADOW = SimpleOption.builder() - .node("pack-display", "text-shadow").type(TypeToken.get(Boolean.class)) + public static final SimpleOption PACK_ICON = SimpleOption.builder() + .node("pack-display", "pack-icon").type(TypeToken.get(Boolean.class)) .notifyClient() .build(); @@ -71,18 +71,28 @@ public final class ModPackDisplay { * * @since 1.0.0 */ - public static final SimpleOption BRACKETS = SimpleOption.builder() - .node("pack-display", "brackets").type(TypeToken.get(Boolean.class)) + public static final SimpleOption PACK_DESCRIPTION = SimpleOption.builder() + .node("pack-display", "pack-description").type(TypeToken.get(Boolean.class)) .notifyClient() .build(); /** * No documentation available. * - * @since 1.1.6 + * @since 1.1.9 */ - public static final SimpleOption BRACKET_COLOR = SimpleOption.builder() - .node("pack-display", "bracket-color").type(TypeToken.get(Color.class)) + public static final SimpleOption PACK_EXTENSION = SimpleOption.builder() + .node("pack-display", "pack-extension").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption MOVE_TITLE_DOWN = SimpleOption.builder() + .node("pack-display", "move-title-down").type(TypeToken.get(Boolean.class)) .notifyClient() .build(); @@ -91,30 +101,28 @@ public final class ModPackDisplay { * * @since 1.0.0 */ - public static final SimpleOption BACKGROUND = SimpleOption.builder() - .node("pack-display", "background").type(TypeToken.get(Boolean.class)) + public static final SimpleOption TEXT_SHADOW = SimpleOption.builder() + .node("pack-display", "text-shadow").type(TypeToken.get(Boolean.class)) .notifyClient() .build(); /** - * If this is disabled the background will change size with the text. + * No documentation available. * * @since 1.0.0 */ - public static final SimpleOption STATIC_BACKGROUND_WIDTH = SimpleOption.builder() - .comment("If this is disabled the background will change size with the text.") - .node("pack-display", "static-background-width").type(TypeToken.get(Boolean.class)) + public static final SimpleOption BRACKETS = SimpleOption.builder() + .node("pack-display", "brackets").type(TypeToken.get(Boolean.class)) .notifyClient() .build(); /** - * If this is disabled the background will change size with the text. + * No documentation available. * * @since 1.1.6 */ - public static final SimpleOption STATIC_BACKGROUND_HEIGHT = SimpleOption.builder() - .comment("If this is disabled the background will change size with the text.") - .node("pack-display", "static-background-height").type(TypeToken.get(Boolean.class)) + public static final SimpleOption BRACKET_COLOR = SimpleOption.builder() + .node("pack-display", "bracket-color").type(TypeToken.get(Color.class)) .notifyClient() .build(); @@ -123,9 +131,8 @@ public final class ModPackDisplay { * * @since 1.0.0 */ - public static final NumberOption BACKGROUND_WIDTH = NumberOption.number() - .node("pack-display", "background-width").type(TypeToken.get(Integer.class)) - .min(60).max(300) + public static final SimpleOption BACKGROUND = SimpleOption.builder() + .node("pack-display", "background").type(TypeToken.get(Boolean.class)) .notifyClient() .build(); @@ -194,10 +201,84 @@ public final class ModPackDisplay { /** * No documentation available. * + * @since 1.1.9 + */ + public static final SimpleOption DESCRIPTION_REPLACEMENT_COLOR = SimpleOption.builder() + .node("pack-display", "description-replacement-color").type(TypeToken.get(Color.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption KEEP_BOLD = SimpleOption.builder() + .node("pack-display", "keep-bold").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption KEEP_ITALIC = SimpleOption.builder() + .node("pack-display", "keep-italic").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption KEEP_UNDERLINE = SimpleOption.builder() + .node("pack-display", "keep-underline").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption KEEP_STRIKETHROUGH = SimpleOption.builder() + .node("pack-display", "keep-strikethrough").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption KEEP_OBFUSCATED = SimpleOption.builder() + .node("pack-display", "keep-obfuscated").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * If this is disabled the background will change size with the text. + * * @since 1.0.0 */ - public static final SimpleOption PACK_ICON = SimpleOption.builder() - .node("pack-display", "pack-icon").type(TypeToken.get(Boolean.class)) + @Deprecated + public static final SimpleOption STATIC_BACKGROUND_WIDTH = SimpleOption.builder() + .comment("If this is disabled the background will change size with the text.") + .node("pack-display", "static-background-width").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * If this is disabled the background will change size with the text. + * + * @since 1.1.6 + */ + @Deprecated + public static final SimpleOption STATIC_BACKGROUND_HEIGHT = SimpleOption.builder() + .comment("If this is disabled the background will change size with the text.") + .node("pack-display", "static-background-height").type(TypeToken.get(Boolean.class)) .notifyClient() .build(); @@ -206,8 +287,10 @@ public final class ModPackDisplay { * * @since 1.0.0 */ - public static final SimpleOption PACK_DESCRIPTION = SimpleOption.builder() - .node("pack-display", "pack-description").type(TypeToken.get(Boolean.class)) + @Deprecated + public static final NumberOption BACKGROUND_WIDTH = NumberOption.number() + .node("pack-display", "background-width").type(TypeToken.get(Integer.class)) + .min(60).max(300) .notifyClient() .build(); diff --git a/api/src/main/java/com/lunarclient/apollo/mods/impl/ModPing.java b/api/src/main/java/com/lunarclient/apollo/mods/impl/ModPing.java index 96df0ccb..95a48d12 100644 --- a/api/src/main/java/com/lunarclient/apollo/mods/impl/ModPing.java +++ b/api/src/main/java/com/lunarclient/apollo/mods/impl/ModPing.java @@ -53,27 +53,71 @@ public final class ModPing { public static final NumberOption UPDATE_INTERVAL_SEC = NumberOption.number() .comment("Faster updates may impact performance") .node("ping", "update-interval-sec").type(TypeToken.get(Integer.class)) - .min(1).max(30) + .min(1).max(120) + .notifyClient() + .build(); + + /** + * How many updates to average together (one update happens per the 'update interval' setting). + * + * @since 1.1.9 + */ + public static final NumberOption AVERAGE_SAMPLES = NumberOption.number() + .comment("How many updates to average together (one update happens per the 'update interval' setting)") + .node("ping", "average-samples").type(TypeToken.get(Integer.class)) + .min(2).max(20) .notifyClient() .build(); /** * No documentation available. * - * @since 1.1.1 + * @since 1.1.9 */ - public static final SimpleOption ENABLE_PING_NAMETAG = SimpleOption.builder() - .node("ping", "enable-ping-nametag").type(TypeToken.get(Boolean.class)) + public static final SimpleOption PING_SPIKE_DETECTION = SimpleOption.builder() + .node("ping", "ping-spike-detection").type(TypeToken.get(Boolean.class)) .notifyClient() .build(); /** * No documentation available. * - * @since 1.1.1 + * @since 1.1.9 */ - public static final SimpleOption PING_ABOVE = SimpleOption.builder() - .node("ping", "ping-above").type(TypeToken.get(Boolean.class)) + public static final NumberOption MEDIUM_SPIKE_THRESHOLD = NumberOption.number() + .node("ping", "medium-spike-threshold").type(TypeToken.get(Integer.class)) + .min(1).max(200) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption MEDIUM_SPIKE_COLOR = SimpleOption.builder() + .node("ping", "medium-spike-color").type(TypeToken.get(Color.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final NumberOption LARGE_SPIKE_THRESHOLD = NumberOption.number() + .node("ping", "large-spike-threshold").type(TypeToken.get(Integer.class)) + .min(1).max(200) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption LARGE_SPIKE_COLOR = SimpleOption.builder() + .node("ping", "large-spike-color").type(TypeToken.get(Color.class)) .notifyClient() .build(); @@ -87,6 +131,16 @@ public final class ModPing { .notifyClient() .build(); + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption SHOW_PING_PREFIX = SimpleOption.builder() + .node("ping", "show-ping-prefix").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + /** * No documentation available. * @@ -157,6 +211,28 @@ public final class ModPing { .notifyClient() .build(); + /** + * No documentation available. + * + * @since 1.1.1 + */ + @Deprecated + public static final SimpleOption ENABLE_PING_NAMETAG = SimpleOption.builder() + .node("ping", "enable-ping-nametag").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.1 + */ + @Deprecated + public static final SimpleOption PING_ABOVE = SimpleOption.builder() + .node("ping", "ping-above").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + /** * No documentation available. * diff --git a/api/src/main/java/com/lunarclient/apollo/mods/impl/ModPotionEffects.java b/api/src/main/java/com/lunarclient/apollo/mods/impl/ModPotionEffects.java index 2861d086..302c43d7 100644 --- a/api/src/main/java/com/lunarclient/apollo/mods/impl/ModPotionEffects.java +++ b/api/src/main/java/com/lunarclient/apollo/mods/impl/ModPotionEffects.java @@ -96,6 +96,87 @@ public final class ModPotionEffects { .notifyClient() .build(); + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption BACKGROUND = SimpleOption.builder() + .node("potion-effects", "background").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption MINIMAL_MODE = SimpleOption.builder() + .node("potion-effects", "minimal-mode").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption MINIMAL_MODE_HORIZONTAL = SimpleOption.builder() + .node("potion-effects", "minimal-mode-horizontal").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption BORDER = SimpleOption.builder() + .node("potion-effects", "border").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final NumberOption BORDER_THICKNESS = NumberOption.number() + .node("potion-effects", "border-thickness").type(TypeToken.get(Float.class)) + .min(0.5F).max(3.0F) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption FORMATTED_DURATIONS = SimpleOption.builder() + .node("potion-effects", "formatted-durations").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption UPPERCASE_POTION_NAMES = SimpleOption.builder() + .node("potion-effects", "uppercase-potion-names").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption REVERSED_TEXT = SimpleOption.builder() + .node("potion-effects", "reversed-text").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + /** * No documentation available. * @@ -127,6 +208,26 @@ public final class ModPotionEffects { .notifyClient() .build(); + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption BACKGROUND_COLOR = SimpleOption.builder() + .node("potion-effects", "background-color").type(TypeToken.get(Color.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption BORDER_COLOR = SimpleOption.builder() + .node("potion-effects", "border-color").type(TypeToken.get(Color.class)) + .notifyClient() + .build(); + /** * No documentation available. * diff --git a/api/src/main/java/com/lunarclient/apollo/mods/impl/ModRadio.java b/api/src/main/java/com/lunarclient/apollo/mods/impl/ModRadio.java index c261e594..666a2632 100644 --- a/api/src/main/java/com/lunarclient/apollo/mods/impl/ModRadio.java +++ b/api/src/main/java/com/lunarclient/apollo/mods/impl/ModRadio.java @@ -50,9 +50,9 @@ public final class ModRadio { * * @since 1.1.7 */ - public static final NumberOption SCALE = NumberOption.number() - .node("radio", "scale").type(TypeToken.get(Float.class)) - .min(0.5F).max(1.5F) + public static final NumberOption VOLUME = NumberOption.number() + .node("radio", "volume").type(TypeToken.get(Integer.class)) + .min(0).max(100) .notifyClient() .build(); @@ -61,9 +61,8 @@ public final class ModRadio { * * @since 1.1.7 */ - public static final NumberOption VOLUME = NumberOption.number() - .node("radio", "volume").type(TypeToken.get(Integer.class)) - .min(0).max(100) + public static final SimpleOption MUTE_RADIO = SimpleOption.builder() + .node("radio", "mute-radio").type(TypeToken.get(Boolean.class)) .notifyClient() .build(); @@ -72,8 +71,9 @@ public final class ModRadio { * * @since 1.1.7 */ - public static final SimpleOption MUTE_RADIO = SimpleOption.builder() - .node("radio", "mute-radio").type(TypeToken.get(Boolean.class)) + public static final NumberOption SCALE = NumberOption.number() + .node("radio", "scale").type(TypeToken.get(Float.class)) + .min(0.5F).max(1.5F) .notifyClient() .build(); diff --git a/api/src/main/java/com/lunarclient/apollo/mods/impl/ModScreenshot.java b/api/src/main/java/com/lunarclient/apollo/mods/impl/ModScreenshot.java index df150f6c..83657736 100644 --- a/api/src/main/java/com/lunarclient/apollo/mods/impl/ModScreenshot.java +++ b/api/src/main/java/com/lunarclient/apollo/mods/impl/ModScreenshot.java @@ -83,6 +83,17 @@ public final class ModScreenshot { .notifyClient() .build(); + /** + * A screenshot file saved with world details enabled has metadata that contains your player coordinates, the biome, and more. + * + * @since 1.1.9 + */ + public static final SimpleOption WORLD_DETAILS = SimpleOption.builder() + .comment("A screenshot file saved with world details enabled has metadata that contains your player coordinates, the biome, and more.") + .node("screenshot", "world-details").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + private ModScreenshot() { } diff --git a/api/src/main/java/com/lunarclient/apollo/mods/impl/ModSkyblock.java b/api/src/main/java/com/lunarclient/apollo/mods/impl/ModSkyblock.java index fdae8cd0..e02fa3c9 100644 --- a/api/src/main/java/com/lunarclient/apollo/mods/impl/ModSkyblock.java +++ b/api/src/main/java/com/lunarclient/apollo/mods/impl/ModSkyblock.java @@ -148,6 +148,17 @@ public final class ModSkyblock { .notifyClient() .build(); + /** + * Replaces left clicks in menus with a middle click. Hold control to override. + * + * @since 1.1.9 + */ + public static final SimpleOption SKY_BLOCK_MIDDLE_CLICK_ITEMS = SimpleOption.builder() + .comment("Replaces left clicks in menus with a middle click. Hold control to override.") + .node("skyblock", "sky-block-middle-click-items").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + /** * Shows the creation date of the item in the lore. * @@ -190,6 +201,16 @@ public final class ModSkyblock { .notifyClient() .build(); + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption SB_MENU_CLICK_TO_COMMAND = SimpleOption.builder() + .node("skyblock", "sb-menu-click-to-command").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + /** * Makes Giant HP more visible by showing their HP at their feet. * @@ -204,10 +225,10 @@ public final class ModSkyblock { /** * No documentation available. * - * @since 1.1.7 + * @since 1.1.9 */ - public static final SimpleOption DUNGEON_SECRETS_COLLECTED = SimpleOption.builder() - .node("skyblock", "dungeon-secrets-collected").type(TypeToken.get(Boolean.class)) + public static final SimpleOption SKYBLOCK_SECRETS_COLLECTED = SimpleOption.builder() + .node("skyblock", "skyblock-secrets-collected").type(TypeToken.get(Boolean.class)) .notifyClient() .build(); @@ -285,6 +306,28 @@ public final class ModSkyblock { .notifyClient() .build(); + /** + * Hides players and fishing rods near your bobber while you are fishing. + * + * @since 1.1.9 + */ + public static final SimpleOption SKYBLOCK_FISHING_HIDE_PLAYERS = SimpleOption.builder() + .comment("Hides players and fishing rods near your bobber while you are fishing.") + .node("skyblock", "skyblock-fishing-hide-players").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * Shows which hotspot the Hotspot Radar item is pointing to. + * + * @since 1.1.9 + */ + public static final SimpleOption SKYBLOCK_FISHING_HOTSPOT_LOCATOR = SimpleOption.builder() + .comment("Shows which hotspot the Hotspot Radar item is pointing to.") + .node("skyblock", "skyblock-fishing-hotspot-locator").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + /** * Provides a chat message on boss kill that tells you how long it took to kill!. * @@ -372,6 +415,27 @@ public final class ModSkyblock { .notifyClient() .build(); + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption SKYBLOCK_USE_TICK_TIMERS = SimpleOption.builder() + .node("skyblock", "skyblock-use-tick-timers").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.7 + */ + @Deprecated + public static final SimpleOption DUNGEON_SECRETS_COLLECTED = SimpleOption.builder() + .node("skyblock", "dungeon-secrets-collected").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + private ModSkyblock() { } diff --git a/api/src/main/java/com/lunarclient/apollo/mods/impl/ModTierTagger.java b/api/src/main/java/com/lunarclient/apollo/mods/impl/ModTierTagger.java new file mode 100644 index 00000000..54d82609 --- /dev/null +++ b/api/src/main/java/com/lunarclient/apollo/mods/impl/ModTierTagger.java @@ -0,0 +1,109 @@ +/* + * 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.mods.impl; + +import com.lunarclient.apollo.option.SimpleOption; +import io.leangen.geantyref.TypeToken; + +/** + * Show player's PvP tier on their Name Tag. + * + * @since 1.1.9 + */ +public final class ModTierTagger { + + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption ENABLED = SimpleOption.builder() + .node("tier-tagger", "enabled").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption MC_TIERS_FORMAT = SimpleOption.builder() + .node("tier-tagger", "mc-tiers-format").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption SUFFIX = SimpleOption.builder() + .node("tier-tagger", "suffix").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption SEPARATE_NAMETAG = SimpleOption.builder() + .node("tier-tagger", "separate-nametag").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption SHOW_GM_ICONS = SimpleOption.builder() + .node("tier-tagger", "show-gm-icons").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption SHOW_RETIRED = SimpleOption.builder() + .node("tier-tagger", "show-retired").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption SHOW_REGION = SimpleOption.builder() + .node("tier-tagger", "show-region").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + private ModTierTagger() { + } + +} diff --git a/api/src/main/java/com/lunarclient/apollo/mods/impl/ModToggleSneak.java b/api/src/main/java/com/lunarclient/apollo/mods/impl/ModToggleSneak.java index d1394391..e5049ae1 100644 --- a/api/src/main/java/com/lunarclient/apollo/mods/impl/ModToggleSneak.java +++ b/api/src/main/java/com/lunarclient/apollo/mods/impl/ModToggleSneak.java @@ -54,6 +54,16 @@ public final class ModToggleSneak { .notifyClient() .build(); + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption SPRINT_KEYBIND_OVERRIDE = SimpleOption.builder() + .node("toggle-sneak", "sprint-keybind-override").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + /** * No documentation available. * @@ -64,6 +74,16 @@ public final class ModToggleSneak { .notifyClient() .build(); + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption SNEAK_KEYBIND_OVERRIDE = SimpleOption.builder() + .node("toggle-sneak", "sneak-keybind-override").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + /** * No documentation available. * diff --git a/api/src/main/java/com/lunarclient/apollo/mods/impl/ModTotemCounter.java b/api/src/main/java/com/lunarclient/apollo/mods/impl/ModTotemCounter.java new file mode 100644 index 00000000..979d7947 --- /dev/null +++ b/api/src/main/java/com/lunarclient/apollo/mods/impl/ModTotemCounter.java @@ -0,0 +1,140 @@ +/* + * 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.mods.impl; + +import com.lunarclient.apollo.option.SimpleOption; +import io.leangen.geantyref.TypeToken; +import java.awt.Color; + +/** + * Keep track of players' totem usages. Totem pops aren't tracked when the mod is disabled, so toggling it on mid-game could result in a mismatch. + * + * @since 1.1.9 + */ +public final class ModTotemCounter { + + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption ENABLED = SimpleOption.builder() + .node("totem-counter", "enabled").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption SHOW_FOR_SELF = SimpleOption.builder() + .node("totem-counter", "show-for-self").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption SHOW_TAB_LIST = SimpleOption.builder() + .node("totem-counter", "show-tab-list").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption FLIP = SimpleOption.builder() + .node("totem-counter", "flip").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption COUNT_COLOR = SimpleOption.builder() + .node("totem-counter", "count-color").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption SHOW_NAMETAG = SimpleOption.builder() + .node("totem-counter", "show-nametag").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption SHOW_PREFIX = SimpleOption.builder() + .node("totem-counter", "show-prefix").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption SEPARATE_NAMETAG = SimpleOption.builder() + .node("totem-counter", "separate-nametag").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption RENDER_FIRST = SimpleOption.builder() + .node("totem-counter", "render-first").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption PREFIX_COLOR = SimpleOption.builder() + .node("totem-counter", "prefix-color").type(TypeToken.get(Color.class)) + .notifyClient() + .build(); + + private ModTotemCounter() { + } + +} diff --git a/api/src/main/java/com/lunarclient/apollo/mods/impl/ModWaila.java b/api/src/main/java/com/lunarclient/apollo/mods/impl/ModWaila.java index 74ed8238..8a5918c5 100644 --- a/api/src/main/java/com/lunarclient/apollo/mods/impl/ModWaila.java +++ b/api/src/main/java/com/lunarclient/apollo/mods/impl/ModWaila.java @@ -56,6 +56,16 @@ public final class ModWaila { .notifyClient() .build(); + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption ALWAYS_SHOW = SimpleOption.builder() + .node("waila", "always-show").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + /** * No documentation available. * @@ -117,6 +127,86 @@ public final class ModWaila { .notifyClient() .build(); + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption SHOW_BLOCK_COORDS = SimpleOption.builder() + .node("waila", "show-block-coords").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption BLOCK_COORDS_COLOR = SimpleOption.builder() + .node("waila", "block-coords-color").type(TypeToken.get(Color.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption SHOW_CORRECT_TOOL = SimpleOption.builder() + .node("waila", "show-correct-tool").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption CORRECT_TOOL_COLOR = SimpleOption.builder() + .node("waila", "correct-tool-color").type(TypeToken.get(Color.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption SHOW_BREAK_TIME = SimpleOption.builder() + .node("waila", "show-break-time").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption BREAK_TIME_COLOR = SimpleOption.builder() + .node("waila", "break-time-color").type(TypeToken.get(Color.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption SHOW_LIGHT_LEVEL = SimpleOption.builder() + .node("waila", "show-light-level").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption LIGHT_LEVEL_COLOR = SimpleOption.builder() + .node("waila", "light-level-color").type(TypeToken.get(Color.class)) + .notifyClient() + .build(); + /** * No documentation available. * diff --git a/api/src/main/java/com/lunarclient/apollo/mods/impl/ModWaypoints.java b/api/src/main/java/com/lunarclient/apollo/mods/impl/ModWaypoints.java index c5284a60..4ce9cfe7 100644 --- a/api/src/main/java/com/lunarclient/apollo/mods/impl/ModWaypoints.java +++ b/api/src/main/java/com/lunarclient/apollo/mods/impl/ModWaypoints.java @@ -44,6 +44,16 @@ public final class ModWaypoints { .notifyClient() .build(); + /** + * No documentation available. + * + * @since 1.1.6 + */ + public static final SimpleOption ADD_WAYPOINTS_FROM_CHAT = SimpleOption.builder() + .node("waypoints", "add-waypoints-from-chat").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + /** * No documentation available. * @@ -54,6 +64,28 @@ public final class ModWaypoints { .notifyClient() .build(); + /** + * No documentation available. + * + * @since 1.1.9 + */ + public static final SimpleOption LIMIT_DEATH_WAYPOINTS = SimpleOption.builder() + .node("waypoints", "limit-death-waypoints").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * Maximum amount of Death Waypoints you will see at one time. + * + * @since 1.1.9 + */ + public static final NumberOption MAX_DEATH_WAYPOINTS = NumberOption.number() + .comment("Maximum amount of Death Waypoints you will see at one time") + .node("waypoints", "max-death-waypoints").type(TypeToken.get(Integer.class)) + .min(1).max(20) + .notifyClient() + .build(); + /** * No documentation available. * @@ -95,17 +127,6 @@ public final class ModWaypoints { .notifyClient() .build(); - /** - * Only show each waypoint when looking near then in the world. - * - * @since 1.0.0 - */ - public static final SimpleOption ONLY_SHOW_WHEN_LOOKING_NEAR = SimpleOption.builder() - .comment("Only show each waypoint when looking near then in the world") - .node("waypoints", "only-show-when-looking-near").type(TypeToken.get(Boolean.class)) - .notifyClient() - .build(); - /** * Show simpler text icons above each waypoint. * @@ -140,12 +161,13 @@ public final class ModWaypoints { .build(); /** - * No documentation available. + * Only show each waypoint when looking near then in the world. * - * @since 1.1.6 + * @since 1.0.0 */ - public static final SimpleOption ADD_WAYPOINTS_FROM_CHAT = SimpleOption.builder() - .node("waypoints", "add-waypoints-from-chat").type(TypeToken.get(Boolean.class)) + public static final SimpleOption ONLY_SHOW_WHEN_LOOKING_NEAR = SimpleOption.builder() + .comment("Only show each waypoint when looking near then in the world") + .node("waypoints", "only-show-when-looking-near").type(TypeToken.get(Boolean.class)) .notifyClient() .build(); 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/api/src/main/java/com/lunarclient/apollo/module/title/TitleModule.java b/api/src/main/java/com/lunarclient/apollo/module/title/TitleModule.java index 792ddc98..f75cddd1 100644 --- a/api/src/main/java/com/lunarclient/apollo/module/title/TitleModule.java +++ b/api/src/main/java/com/lunarclient/apollo/module/title/TitleModule.java @@ -25,7 +25,10 @@ import com.lunarclient.apollo.module.ApolloModule; import com.lunarclient.apollo.module.ModuleDefinition; +import com.lunarclient.apollo.option.Option; +import com.lunarclient.apollo.option.SimpleOption; import com.lunarclient.apollo.recipients.Recipients; +import io.leangen.geantyref.TypeToken; import org.jetbrains.annotations.ApiStatus; /** @@ -40,6 +43,27 @@ @ModuleDefinition(id = "title", name = "Title") public abstract class TitleModule extends ApolloModule { + /** + * Determines whether the players displayed title should clear when switching servers. + * + * @since 1.1.9 + */ + public static final SimpleOption CLEAR_TITLE_ON_SERVER_SWITCH = Option.builder() + .comment("Set to 'true' to clear the shown title when changing servers, otherwise 'false'.") + .node("clear-title-on-server-switch").type(TypeToken.get(Boolean.class)) + .defaultValue(false).notifyClient().build(); + + TitleModule() { + this.registerOptions( + TitleModule.CLEAR_TITLE_ON_SERVER_SWITCH + ); + } + + @Override + public boolean isClientNotify() { + return true; + } + /** * Sends the {@link Title} to the {@link Recipients}. * diff --git a/build-logic/src/main/kotlin/apollo.base-conventions.gradle.kts b/build-logic/src/main/kotlin/apollo.base-conventions.gradle.kts index 48db4d5a..d87f820e 100644 --- a/build-logic/src/main/kotlin/apollo.base-conventions.gradle.kts +++ b/build-logic/src/main/kotlin/apollo.base-conventions.gradle.kts @@ -1,4 +1,6 @@ import com.diffplug.gradle.spotless.FormatExtension +import org.gradle.jvm.toolchain.JavaLanguageVersion +import org.gradle.jvm.toolchain.JavaToolchainService import java.nio.charset.StandardCharsets import java.nio.file.Files import java.util.regex.Pattern @@ -83,6 +85,11 @@ checkstyle { tasks { javadoc { + val javaToolchains = project.extensions.getByType(JavaToolchainService::class.java) + javadocTool.set(javaToolchains.javadocToolFor { + languageVersion.set(JavaLanguageVersion.of(21)) + }) + val minimalOptions: MinimalJavadocOptions = options options.encoding("UTF-8") 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/bukkit/src/main/java/com/lunarclient/apollo/ApolloBukkitPlatform.java b/bukkit/src/main/java/com/lunarclient/apollo/ApolloBukkitPlatform.java index 117e952d..013a3abd 100644 --- a/bukkit/src/main/java/com/lunarclient/apollo/ApolloBukkitPlatform.java +++ b/bukkit/src/main/java/com/lunarclient/apollo/ApolloBukkitPlatform.java @@ -25,9 +25,11 @@ import com.lunarclient.apollo.command.impl.ApolloCommand; import com.lunarclient.apollo.command.impl.LunarClientCommand; +import com.lunarclient.apollo.listener.ApolloMetadataListener; import com.lunarclient.apollo.listener.ApolloPlayerListener; import com.lunarclient.apollo.listener.ApolloWorldListener; import com.lunarclient.apollo.loader.PlatformPlugin; +import com.lunarclient.apollo.metadata.BukkitMetadataManager; import com.lunarclient.apollo.module.ApolloModuleManagerImpl; import com.lunarclient.apollo.module.autotexthotkey.AutoTextHotkeyModule; import com.lunarclient.apollo.module.beam.BeamModule; @@ -119,7 +121,9 @@ public void onEnable() { this.stats = new BukkitApolloStats(); ApolloManager.bootstrap(this); + ApolloManager.setMetadataManager(new BukkitMetadataManager()); + new ApolloMetadataListener(this.plugin); new ApolloPlayerListener(this.plugin); new ApolloWorldListener(this.plugin); diff --git a/bukkit/src/main/java/com/lunarclient/apollo/listener/ApolloMetadataListener.java b/bukkit/src/main/java/com/lunarclient/apollo/listener/ApolloMetadataListener.java new file mode 100644 index 00000000..f38bc58a --- /dev/null +++ b/bukkit/src/main/java/com/lunarclient/apollo/listener/ApolloMetadataListener.java @@ -0,0 +1,100 @@ +/* + * 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.listener; + +import com.google.common.io.ByteArrayDataInput; +import com.google.common.io.ByteStreams; +import com.lunarclient.apollo.ApolloManager; +import com.lunarclient.apollo.metadata.BukkitMetadataManager; +import com.lunarclient.apollo.util.ByteBufUtil; +import java.io.ByteArrayInputStream; +import java.io.DataInputStream; +import java.io.IOException; +import java.util.Map; +import org.bukkit.Bukkit; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerResourcePackStatusEvent; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.plugin.messaging.Messenger; +import org.bukkit.plugin.messaging.PluginMessageListener; + +/** + * Handles Apollo metadata listeners. + * + * @since 1.1.9 + */ +public final class ApolloMetadataListener implements Listener { + + private final JavaPlugin plugin; + + /** + * Constructs the {@link ApolloMetadataListener}. + * + * @param plugin the plugin + * @since 1.1.9 + */ + public ApolloMetadataListener(JavaPlugin plugin) { + this.plugin = plugin; + + this.registerBrandListener(); + Bukkit.getPluginManager().registerEvents(this, plugin); + } + + @EventHandler + private void onResourcePackStatus(PlayerResourcePackStatusEvent event) { + String status = event.getStatus().name(); + BukkitMetadataManager manager = (BukkitMetadataManager) ApolloManager.getMetadataManager(); + Map statuses = manager.getResourcePackStatuses(); + + statuses.put(status, statuses.getOrDefault(status, 0) + 1); + } + + private void registerBrandListener() { + Messenger messenger = this.plugin.getServer().getMessenger(); + + try { + PluginMessageListener listener = (channel, player, bytes) -> { + try (DataInputStream in = new DataInputStream(new ByteArrayInputStream(bytes))) { + this.collectBrand(in.readUTF()); + } catch (IOException ignored) { + } + }; + + messenger.registerIncomingPluginChannel(this.plugin, "MC|Brand", listener); + } catch (IllegalArgumentException ignored) { + } + + messenger.registerIncomingPluginChannel(this.plugin, "minecraft:brand", (channel, player, bytes) -> { + ByteArrayDataInput in = ByteStreams.newDataInput(bytes); + this.collectBrand(ByteBufUtil.readString(in)); + }); + } + + private void collectBrand(String brand) { + BukkitMetadataManager manager = (BukkitMetadataManager) ApolloManager.getMetadataManager(); + manager.getClientBrands().add(brand); + } + +} diff --git a/bukkit/src/main/java/com/lunarclient/apollo/metadata/BukkitMetadata.java b/bukkit/src/main/java/com/lunarclient/apollo/metadata/BukkitMetadata.java new file mode 100644 index 00000000..e1bf4842 --- /dev/null +++ b/bukkit/src/main/java/com/lunarclient/apollo/metadata/BukkitMetadata.java @@ -0,0 +1,60 @@ +/* + * 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.metadata; + +import com.lunarclient.apollo.stats.metadata.PlatformMetadata; +import java.util.Map; +import java.util.Set; +import lombok.Builder; +import lombok.ToString; + +/** + * Represents the bukkit metadata implementation. + * + * @since 1.1.9 + */ +@ToString +@Builder(toBuilder = true) +public class BukkitMetadata extends PlatformMetadata { + + /** + * Tracks client brands sent by the players. + * + *

A {@link Set} of {@link String} client brands.

+ * + * @since 1.1.9 + */ + private final Set clientBrands; + + /** + * Tracks the total number of resource pack status events received. + * + *

Represents a {@link Map} of {@link String} status enum name as a key + * and {@link Integer} count of how many times that status has been reported.

+ * + * @since 1.1.9 + */ + private final Map resourcePackStatuses; + +} diff --git a/bukkit/src/main/java/com/lunarclient/apollo/metadata/BukkitMetadataManager.java b/bukkit/src/main/java/com/lunarclient/apollo/metadata/BukkitMetadataManager.java new file mode 100644 index 00000000..10f4a042 --- /dev/null +++ b/bukkit/src/main/java/com/lunarclient/apollo/metadata/BukkitMetadataManager.java @@ -0,0 +1,59 @@ +/* + * 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.metadata; + +import com.lunarclient.apollo.stats.metadata.ApolloMetadataManager; +import com.lunarclient.apollo.stats.metadata.PlatformMetadata; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import lombok.Getter; + +/** + * The Bukkit implementation of {@link ApolloMetadataManager}. + * + * @since 1.1.9 + */ +@Getter +public class BukkitMetadataManager implements ApolloMetadataManager { + + private final Set clientBrands = new HashSet<>(); + private final Map resourcePackStatuses = new HashMap<>(); + + @Override + public PlatformMetadata extract() { + return BukkitMetadata.builder() + .clientBrands(new HashSet<>(this.clientBrands)) + .resourcePackStatuses(new HashMap<>(this.resourcePackStatuses)) + .build(); + } + + @Override + public void clear() { + this.clientBrands.clear(); + this.resourcePackStatuses.clear(); + } + +} diff --git a/bukkit/src/main/java/com/lunarclient/apollo/util/ByteBufUtil.java b/bukkit/src/main/java/com/lunarclient/apollo/util/ByteBufUtil.java new file mode 100644 index 00000000..67a03b80 --- /dev/null +++ b/bukkit/src/main/java/com/lunarclient/apollo/util/ByteBufUtil.java @@ -0,0 +1,83 @@ +/* + * 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.util; + +import com.google.common.io.ByteArrayDataInput; +import java.nio.charset.StandardCharsets; + +/** + * Represents a util for reading byte buffs. + * + * @since 1.1.9 + */ +public final class ByteBufUtil { + + /** + * Reads an int from the given input stream. + * + * @param in in the {@link ByteArrayDataInput} to read from + * @return the read int + * @throws IllegalArgumentException if the value length is invalid or too large + * @since 1.1.9 + */ + public static int readVarInt(ByteArrayDataInput in) { + int i = 0; + int j = 0; + + while (true) { + byte b = in.readByte(); + i |= (b & 0x7F) << j++ * 7; + + if (j > 5) { + throw new RuntimeException("VarInt too big"); + } + + if ((b & 0x80) != 128) { + break; + } + } + + return i; + } + + /** + * Reads a UTF-8 encoded string from the given input stream. + * + * @param in the {@link ByteArrayDataInput} to read from + * @return the decoded string + * @throws IllegalArgumentException if the value length is invalid or too large + * @since 1.1.9 + */ + public static String readString(ByteArrayDataInput in) { + int length = ByteBufUtil.readVarInt(in); + byte[] bytes = new byte[length]; + in.readFully(bytes); + + return new String(bytes, StandardCharsets.UTF_8); + } + + private ByteBufUtil() { + } + +} diff --git a/bukkit/src/platform-loader/resources/plugin.yml b/bukkit/src/platform-loader/resources/plugin.yml index 251013ad..8fe6f6bc 100644 --- a/bukkit/src/platform-loader/resources/plugin.yml +++ b/bukkit/src/platform-loader/resources/plugin.yml @@ -1,6 +1,6 @@ name: Apollo-Bukkit main: com.lunarclient.apollo.loader.BukkitPlatformLoader -version: 1.1.8 +version: 1.1.9 author: Moonsworth api-version: 1.13 soft-depend: [LunarClient-API] diff --git a/bungee/src/main/java/com/lunarclient/apollo/ApolloBungeePlatform.java b/bungee/src/main/java/com/lunarclient/apollo/ApolloBungeePlatform.java index 44fe00b0..dc2aa3e8 100644 --- a/bungee/src/main/java/com/lunarclient/apollo/ApolloBungeePlatform.java +++ b/bungee/src/main/java/com/lunarclient/apollo/ApolloBungeePlatform.java @@ -25,8 +25,10 @@ import com.lunarclient.apollo.command.impl.ApolloCommand; import com.lunarclient.apollo.command.impl.LunarClientCommand; +import com.lunarclient.apollo.listener.ApolloMetadataListener; import com.lunarclient.apollo.listener.ApolloPlayerListener; import com.lunarclient.apollo.loader.PlatformPlugin; +import com.lunarclient.apollo.metadata.BungeeMetadataManager; import com.lunarclient.apollo.module.ApolloModuleManagerImpl; import com.lunarclient.apollo.module.autotexthotkey.AutoTextHotkeyModule; import com.lunarclient.apollo.module.beam.BeamModule; @@ -107,6 +109,7 @@ public void onEnable() { this.stats = new BungeeApolloStats(); ApolloManager.bootstrap(this); + ApolloManager.setMetadataManager(new BungeeMetadataManager()); ((ApolloModuleManagerImpl) Apollo.getModuleManager()) .addModule(AutoTextHotkeyModule.class) @@ -146,6 +149,7 @@ public void onEnable() { server.registerChannel(ApolloManager.PLUGIN_MESSAGE_CHANNEL); PluginManager pluginManager = server.getPluginManager(); + pluginManager.registerListener(this.plugin, new ApolloMetadataListener(this.plugin)); pluginManager.registerListener(this.plugin, new ApolloPlayerListener()); pluginManager.registerCommand(this.plugin, ApolloCommand.create()); pluginManager.registerCommand(this.plugin, LunarClientCommand.create()); diff --git a/bungee/src/main/java/com/lunarclient/apollo/listener/ApolloMetadataListener.java b/bungee/src/main/java/com/lunarclient/apollo/listener/ApolloMetadataListener.java new file mode 100644 index 00000000..2cda362d --- /dev/null +++ b/bungee/src/main/java/com/lunarclient/apollo/listener/ApolloMetadataListener.java @@ -0,0 +1,158 @@ +/* + * 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.listener; + +import com.google.common.io.ByteArrayDataInput; +import com.google.common.io.ByteStreams; +import com.lunarclient.apollo.ApolloManager; +import com.lunarclient.apollo.metadata.BungeeMetadataManager; +import com.lunarclient.apollo.util.ByteBufUtil; +import java.io.ByteArrayInputStream; +import java.io.DataInputStream; +import java.io.IOException; +import java.net.InetSocketAddress; +import net.md_5.bungee.api.ProxyServer; +import net.md_5.bungee.api.connection.PendingConnection; +import net.md_5.bungee.api.connection.ProxiedPlayer; +import net.md_5.bungee.api.event.PluginMessageEvent; +import net.md_5.bungee.api.event.PreLoginEvent; +import net.md_5.bungee.api.plugin.Listener; +import net.md_5.bungee.api.plugin.Plugin; +import net.md_5.bungee.event.EventHandler; + +/** + * Handles Apollo metadata listeners. + * + * @since 1.1.9 + */ +public final class ApolloMetadataListener implements Listener { + + /** + * Constructs the {@link ApolloMetadataListener}. + * + * @param plugin the plugin + * @since 1.1.9 + */ + public ApolloMetadataListener(Plugin plugin) { + ProxyServer server = plugin.getProxy(); + + server.registerChannel("MC|Brand"); + server.registerChannel("minecraft:brand"); + + server.registerChannel("FML|HS"); + server.registerChannel("fml:handshake"); + } + + /** + * Handles plugin messages for client brand and FML mod information. + * + * @param event the event + * @since 1.1.9 + */ + @EventHandler + public void onPluginMessage(PluginMessageEvent event) { + if (!(event.getSender() instanceof ProxiedPlayer)) { + return; + } + + String tag = event.getTag(); + byte[] data = event.getData(); + + switch (tag) { + case "MC|Brand": { + try (DataInputStream in = new DataInputStream(new ByteArrayInputStream(data))) { + this.collectBrand(in.readUTF()); + } catch (IOException ignored) { + } + + break; + } + case "minecraft:brand": { + ByteArrayDataInput in = ByteStreams.newDataInput(data); + this.collectBrand(ByteBufUtil.readString(in)); + break; + } + case "fml:handshake": + case "FML|HS": { + this.handleFml(data); + break; + } + } + } + + /** + * Captures the server IP and port the player used to connect. + * + * @param event the event + * @since 1.1.9 + */ + @EventHandler + public void onPreLogin(PreLoginEvent event) { + PendingConnection connection = event.getConnection(); + InetSocketAddress host = connection.getVirtualHost(); + + if (host == null) { + return; + } + + String hostString; + if (host.getAddress() != null) { + hostString = host.getAddress().getHostAddress(); + } else { + hostString = host.getHostName(); + } + + BungeeMetadataManager manager = (BungeeMetadataManager) ApolloManager.getMetadataManager(); + manager.getServerAddress().add(hostString + ":" + host.getPort()); + } + + private void collectBrand(String brand) { + BungeeMetadataManager manager = (BungeeMetadataManager) ApolloManager.getMetadataManager(); + manager.getClientBrands().add(brand); + } + + private void handleFml(byte[] data) { + ByteArrayDataInput in = ByteStreams.newDataInput(data); + + try { + byte discriminator = in.readByte(); + + if (discriminator != 2) { + return; + } + + int count = ByteBufUtil.readVarInt(in); + + for (int i = 0; i < count; i++) { + String modId = ByteBufUtil.readString(in); + String version = ByteBufUtil.readString(in); + + BungeeMetadataManager manager = (BungeeMetadataManager) ApolloManager.getMetadataManager(); + manager.getMods().put(modId, version); + } + } catch (Exception ignored) { + } + } + +} diff --git a/bungee/src/main/java/com/lunarclient/apollo/metadata/BungeeMetadata.java b/bungee/src/main/java/com/lunarclient/apollo/metadata/BungeeMetadata.java new file mode 100644 index 00000000..2b614b4c --- /dev/null +++ b/bungee/src/main/java/com/lunarclient/apollo/metadata/BungeeMetadata.java @@ -0,0 +1,69 @@ +/* + * 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.metadata; + +import com.lunarclient.apollo.stats.metadata.PlatformMetadata; +import java.util.Map; +import java.util.Set; +import lombok.Builder; +import lombok.ToString; + +/** + * Represents the bungee metadata implementation. + * + * @since 1.1.9 + */ +@ToString +@Builder(toBuilder = true) +public class BungeeMetadata extends PlatformMetadata { + + /** + * Tracks client brands sent by the players. + * + *

A {@link Set} of {@link String} client brands.

+ * + * @since 1.1.9 + */ + private final Set clientBrands; + + /** + * Tracks forge mods sent with the forge handshake. + * + *

A {@link Map} of {@link String} mod id + * as a key and {@link String} version as value.

+ * + * @since 1.1.9 + */ + private final Map mods; + + /** + * Tracks the server IP and port the player used to connect. + * + *

A {@link Set} of {@link String} server addresses in the format: host:port

+ * + * @since 1.1.9 + */ + private final Set serverAddress; + +} diff --git a/bungee/src/main/java/com/lunarclient/apollo/metadata/BungeeMetadataManager.java b/bungee/src/main/java/com/lunarclient/apollo/metadata/BungeeMetadataManager.java new file mode 100644 index 00000000..1ea78f1b --- /dev/null +++ b/bungee/src/main/java/com/lunarclient/apollo/metadata/BungeeMetadataManager.java @@ -0,0 +1,62 @@ +/* + * 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.metadata; + +import com.lunarclient.apollo.stats.metadata.ApolloMetadataManager; +import com.lunarclient.apollo.stats.metadata.PlatformMetadata; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import lombok.Getter; + +/** + * The Bungee implementation of {@link ApolloMetadataManager}. + * + * @since 1.1.9 + */ +@Getter +public class BungeeMetadataManager implements ApolloMetadataManager { + + private final Set clientBrands = new HashSet<>(); + private final Map mods = new HashMap<>(); + private final Set serverAddress = new HashSet<>(); + + @Override + public PlatformMetadata extract() { + return BungeeMetadata.builder() + .clientBrands(new HashSet<>(this.clientBrands)) + .mods(new HashMap<>(this.mods)) + .serverAddress(new HashSet<>(this.serverAddress)) + .build(); + } + + @Override + public void clear() { + this.clientBrands.clear(); + this.mods.clear(); + this.serverAddress.clear(); + } + +} diff --git a/bungee/src/main/java/com/lunarclient/apollo/util/ByteBufUtil.java b/bungee/src/main/java/com/lunarclient/apollo/util/ByteBufUtil.java new file mode 100644 index 00000000..67a03b80 --- /dev/null +++ b/bungee/src/main/java/com/lunarclient/apollo/util/ByteBufUtil.java @@ -0,0 +1,83 @@ +/* + * 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.util; + +import com.google.common.io.ByteArrayDataInput; +import java.nio.charset.StandardCharsets; + +/** + * Represents a util for reading byte buffs. + * + * @since 1.1.9 + */ +public final class ByteBufUtil { + + /** + * Reads an int from the given input stream. + * + * @param in in the {@link ByteArrayDataInput} to read from + * @return the read int + * @throws IllegalArgumentException if the value length is invalid or too large + * @since 1.1.9 + */ + public static int readVarInt(ByteArrayDataInput in) { + int i = 0; + int j = 0; + + while (true) { + byte b = in.readByte(); + i |= (b & 0x7F) << j++ * 7; + + if (j > 5) { + throw new RuntimeException("VarInt too big"); + } + + if ((b & 0x80) != 128) { + break; + } + } + + return i; + } + + /** + * Reads a UTF-8 encoded string from the given input stream. + * + * @param in the {@link ByteArrayDataInput} to read from + * @return the decoded string + * @throws IllegalArgumentException if the value length is invalid or too large + * @since 1.1.9 + */ + public static String readString(ByteArrayDataInput in) { + int length = ByteBufUtil.readVarInt(in); + byte[] bytes = new byte[length]; + in.readFully(bytes); + + return new String(bytes, StandardCharsets.UTF_8); + } + + private ByteBufUtil() { + } + +} diff --git a/bungee/src/platform-loader/resources/plugin.yml b/bungee/src/platform-loader/resources/plugin.yml index 6274a8dc..b1b67af6 100644 --- a/bungee/src/platform-loader/resources/plugin.yml +++ b/bungee/src/platform-loader/resources/plugin.yml @@ -1,4 +1,4 @@ name: Apollo-Bungee main: com.lunarclient.apollo.loader.BungeePlatformLoader -version: 1.1.8 +version: 1.1.9 author: Moonsworth diff --git a/common/src/main/java/com/lunarclient/apollo/ApolloManager.java b/common/src/main/java/com/lunarclient/apollo/ApolloManager.java index 4085d740..8c967e2b 100644 --- a/common/src/main/java/com/lunarclient/apollo/ApolloManager.java +++ b/common/src/main/java/com/lunarclient/apollo/ApolloManager.java @@ -34,6 +34,7 @@ import com.lunarclient.apollo.player.ApolloPlayerManagerImpl; import com.lunarclient.apollo.roundtrip.ApolloRoundtripManager; import com.lunarclient.apollo.stats.ApolloStatsManager; +import com.lunarclient.apollo.stats.metadata.ApolloMetadataManager; import com.lunarclient.apollo.util.ConfigTarget; import com.lunarclient.apollo.version.ApolloVersionManager; import com.lunarclient.apollo.world.ApolloWorldManagerImpl; @@ -42,6 +43,7 @@ import java.util.LinkedList; import java.util.List; import lombok.Getter; +import lombok.Setter; /** * Provides the instances for {@link Apollo}. @@ -74,6 +76,7 @@ public final class ApolloManager { @Getter private static ApolloNetworkManager networkManager; @Getter private static ApolloVersionManager versionManager; @Getter private static ApolloStatsManager statsManager; + @Getter @Setter private static ApolloMetadataManager metadataManager; @Getter private static Path configPath; diff --git a/common/src/main/java/com/lunarclient/apollo/api/request/ServerHeartbeatRequest.java b/common/src/main/java/com/lunarclient/apollo/api/request/heartbeat/ServerHeartbeatRequest.java similarity index 91% rename from common/src/main/java/com/lunarclient/apollo/api/request/ServerHeartbeatRequest.java rename to common/src/main/java/com/lunarclient/apollo/api/request/heartbeat/ServerHeartbeatRequest.java index 8bf8007d..2a7e5322 100644 --- a/common/src/main/java/com/lunarclient/apollo/api/request/ServerHeartbeatRequest.java +++ b/common/src/main/java/com/lunarclient/apollo/api/request/heartbeat/ServerHeartbeatRequest.java @@ -21,12 +21,13 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -package com.lunarclient.apollo.api.request; +package com.lunarclient.apollo.api.request.heartbeat; import com.lunarclient.apollo.api.ApiRequest; import com.lunarclient.apollo.api.ApiRequestType; import com.lunarclient.apollo.api.ApiServiceType; import com.lunarclient.apollo.api.response.ServerHeartbeatResponse; +import com.lunarclient.apollo.stats.metadata.PlatformMetadata; import lombok.Builder; import lombok.ToString; @@ -81,6 +82,13 @@ public final class ServerHeartbeatRequest implements ApiRequest ((AbstractApolloPlayer) player).sendPacket(message)); } diff --git a/common/src/main/java/com/lunarclient/apollo/module/packetenrichment/PacketEnrichmentImpl.java b/common/src/main/java/com/lunarclient/apollo/module/packetenrichment/PacketEnrichmentImpl.java index d19a38b6..de9d0247 100644 --- a/common/src/main/java/com/lunarclient/apollo/module/packetenrichment/PacketEnrichmentImpl.java +++ b/common/src/main/java/com/lunarclient/apollo/module/packetenrichment/PacketEnrichmentImpl.java @@ -55,6 +55,7 @@ public PacketEnrichmentImpl() { private void onReceivePacket(ApolloReceivePacketEvent event) { event.unpack(PlayerAttackMessage.class).ifPresent(packet -> { ApolloPlayerAttackEvent playerAttackEvent = new ApolloPlayerAttackEvent( + event.getPlayer(), NetworkTypes.fromProtobuf(packet.getPacketInfo().getInstantiationTime()), NetworkTypes.fromProtobuf(packet.getTargetInfo()), NetworkTypes.fromProtobuf(packet.getAttackerInfo()), @@ -70,6 +71,7 @@ private void onReceivePacket(ApolloReceivePacketEvent event) { event.unpack(PlayerChatOpenMessage.class).ifPresent(packet -> { ApolloPlayerChatOpenEvent playerChatOpenEvent = new ApolloPlayerChatOpenEvent( + event.getPlayer(), NetworkTypes.fromProtobuf(packet.getPacketInfo().getInstantiationTime()), NetworkTypes.fromProtobuf(packet.getPlayerInfo())); @@ -82,6 +84,7 @@ private void onReceivePacket(ApolloReceivePacketEvent event) { event.unpack(PlayerChatCloseMessage.class).ifPresent(packet -> { ApolloPlayerChatCloseEvent playerChatCloseEvent = new ApolloPlayerChatCloseEvent( + event.getPlayer(), NetworkTypes.fromProtobuf(packet.getPacketInfo().getInstantiationTime()), NetworkTypes.fromProtobuf(packet.getPlayerInfo())); @@ -94,6 +97,7 @@ private void onReceivePacket(ApolloReceivePacketEvent event) { event.unpack(PlayerUseItemMessage.class).ifPresent(packet -> { ApolloPlayerUseItemEvent playerUseItemEvent = new ApolloPlayerUseItemEvent( + event.getPlayer(), NetworkTypes.fromProtobuf(packet.getPacketInfo().getInstantiationTime()), NetworkTypes.fromProtobuf(packet.getPlayerInfo()), packet.getMainHand() diff --git a/common/src/main/java/com/lunarclient/apollo/stats/ApolloStatsManager.java b/common/src/main/java/com/lunarclient/apollo/stats/ApolloStatsManager.java index 31c7c50d..ad51fc36 100644 --- a/common/src/main/java/com/lunarclient/apollo/stats/ApolloStatsManager.java +++ b/common/src/main/java/com/lunarclient/apollo/stats/ApolloStatsManager.java @@ -82,6 +82,11 @@ public final class ApolloStatsManager { .node(CONFIG_PREFIX, "counts").type(TypeToken.get(Boolean.class)) .defaultValue(true).build(); + public static final SimpleOption HEARTBEAT_USER_METADATA = Option.builder() + .comment("Set to 'true' to send players user metadata to MCStats, otherwise 'false'.") + .node(CONFIG_PREFIX, "user-metadata").type(TypeToken.get(Boolean.class)) + .defaultValue(true).build(); + /** * Constructs the {@link ApolloStatsManager}. * @@ -95,7 +100,8 @@ public ApolloStatsManager() { ApolloStatsManager.HARDWARE_INFORMATION, ApolloStatsManager.SOFTWARE_INFORMATION, ApolloStatsManager.HEARTBEAT_PERFORMANCE, - ApolloStatsManager.HEARTBEAT_COUNTS + ApolloStatsManager.HEARTBEAT_COUNTS, + ApolloStatsManager.HEARTBEAT_USER_METADATA ); } diff --git a/common/src/main/java/com/lunarclient/apollo/stats/ApolloStatsThread.java b/common/src/main/java/com/lunarclient/apollo/stats/ApolloStatsThread.java index 08924c8c..404dcc63 100644 --- a/common/src/main/java/com/lunarclient/apollo/stats/ApolloStatsThread.java +++ b/common/src/main/java/com/lunarclient/apollo/stats/ApolloStatsThread.java @@ -27,8 +27,9 @@ import com.lunarclient.apollo.ApolloManager; import com.lunarclient.apollo.ApolloPlatform; import com.lunarclient.apollo.api.ApolloHttpManager; -import com.lunarclient.apollo.api.request.ServerHeartbeatRequest; +import com.lunarclient.apollo.api.request.heartbeat.ServerHeartbeatRequest; import com.lunarclient.apollo.option.Options; +import com.lunarclient.apollo.stats.metadata.ApolloMetadataManager; import java.lang.management.ManagementFactory; import java.lang.management.OperatingSystemMXBean; import java.util.concurrent.TimeUnit; @@ -71,8 +72,9 @@ public void run() { boolean performance = options.get(ApolloStatsManager.HEARTBEAT_PERFORMANCE); boolean counts = options.get(ApolloStatsManager.HEARTBEAT_COUNTS); + boolean userMetadata = options.get(ApolloStatsManager.HEARTBEAT_USER_METADATA); - if (!performance && !counts) { + if (!performance && !counts && !userMetadata) { break; } @@ -92,6 +94,15 @@ public void run() { .totalPlayers(stats.getTotalPlayers()); } + if (userMetadata) { + ApolloMetadataManager metadataManager = ApolloManager.getMetadataManager(); + + requestBuilder + .metadata(metadataManager.extract()); + + metadataManager.clear(); + } + final ServerHeartbeatRequest finalRequest = request = requestBuilder.build(); ApolloManager.getHttpManager().request(request) diff --git a/common/src/main/java/com/lunarclient/apollo/stats/metadata/ApolloMetadataManager.java b/common/src/main/java/com/lunarclient/apollo/stats/metadata/ApolloMetadataManager.java new file mode 100644 index 00000000..e9948521 --- /dev/null +++ b/common/src/main/java/com/lunarclient/apollo/stats/metadata/ApolloMetadataManager.java @@ -0,0 +1,49 @@ +/* + * 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.stats.metadata; + +/** + * Represents the Apollo metadata manager, responsible for + * managing and extracting metadata related to the platform. + * + * @since 1.1.9 + */ +public interface ApolloMetadataManager { + + /** + * Extract the current platform metadata. + * + * @return the platform metadata object + * @since 1.1.9 + */ + PlatformMetadata extract(); + + /** + * Clears the current metadata cache. + * + * @since 1.1.9 + */ + void clear(); + +} diff --git a/common/src/main/java/com/lunarclient/apollo/stats/metadata/PlatformMetadata.java b/common/src/main/java/com/lunarclient/apollo/stats/metadata/PlatformMetadata.java new file mode 100644 index 00000000..d1718112 --- /dev/null +++ b/common/src/main/java/com/lunarclient/apollo/stats/metadata/PlatformMetadata.java @@ -0,0 +1,32 @@ +/* + * 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.stats.metadata; + +/** + * Represents the base class for platform specific metadata. + * + * @since 1.1.9 + */ +public abstract class PlatformMetadata { +} diff --git a/docs/developers/events.mdx b/docs/developers/events.mdx index 860343cd..18f36fa4 100644 --- a/docs/developers/events.mdx +++ b/docs/developers/events.mdx @@ -183,6 +183,7 @@ _Called when the player closes their chat._ | Field | Description | | -------------------------- | -------------------------------------------------- | +| `ApolloPlayer player` | The Apollo player that sent the packet. | | `long instantiationTimeMs` | The unix timestamp when the packet was created. | | `PlayerInfo playerInfo` | The player's general information. | @@ -197,6 +198,7 @@ _Called when the player opens their chat._ | Field | Description | | -------------------------- | -------------------------------------------------- | +| `ApolloPlayer player` | The Apollo player that sent the packet. | | `long instantiationTimeMs` | The unix timestamp when the packet was created. | | `PlayerInfo playerInfo` | The player's general information. | @@ -211,6 +213,7 @@ _Called when the player attacks another player._ | Field | Description | | -------------------------- | -------------------------------------------------- | +| `ApolloPlayer player` | The Apollo player that sent the packet. | | `long instantiationTimeMs` | The unix timestamp when the packet was created. | | `PlayerInfo targetInfo` | The target player general information. | | `PlayerInfo attackerInfo` | The attacker player general information. | @@ -227,6 +230,7 @@ _Called when the player uses an item (1.16.1+)._ | Field | Description | | -------------------------- | -------------------------------------------------- | +| `ApolloPlayer player` | The Apollo player that sent the packet. | | `long instantiationTimeMs` | The unix timestamp when the packet was created. | | `PlayerInfo playerInfo` | The player's general information. | | `boolean mainHand` | Whether the item was in the player's main hand. | diff --git a/docs/developers/lightweight/json/packet-util.mdx b/docs/developers/lightweight/json/packet-util.mdx index 0a740d1e..b7263a48 100644 --- a/docs/developers/lightweight/json/packet-util.mdx +++ b/docs/developers/lightweight/json/packet-util.mdx @@ -47,6 +47,7 @@ static { CONFIG_MODULE_PROPERTIES.put("server_rule", "override-max-chat-length", false); CONFIG_MODULE_PROPERTIES.put("server_rule", "max-chat-length", 256); CONFIG_MODULE_PROPERTIES.put("tnt_countdown", "tnt-ticks", 80); + CONFIG_MODULE_PROPERTIES.put("title", "clear-title-on-server-switch", false); CONFIG_MODULE_PROPERTIES.put("waypoint", "server-handles-waypoints", false); } ``` 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/docs/developers/lightweight/protobuf/packet-util.mdx b/docs/developers/lightweight/protobuf/packet-util.mdx index 3ea0b429..b74f9b56 100644 --- a/docs/developers/lightweight/protobuf/packet-util.mdx +++ b/docs/developers/lightweight/protobuf/packet-util.mdx @@ -51,6 +51,7 @@ static { CONFIG_MODULE_PROPERTIES.put("server_rule", "override-max-chat-length", Value.newBuilder().setBoolValue(false).build()); CONFIG_MODULE_PROPERTIES.put("server_rule", "max-chat-length", Value.newBuilder().setNumberValue(256).build()); CONFIG_MODULE_PROPERTIES.put("tnt_countdown", "tnt-ticks", Value.newBuilder().setNumberValue(80).build()); + CONFIG_MODULE_PROPERTIES.put("title", "clear-title-on-server-switch", Value.newBuilder().setBoolValue(false).build()); CONFIG_MODULE_PROPERTIES.put("waypoint", "server-handles-waypoints", Value.newBuilder().setBoolValue(false).build()); } ``` diff --git a/docs/developers/mods/3dskins.mdx b/docs/developers/mods/3dskins.mdx index 0cdf5637..61cf6a6a 100644 --- a/docs/developers/mods/3dskins.mdx +++ b/docs/developers/mods/3dskins.mdx @@ -29,6 +29,12 @@ public void toggle3DSkinsExample(Player viewer, boolean value) { - Minimum: `5` - Maximum: `40` +- __`SHOW_OTHERS`__ + - Config Key: `show-others` + - Values + - Type: `Boolean` + - Default: `true` + - __`ENABLE_HAT`__ - Config Key: `enable-hat` - Values @@ -89,6 +95,14 @@ public void toggle3DSkinsExample(Player viewer, boolean value) { - Minimum: `1.001F` - Maximum: `1.25F` +- __`FIRST_PERSON_VOXEL_SIZE`__ + - Config Key: `first-person-voxel-size` + - Values + - Type: `Float` + - Default: `1.1F` + - Minimum: `1.001F` + - Maximum: `1.3F` + - __`ENABLE_SKULLS`__ - Config Key: `enable-skulls` - Values diff --git a/docs/developers/mods/_meta.json b/docs/developers/mods/_meta.json index f4137431..2771a51f 100644 --- a/docs/developers/mods/_meta.json +++ b/docs/developers/mods/_meta.json @@ -29,10 +29,12 @@ "hurtcam": "HurtCam", "hypixelbedwars": "HypixelBedwars", "hypixelmod": "HypixelMod", + "inventorymod": "InventoryMod", "itemcounter": "ItemCounter", "itemphysics": "ItemPhysics", "itemtracker": "ItemTracker", "keystrokes": "Keystrokes", + "killsounds": "KillSounds", "lighting": "Lighting", "memory": "Memory", "menublur": "MenuBlur", @@ -69,10 +71,12 @@ "stopwatch": "Stopwatch", "tab": "Tab", "teamview": "TeamView", + "tiertagger": "TierTagger", "timechanger": "TimeChanger", "titles": "Titles", "tntcountdown": "TntCountdown", "togglesneak": "ToggleSneak", + "totemcounter": "TotemCounter", "uhcoverlay": "UhcOverlay", "waila": "Waila", "waypoints": "Waypoints", diff --git a/docs/developers/mods/armorstatus.mdx b/docs/developers/mods/armorstatus.mdx index 31ac771d..5f451abe 100644 --- a/docs/developers/mods/armorstatus.mdx +++ b/docs/developers/mods/armorstatus.mdx @@ -35,6 +35,12 @@ public void toggleArmorStatusExample(Player viewer, boolean value) { - Type: `Boolean` - Default: `false` +- __`HIDE_UNBREAKABLE_DURABILITY`__ + - Config Key: `hide-unbreakable-durability` + - Values + - Type: `Boolean` + - Default: `false` + - __`ITEM_NAME`__ - Config Key: `item-name` - Values diff --git a/docs/developers/mods/autotexthotkey.mdx b/docs/developers/mods/autotexthotkey.mdx index 8e771ce3..bcfe5d84 100644 --- a/docs/developers/mods/autotexthotkey.mdx +++ b/docs/developers/mods/autotexthotkey.mdx @@ -21,3 +21,10 @@ public void toggleAutoTextHotKeyExample(Player viewer, boolean value) { - Type: `Boolean` - Default: `false` +- __`NOTIFY_ON_BLOCKED_INPUT`__ + - Displays a notification when an input is blocked by the server + - Config Key: `notify-on-blocked-input` + - Values + - Type: `Boolean` + - Default: `true` + diff --git a/docs/developers/mods/chat.mdx b/docs/developers/mods/chat.mdx index c27fafe9..c1428e57 100644 --- a/docs/developers/mods/chat.mdx +++ b/docs/developers/mods/chat.mdx @@ -28,6 +28,18 @@ public void toggleChatExample(Player viewer, boolean value) { - Type: `Boolean` - Default: `true` +- __`MODERN_CHAT_LENGTH_HYPIXEL`__ + - Config Key: `modern-chat-length-hypixel` + - Values + - Type: `Boolean` + - Default: `false` + +- __`LONG_CHAT_SINGLEPLAYER`__ + - Config Key: `long-chat-singleplayer` + - Values + - Type: `Boolean` + - Default: `false` + - __`STACK_MESSAGES`__ - Choose whether or not you want to stack multiple of the same messages in chat - Config Key: `stack-messages` @@ -111,6 +123,7 @@ For example, if your name is Notch, this will ping on Notch but not Notch123. - __`HOVER_IMAGE_PREVIEW`__ - Displays a preview of an image when hovering over it. +If a single message has more than one image, press CTRL to cycle through them. - Config Key: `hover-image-preview` - Values - Type: `Boolean` @@ -130,10 +143,17 @@ For example, if your name is Notch, this will ping on Notch but not Notch123. - Config Key: `max-image-size` - Values - Type: `Double` - - Default: `100.0D` + - Default: `30.0D` - Minimum: `0.0D` - Maximum: `100.0D` +- __`FULLSCREEN_IMAGE`__ + - When your max image size is set to e.g. 50%, when you press shift, the image will expand to 100% + - Config Key: `fullscreen-image` + - Values + - Type: `Boolean` + - Default: `true` + - __`SMOOTH_CHAT`__ - Config Key: `smooth-chat` - Values @@ -148,6 +168,36 @@ For example, if your name is Notch, this will ping on Notch but not Notch123. - Minimum: `1` - Maximum: `10` +- __`CHAT_NAME_BOLD`__ + - Config Key: `chat-name-bold` + - Values + - Type: `Boolean` + - Default: `false` + +- __`CHAT_NAME_ITALIC`__ + - Config Key: `chat-name-italic` + - Values + - Type: `Boolean` + - Default: `false` + +- __`CHAT_NAME_UNDERLINE`__ + - Config Key: `chat-name-underline` + - Values + - Type: `Boolean` + - Default: `false` + +- __`CHAT_NAME_STRIKETHROUGH`__ + - Config Key: `chat-name-strikethrough` + - Values + - Type: `Boolean` + - Default: `false` + +- __`CHAT_NAME_OBFUSCATED`__ + - Config Key: `chat-name-obfuscated` + - Values + - Type: `Boolean` + - Default: `false` + - __`CHAT_BACKGROUND_OPACITY`__ - Config Key: `chat-background-opacity` - Values diff --git a/docs/developers/mods/directionhud.mdx b/docs/developers/mods/directionhud.mdx index fe4b64a2..00bac58c 100644 --- a/docs/developers/mods/directionhud.mdx +++ b/docs/developers/mods/directionhud.mdx @@ -70,12 +70,6 @@ public void toggleDirectionHUDExample(Player viewer, boolean value) { - Minimum: `0.5F` - Maximum: `3.0F` -- __`USE_LEGACY_STYLE`__ - - Config Key: `use-legacy-style` - - Values - - Type: `Boolean` - - Default: `false` - - __`SHOW_MARKER`__ - Config Key: `show-marker` - Values @@ -88,6 +82,19 @@ public void toggleDirectionHUDExample(Player viewer, boolean value) { - Type: `Boolean` - Default: `true` +- __`USE_LEGACY_STYLE`__ + - Config Key: `use-legacy-style` + - Values + - Type: `Boolean` + - Default: `false` + +- __`SHOW_WITH_TAB`__ + - Choose whether to show the Direction HUD when TAB is open. + - Config Key: `show-with-tab` + - Values + - Type: `Boolean` + - Default: `false` + - __`BACKGROUND_COLOR`__ - Config Key: `background-color` - Values diff --git a/docs/developers/mods/inventorymod.mdx b/docs/developers/mods/inventorymod.mdx new file mode 100644 index 00000000..c38732ee --- /dev/null +++ b/docs/developers/mods/inventorymod.mdx @@ -0,0 +1,38 @@ +# Inventory Mod + +A collection of quality of life tweaks for the inventory. + +## Integration + +### How to toggle the mod + +```java +public void toggleInventoryModExample(Player viewer, boolean value) { + Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId()); + apolloPlayerOpt.ifPresent(apolloPlayer -> this.modSettingModule.getOptions().set(apolloPlayer, ModInventoryMod.ENABLED, value)); +} +``` + +## Available options + +- __`ENABLED`__ + - Config Key: `enabled` + - Values + - Type: `Boolean` + - Default: `false` + +- __`DONT_RESET_CURSOR`__ + - Useful for navigating inventory menus on servers. + - Config Key: `dont-reset-cursor` + - Values + - Type: `Boolean` + - Default: `false` + +- __`RESET_CURSOR_TIMEOUT`__ + - Config Key: `reset-cursor-timeout` + - Values + - Type: `Float` + - Default: `0.3F` + - Minimum: `0.1F` + - Maximum: `5.0F` + diff --git a/docs/developers/mods/keystrokes.mdx b/docs/developers/mods/keystrokes.mdx index eeccfc54..8d1e2134 100644 --- a/docs/developers/mods/keystrokes.mdx +++ b/docs/developers/mods/keystrokes.mdx @@ -47,6 +47,12 @@ public void toggleKeyStrokesExample(Player viewer, boolean value) { - Type: `Boolean` - Default: `false` +- __`USE_ARROWS`__ + - Config Key: `use-arrows` + - Values + - Type: `Boolean` + - Default: `false` + - __`KEY_STROKES_MOVEMENT`__ - Config Key: `key-strokes-movement` - Values @@ -57,13 +63,7 @@ public void toggleKeyStrokesExample(Player viewer, boolean value) { - Config Key: `key-strokes-spacebar` - Values - Type: `Boolean` - - Default: `false` - -- __`USE_ARROWS`__ - - Config Key: `use-arrows` - - Values - - Type: `Boolean` - - Default: `false` + - Default: `true` - __`TEXT_SHADOW`__ - Config Key: `text-shadow` @@ -83,11 +83,49 @@ public void toggleKeyStrokesExample(Player viewer, boolean value) { - Type: `Boolean` - Default: `false` +- __`ANIMATE`__ + - Config Key: `animate` + - Values + - Type: `Boolean` + - Default: `false` + +- __`DURATION`__ + - Config Key: `duration` + - Values + - Type: `Float` + - Default: `0.5F` + - Minimum: `0.1F` + - Maximum: `1.0F` + +- __`ANIMATE_COLOR`__ + - Config Key: `animate-color` + - Values + - Type: `Boolean` + - Default: `false` + +- __`ANIMATION_START_COLOR`__ + - Config Key: `animation-start-color` + - Values + - Type: `String` + - Default: `#C0FFFFFF` + +- __`ANIMATION_CENTER_COLOR`__ + - Config Key: `animation-center-color` + - Values + - Type: `String` + - Default: `#6FFFFFFF` + +- __`ANIMATION_END_COLOR`__ + - Config Key: `animation-end-color` + - Values + - Type: `String` + - Default: `#6FFFFFFF` + - __`BORDER_THICKNESS`__ - Config Key: `border-thickness` - Values - Type: `Float` - - Default: `0.5F` + - Default: `1.0F` - Minimum: `0.5F` - Maximum: `3.0F` @@ -137,3 +175,11 @@ public void toggleKeyStrokesExample(Player viewer, boolean value) { - Minimum: `0L` - Maximum: `500L` +- __`SPACEBAR_THICKNESS`__ + - Config Key: `spacebar-thickness` + - Values + - Type: `Float` + - Default: `1.0F` + - Minimum: `1.0F` + - Maximum: `4.25F` + diff --git a/docs/developers/mods/killsounds.mdx b/docs/developers/mods/killsounds.mdx new file mode 100644 index 00000000..5fadd565 --- /dev/null +++ b/docs/developers/mods/killsounds.mdx @@ -0,0 +1,23 @@ +# Kill Sounds + +Allows you to change kill sounds for players. + +## Integration + +### How to toggle the mod + +```java +public void toggleKillSoundsExample(Player viewer, boolean value) { + Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId()); + apolloPlayerOpt.ifPresent(apolloPlayer -> this.modSettingModule.getOptions().set(apolloPlayer, ModKillSounds.ENABLED, value)); +} +``` + +## Available options + +- __`ENABLED`__ + - Config Key: `enabled` + - Values + - Type: `Boolean` + - Default: `false` + diff --git a/docs/developers/mods/packdisplay.mdx b/docs/developers/mods/packdisplay.mdx index 38ed2e04..30217e2b 100644 --- a/docs/developers/mods/packdisplay.mdx +++ b/docs/developers/mods/packdisplay.mdx @@ -29,6 +29,30 @@ public void togglePackDisplayExample(Player viewer, boolean value) { - Minimum: `0.5F` - Maximum: `1.5F` +- __`PACK_ICON`__ + - Config Key: `pack-icon` + - Values + - Type: `Boolean` + - Default: `true` + +- __`PACK_DESCRIPTION`__ + - Config Key: `pack-description` + - Values + - Type: `Boolean` + - Default: `false` + +- __`PACK_EXTENSION`__ + - Config Key: `pack-extension` + - Values + - Type: `Boolean` + - Default: `false` + +- __`MOVE_TITLE_DOWN`__ + - Config Key: `move-title-down` + - Values + - Type: `Boolean` + - Default: `true` + - __`TEXT_SHADOW`__ - Config Key: `text-shadow` - Values @@ -53,28 +77,6 @@ public void togglePackDisplayExample(Player viewer, boolean value) { - Type: `Boolean` - Default: `true` -- __`STATIC_BACKGROUND_WIDTH`__ - - If this is disabled the background will change size with the text. - - Config Key: `static-background-width` - - Values - - Type: `Boolean` - - Default: `true` - -- __`STATIC_BACKGROUND_HEIGHT`__ - - If this is disabled the background will change size with the text. - - Config Key: `static-background-height` - - Values - - Type: `Boolean` - - Default: `true` - -- __`BACKGROUND_WIDTH`__ - - Config Key: `background-width` - - Values - - Type: `Integer` - - Default: `100` - - Minimum: `60` - - Maximum: `300` - - __`BACKGROUND_HEIGHT`__ - Config Key: `background-height` - Values @@ -115,15 +117,39 @@ public void togglePackDisplayExample(Player viewer, boolean value) { - Type: `String` - Default: `#FFFFFFFF` -- __`PACK_ICON`__ - - Config Key: `pack-icon` +- __`DESCRIPTION_REPLACEMENT_COLOR`__ + - Config Key: `description-replacement-color` + - Values + - Type: `String` + - Default: `#FFFFFFFF` + +- __`KEEP_BOLD`__ + - Config Key: `keep-bold` - Values - Type: `Boolean` - Default: `true` -- __`PACK_DESCRIPTION`__ - - Config Key: `pack-description` +- __`KEEP_ITALIC`__ + - Config Key: `keep-italic` - Values - Type: `Boolean` - - Default: `false` + - Default: `true` + +- __`KEEP_UNDERLINE`__ + - Config Key: `keep-underline` + - Values + - Type: `Boolean` + - Default: `true` + +- __`KEEP_STRIKETHROUGH`__ + - Config Key: `keep-strikethrough` + - Values + - Type: `Boolean` + - Default: `true` + +- __`KEEP_OBFUSCATED`__ + - Config Key: `keep-obfuscated` + - Values + - Type: `Boolean` + - Default: `true` diff --git a/docs/developers/mods/ping.mdx b/docs/developers/mods/ping.mdx index 15f62ba9..7f3b9672 100644 --- a/docs/developers/mods/ping.mdx +++ b/docs/developers/mods/ping.mdx @@ -26,21 +26,52 @@ public void togglePingExample(Player viewer, boolean value) { - Config Key: `update-interval-sec` - Values - Type: `Integer` - - Default: `15` + - Default: `20` - Minimum: `1` - - Maximum: `30` + - Maximum: `120` -- __`ENABLE_PING_NAMETAG`__ - - Config Key: `enable-ping-nametag` +- __`AVERAGE_SAMPLES`__ + - How many updates to average together (one update happens per the 'update interval' setting) + - Config Key: `average-samples` + - Values + - Type: `Integer` + - Default: `3` + - Minimum: `2` + - Maximum: `20` + +- __`PING_SPIKE_DETECTION`__ + - Config Key: `ping-spike-detection` - Values - Type: `Boolean` - Default: `false` -- __`PING_ABOVE`__ - - Config Key: `ping-above` +- __`MEDIUM_SPIKE_THRESHOLD`__ + - Config Key: `medium-spike-threshold` - Values - - Type: `Boolean` - - Default: `true` + - Type: `Integer` + - Default: `20` + - Minimum: `1` + - Maximum: `200` + +- __`MEDIUM_SPIKE_COLOR`__ + - Config Key: `medium-spike-color` + - Values + - Type: `String` + - Default: `#FFFF9100` + +- __`LARGE_SPIKE_THRESHOLD`__ + - Config Key: `large-spike-threshold` + - Values + - Type: `Integer` + - Default: `50` + - Minimum: `1` + - Maximum: `200` + +- __`LARGE_SPIKE_COLOR`__ + - Config Key: `large-spike-color` + - Values + - Type: `String` + - Default: `#FFFF0000` - __`PING_SHOW_MS`__ - Config Key: `ping-show-ms` @@ -48,11 +79,17 @@ public void togglePingExample(Player viewer, boolean value) { - Type: `Boolean` - Default: `true` +- __`SHOW_PING_PREFIX`__ + - Config Key: `show-ping-prefix` + - Values + - Type: `Boolean` + - Default: `true` + - __`PING_PREFIX_COLOR`__ - Config Key: `ping-prefix-color` - Values - Type: `String` - - Default: `#55555555` + - Default: `#FFFFFFFF` - __`DYNAMIC_PING_COLOR`__ - Config Key: `dynamic-ping-color` diff --git a/docs/developers/mods/potioneffects.mdx b/docs/developers/mods/potioneffects.mdx index db4c0d6d..26d68a17 100644 --- a/docs/developers/mods/potioneffects.mdx +++ b/docs/developers/mods/potioneffects.mdx @@ -53,6 +53,56 @@ public void togglePotionEffectsExample(Player viewer, boolean value) { - Type: `Boolean` - Default: `true` +- __`BACKGROUND`__ + - Config Key: `background` + - Values + - Type: `Boolean` + - Default: `true` + +- __`MINIMAL_MODE`__ + - Config Key: `minimal-mode` + - Values + - Type: `Boolean` + - Default: `false` + +- __`MINIMAL_MODE_HORIZONTAL`__ + - Config Key: `minimal-mode-horizontal` + - Values + - Type: `Boolean` + - Default: `false` + +- __`BORDER`__ + - Config Key: `border` + - Values + - Type: `Boolean` + - Default: `false` + +- __`BORDER_THICKNESS`__ + - Config Key: `border-thickness` + - Values + - Type: `Float` + - Default: `0.5F` + - Minimum: `0.5F` + - Maximum: `3.0F` + +- __`FORMATTED_DURATIONS`__ + - Config Key: `formatted-durations` + - Values + - Type: `Boolean` + - Default: `false` + +- __`UPPERCASE_POTION_NAMES`__ + - Config Key: `uppercase-potion-names` + - Values + - Type: `Boolean` + - Default: `false` + +- __`REVERSED_TEXT`__ + - Config Key: `reversed-text` + - Values + - Type: `Boolean` + - Default: `false` + - __`HIDE_MODERN_ICONS`__ - Config Key: `hide-modern-icons` - Values @@ -73,6 +123,18 @@ public void togglePotionEffectsExample(Player viewer, boolean value) { - Minimum: `2` - Maximum: `20` +- __`BACKGROUND_COLOR`__ + - Config Key: `background-color` + - Values + - Type: `String` + - Default: `#6F000000` + +- __`BORDER_COLOR`__ + - Config Key: `border-color` + - Values + - Type: `String` + - Default: `#9F000000` + - __`COLOR_NAME_BASED_ON_EFFECT`__ - Config Key: `color-name-based-on-effect` - Values diff --git a/docs/developers/mods/radio.mdx b/docs/developers/mods/radio.mdx index 737d4930..87d68f1a 100644 --- a/docs/developers/mods/radio.mdx +++ b/docs/developers/mods/radio.mdx @@ -21,14 +21,6 @@ public void toggleRadioExample(Player viewer, boolean value) { - Type: `Boolean` - Default: `true` -- __`SCALE`__ - - Config Key: `scale` - - Values - - Type: `Float` - - Default: `1.0F` - - Minimum: `0.5F` - - Maximum: `1.5F` - - __`VOLUME`__ - Config Key: `volume` - Values @@ -43,6 +35,14 @@ public void toggleRadioExample(Player viewer, boolean value) { - Type: `Boolean` - Default: `false` +- __`SCALE`__ + - Config Key: `scale` + - Values + - Type: `Float` + - Default: `1.0F` + - Minimum: `0.5F` + - Maximum: `1.5F` + - __`BACKGROUND`__ - Config Key: `background` - Values diff --git a/docs/developers/mods/screenshot.mdx b/docs/developers/mods/screenshot.mdx index 1e7cc98f..41283ac9 100644 --- a/docs/developers/mods/screenshot.mdx +++ b/docs/developers/mods/screenshot.mdx @@ -45,3 +45,10 @@ public void toggleScreenshotUploaderExample(Player viewer, boolean value) { - Type: `Boolean` - Default: `true` +- __`WORLD_DETAILS`__ + - A screenshot file saved with world details enabled has metadata that contains your player coordinates, the biome, and more. + - Config Key: `world-details` + - Values + - Type: `Boolean` + - Default: `true` + diff --git a/docs/developers/mods/scrollabletooltips.mdx b/docs/developers/mods/scrollabletooltips.mdx index 1ebd4d7b..bfe64801 100644 --- a/docs/developers/mods/scrollabletooltips.mdx +++ b/docs/developers/mods/scrollabletooltips.mdx @@ -19,7 +19,7 @@ public void toggleScrollableTooltipsExample(Player viewer, boolean value) { - Config Key: `enabled` - Values - Type: `Boolean` - - Default: `true` + - Default: `false` - __`START_AT_TOP`__ - Config Key: `start-at-top` diff --git a/docs/developers/mods/skyblock.mdx b/docs/developers/mods/skyblock.mdx index 5b170560..c3c00574 100644 --- a/docs/developers/mods/skyblock.mdx +++ b/docs/developers/mods/skyblock.mdx @@ -86,6 +86,13 @@ public void toggleHypixelSkyblockExample(Player viewer, boolean value) { - Type: `Boolean` - Default: `false` +- __`SKY_BLOCK_MIDDLE_CLICK_ITEMS`__ + - Replaces left clicks in menus with a middle click. Hold control to override. + - Config Key: `sky-block-middle-click-items` + - Values + - Type: `Boolean` + - Default: `false` + - __`SKY_BLOCK_CREATION_DATE`__ - Shows the creation date of the item in the lore. - Config Key: `sky-block-creation-date` @@ -112,6 +119,12 @@ public void toggleHypixelSkyblockExample(Player viewer, boolean value) { - Type: `Boolean` - Default: `false` +- __`SB_MENU_CLICK_TO_COMMAND`__ + - Config Key: `sb-menu-click-to-command` + - Values + - Type: `Boolean` + - Default: `true` + - __`SHOW_GIANT_HPAT_FEET`__ - Makes Giant HP more visible by showing their HP at their feet. - Config Key: `show-giant-h-p-at-feet` @@ -119,11 +132,11 @@ public void toggleHypixelSkyblockExample(Player viewer, boolean value) { - Type: `Boolean` - Default: `false` -- __`DUNGEON_SECRETS_COLLECTED`__ - - Config Key: `dungeon-secrets-collected` +- __`SKYBLOCK_SECRETS_COLLECTED`__ + - Config Key: `skyblock-secrets-collected` - Values - Type: `Boolean` - - Default: `false` + - Default: `true` - __`TALLER_CROPS`__ - Changes crop hitboxes with their 1.12+ variant. Only enabled on Hypixel or singleplayer. @@ -171,6 +184,20 @@ public void toggleHypixelSkyblockExample(Player viewer, boolean value) { - Type: `Boolean` - Default: `false` +- __`SKYBLOCK_FISHING_HIDE_PLAYERS`__ + - Hides players and fishing rods near your bobber while you are fishing. + - Config Key: `skyblock-fishing-hide-players` + - Values + - Type: `Boolean` + - Default: `false` + +- __`SKYBLOCK_FISHING_HOTSPOT_LOCATOR`__ + - Shows which hotspot the Hotspot Radar item is pointing to. + - Config Key: `skyblock-fishing-hotspot-locator` + - Values + - Type: `Boolean` + - Default: `false` + - __`SLAYER_BOSS_TIMER`__ - Provides a chat message on boss kill that tells you how long it took to kill! - Config Key: `slayer-boss-timer` @@ -227,3 +254,9 @@ public void toggleHypixelSkyblockExample(Player viewer, boolean value) { - Minimum: `1.0F` - Maximum: `10.0F` +- __`SKYBLOCK_USE_TICK_TIMERS`__ + - Config Key: `skyblock-use-tick-timers` + - Values + - Type: `Boolean` + - Default: `true` + diff --git a/docs/developers/mods/tiertagger.mdx b/docs/developers/mods/tiertagger.mdx new file mode 100644 index 00000000..5401ceb7 --- /dev/null +++ b/docs/developers/mods/tiertagger.mdx @@ -0,0 +1,59 @@ +# Tier Tagger + +Show player's PvP tier on their Name Tag + +## Integration + +### How to toggle the mod + +```java +public void toggleTierTaggerExample(Player viewer, boolean value) { + Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId()); + apolloPlayerOpt.ifPresent(apolloPlayer -> this.modSettingModule.getOptions().set(apolloPlayer, ModTierTagger.ENABLED, value)); +} +``` + +## Available options + +- __`ENABLED`__ + - Config Key: `enabled` + - Values + - Type: `Boolean` + - Default: `false` + +- __`MC_TIERS_FORMAT`__ + - Config Key: `mc-tiers-format` + - Values + - Type: `Boolean` + - Default: `false` + +- __`SUFFIX`__ + - Config Key: `suffix` + - Values + - Type: `Boolean` + - Default: `false` + +- __`SEPARATE_NAMETAG`__ + - Config Key: `separate-nametag` + - Values + - Type: `Boolean` + - Default: `false` + +- __`SHOW_GM_ICONS`__ + - Config Key: `show-gm-icons` + - Values + - Type: `Boolean` + - Default: `true` + +- __`SHOW_RETIRED`__ + - Config Key: `show-retired` + - Values + - Type: `Boolean` + - Default: `false` + +- __`SHOW_REGION`__ + - Config Key: `show-region` + - Values + - Type: `Boolean` + - Default: `true` + diff --git a/docs/developers/mods/togglesneak.mdx b/docs/developers/mods/togglesneak.mdx index e6e17485..234deba4 100644 --- a/docs/developers/mods/togglesneak.mdx +++ b/docs/developers/mods/togglesneak.mdx @@ -27,12 +27,24 @@ public void toggleToggleSneakSprintExample(Player viewer, boolean value) { - Type: `Boolean` - Default: `true` +- __`SPRINT_KEYBIND_OVERRIDE`__ + - Config Key: `sprint-keybind-override` + - Values + - Type: `Boolean` + - Default: `false` + - __`TOGGLE_SNEAK`__ - Config Key: `toggle-sneak` - Values - Type: `Boolean` - Default: `false` +- __`SNEAK_KEYBIND_OVERRIDE`__ + - Config Key: `sneak-keybind-override` + - Values + - Type: `Boolean` + - Default: `false` + - __`TOGGLE_SNEAK_CONTAINER`__ - Config Key: `toggle-sneak-container` - Values diff --git a/docs/developers/mods/totemcounter.mdx b/docs/developers/mods/totemcounter.mdx new file mode 100644 index 00000000..4447696d --- /dev/null +++ b/docs/developers/mods/totemcounter.mdx @@ -0,0 +1,77 @@ +# Totem Counter + +Keep track of players' totem usages. Totem pops aren't tracked when the mod is disabled, so toggling it on mid-game could result in a mismatch. + +## Integration + +### How to toggle the mod + +```java +public void toggleTotemCounterExample(Player viewer, boolean value) { + Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId()); + apolloPlayerOpt.ifPresent(apolloPlayer -> this.modSettingModule.getOptions().set(apolloPlayer, ModTotemCounter.ENABLED, value)); +} +``` + +## Available options + +- __`ENABLED`__ + - Config Key: `enabled` + - Values + - Type: `Boolean` + - Default: `false` + +- __`SHOW_FOR_SELF`__ + - Config Key: `show-for-self` + - Values + - Type: `Boolean` + - Default: `true` + +- __`SHOW_TAB_LIST`__ + - Config Key: `show-tab-list` + - Values + - Type: `Boolean` + - Default: `true` + +- __`FLIP`__ + - Config Key: `flip` + - Values + - Type: `Boolean` + - Default: `false` + +- __`COUNT_COLOR`__ + - Config Key: `count-color` + - Values + - Type: `Boolean` + - Default: `true` + +- __`SHOW_NAMETAG`__ + - Config Key: `show-nametag` + - Values + - Type: `Boolean` + - Default: `true` + +- __`SHOW_PREFIX`__ + - Config Key: `show-prefix` + - Values + - Type: `Boolean` + - Default: `false` + +- __`SEPARATE_NAMETAG`__ + - Config Key: `separate-nametag` + - Values + - Type: `Boolean` + - Default: `false` + +- __`RENDER_FIRST`__ + - Config Key: `render-first` + - Values + - Type: `Boolean` + - Default: `false` + +- __`PREFIX_COLOR`__ + - Config Key: `prefix-color` + - Values + - Type: `String` + - Default: `#FFFFFF55` + diff --git a/docs/developers/mods/waila.mdx b/docs/developers/mods/waila.mdx index 82f75205..973ebd17 100644 --- a/docs/developers/mods/waila.mdx +++ b/docs/developers/mods/waila.mdx @@ -29,6 +29,12 @@ public void toggleWAILAExample(Player viewer, boolean value) { - Minimum: `0.5F` - Maximum: `1.5F` +- __`ALWAYS_SHOW`__ + - Config Key: `always-show` + - Values + - Type: `Boolean` + - Default: `false` + - __`SHOW_ENTITIES`__ - Config Key: `show-entities` - Values @@ -67,6 +73,54 @@ public void toggleWAILAExample(Player viewer, boolean value) { - Minimum: `0.5F` - Maximum: `3.0F` +- __`SHOW_BLOCK_COORDS`__ + - Config Key: `show-block-coords` + - Values + - Type: `Boolean` + - Default: `true` + +- __`BLOCK_COORDS_COLOR`__ + - Config Key: `block-coords-color` + - Values + - Type: `String` + - Default: `#FFFFFFFF` + +- __`SHOW_CORRECT_TOOL`__ + - Config Key: `show-correct-tool` + - Values + - Type: `Boolean` + - Default: `true` + +- __`CORRECT_TOOL_COLOR`__ + - Config Key: `correct-tool-color` + - Values + - Type: `String` + - Default: `#FFFFFFFF` + +- __`SHOW_BREAK_TIME`__ + - Config Key: `show-break-time` + - Values + - Type: `Boolean` + - Default: `false` + +- __`BREAK_TIME_COLOR`__ + - Config Key: `break-time-color` + - Values + - Type: `String` + - Default: `#FFFFFFFF` + +- __`SHOW_LIGHT_LEVEL`__ + - Config Key: `show-light-level` + - Values + - Type: `Boolean` + - Default: `false` + +- __`LIGHT_LEVEL_COLOR`__ + - Config Key: `light-level-color` + - Values + - Type: `String` + - Default: `#FFFFFFFF` + - __`TEXT_COLOR`__ - Config Key: `text-color` - Values diff --git a/docs/developers/mods/waypoints.mdx b/docs/developers/mods/waypoints.mdx index 24a60903..b4e0107e 100644 --- a/docs/developers/mods/waypoints.mdx +++ b/docs/developers/mods/waypoints.mdx @@ -21,11 +21,32 @@ public void toggleWaypointsExample(Player viewer, boolean value) { - Type: `Boolean` - Default: `true` +- __`ADD_WAYPOINTS_FROM_CHAT`__ + - Config Key: `add-waypoints-from-chat` + - Values + - Type: `Boolean` + - Default: `true` + - __`DEATH_WAYPOINT`__ - Config Key: `death-waypoint` - Values - Type: `Boolean` - - Default: `false` + - Default: `true` + +- __`LIMIT_DEATH_WAYPOINTS`__ + - Config Key: `limit-death-waypoints` + - Values + - Type: `Boolean` + - Default: `true` + +- __`MAX_DEATH_WAYPOINTS`__ + - Maximum amount of Death Waypoints you will see at one time + - Config Key: `max-death-waypoints` + - Values + - Type: `Integer` + - Default: `3` + - Minimum: `1` + - Maximum: `20` - __`WAYPOINT_BEAMS`__ - Config Key: `waypoint-beams` @@ -53,13 +74,6 @@ public void toggleWaypointsExample(Player viewer, boolean value) { - Minimum: `1.0F` - Maximum: `8.0F` -- __`ONLY_SHOW_WHEN_LOOKING_NEAR`__ - - Only show each waypoint when looking near then in the world - - Config Key: `only-show-when-looking-near` - - Values - - Type: `Boolean` - - Default: `false` - - __`SHOW_ICONS`__ - Show simpler text icons above each waypoint - Config Key: `show-icons` @@ -83,9 +97,10 @@ public void toggleWaypointsExample(Player viewer, boolean value) { - Minimum: `0.1F` - Maximum: `3.0F` -- __`ADD_WAYPOINTS_FROM_CHAT`__ - - Config Key: `add-waypoints-from-chat` +- __`ONLY_SHOW_WHEN_LOOKING_NEAR`__ + - Only show each waypoint when looking near then in the world + - Config Key: `only-show-when-looking-near` - Values - Type: `Boolean` - - Default: `true` + - Default: `false` 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/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. diff --git a/docs/developers/modules/inventory.mdx b/docs/developers/modules/inventory.mdx index 1cbfd74b..35615fe2 100644 --- a/docs/developers/modules/inventory.mdx +++ b/docs/developers/modules/inventory.mdx @@ -12,6 +12,8 @@ The inventory module allows you to create customizable and professional user int - Ability to open URLs. (Respects chat privacy settings) - Ability to suggest & run commands. (Handled client-side) - Ability to copy to clipboard. + - Ability to hide item tooltips. + - Ability to hide slot highlighting. This module is disabled by default, if you wish to use this module you will need to enable it in `config.yml`. @@ -28,23 +30,31 @@ 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"}}}}}` + +**Hide Item Tooltip Item** + +`/summon item ~ ~1 ~ {Item:{id:"minecraft:sponge",Count:1b,components:{"minecraft:custom_name":"HIDE ITEM TOOLTIP","minecraft:custom_data":{lunar:{unclickable:true,hideItemTooltip:true}}}}}` + +**Hide Slot Highlight Item** + +`/summon item ~ ~1 ~ {Item:{id:"minecraft:dirt",Count:1b,components:{"minecraft:custom_name":"HIDE SLOT HIGHTLIGHT","minecraft:custom_data":{lunar:{unclickable:true,hideSlotHighlight:true}}}}}` @@ -65,7 +75,7 @@ public void inventoryModuleNMSExample(Player player) { ChatColor.RED.toString() + ChatColor.BOLD + "UNCLICKABLE" ); - inventory.setItem(11, ItemUtil.addTag(unclickableItem, "unclickable", true)); + inventory.setItem(10, ItemUtil.addTag(unclickableItem, "unclickable", true)); ItemStack copyToClipboardItem = ItemUtil.itemWithName( Material.PAPER, @@ -73,7 +83,7 @@ public void inventoryModuleNMSExample(Player player) { ); copyToClipboardItem = ItemUtil.addTag(copyToClipboardItem, "unclickable", true); - inventory.setItem(14, ItemUtil.addTag(copyToClipboardItem, "copyToClipboard", "lunarclient.com")); + inventory.setItem(12, ItemUtil.addTag(copyToClipboardItem, "copyToClipboard", "lunarclient.com")); ItemStack openUrlItem = ItemUtil.itemWithName( Material.TORCH, @@ -81,7 +91,7 @@ public void inventoryModuleNMSExample(Player player) { ); openUrlItem = ItemUtil.addTag(openUrlItem, "unclickable", true); - inventory.setItem(17, ItemUtil.addTag(openUrlItem, "openUrl", "https://lunarclient.com")); + inventory.setItem(14, ItemUtil.addTag(openUrlItem, "openUrl", "https://lunarclient.com")); ItemStack suggestCommandItem = ItemUtil.itemWithName( Material.BOOK, @@ -89,7 +99,7 @@ public void inventoryModuleNMSExample(Player player) { ); suggestCommandItem = ItemUtil.addTag(suggestCommandItem, "unclickable", true); - inventory.setItem(29, ItemUtil.addTag(suggestCommandItem, "suggestCommand", "/apollo")); + inventory.setItem(16, ItemUtil.addTag(suggestCommandItem, "suggestCommand", "/apollo")); ItemStack runCommandItem = ItemUtil.itemWithName( Material.ENCHANTED_BOOK, @@ -97,7 +107,23 @@ public void inventoryModuleNMSExample(Player player) { ); runCommandItem = ItemUtil.addTag(runCommandItem, "unclickable", true); - inventory.setItem(33, ItemUtil.addTag(runCommandItem, "runCommand", "/apollo")); + inventory.setItem(29, ItemUtil.addTag(runCommandItem, "runCommand", "/apollo")); + + ItemStack hideTooltipItem = ItemUtil.itemWithName( + Material.SPONGE, + ChatColor.GRAY.toString() + ChatColor.BOLD + "HIDE ITEM TOOLTIP" + ); + + hideTooltipItem = ItemUtil.addTag(hideTooltipItem, "unclickable", true); + inventory.setItem(31, ItemUtil.addTag(hideTooltipItem, "hideItemTooltip", true)); + + ItemStack hideHighlightItem = ItemUtil.itemWithName( + Material.DIRT, + ChatColor.DARK_GRAY.toString() + ChatColor.BOLD + "HIDE SLOT HIGHTLIGHT" + ); + + hideHighlightItem = ItemUtil.addTag(hideHighlightItem, "unclickable", true); + inventory.setItem(33, ItemUtil.addTag(hideHighlightItem, "hideSlotHighlight", true)); player.openInventory(inventory); } 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}}}}}` diff --git a/docs/developers/modules/title.mdx b/docs/developers/modules/title.mdx index 78649ac8..f8b71cff 100644 --- a/docs/developers/modules/title.mdx +++ b/docs/developers/modules/title.mdx @@ -70,6 +70,14 @@ public void resetTitlesExample(Player viewer) { } ``` +### Clear Title On Server Switch + +```java +public void setClearTitleOnServerSwitch(boolean value) { + this.titleModule.getOptions().set(TitleModule.CLEAR_TITLE_ON_SERVER_SWITCH, value); +} +``` + #### `Title` Options `.type(TitleType)` is the type of title you want to display. See the [TitleType](#titletype-types) types section for more. @@ -190,6 +198,18 @@ public void resetTitlesExample(Player viewer) { } ``` +**Clear Title On Server Switch** + +```java +public void setClearTitleOnServerSwitch(boolean value) { + Map properties = new HashMap<>(); + properties.put("clear-title-on-server-switch", Value.newBuilder().setBoolValue(value).build()); + + ConfigurableSettings settings = ProtobufPacketUtil.createModuleMessage("title", properties); + ProtobufPacketUtil.broadcastPacket(settings); +} +``` + @@ -253,6 +273,26 @@ public void resetTitlesExample(Player viewer) { } ``` +**Clear Title On Server Switch** + +```java +public void setClearTitleOnServerSwitch(boolean value) { + Map properties = new HashMap<>(); + properties.put("clear-title-on-server-switch", value); + + JsonObject message = JsonUtil.createEnableModuleObjectWithType("title", properties); + JsonPacketUtil.broadcastPacket(message); +} +``` + + +## Available options + +- __`CLEAR_TITLE_ON_SERVER_SWITCH`__ + - Determines whether the players displayed title should clear when switching servers. + - Values + - Type: `Boolean` + - Default: `false` diff --git a/bukkit-example-api/build.gradle.kts b/example/bukkit/api/build.gradle.kts similarity index 82% rename from bukkit-example-api/build.gradle.kts rename to example/bukkit/api/build.gradle.kts index 924ea690..901f2477 100644 --- a/bukkit-example-api/build.gradle.kts +++ b/example/bukkit/api/build.gradle.kts @@ -13,5 +13,5 @@ dependencies { compileOnly(project(path = ":apollo-common", configuration = "shadow")) compileOnly(libs.folia) - implementation(project(":apollo-bukkit-example-common")) + implementation(project(":example:bukkit:apollo-example-bukkit-common")) } diff --git a/bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/ApolloApiExamplePlatform.java b/example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/ApolloApiExamplePlatform.java similarity index 100% rename from bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/ApolloApiExamplePlatform.java rename to example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/ApolloApiExamplePlatform.java diff --git a/bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/debug/Debug.java b/example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/debug/Debug.java similarity index 100% rename from bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/debug/Debug.java rename to example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/debug/Debug.java diff --git a/bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/debug/DebugManager.java b/example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/debug/DebugManager.java similarity index 100% rename from bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/debug/DebugManager.java rename to example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/debug/DebugManager.java diff --git a/bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/debug/DebugTask.java b/example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/debug/DebugTask.java similarity index 100% rename from bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/debug/DebugTask.java rename to example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/debug/DebugTask.java diff --git a/bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/debug/command/ApolloDebugCommand.java b/example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/debug/command/ApolloDebugCommand.java similarity index 100% rename from bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/debug/command/ApolloDebugCommand.java rename to example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/debug/command/ApolloDebugCommand.java diff --git a/bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/debug/command/BordersCommand.java b/example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/debug/command/BordersCommand.java similarity index 100% rename from bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/debug/command/BordersCommand.java rename to example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/debug/command/BordersCommand.java diff --git a/bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/debug/command/SpamPacketsCommand.java b/example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/debug/command/SpamPacketsCommand.java similarity index 100% rename from bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/debug/command/SpamPacketsCommand.java rename to example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/debug/command/SpamPacketsCommand.java diff --git a/bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/debug/impl/BorderCollisionTest.java b/example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/debug/impl/BorderCollisionTest.java similarity index 100% rename from bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/debug/impl/BorderCollisionTest.java rename to example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/debug/impl/BorderCollisionTest.java diff --git a/bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/debug/impl/SpamPacketDebug.java b/example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/debug/impl/SpamPacketDebug.java similarity index 100% rename from bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/debug/impl/SpamPacketDebug.java rename to example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/debug/impl/SpamPacketDebug.java diff --git a/bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/debug/payload/PayloadListener.java b/example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/debug/payload/PayloadListener.java similarity index 100% rename from bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/debug/payload/PayloadListener.java rename to example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/debug/payload/PayloadListener.java diff --git a/bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/general/ApolloEventListenerExample.java b/example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/general/ApolloEventListenerExample.java similarity index 100% rename from bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/general/ApolloEventListenerExample.java rename to example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/general/ApolloEventListenerExample.java diff --git a/bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/general/ApolloGeneralExample.java b/example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/general/ApolloGeneralExample.java similarity index 100% rename from bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/general/ApolloGeneralExample.java rename to example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/general/ApolloGeneralExample.java diff --git a/bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/listener/ApolloPlayerApiListener.java b/example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/listener/ApolloPlayerApiListener.java similarity index 100% rename from bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/listener/ApolloPlayerApiListener.java rename to example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/listener/ApolloPlayerApiListener.java diff --git a/bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/AutoTextHotkeyApiExample.java b/example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/AutoTextHotkeyApiExample.java similarity index 100% rename from bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/AutoTextHotkeyApiExample.java rename to example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/AutoTextHotkeyApiExample.java diff --git a/bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/BeamApiExample.java b/example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/BeamApiExample.java similarity index 100% rename from bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/BeamApiExample.java rename to example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/BeamApiExample.java diff --git a/bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/BorderApiExample.java b/example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/BorderApiExample.java similarity index 100% rename from bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/BorderApiExample.java rename to example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/BorderApiExample.java diff --git a/bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/ChatApiExample.java b/example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/ChatApiExample.java similarity index 100% rename from bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/ChatApiExample.java rename to example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/ChatApiExample.java diff --git a/bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/ColoredFireApiExample.java b/example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/ColoredFireApiExample.java similarity index 100% rename from bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/ColoredFireApiExample.java rename to example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/ColoredFireApiExample.java diff --git a/bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/CombatApiExample.java b/example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/CombatApiExample.java similarity index 100% rename from bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/CombatApiExample.java rename to example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/CombatApiExample.java diff --git a/bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/CooldownApiExample.java b/example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/CooldownApiExample.java similarity index 100% rename from bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/CooldownApiExample.java rename to example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/CooldownApiExample.java diff --git a/bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/EntityApiExample.java b/example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/EntityApiExample.java similarity index 100% rename from bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/EntityApiExample.java rename to example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/EntityApiExample.java diff --git a/bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/GlowApiExample.java b/example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/GlowApiExample.java similarity index 100% rename from bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/GlowApiExample.java rename to example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/GlowApiExample.java diff --git a/bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/HologramApiExample.java b/example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/HologramApiExample.java similarity index 100% rename from bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/HologramApiExample.java rename to example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/HologramApiExample.java diff --git a/bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/LimbApiExample.java b/example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/LimbApiExample.java similarity index 100% rename from bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/LimbApiExample.java rename to example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/LimbApiExample.java diff --git a/bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/ModSettingsApiExample.java b/example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/ModSettingsApiExample.java similarity index 100% rename from bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/ModSettingsApiExample.java rename to example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/ModSettingsApiExample.java diff --git a/bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/NametagApiExample.java b/example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/NametagApiExample.java similarity index 100% rename from bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/NametagApiExample.java rename to example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/NametagApiExample.java diff --git a/bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/NickHiderApiExample.java b/example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/NickHiderApiExample.java similarity index 100% rename from bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/NickHiderApiExample.java rename to example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/NickHiderApiExample.java diff --git a/bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/NotificationApiExample.java b/example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/NotificationApiExample.java similarity index 100% rename from bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/NotificationApiExample.java rename to example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/NotificationApiExample.java diff --git a/bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/RichPresenceApiExample.java b/example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/RichPresenceApiExample.java similarity index 100% rename from bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/RichPresenceApiExample.java rename to example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/RichPresenceApiExample.java diff --git a/bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/ServerRuleApiExample.java b/example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/ServerRuleApiExample.java similarity index 100% rename from bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/ServerRuleApiExample.java rename to example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/ServerRuleApiExample.java diff --git a/bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/StaffModApiExample.java b/example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/StaffModApiExample.java similarity index 100% rename from bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/StaffModApiExample.java rename to example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/StaffModApiExample.java diff --git a/bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/StopwatchApiExample.java b/example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/StopwatchApiExample.java similarity index 100% rename from bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/StopwatchApiExample.java rename to example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/StopwatchApiExample.java diff --git a/bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/TeamApiExample.java b/example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/TeamApiExample.java similarity index 100% rename from bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/TeamApiExample.java rename to example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/TeamApiExample.java diff --git a/bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/TebexApiExample.java b/example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/TebexApiExample.java similarity index 100% rename from bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/TebexApiExample.java rename to example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/TebexApiExample.java diff --git a/bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/TitleApiExample.java b/example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/TitleApiExample.java similarity index 95% rename from bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/TitleApiExample.java rename to example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/TitleApiExample.java index 78e884c0..e3843c8f 100644 --- a/bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/TitleApiExample.java +++ b/example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/TitleApiExample.java @@ -82,4 +82,9 @@ public void resetTitlesExample(Player viewer) { apolloPlayerOpt.ifPresent(this.titleModule::resetTitles); } + @Override + public void setClearTitleOnServerSwitch(boolean value) { + this.titleModule.getOptions().set(TitleModule.CLEAR_TITLE_ON_SERVER_SWITCH, value); + } + } diff --git a/bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/TntCountdownApiExample.java b/example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/TntCountdownApiExample.java similarity index 100% rename from bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/TntCountdownApiExample.java rename to example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/TntCountdownApiExample.java diff --git a/bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/TransferApiExample.java b/example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/TransferApiExample.java similarity index 100% rename from bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/TransferApiExample.java rename to example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/TransferApiExample.java diff --git a/bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/VignetteApiExample.java b/example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/VignetteApiExample.java similarity index 100% rename from bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/VignetteApiExample.java rename to example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/VignetteApiExample.java diff --git a/bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/WaypointApiExample.java b/example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/WaypointApiExample.java similarity index 100% rename from bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/module/WaypointApiExample.java rename to example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/WaypointApiExample.java diff --git a/bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/util/BukkitApolloExample.java b/example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/util/BukkitApolloExample.java similarity index 100% rename from bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/util/BukkitApolloExample.java rename to example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/util/BukkitApolloExample.java diff --git a/bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/util/ComponentExample.java b/example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/util/ComponentExample.java similarity index 100% rename from bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/util/ComponentExample.java rename to example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/util/ComponentExample.java diff --git a/bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/util/CuboidExample.java b/example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/util/CuboidExample.java similarity index 100% rename from bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/util/CuboidExample.java rename to example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/util/CuboidExample.java diff --git a/bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/util/IconExample.java b/example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/util/IconExample.java similarity index 100% rename from bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/util/IconExample.java rename to example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/util/IconExample.java diff --git a/bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/util/LocationExample.java b/example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/util/LocationExample.java similarity index 100% rename from bukkit-example-api/src/main/java/com/lunarclient/apollo/example/api/util/LocationExample.java rename to example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/util/LocationExample.java diff --git a/bukkit-example-api/src/main/resources/plugin.yml b/example/bukkit/api/src/main/resources/plugin.yml similarity index 99% rename from bukkit-example-api/src/main/resources/plugin.yml rename to example/bukkit/api/src/main/resources/plugin.yml index 0c9392a2..95c7d6f4 100644 --- a/bukkit-example-api/src/main/resources/plugin.yml +++ b/example/bukkit/api/src/main/resources/plugin.yml @@ -1,6 +1,6 @@ name: Apollo-API-Example main: com.lunarclient.apollo.example.api.ApolloApiExamplePlatform -version: 1.1.8 +version: 1.1.9 author: Moonsworth softdepend: [ Apollo-Bukkit, Apollo-Folia ] api-version: 1.13 diff --git a/bukkit-example-common/build.gradle.kts b/example/bukkit/common/build.gradle.kts similarity index 100% rename from bukkit-example-common/build.gradle.kts rename to example/bukkit/common/build.gradle.kts diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/ApolloExamplePlugin.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/ApolloExamplePlugin.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/ApolloExamplePlugin.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/ApolloExamplePlugin.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/ApolloExampleType.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/ApolloExampleType.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/ApolloExampleType.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/ApolloExampleType.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/AutoTextHotkeyCommand.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/AutoTextHotkeyCommand.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/AutoTextHotkeyCommand.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/AutoTextHotkeyCommand.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/BeamCommand.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/BeamCommand.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/BeamCommand.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/BeamCommand.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/BorderCommand.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/BorderCommand.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/BorderCommand.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/BorderCommand.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/ChatCommand.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/ChatCommand.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/ChatCommand.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/ChatCommand.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/ColoredFireCommand.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/ColoredFireCommand.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/ColoredFireCommand.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/ColoredFireCommand.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/CombatCommand.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/CombatCommand.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/CombatCommand.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/CombatCommand.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/CooldownCommand.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/CooldownCommand.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/CooldownCommand.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/CooldownCommand.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/EntityCommand.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/EntityCommand.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/EntityCommand.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/EntityCommand.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/GlintCommand.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/GlintCommand.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/GlintCommand.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/GlintCommand.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/GlowCommand.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/GlowCommand.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/GlowCommand.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/GlowCommand.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/HologramCommand.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/HologramCommand.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/HologramCommand.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/HologramCommand.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/InventoryCommand.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/InventoryCommand.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/InventoryCommand.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/InventoryCommand.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/LimbCommand.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/LimbCommand.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/LimbCommand.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/LimbCommand.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/ModSettingsCommand.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/ModSettingsCommand.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/ModSettingsCommand.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/ModSettingsCommand.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/NametagCommand.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/NametagCommand.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/NametagCommand.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/NametagCommand.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/NickHiderCommand.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/NickHiderCommand.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/NickHiderCommand.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/NickHiderCommand.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/NotificationCommand.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/NotificationCommand.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/NotificationCommand.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/NotificationCommand.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/RichPresenceCommand.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/RichPresenceCommand.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/RichPresenceCommand.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/RichPresenceCommand.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/SaturationCommand.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/SaturationCommand.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/SaturationCommand.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/SaturationCommand.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/ServerRuleCommand.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/ServerRuleCommand.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/ServerRuleCommand.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/ServerRuleCommand.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/StaffModCommand.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/StaffModCommand.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/StaffModCommand.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/StaffModCommand.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/StopwatchCommand.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/StopwatchCommand.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/StopwatchCommand.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/StopwatchCommand.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/TeamCommand.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/TeamCommand.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/TeamCommand.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/TeamCommand.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/TebexCommand.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/TebexCommand.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/TebexCommand.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/TebexCommand.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/TitleCommand.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/TitleCommand.java similarity index 85% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/TitleCommand.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/TitleCommand.java index fa6d2423..cf7ad4cf 100644 --- a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/TitleCommand.java +++ b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/TitleCommand.java @@ -41,14 +41,22 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command } Player player = (Player) sender; + TitleExample titleExample = ApolloExamplePlugin.getInstance().getTitleExample(); + + if (args.length == 2 && args[0].equalsIgnoreCase("clearOnServerSwitch")) { + boolean value = Boolean.parseBoolean(args[1]); + titleExample.setClearTitleOnServerSwitch(value); + + player.sendMessage("Clear title on server switch has been set to " + value); + return true; + } if (args.length != 1) { player.sendMessage("Usage: /title "); + player.sendMessage("Usage: /title "); return true; } - TitleExample titleExample = ApolloExamplePlugin.getInstance().getTitleExample(); - switch (args[0].toLowerCase()) { case "display": { titleExample.displayTitleExample(player); @@ -70,6 +78,7 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command default: { player.sendMessage("Usage: /title "); + player.sendMessage("Usage: /title "); break; } } diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/TntCountdownCommand.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/TntCountdownCommand.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/TntCountdownCommand.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/TntCountdownCommand.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/TransferCommand.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/TransferCommand.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/TransferCommand.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/TransferCommand.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/VignetteCommand.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/VignetteCommand.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/VignetteCommand.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/VignetteCommand.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/WaypointCommand.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/WaypointCommand.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/command/WaypointCommand.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/command/WaypointCommand.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/ApolloModuleExample.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/ApolloModuleExample.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/ApolloModuleExample.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/ApolloModuleExample.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/NMSExample.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/NMSExample.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/NMSExample.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/NMSExample.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/AutoTextHotkeyExample.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/AutoTextHotkeyExample.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/AutoTextHotkeyExample.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/AutoTextHotkeyExample.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/BeamExample.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/BeamExample.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/BeamExample.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/BeamExample.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/BorderExample.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/BorderExample.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/BorderExample.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/BorderExample.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/ChatExample.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/ChatExample.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/ChatExample.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/ChatExample.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/ColoredFireExample.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/ColoredFireExample.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/ColoredFireExample.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/ColoredFireExample.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/CombatExample.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/CombatExample.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/CombatExample.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/CombatExample.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/CooldownExample.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/CooldownExample.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/CooldownExample.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/CooldownExample.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/EntityExample.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/EntityExample.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/EntityExample.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/EntityExample.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/GlintExample.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/GlintExample.java similarity index 84% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/GlintExample.java rename to example/bukkit/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/example/bukkit/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/GlowExample.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/GlowExample.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/GlowExample.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/GlowExample.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/HologramExample.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/HologramExample.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/HologramExample.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/HologramExample.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/InventoryExample.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/InventoryExample.java similarity index 62% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/InventoryExample.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/InventoryExample.java index acc3a923..27ffef3a 100644 --- a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/InventoryExample.java +++ b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/InventoryExample.java @@ -45,11 +45,13 @@ 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\"}}}}}"); + player.performCommand("summon item ~ ~1 ~ {Item:{id:\"minecraft:sponge\",Count:1b,components:{\"minecraft:custom_name\":\"HIDE ITEM TOOLTIP\",\"minecraft:custom_data\":{lunar:{unclickable:true,hideItemTooltip:true}}}}}"); + player.performCommand("summon item ~ ~1 ~ {Item:{id:\"minecraft:dirt\",Count:1b,components:{\"minecraft:custom_name\":\"HIDE SLOT HIGHTLIGHT\",\"minecraft:custom_data\":{lunar:{unclickable:true,hideSlotHighlight:true}}}}}"); } public void inventoryModuleNMSExample(Player player) { @@ -60,7 +62,7 @@ public void inventoryModuleNMSExample(Player player) { ChatColor.RED.toString() + ChatColor.BOLD + "UNCLICKABLE" ); - inventory.setItem(11, ItemUtil.addTag(unclickableItem, "unclickable", true)); + inventory.setItem(10, ItemUtil.addTag(unclickableItem, "unclickable", true)); ItemStack copyToClipboardItem = ItemUtil.itemWithName( Material.PAPER, @@ -68,7 +70,7 @@ public void inventoryModuleNMSExample(Player player) { ); copyToClipboardItem = ItemUtil.addTag(copyToClipboardItem, "unclickable", true); - inventory.setItem(14, ItemUtil.addTag(copyToClipboardItem, "copyToClipboard", "lunarclient.com")); + inventory.setItem(12, ItemUtil.addTag(copyToClipboardItem, "copyToClipboard", "lunarclient.com")); ItemStack openUrlItem = ItemUtil.itemWithName( Material.TORCH, @@ -76,7 +78,7 @@ public void inventoryModuleNMSExample(Player player) { ); openUrlItem = ItemUtil.addTag(openUrlItem, "unclickable", true); - inventory.setItem(17, ItemUtil.addTag(openUrlItem, "openUrl", "https://lunarclient.com")); + inventory.setItem(14, ItemUtil.addTag(openUrlItem, "openUrl", "https://lunarclient.com")); ItemStack suggestCommandItem = ItemUtil.itemWithName( Material.BOOK, @@ -84,7 +86,7 @@ public void inventoryModuleNMSExample(Player player) { ); suggestCommandItem = ItemUtil.addTag(suggestCommandItem, "unclickable", true); - inventory.setItem(29, ItemUtil.addTag(suggestCommandItem, "suggestCommand", "/apollo")); + inventory.setItem(16, ItemUtil.addTag(suggestCommandItem, "suggestCommand", "/apollo")); ItemStack runCommandItem = ItemUtil.itemWithName( Material.ENCHANTED_BOOK, @@ -92,7 +94,23 @@ public void inventoryModuleNMSExample(Player player) { ); runCommandItem = ItemUtil.addTag(runCommandItem, "unclickable", true); - inventory.setItem(33, ItemUtil.addTag(runCommandItem, "runCommand", "/apollo")); + inventory.setItem(29, ItemUtil.addTag(runCommandItem, "runCommand", "/apollo")); + + ItemStack hideTooltipItem = ItemUtil.itemWithName( + Material.SPONGE, + ChatColor.GRAY.toString() + ChatColor.BOLD + "HIDE ITEM TOOLTIP" + ); + + hideTooltipItem = ItemUtil.addTag(hideTooltipItem, "unclickable", true); + inventory.setItem(31, ItemUtil.addTag(hideTooltipItem, "hideItemTooltip", true)); + + ItemStack hideHighlightItem = ItemUtil.itemWithName( + Material.DIRT, + ChatColor.DARK_GRAY.toString() + ChatColor.BOLD + "HIDE SLOT HIGHTLIGHT" + ); + + hideHighlightItem = ItemUtil.addTag(hideHighlightItem, "unclickable", true); + inventory.setItem(33, ItemUtil.addTag(hideHighlightItem, "hideSlotHighlight", true)); player.openInventory(inventory); } diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/LimbExample.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/LimbExample.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/LimbExample.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/LimbExample.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/ModSettingsExample.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/ModSettingsExample.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/ModSettingsExample.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/ModSettingsExample.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/NametagExample.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/NametagExample.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/NametagExample.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/NametagExample.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/NickHiderExample.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/NickHiderExample.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/NickHiderExample.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/NickHiderExample.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/NotificationExample.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/NotificationExample.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/NotificationExample.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/NotificationExample.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/RichPresenceExample.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/RichPresenceExample.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/RichPresenceExample.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/RichPresenceExample.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/SaturationExample.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/SaturationExample.java similarity index 90% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/SaturationExample.java rename to example/bukkit/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/example/bukkit/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/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/ServerRuleExample.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/ServerRuleExample.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/ServerRuleExample.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/ServerRuleExample.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/StaffModExample.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/StaffModExample.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/StaffModExample.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/StaffModExample.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/StopwatchExample.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/StopwatchExample.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/StopwatchExample.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/StopwatchExample.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/TeamExample.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/TeamExample.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/TeamExample.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/TeamExample.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/TebexExample.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/TebexExample.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/TebexExample.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/TebexExample.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/TitleExample.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/TitleExample.java similarity index 95% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/TitleExample.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/TitleExample.java index 48fdc134..87075107 100644 --- a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/TitleExample.java +++ b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/TitleExample.java @@ -34,4 +34,6 @@ public abstract class TitleExample extends ApolloModuleExample { public abstract void resetTitlesExample(Player viewer); + public abstract void setClearTitleOnServerSwitch(boolean value); + } diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/TntCountdownExample.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/TntCountdownExample.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/TntCountdownExample.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/TntCountdownExample.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/TransferExample.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/TransferExample.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/TransferExample.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/TransferExample.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/VignetteExample.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/VignetteExample.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/VignetteExample.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/VignetteExample.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/WaypointExample.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/WaypointExample.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/WaypointExample.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/module/impl/WaypointExample.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/util/ItemUtil.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/util/ItemUtil.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/util/ItemUtil.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/util/ItemUtil.java diff --git a/bukkit-example-common/src/main/java/com/lunarclient/apollo/example/util/ServerUtil.java b/example/bukkit/common/src/main/java/com/lunarclient/apollo/example/util/ServerUtil.java similarity index 100% rename from bukkit-example-common/src/main/java/com/lunarclient/apollo/example/util/ServerUtil.java rename to example/bukkit/common/src/main/java/com/lunarclient/apollo/example/util/ServerUtil.java diff --git a/bukkit-example-json/build.gradle.kts b/example/bukkit/json/build.gradle.kts similarity index 82% rename from bukkit-example-json/build.gradle.kts rename to example/bukkit/json/build.gradle.kts index 2f8ebbd5..74491a7d 100644 --- a/bukkit-example-json/build.gradle.kts +++ b/example/bukkit/json/build.gradle.kts @@ -16,5 +16,5 @@ dependencies { compileOnly(libs.bukkit) compileOnly(libs.folia) - implementation(project(":apollo-bukkit-example-common")) + implementation(project(":example:bukkit:apollo-example-bukkit-common")) } diff --git a/bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/ApolloJsonExamplePlatform.java b/example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/ApolloJsonExamplePlatform.java similarity index 100% rename from bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/ApolloJsonExamplePlatform.java rename to example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/ApolloJsonExamplePlatform.java diff --git a/bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/listener/ApolloPlayerJsonListener.java b/example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/listener/ApolloPlayerJsonListener.java similarity index 100% rename from bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/listener/ApolloPlayerJsonListener.java rename to example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/listener/ApolloPlayerJsonListener.java diff --git a/bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/AutoTextHotkeyJsonExample.java b/example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/AutoTextHotkeyJsonExample.java similarity index 100% rename from bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/AutoTextHotkeyJsonExample.java rename to example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/AutoTextHotkeyJsonExample.java diff --git a/bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/BeamJsonExample.java b/example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/BeamJsonExample.java similarity index 100% rename from bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/BeamJsonExample.java rename to example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/BeamJsonExample.java diff --git a/bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/BorderJsonExample.java b/example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/BorderJsonExample.java similarity index 100% rename from bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/BorderJsonExample.java rename to example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/BorderJsonExample.java diff --git a/bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/ChatJsonExample.java b/example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/ChatJsonExample.java similarity index 100% rename from bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/ChatJsonExample.java rename to example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/ChatJsonExample.java diff --git a/bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/ColoredFireJsonExample.java b/example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/ColoredFireJsonExample.java similarity index 100% rename from bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/ColoredFireJsonExample.java rename to example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/ColoredFireJsonExample.java diff --git a/bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/CombatJsonExample.java b/example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/CombatJsonExample.java similarity index 100% rename from bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/CombatJsonExample.java rename to example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/CombatJsonExample.java diff --git a/bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/CooldownJsonExample.java b/example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/CooldownJsonExample.java similarity index 100% rename from bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/CooldownJsonExample.java rename to example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/CooldownJsonExample.java diff --git a/bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/EntityJsonExample.java b/example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/EntityJsonExample.java similarity index 100% rename from bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/EntityJsonExample.java rename to example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/EntityJsonExample.java diff --git a/bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/GlowJsonExample.java b/example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/GlowJsonExample.java similarity index 100% rename from bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/GlowJsonExample.java rename to example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/GlowJsonExample.java diff --git a/bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/HologramJsonExample.java b/example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/HologramJsonExample.java similarity index 100% rename from bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/HologramJsonExample.java rename to example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/HologramJsonExample.java diff --git a/bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/LimbJsonExample.java b/example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/LimbJsonExample.java similarity index 100% rename from bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/LimbJsonExample.java rename to example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/LimbJsonExample.java diff --git a/bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/ModSettingsJsonExample.java b/example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/ModSettingsJsonExample.java similarity index 100% rename from bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/ModSettingsJsonExample.java rename to example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/ModSettingsJsonExample.java diff --git a/bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/NametagJsonExample.java b/example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/NametagJsonExample.java similarity index 100% rename from bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/NametagJsonExample.java rename to example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/NametagJsonExample.java diff --git a/bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/NickHiderJsonExample.java b/example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/NickHiderJsonExample.java similarity index 100% rename from bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/NickHiderJsonExample.java rename to example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/NickHiderJsonExample.java diff --git a/bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/NotificationJsonExample.java b/example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/NotificationJsonExample.java similarity index 100% rename from bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/NotificationJsonExample.java rename to example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/NotificationJsonExample.java diff --git a/bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/RichPresenceJsonExample.java b/example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/RichPresenceJsonExample.java similarity index 100% rename from bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/RichPresenceJsonExample.java rename to example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/RichPresenceJsonExample.java diff --git a/bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/ServerRuleJsonExample.java b/example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/ServerRuleJsonExample.java similarity index 100% rename from bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/ServerRuleJsonExample.java rename to example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/ServerRuleJsonExample.java diff --git a/bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/StaffModJsonExample.java b/example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/StaffModJsonExample.java similarity index 100% rename from bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/StaffModJsonExample.java rename to example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/StaffModJsonExample.java diff --git a/bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/StopwatchJsonExample.java b/example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/StopwatchJsonExample.java similarity index 100% rename from bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/StopwatchJsonExample.java rename to example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/StopwatchJsonExample.java diff --git a/bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/TeamJsonExample.java b/example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/TeamJsonExample.java similarity index 100% rename from bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/TeamJsonExample.java rename to example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/TeamJsonExample.java diff --git a/bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/TebexJsonExample.java b/example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/TebexJsonExample.java similarity index 100% rename from bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/TebexJsonExample.java rename to example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/TebexJsonExample.java diff --git a/bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/TitleJsonExample.java b/example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/TitleJsonExample.java similarity index 91% rename from bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/TitleJsonExample.java rename to example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/TitleJsonExample.java index 31d4de8e..a7d138d4 100644 --- a/bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/TitleJsonExample.java +++ b/example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/TitleJsonExample.java @@ -29,6 +29,8 @@ import com.lunarclient.apollo.example.json.util.JsonUtil; import com.lunarclient.apollo.example.module.impl.TitleExample; import java.time.Duration; +import java.util.HashMap; +import java.util.Map; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.format.NamedTextColor; import net.kyori.adventure.text.format.TextDecoration; @@ -86,4 +88,13 @@ public void resetTitlesExample(Player viewer) { JsonPacketUtil.sendPacket(viewer, message); } + @Override + public void setClearTitleOnServerSwitch(boolean value) { + Map properties = new HashMap<>(); + properties.put("clear-title-on-server-switch", value); + + JsonObject message = JsonUtil.createEnableModuleObjectWithType("title", properties); + JsonPacketUtil.broadcastPacket(message); + } + } diff --git a/bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/TntCountdownJsonExample.java b/example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/TntCountdownJsonExample.java similarity index 100% rename from bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/TntCountdownJsonExample.java rename to example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/TntCountdownJsonExample.java diff --git a/bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/TransferJsonExample.java b/example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/TransferJsonExample.java similarity index 100% rename from bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/TransferJsonExample.java rename to example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/TransferJsonExample.java diff --git a/bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/VignetteJsonExample.java b/example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/VignetteJsonExample.java similarity index 100% rename from bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/VignetteJsonExample.java rename to example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/VignetteJsonExample.java diff --git a/bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/WaypointJsonExample.java b/example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/WaypointJsonExample.java similarity index 100% rename from bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/module/WaypointJsonExample.java rename to example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/WaypointJsonExample.java diff --git a/bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/util/AdventureUtil.java b/example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/util/AdventureUtil.java similarity index 100% rename from bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/util/AdventureUtil.java rename to example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/util/AdventureUtil.java diff --git a/bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/util/JsonPacketUtil.java b/example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/util/JsonPacketUtil.java similarity index 98% rename from bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/util/JsonPacketUtil.java rename to example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/util/JsonPacketUtil.java index 1ac6bd83..57b94561 100644 --- a/bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/util/JsonPacketUtil.java +++ b/example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/util/JsonPacketUtil.java @@ -65,6 +65,7 @@ public final class JsonPacketUtil { CONFIG_MODULE_PROPERTIES.put("server_rule", "override-max-chat-length", false); CONFIG_MODULE_PROPERTIES.put("server_rule", "max-chat-length", 256); CONFIG_MODULE_PROPERTIES.put("tnt_countdown", "tnt-ticks", 80); + CONFIG_MODULE_PROPERTIES.put("title", "clear-title-on-server-switch", false); CONFIG_MODULE_PROPERTIES.put("waypoint", "server-handles-waypoints", false); } diff --git a/bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/util/JsonUtil.java b/example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/util/JsonUtil.java similarity index 100% rename from bukkit-example-json/src/main/java/com/lunarclient/apollo/example/json/util/JsonUtil.java rename to example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/util/JsonUtil.java diff --git a/bukkit-example-json/src/main/resources/plugin.yml b/example/bukkit/json/src/main/resources/plugin.yml similarity index 99% rename from bukkit-example-json/src/main/resources/plugin.yml rename to example/bukkit/json/src/main/resources/plugin.yml index ba7d9d64..bf36c7f3 100644 --- a/bukkit-example-json/src/main/resources/plugin.yml +++ b/example/bukkit/json/src/main/resources/plugin.yml @@ -1,6 +1,6 @@ name: Apollo-Json-Example main: com.lunarclient.apollo.example.json.ApolloJsonExamplePlatform -version: 1.1.8 +version: 1.1.9 author: Moonsworth softdepend: [ Apollo-Bukkit ] api-version: 1.13 diff --git a/bukkit-example-proto/build.gradle.kts b/example/bukkit/proto/build.gradle.kts similarity index 83% rename from bukkit-example-proto/build.gradle.kts rename to example/bukkit/proto/build.gradle.kts index 774562ed..acdfefe8 100644 --- a/bukkit-example-proto/build.gradle.kts +++ b/example/bukkit/proto/build.gradle.kts @@ -18,5 +18,5 @@ dependencies { compileOnly(libs.bukkit) compileOnly(libs.folia) - implementation(project(":apollo-bukkit-example-common")) + implementation(project(":example:bukkit:apollo-example-bukkit-common")) } diff --git a/bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/ApolloProtoExamplePlatform.java b/example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/ApolloProtoExamplePlatform.java similarity index 100% rename from bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/ApolloProtoExamplePlatform.java rename to example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/ApolloProtoExamplePlatform.java diff --git a/bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/listener/ApolloPacketReceiveProtoListener.java b/example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/listener/ApolloPacketReceiveProtoListener.java similarity index 100% rename from bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/listener/ApolloPacketReceiveProtoListener.java rename to example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/listener/ApolloPacketReceiveProtoListener.java diff --git a/bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/listener/ApolloPlayerProtoListener.java b/example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/listener/ApolloPlayerProtoListener.java similarity index 100% rename from bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/listener/ApolloPlayerProtoListener.java rename to example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/listener/ApolloPlayerProtoListener.java diff --git a/bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/listener/ApolloRoundtripProtoListener.java b/example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/listener/ApolloRoundtripProtoListener.java similarity index 100% rename from bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/listener/ApolloRoundtripProtoListener.java rename to example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/listener/ApolloRoundtripProtoListener.java diff --git a/bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/AutoTextHotkeyProtoExample.java b/example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/AutoTextHotkeyProtoExample.java similarity index 100% rename from bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/AutoTextHotkeyProtoExample.java rename to example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/AutoTextHotkeyProtoExample.java diff --git a/bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/BeamProtoExample.java b/example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/BeamProtoExample.java similarity index 100% rename from bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/BeamProtoExample.java rename to example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/BeamProtoExample.java diff --git a/bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/BorderProtoExample.java b/example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/BorderProtoExample.java similarity index 100% rename from bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/BorderProtoExample.java rename to example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/BorderProtoExample.java diff --git a/bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/ChatProtoExample.java b/example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/ChatProtoExample.java similarity index 100% rename from bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/ChatProtoExample.java rename to example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/ChatProtoExample.java diff --git a/bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/ColoredFireProtoExample.java b/example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/ColoredFireProtoExample.java similarity index 100% rename from bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/ColoredFireProtoExample.java rename to example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/ColoredFireProtoExample.java diff --git a/bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/CombatProtoExample.java b/example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/CombatProtoExample.java similarity index 100% rename from bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/CombatProtoExample.java rename to example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/CombatProtoExample.java diff --git a/bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/CooldownProtoExample.java b/example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/CooldownProtoExample.java similarity index 100% rename from bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/CooldownProtoExample.java rename to example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/CooldownProtoExample.java diff --git a/bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/EntityProtoExample.java b/example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/EntityProtoExample.java similarity index 100% rename from bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/EntityProtoExample.java rename to example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/EntityProtoExample.java diff --git a/bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/GlowProtoExample.java b/example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/GlowProtoExample.java similarity index 100% rename from bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/GlowProtoExample.java rename to example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/GlowProtoExample.java diff --git a/bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/HologramProtoExample.java b/example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/HologramProtoExample.java similarity index 100% rename from bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/HologramProtoExample.java rename to example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/HologramProtoExample.java diff --git a/bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/LimbProtoExample.java b/example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/LimbProtoExample.java similarity index 100% rename from bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/LimbProtoExample.java rename to example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/LimbProtoExample.java diff --git a/bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/ModSettingsProtoExample.java b/example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/ModSettingsProtoExample.java similarity index 100% rename from bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/ModSettingsProtoExample.java rename to example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/ModSettingsProtoExample.java diff --git a/bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/NametagProtoExample.java b/example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/NametagProtoExample.java similarity index 100% rename from bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/NametagProtoExample.java rename to example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/NametagProtoExample.java diff --git a/bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/NickHiderProtoExample.java b/example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/NickHiderProtoExample.java similarity index 100% rename from bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/NickHiderProtoExample.java rename to example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/NickHiderProtoExample.java diff --git a/bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/NotificationProtoExample.java b/example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/NotificationProtoExample.java similarity index 100% rename from bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/NotificationProtoExample.java rename to example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/NotificationProtoExample.java diff --git a/bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/RichPresenceProtoExample.java b/example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/RichPresenceProtoExample.java similarity index 100% rename from bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/RichPresenceProtoExample.java rename to example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/RichPresenceProtoExample.java diff --git a/bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/ServerRuleProtoExample.java b/example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/ServerRuleProtoExample.java similarity index 100% rename from bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/ServerRuleProtoExample.java rename to example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/ServerRuleProtoExample.java diff --git a/bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/StaffModProtoExample.java b/example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/StaffModProtoExample.java similarity index 100% rename from bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/StaffModProtoExample.java rename to example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/StaffModProtoExample.java diff --git a/bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/StopwatchProtoExample.java b/example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/StopwatchProtoExample.java similarity index 100% rename from bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/StopwatchProtoExample.java rename to example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/StopwatchProtoExample.java diff --git a/bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/TeamProtoExample.java b/example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/TeamProtoExample.java similarity index 100% rename from bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/TeamProtoExample.java rename to example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/TeamProtoExample.java diff --git a/bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/TebexProtoExample.java b/example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/TebexProtoExample.java similarity index 100% rename from bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/TebexProtoExample.java rename to example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/TebexProtoExample.java diff --git a/bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/TitleProtoExample.java b/example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/TitleProtoExample.java similarity index 87% rename from bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/TitleProtoExample.java rename to example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/TitleProtoExample.java index 786e2c71..6488314d 100644 --- a/bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/TitleProtoExample.java +++ b/example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/TitleProtoExample.java @@ -23,6 +23,8 @@ */ package com.lunarclient.apollo.example.proto.module; +import com.google.protobuf.Value; +import com.lunarclient.apollo.configurable.v1.ConfigurableSettings; import com.lunarclient.apollo.example.module.impl.TitleExample; import com.lunarclient.apollo.example.proto.util.AdventureUtil; import com.lunarclient.apollo.example.proto.util.ProtobufPacketUtil; @@ -31,6 +33,8 @@ import com.lunarclient.apollo.title.v1.ResetTitlesMessage; import com.lunarclient.apollo.title.v1.TitleType; import java.time.Duration; +import java.util.HashMap; +import java.util.Map; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.format.NamedTextColor; import net.kyori.adventure.text.format.TextDecoration; @@ -86,4 +90,13 @@ public void resetTitlesExample(Player viewer) { ProtobufPacketUtil.sendPacket(viewer, message); } + @Override + public void setClearTitleOnServerSwitch(boolean value) { + Map properties = new HashMap<>(); + properties.put("clear-title-on-server-switch", Value.newBuilder().setBoolValue(value).build()); + + ConfigurableSettings settings = ProtobufPacketUtil.createModuleMessage("title", properties); + ProtobufPacketUtil.broadcastPacket(settings); + } + } diff --git a/bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/TntCountdownProtoExample.java b/example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/TntCountdownProtoExample.java similarity index 100% rename from bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/TntCountdownProtoExample.java rename to example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/TntCountdownProtoExample.java diff --git a/bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/TransferProtoExample.java b/example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/TransferProtoExample.java similarity index 100% rename from bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/TransferProtoExample.java rename to example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/TransferProtoExample.java diff --git a/bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/VignetteProtoExample.java b/example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/VignetteProtoExample.java similarity index 100% rename from bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/VignetteProtoExample.java rename to example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/VignetteProtoExample.java diff --git a/bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/WaypointProtoExample.java b/example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/WaypointProtoExample.java similarity index 100% rename from bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/module/WaypointProtoExample.java rename to example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/WaypointProtoExample.java diff --git a/bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/util/AdventureUtil.java b/example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/util/AdventureUtil.java similarity index 100% rename from bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/util/AdventureUtil.java rename to example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/util/AdventureUtil.java diff --git a/bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/util/ProtobufPacketUtil.java b/example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/util/ProtobufPacketUtil.java similarity index 98% rename from bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/util/ProtobufPacketUtil.java rename to example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/util/ProtobufPacketUtil.java index 97590deb..423d6214 100644 --- a/bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/util/ProtobufPacketUtil.java +++ b/example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/util/ProtobufPacketUtil.java @@ -72,6 +72,7 @@ public final class ProtobufPacketUtil { CONFIG_MODULE_PROPERTIES.put("server_rule", "override-max-chat-length", Value.newBuilder().setBoolValue(false).build()); CONFIG_MODULE_PROPERTIES.put("server_rule", "max-chat-length", Value.newBuilder().setNumberValue(256).build()); CONFIG_MODULE_PROPERTIES.put("tnt_countdown", "tnt-ticks", Value.newBuilder().setNumberValue(80).build()); + CONFIG_MODULE_PROPERTIES.put("title", "clear-title-on-server-switch", Value.newBuilder().setBoolValue(false).build()); CONFIG_MODULE_PROPERTIES.put("waypoint", "server-handles-waypoints", Value.newBuilder().setBoolValue(false).build()); } diff --git a/bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/util/ProtobufUtil.java b/example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/util/ProtobufUtil.java similarity index 100% rename from bukkit-example-proto/src/main/java/com/lunarclient/apollo/example/proto/util/ProtobufUtil.java rename to example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/util/ProtobufUtil.java diff --git a/bukkit-example-proto/src/main/resources/plugin.yml b/example/bukkit/proto/src/main/resources/plugin.yml similarity index 99% rename from bukkit-example-proto/src/main/resources/plugin.yml rename to example/bukkit/proto/src/main/resources/plugin.yml index 0ccac43d..79b2e77f 100644 --- a/bukkit-example-proto/src/main/resources/plugin.yml +++ b/example/bukkit/proto/src/main/resources/plugin.yml @@ -1,6 +1,6 @@ name: Apollo-Proto-Example main: com.lunarclient.apollo.example.proto.ApolloProtoExamplePlatform -version: 1.1.8 +version: 1.1.9 author: Moonsworth softdepend: [ Apollo-Bukkit ] api-version: 1.13 diff --git a/folia/src/main/java/com/lunarclient/apollo/ApolloFoliaPlatform.java b/folia/src/main/java/com/lunarclient/apollo/ApolloFoliaPlatform.java index f0341a7c..f72e0e61 100644 --- a/folia/src/main/java/com/lunarclient/apollo/ApolloFoliaPlatform.java +++ b/folia/src/main/java/com/lunarclient/apollo/ApolloFoliaPlatform.java @@ -25,8 +25,10 @@ import com.lunarclient.apollo.command.impl.ApolloCommand; import com.lunarclient.apollo.command.impl.LunarClientCommand; +import com.lunarclient.apollo.listener.ApolloMetadataListener; import com.lunarclient.apollo.listener.ApolloPlayerListener; import com.lunarclient.apollo.listener.ApolloWorldListener; +import com.lunarclient.apollo.metadata.FoliaMetadataManager; import com.lunarclient.apollo.module.ApolloModuleManagerImpl; import com.lunarclient.apollo.module.autotexthotkey.AutoTextHotkeyModule; import com.lunarclient.apollo.module.beam.BeamModule; @@ -109,7 +111,9 @@ public void onEnable() { this.stats = new FoliaApolloStats(); ApolloManager.bootstrap(this); + ApolloManager.setMetadataManager(new FoliaMetadataManager()); + new ApolloMetadataListener(this); new ApolloPlayerListener(this); new ApolloWorldListener(this); diff --git a/folia/src/main/java/com/lunarclient/apollo/listener/ApolloMetadataListener.java b/folia/src/main/java/com/lunarclient/apollo/listener/ApolloMetadataListener.java new file mode 100644 index 00000000..599f8ea7 --- /dev/null +++ b/folia/src/main/java/com/lunarclient/apollo/listener/ApolloMetadataListener.java @@ -0,0 +1,86 @@ +/* + * 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.listener; + +import com.lunarclient.apollo.ApolloManager; +import com.lunarclient.apollo.metadata.FoliaMetadataManager; +import java.util.Map; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerResourcePackStatusEvent; +import org.bukkit.plugin.java.JavaPlugin; + +/** + * Handles Apollo metadata listeners. + * + * @since 1.1.9 + */ +public final class ApolloMetadataListener implements Listener { + + private final JavaPlugin plugin; + + /** + * Constructs the {@link ApolloMetadataListener}. + * + * @param plugin the plugin + * @since 1.1.9 + */ + public ApolloMetadataListener(JavaPlugin plugin) { + this.plugin = plugin; + + Bukkit.getPluginManager().registerEvents(this, plugin); + } + + @EventHandler + private void onPlayerJoin(PlayerJoinEvent event) { + Player player = event.getPlayer(); + + Bukkit.getGlobalRegionScheduler().runDelayed(this.plugin, t -> { + if (!player.isOnline()) { + return; + } + + String brand = player.getClientBrandName(); + if (brand == null) { + return; + } + + FoliaMetadataManager manager = (FoliaMetadataManager) ApolloManager.getMetadataManager(); + manager.getClientBrands().add(brand); + }, 20L * 3); + } + + @EventHandler + private void onResourcePackStatus(PlayerResourcePackStatusEvent event) { + String status = event.getStatus().name(); + FoliaMetadataManager manager = (FoliaMetadataManager) ApolloManager.getMetadataManager(); + Map statuses = manager.getResourcePackStatuses(); + + statuses.put(status, statuses.getOrDefault(status, 0) + 1); + } + +} diff --git a/folia/src/main/java/com/lunarclient/apollo/metadata/FoliaMetadata.java b/folia/src/main/java/com/lunarclient/apollo/metadata/FoliaMetadata.java new file mode 100644 index 00000000..a8137b7c --- /dev/null +++ b/folia/src/main/java/com/lunarclient/apollo/metadata/FoliaMetadata.java @@ -0,0 +1,60 @@ +/* + * 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.metadata; + +import com.lunarclient.apollo.stats.metadata.PlatformMetadata; +import java.util.Map; +import java.util.Set; +import lombok.Builder; +import lombok.ToString; + +/** + * Represents the folia metadata implementation. + * + * @since 1.1.9 + */ +@ToString +@Builder(toBuilder = true) +public class FoliaMetadata extends PlatformMetadata { + + /** + * Tracks client brands sent by the players. + * + *

A {@link Set} of {@link String} client brands.

+ * + * @since 1.1.9 + */ + private final Set clientBrands; + + /** + * Tracks the total number of resource pack status events received. + * + *

Represents a {@link Map} of {@link String} status enum name as a key + * and {@link Integer} count of how many times that status has been reported.

+ * + * @since 1.1.9 + */ + private final Map resourcePackStatuses; + +} diff --git a/folia/src/main/java/com/lunarclient/apollo/metadata/FoliaMetadataManager.java b/folia/src/main/java/com/lunarclient/apollo/metadata/FoliaMetadataManager.java new file mode 100644 index 00000000..4018002c --- /dev/null +++ b/folia/src/main/java/com/lunarclient/apollo/metadata/FoliaMetadataManager.java @@ -0,0 +1,60 @@ +/* + * 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.metadata; + +import com.lunarclient.apollo.stats.metadata.ApolloMetadataManager; +import com.lunarclient.apollo.stats.metadata.PlatformMetadata; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; +import lombok.Getter; + +/** + * The Folia implementation of {@link ApolloMetadataManager}. + * + * @since 1.1.9 + */ +@Getter +public class FoliaMetadataManager implements ApolloMetadataManager { + + private final Set clientBrands = ConcurrentHashMap.newKeySet(); + private final Map resourcePackStatuses = new ConcurrentHashMap<>(); + + @Override + public PlatformMetadata extract() { + return FoliaMetadata.builder() + .clientBrands(new HashSet<>(this.clientBrands)) + .resourcePackStatuses(new HashMap<>(this.resourcePackStatuses)) + .build(); + } + + @Override + public void clear() { + this.clientBrands.clear(); + this.resourcePackStatuses.clear(); + } + +} diff --git a/folia/src/main/resources/plugin.yml b/folia/src/main/resources/plugin.yml index a8047db0..c48a5581 100644 --- a/folia/src/main/resources/plugin.yml +++ b/folia/src/main/resources/plugin.yml @@ -1,6 +1,6 @@ name: Apollo-Folia main: com.lunarclient.apollo.ApolloFoliaPlatform -version: 1.1.7 +version: 1.1.9 author: Moonsworth api-version: 1.13 folia-supported: true diff --git a/gradle.properties b/gradle.properties index e00f89ab..a3548696 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ group=com.lunarclient -version=1.1.8 +version=1.1.9 description=The API for interacting with Lunar Client players. org.gradle.parallel=true diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 4ac0dc24..907d96b0 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -11,11 +11,11 @@ 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" -velocity = "3.0.1" +velocity = "3.3.0-SNAPSHOT" folia = "1.20.1-R0.1-SNAPSHOT" asm = "9.7.1" diff --git a/scripts/deploy.sh b/scripts/deploy.sh deleted file mode 100755 index e78c0132..00000000 --- a/scripts/deploy.sh +++ /dev/null @@ -1,98 +0,0 @@ -#!/bin/bash -set -eo pipefail - -VERSION="1.1.8" -REMOTE_USER="ubuntu" -REMOTE_HOST="147.135.8.94" - -usage() { - echo "Usage: $0 [api|json|proto]" - echo "Available servers: apollo, test, folia" - echo "Optional module (for bukkit servers only): api (default), json, proto" - exit 1 -} - -validate_server() { - case "$1" in - apollo|test|folia) ;; - *) - echo "Unknown server: $1" - usage - ;; - esac -} - -validate_module() { - case "$1" in - api|json|proto) ;; - *) - echo "Unknown module: $1" - usage - ;; - esac -} - -deploy_files() { - local server="$1" - shift - local -a files=("${@:1:$#-1}") - local destination="${!#}" - - if [ -n "$MODULE" ]; then - echo "Deploying to $server server (module: $MODULE)..." - else - echo "Deploying to $server server..." - fi - - for file in "${files[@]}"; do - if [ ! -f "$file" ]; then - echo "Error: File $file not found!" - exit 1 - fi - scp "$file" "$REMOTE_USER@$REMOTE_HOST:$destination" - done -} - - -# Main script execution -[ $# -lt 1 ] && usage - -SERVER="$1" -MODULE="${2:-api}" # Default to "api" if not provided - -validate_module "$MODULE" -validate_server "$SERVER" - -echo "Building project..." -./gradlew clean build - -declare -a files_to_copy -declare destination_path - -case "$SERVER" in - apollo) - files_to_copy=( - "bukkit/build/libs/apollo-bukkit-${VERSION}.jar" - "bukkit-example-${MODULE}/build/libs/apollo-bukkit-example-${MODULE}-${VERSION}.jar" - ) - destination_path="/home/ubuntu/apollo/plugins/" - ;; - test) - files_to_copy=( - "bukkit/build/libs/apollo-bukkit-${VERSION}.jar" - "bukkit-example-${MODULE}/build/libs/apollo-bukkit-example-${MODULE}-${VERSION}.jar" - ) - destination_path="/home/ubuntu/lctest/plugins/" - ;; - folia) - files_to_copy=( - "folia/build/libs/apollo-folia-${VERSION}.jar" - "bukkit-example-${MODULE}/build/libs/apollo-bukkit-example-${MODULE}-${VERSION}.jar" - ) - destination_path="/home/ubuntu/apollo-folia/plugins/" - ;; -esac - -deploy_files "$SERVER" "${files_to_copy[@]}" "$destination_path" - -echo "Deployment to $SERVER completed successfully." diff --git a/settings.gradle.kts b/settings.gradle.kts index 9a815b02..3c0b977e 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() } @@ -36,10 +36,10 @@ listOfNotNull( "api", "common", "bukkit", - "bukkit-example-common", - "bukkit-example-api", - "bukkit-example-json", - "bukkit-example-proto", + "example:bukkit:common", + "example:bukkit:api", + "example:bukkit:json", + "example:bukkit:proto", if (loadAllVersions) "bungee" else null, if (loadAllVersions) "velocity" else null, if (loadAllVersions) "folia" else null diff --git a/velocity/build.gradle.kts b/velocity/build.gradle.kts index 05a96bfe..9b7ad5bf 100644 --- a/velocity/build.gradle.kts +++ b/velocity/build.gradle.kts @@ -2,6 +2,10 @@ plugins { id("apollo.shadow-conventions") } +java { + javaTarget(17) +} + dependencies { compileOnly(libs.velocity) diff --git a/velocity/src/main/java/com/lunarclient/apollo/ApolloVelocityPlatform.java b/velocity/src/main/java/com/lunarclient/apollo/ApolloVelocityPlatform.java index 926d96f1..830221e1 100644 --- a/velocity/src/main/java/com/lunarclient/apollo/ApolloVelocityPlatform.java +++ b/velocity/src/main/java/com/lunarclient/apollo/ApolloVelocityPlatform.java @@ -26,7 +26,9 @@ import com.google.inject.Inject; import com.lunarclient.apollo.command.impl.ApolloCommand; import com.lunarclient.apollo.command.impl.LunarClientCommand; +import com.lunarclient.apollo.listener.ApolloMetadataListener; import com.lunarclient.apollo.listener.ApolloPlayerListener; +import com.lunarclient.apollo.metadata.VelocityMetadataManager; import com.lunarclient.apollo.module.ApolloModuleManagerImpl; import com.lunarclient.apollo.module.autotexthotkey.AutoTextHotkeyModule; import com.lunarclient.apollo.module.beam.BeamModule; @@ -75,6 +77,7 @@ import com.lunarclient.apollo.stats.ApolloStats; import com.lunarclient.apollo.wrapper.VelocityApolloStats; import com.velocitypowered.api.command.CommandManager; +import com.velocitypowered.api.event.EventManager; import com.velocitypowered.api.event.Subscribe; import com.velocitypowered.api.event.proxy.ProxyInitializeEvent; import com.velocitypowered.api.event.proxy.ProxyShutdownEvent; @@ -83,6 +86,7 @@ import com.velocitypowered.api.plugin.PluginDescription; import com.velocitypowered.api.plugin.annotation.DataDirectory; import com.velocitypowered.api.proxy.ProxyServer; +import com.velocitypowered.api.proxy.messages.ChannelRegistrar; import com.velocitypowered.api.proxy.messages.MinecraftChannelIdentifier; import java.nio.file.Path; import java.util.logging.Level; @@ -97,7 +101,7 @@ @Plugin( id = "apollo", name = "Apollo-Velocity", - version = "1.1.8", + version = "1.1.9", url = "https://moonsworth.com", description = "Implementation of Apollo for Velocity", authors = {"Moonsworth"} @@ -163,7 +167,9 @@ public Object getPlugin() { public void onProxyInitialization(ProxyInitializeEvent event) { ApolloVelocityPlatform.instance = this; this.stats = new VelocityApolloStats(); + ApolloManager.bootstrap(this); + ApolloManager.setMetadataManager(new VelocityMetadataManager()); ((ApolloModuleManagerImpl) Apollo.getModuleManager()) .addModule(AutoTextHotkeyModule.class) @@ -199,8 +205,13 @@ public void onProxyInitialization(ProxyInitializeEvent event) { this.getPlatformLogger().log(Level.SEVERE, "Unable to load Apollo configuration and modules!", throwable); } - this.server.getEventManager().register(this, new ApolloPlayerListener()); - this.server.getChannelRegistrar().register(ApolloVelocityPlatform.PLUGIN_CHANNEL); + EventManager eventManager = this.server.getEventManager(); + eventManager.register(this, new ApolloMetadataListener()); + eventManager.register(this, new ApolloPlayerListener()); + + ChannelRegistrar channelRegistrar = this.server.getChannelRegistrar(); + channelRegistrar.register(ApolloVelocityPlatform.PLUGIN_CHANNEL); + channelRegistrar.register(ApolloMetadataListener.FML_HANDSHAKE_CHANNEL); CommandManager commandManager = this.server.getCommandManager(); commandManager.register(ApolloCommand.create()); @@ -222,12 +233,7 @@ public void onProxyShutdown(ProxyShutdownEvent event) { } static { - try { - PLUGIN_CHANNEL = MinecraftChannelIdentifier.from(ApolloManager.PLUGIN_MESSAGE_CHANNEL); - } catch (NoSuchMethodError e) { - String[] messageChannel = ApolloManager.PLUGIN_MESSAGE_CHANNEL.split(":"); - PLUGIN_CHANNEL = MinecraftChannelIdentifier.create(messageChannel[0], messageChannel[1]); - } + PLUGIN_CHANNEL = MinecraftChannelIdentifier.create("lunar", "apollo"); } } diff --git a/velocity/src/main/java/com/lunarclient/apollo/listener/ApolloMetadataListener.java b/velocity/src/main/java/com/lunarclient/apollo/listener/ApolloMetadataListener.java new file mode 100644 index 00000000..09a56802 --- /dev/null +++ b/velocity/src/main/java/com/lunarclient/apollo/listener/ApolloMetadataListener.java @@ -0,0 +1,141 @@ +/* + * 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.listener; + +import com.google.common.io.ByteArrayDataInput; +import com.google.common.io.ByteStreams; +import com.lunarclient.apollo.ApolloManager; +import com.lunarclient.apollo.metadata.VelocityMetadataManager; +import com.lunarclient.apollo.util.ByteBufUtil; +import com.velocitypowered.api.event.Subscribe; +import com.velocitypowered.api.event.connection.PluginMessageEvent; +import com.velocitypowered.api.event.connection.PreLoginEvent; +import com.velocitypowered.api.event.player.PlayerClientBrandEvent; +import com.velocitypowered.api.event.player.PlayerResourcePackStatusEvent; +import com.velocitypowered.api.proxy.Player; +import com.velocitypowered.api.proxy.messages.MinecraftChannelIdentifier; +import java.net.InetSocketAddress; +import java.util.Map; + +/** + * Handles Apollo metadata listeners. + * + * @since 1.1.9 + */ +public final class ApolloMetadataListener { + + public static final MinecraftChannelIdentifier FML_HANDSHAKE_CHANNEL; + + /** + * Handles plugin messages for FML mod information. + * + * @param event the event + * @since 1.1.9 + */ + @Subscribe + public void onPluginMessage(PluginMessageEvent event) { + if (!(event.getSource() instanceof Player)) { + return; + } + + if (!event.getIdentifier().equals(ApolloMetadataListener.FML_HANDSHAKE_CHANNEL)) { + return; + } + + this.handleFml(event.getData()); + } + + /** + * Handles player client brands. + * + * @param event the event + * @since 1.1.9 + */ + @Subscribe + public void onPlayerClientBrand(PlayerClientBrandEvent event) { + VelocityMetadataManager manager = (VelocityMetadataManager) ApolloManager.getMetadataManager(); + manager.getClientBrands().add(event.getBrand()); + } + + /** + * Captures the server IP and port the player used to connect. + * + * @param event the event + * @since 1.1.9 + */ + @Subscribe + public void onPreLogin(PreLoginEvent event) { + InetSocketAddress host = event.getConnection().getVirtualHost().orElse(null); + + if (host == null) { + return; + } + + VelocityMetadataManager manager = (VelocityMetadataManager) ApolloManager.getMetadataManager(); + manager.getServerAddress().add(host.getHostString() + ":" + host.getPort()); + } + + /** + * Tracks the total number of resource pack status events received. + * + * @param event the event + * @since 1.1.9 + */ + @Subscribe + public void onResourcePackStatus(PlayerResourcePackStatusEvent event) { + String status = event.getStatus().name(); + VelocityMetadataManager manager = (VelocityMetadataManager) ApolloManager.getMetadataManager(); + Map statuses = manager.getResourcePackStatuses(); + + statuses.put(status, statuses.getOrDefault(status, 0) + 1); + } + + private void handleFml(byte[] data) { + ByteArrayDataInput in = ByteStreams.newDataInput(data); + + try { + byte discriminator = in.readByte(); + + if (discriminator != 2) { + return; + } + + int count = ByteBufUtil.readVarInt(in); + + for (int i = 0; i < count; i++) { + String modId = ByteBufUtil.readString(in); + String version = ByteBufUtil.readString(in); + + VelocityMetadataManager manager = (VelocityMetadataManager) ApolloManager.getMetadataManager(); + manager.getMods().put(modId, version); + } + } catch (Exception ignored) { + } + } + + static { + FML_HANDSHAKE_CHANNEL = MinecraftChannelIdentifier.create("fml", "handshake"); + } + +} diff --git a/velocity/src/main/java/com/lunarclient/apollo/metadata/VelocityMetadata.java b/velocity/src/main/java/com/lunarclient/apollo/metadata/VelocityMetadata.java new file mode 100644 index 00000000..91577bbc --- /dev/null +++ b/velocity/src/main/java/com/lunarclient/apollo/metadata/VelocityMetadata.java @@ -0,0 +1,79 @@ +/* + * 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.metadata; + +import com.lunarclient.apollo.stats.metadata.PlatformMetadata; +import java.util.Map; +import java.util.Set; +import lombok.Builder; +import lombok.ToString; + +/** + * Represents the velocity metadata implementation. + * + * @since 1.1.9 + */ +@ToString +@Builder(toBuilder = true) +public class VelocityMetadata extends PlatformMetadata { + + /** + * Tracks client brands sent by the players. + * + *

A {@link Set} of {@link String} client brands.

+ * + * @since 1.1.9 + */ + private final Set clientBrands; + + /** + * Tracks forge mods sent with the forge handshake. + * + *

A {@link Map} of {@link String} mod id + * as a key and {@link String} version as value.

+ * + * @since 1.1.9 + */ + private final Map mods; + + /** + * Tracks the server IP and port the player used to connect. + * + *

A {@link Set} of {@link String} server addresses in the format: host:port

+ * + * @since 1.1.9 + */ + private final Set serverAddress; + + /** + * Tracks the total number of resource pack status events received. + * + *

Represents a {@link Map} of {@link String} status enum name as a key + * and {@link Integer} count of how many times that status has been reported.

+ * + * @since 1.1.9 + */ + private final Map resourcePackStatuses; + +} diff --git a/velocity/src/main/java/com/lunarclient/apollo/metadata/VelocityMetadataManager.java b/velocity/src/main/java/com/lunarclient/apollo/metadata/VelocityMetadataManager.java new file mode 100644 index 00000000..a386448e --- /dev/null +++ b/velocity/src/main/java/com/lunarclient/apollo/metadata/VelocityMetadataManager.java @@ -0,0 +1,65 @@ +/* + * 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.metadata; + +import com.lunarclient.apollo.stats.metadata.ApolloMetadataManager; +import com.lunarclient.apollo.stats.metadata.PlatformMetadata; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import lombok.Getter; + +/** + * The Velocity implementation of {@link ApolloMetadataManager}. + * + * @since 1.1.9 + */ +@Getter +public class VelocityMetadataManager implements ApolloMetadataManager { + + private final Set clientBrands = new HashSet<>(); + private final Map mods = new HashMap<>(); + private final Set serverAddress = new HashSet<>(); + private final Map resourcePackStatuses = new HashMap<>(); + + @Override + public PlatformMetadata extract() { + return VelocityMetadata.builder() + .clientBrands(new HashSet<>(this.clientBrands)) + .mods(new HashMap<>(this.mods)) + .serverAddress(new HashSet<>(this.serverAddress)) + .resourcePackStatuses(new HashMap<>(this.resourcePackStatuses)) + .build(); + } + + @Override + public void clear() { + this.clientBrands.clear(); + this.mods.clear(); + this.serverAddress.clear(); + this.resourcePackStatuses.clear(); + } + +} diff --git a/velocity/src/main/java/com/lunarclient/apollo/util/ByteBufUtil.java b/velocity/src/main/java/com/lunarclient/apollo/util/ByteBufUtil.java new file mode 100644 index 00000000..67a03b80 --- /dev/null +++ b/velocity/src/main/java/com/lunarclient/apollo/util/ByteBufUtil.java @@ -0,0 +1,83 @@ +/* + * 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.util; + +import com.google.common.io.ByteArrayDataInput; +import java.nio.charset.StandardCharsets; + +/** + * Represents a util for reading byte buffs. + * + * @since 1.1.9 + */ +public final class ByteBufUtil { + + /** + * Reads an int from the given input stream. + * + * @param in in the {@link ByteArrayDataInput} to read from + * @return the read int + * @throws IllegalArgumentException if the value length is invalid or too large + * @since 1.1.9 + */ + public static int readVarInt(ByteArrayDataInput in) { + int i = 0; + int j = 0; + + while (true) { + byte b = in.readByte(); + i |= (b & 0x7F) << j++ * 7; + + if (j > 5) { + throw new RuntimeException("VarInt too big"); + } + + if ((b & 0x80) != 128) { + break; + } + } + + return i; + } + + /** + * Reads a UTF-8 encoded string from the given input stream. + * + * @param in the {@link ByteArrayDataInput} to read from + * @return the decoded string + * @throws IllegalArgumentException if the value length is invalid or too large + * @since 1.1.9 + */ + public static String readString(ByteArrayDataInput in) { + int length = ByteBufUtil.readVarInt(in); + byte[] bytes = new byte[length]; + in.readFully(bytes); + + return new String(bytes, StandardCharsets.UTF_8); + } + + private ByteBufUtil() { + } + +}