diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml index 3858a485..566632a1 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.yml +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -80,7 +80,8 @@ body: - 1.17 - 1.18 - 1.19 - - 1.20+ + - 1.20 + - 1.21 validations: required: true @@ -114,7 +115,8 @@ body: - 1.17 - 1.18 - 1.19 - - 1.20+ + - 1.20 + - 1.21 - Other/Not Listed validations: required: true @@ -131,6 +133,8 @@ body: - "Optifine" - "Forge" - "Fabric" + - "Vanilla" + - "Other/Not Listed" validations: required: false 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 d7e369ef..e1afdde6 100644 --- a/api/src/main/java/com/lunarclient/apollo/mods/Mods.java +++ b/api/src/main/java/com/lunarclient/apollo/mods/Mods.java @@ -75,6 +75,7 @@ import com.lunarclient.apollo.mods.impl.ModPotionEffects; import com.lunarclient.apollo.mods.impl.ModPvpInfo; import com.lunarclient.apollo.mods.impl.ModQuickplay; +import com.lunarclient.apollo.mods.impl.ModRadio; import com.lunarclient.apollo.mods.impl.ModReachDisplay; import com.lunarclient.apollo.mods.impl.ModReplaymod; import com.lunarclient.apollo.mods.impl.ModSaturation; @@ -194,7 +195,8 @@ public final class Mods { ModHurtCam.class, ModDamageTint.class, ModSkyblock.class, - ModHorseStats.class + ModHorseStats.class, + ModRadio.class ); private Mods() { diff --git a/api/src/main/java/com/lunarclient/apollo/mods/impl/ModCoordinates.java b/api/src/main/java/com/lunarclient/apollo/mods/impl/ModCoordinates.java index cb674606..e1c803ba 100644 --- a/api/src/main/java/com/lunarclient/apollo/mods/impl/ModCoordinates.java +++ b/api/src/main/java/com/lunarclient/apollo/mods/impl/ModCoordinates.java @@ -61,8 +61,8 @@ public final class ModCoordinates { * * @since 1.0.0 */ - public static final SimpleOption BACKGROUND = SimpleOption.builder() - .node("coordinates", "background").type(TypeToken.get(Boolean.class)) + public static final SimpleOption TEXT_SHADOW = SimpleOption.builder() + .node("coordinates", "text-shadow").type(TypeToken.get(Boolean.class)) .notifyClient() .build(); @@ -71,8 +71,8 @@ public final class ModCoordinates { * * @since 1.0.0 */ - public static final SimpleOption TEXT_SHADOW = SimpleOption.builder() - .node("coordinates", "text-shadow").type(TypeToken.get(Boolean.class)) + public static final SimpleOption SHOW_WHILE_TYPING = SimpleOption.builder() + .node("coordinates", "show-while-typing").type(TypeToken.get(Boolean.class)) .notifyClient() .build(); @@ -81,8 +81,8 @@ public final class ModCoordinates { * * @since 1.0.0 */ - public static final SimpleOption SHOW_WHILE_TYPING = SimpleOption.builder() - .node("coordinates", "show-while-typing").type(TypeToken.get(Boolean.class)) + public static final SimpleOption BACKGROUND = SimpleOption.builder() + .node("coordinates", "background").type(TypeToken.get(Boolean.class)) .notifyClient() .build(); diff --git a/api/src/main/java/com/lunarclient/apollo/mods/impl/ModDayCounter.java b/api/src/main/java/com/lunarclient/apollo/mods/impl/ModDayCounter.java index 790a17da..757ba4e3 100644 --- a/api/src/main/java/com/lunarclient/apollo/mods/impl/ModDayCounter.java +++ b/api/src/main/java/com/lunarclient/apollo/mods/impl/ModDayCounter.java @@ -192,11 +192,12 @@ public final class ModDayCounter { .build(); /** - * No documentation available. + * If enabled, this will show the day of the world. If disabled, it will display your playtime in that world. * * @since 1.0.0 */ public static final SimpleOption USE_WORLD_TYPE = SimpleOption.builder() + .comment("If enabled, this will show the day of the world. If disabled, it will display your playtime in that world.") .node("day-counter", "use-world-type").type(TypeToken.get(Boolean.class)) .notifyClient() .build(); 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 f0de98e3..2861d086 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 @@ -170,20 +170,20 @@ public final class ModPotionEffects { /** * No documentation available. * - * @since 1.0.0 + * @since 1.1.1 */ - public static final SimpleOption EXCLUDE_SPEED = SimpleOption.builder() - .node("potion-effects", "exclude-speed").type(TypeToken.get(Boolean.class)) + public static final SimpleOption EXCLUDE_ABSORPTION = SimpleOption.builder() + .node("potion-effects", "exclude-absorption").type(TypeToken.get(Boolean.class)) .notifyClient() .build(); /** * No documentation available. * - * @since 1.0.0 + * @since 1.1.1 */ - public static final SimpleOption EXCLUDE_SLOWNESS = SimpleOption.builder() - .node("potion-effects", "exclude-slowness").type(TypeToken.get(Boolean.class)) + public static final SimpleOption EXCLUDE_BLINDNESS = SimpleOption.builder() + .node("potion-effects", "exclude-blindness").type(TypeToken.get(Boolean.class)) .notifyClient() .build(); @@ -192,8 +192,8 @@ public final class ModPotionEffects { * * @since 1.0.0 */ - public static final SimpleOption EXCLUDE_JUMP_BOOST = SimpleOption.builder() - .node("potion-effects", "exclude-jump-boost").type(TypeToken.get(Boolean.class)) + public static final SimpleOption EXCLUDE_FIRE_RES = SimpleOption.builder() + .node("potion-effects", "exclude-fire-res").type(TypeToken.get(Boolean.class)) .notifyClient() .build(); @@ -202,48 +202,48 @@ public final class ModPotionEffects { * * @since 1.0.0 */ - public static final SimpleOption EXCLUDE_REGEN = SimpleOption.builder() - .node("potion-effects", "exclude-regen").type(TypeToken.get(Boolean.class)) + public static final SimpleOption EXCLUDE_HASTE = SimpleOption.builder() + .node("potion-effects", "exclude-haste").type(TypeToken.get(Boolean.class)) .notifyClient() .build(); /** * No documentation available. * - * @since 1.0.0 + * @since 1.1.1 */ - public static final SimpleOption EXCLUDE_FIRE_RES = SimpleOption.builder() - .node("potion-effects", "exclude-fire-res").type(TypeToken.get(Boolean.class)) + public static final SimpleOption EXCLUDE_HEALTH_BOOST = SimpleOption.builder() + .node("potion-effects", "exclude-health-boost").type(TypeToken.get(Boolean.class)) .notifyClient() .build(); /** * No documentation available. * - * @since 1.0.0 + * @since 1.1.1 */ - public static final SimpleOption EXCLUDE_WATER_BREATHING = SimpleOption.builder() - .node("potion-effects", "exclude-water-breathing").type(TypeToken.get(Boolean.class)) + public static final SimpleOption EXCLUDE_HUNGER = SimpleOption.builder() + .node("potion-effects", "exclude-hunger").type(TypeToken.get(Boolean.class)) .notifyClient() .build(); /** * No documentation available. * - * @since 1.0.0 + * @since 1.1.1 */ - public static final SimpleOption EXCLUDE_NIGHT_VISION = SimpleOption.builder() - .node("potion-effects", "exclude-night-vision").type(TypeToken.get(Boolean.class)) + public static final SimpleOption EXCLUDE_INSTANT_DAMAGE = SimpleOption.builder() + .node("potion-effects", "exclude-instant-damage").type(TypeToken.get(Boolean.class)) .notifyClient() .build(); /** * No documentation available. * - * @since 1.0.0 + * @since 1.1.1 */ - public static final SimpleOption EXCLUDE_WEAKNESS = SimpleOption.builder() - .node("potion-effects", "exclude-weakness").type(TypeToken.get(Boolean.class)) + public static final SimpleOption EXCLUDE_INSTANT_HEALTH = SimpleOption.builder() + .node("potion-effects", "exclude-instant-health").type(TypeToken.get(Boolean.class)) .notifyClient() .build(); @@ -252,8 +252,8 @@ public final class ModPotionEffects { * * @since 1.0.0 */ - public static final SimpleOption EXCLUDE_POISON = SimpleOption.builder() - .node("potion-effects", "exclude-poison").type(TypeToken.get(Boolean.class)) + public static final SimpleOption EXCLUDE_INVIS = SimpleOption.builder() + .node("potion-effects", "exclude-invis").type(TypeToken.get(Boolean.class)) .notifyClient() .build(); @@ -262,18 +262,28 @@ public final class ModPotionEffects { * * @since 1.0.0 */ - public static final SimpleOption EXCLUDE_STRENGTH = SimpleOption.builder() - .node("potion-effects", "exclude-strength").type(TypeToken.get(Boolean.class)) + public static final SimpleOption EXCLUDE_JUMP_BOOST = SimpleOption.builder() + .node("potion-effects", "exclude-jump-boost").type(TypeToken.get(Boolean.class)) .notifyClient() .build(); /** * No documentation available. * - * @since 1.0.0 + * @since 1.1.1 */ - public static final SimpleOption EXCLUDE_HASTE = SimpleOption.builder() - .node("potion-effects", "exclude-haste").type(TypeToken.get(Boolean.class)) + public static final SimpleOption EXCLUDE_MINING_FATIGUE = SimpleOption.builder() + .node("potion-effects", "exclude-mining-fatigue").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.1 + */ + public static final SimpleOption EXCLUDE_NAUSEA = SimpleOption.builder() + .node("potion-effects", "exclude-nausea").type(TypeToken.get(Boolean.class)) .notifyClient() .build(); @@ -282,38 +292,38 @@ public final class ModPotionEffects { * * @since 1.0.0 */ - public static final SimpleOption EXCLUDE_INVIS = SimpleOption.builder() - .node("potion-effects", "exclude-invis").type(TypeToken.get(Boolean.class)) + public static final SimpleOption EXCLUDE_NIGHT_VISION = SimpleOption.builder() + .node("potion-effects", "exclude-night-vision").type(TypeToken.get(Boolean.class)) .notifyClient() .build(); /** * No documentation available. * - * @since 1.1.1 + * @since 1.0.0 */ - public static final SimpleOption EXCLUDE_MINING_FATIGUE = SimpleOption.builder() - .node("potion-effects", "exclude-mining-fatigue").type(TypeToken.get(Boolean.class)) + public static final SimpleOption EXCLUDE_POISON = SimpleOption.builder() + .node("potion-effects", "exclude-poison").type(TypeToken.get(Boolean.class)) .notifyClient() .build(); /** * No documentation available. * - * @since 1.1.1 + * @since 1.0.0 */ - public static final SimpleOption EXCLUDE_INSTANT_HEALTH = SimpleOption.builder() - .node("potion-effects", "exclude-instant-health").type(TypeToken.get(Boolean.class)) + public static final SimpleOption EXCLUDE_REGEN = SimpleOption.builder() + .node("potion-effects", "exclude-regen").type(TypeToken.get(Boolean.class)) .notifyClient() .build(); /** * No documentation available. * - * @since 1.1.1 + * @since 1.1.7 */ - public static final SimpleOption EXCLUDE_INSTANT_DAMAGE = SimpleOption.builder() - .node("potion-effects", "exclude-instant-damage").type(TypeToken.get(Boolean.class)) + public static final SimpleOption EXCLUDE_RESISTANCE = SimpleOption.builder() + .node("potion-effects", "exclude-resistance").type(TypeToken.get(Boolean.class)) .notifyClient() .build(); @@ -322,58 +332,58 @@ public final class ModPotionEffects { * * @since 1.1.1 */ - public static final SimpleOption EXCLUDE_NAUSEA = SimpleOption.builder() - .node("potion-effects", "exclude-nausea").type(TypeToken.get(Boolean.class)) + public static final SimpleOption EXCLUDE_SATURATION = SimpleOption.builder() + .node("potion-effects", "exclude-saturation").type(TypeToken.get(Boolean.class)) .notifyClient() .build(); /** * No documentation available. * - * @since 1.1.1 + * @since 1.0.0 */ - public static final SimpleOption EXCLUDE_BLINDNESS = SimpleOption.builder() - .node("potion-effects", "exclude-blindness").type(TypeToken.get(Boolean.class)) + public static final SimpleOption EXCLUDE_SLOWNESS = SimpleOption.builder() + .node("potion-effects", "exclude-slowness").type(TypeToken.get(Boolean.class)) .notifyClient() .build(); /** * No documentation available. * - * @since 1.1.1 + * @since 1.0.0 */ - public static final SimpleOption EXCLUDE_HUNGER = SimpleOption.builder() - .node("potion-effects", "exclude-hunger").type(TypeToken.get(Boolean.class)) + public static final SimpleOption EXCLUDE_SPEED = SimpleOption.builder() + .node("potion-effects", "exclude-speed").type(TypeToken.get(Boolean.class)) .notifyClient() .build(); /** * No documentation available. * - * @since 1.1.1 + * @since 1.0.0 */ - public static final SimpleOption EXCLUDE_WITHER = SimpleOption.builder() - .node("potion-effects", "exclude-wither").type(TypeToken.get(Boolean.class)) + public static final SimpleOption EXCLUDE_STRENGTH = SimpleOption.builder() + .node("potion-effects", "exclude-strength").type(TypeToken.get(Boolean.class)) .notifyClient() .build(); /** * No documentation available. * - * @since 1.1.1 + * @since 1.0.0 */ - public static final SimpleOption EXCLUDE_HEALTH_BOOST = SimpleOption.builder() - .node("potion-effects", "exclude-health-boost").type(TypeToken.get(Boolean.class)) + public static final SimpleOption EXCLUDE_WATER_BREATHING = SimpleOption.builder() + .node("potion-effects", "exclude-water-breathing").type(TypeToken.get(Boolean.class)) .notifyClient() .build(); /** * No documentation available. * - * @since 1.1.1 + * @since 1.0.0 */ - public static final SimpleOption EXCLUDE_ABSORPTION = SimpleOption.builder() - .node("potion-effects", "exclude-absorption").type(TypeToken.get(Boolean.class)) + public static final SimpleOption EXCLUDE_WEAKNESS = SimpleOption.builder() + .node("potion-effects", "exclude-weakness").type(TypeToken.get(Boolean.class)) .notifyClient() .build(); @@ -382,8 +392,8 @@ public final class ModPotionEffects { * * @since 1.1.1 */ - public static final SimpleOption EXCLUDE_SATURATION = SimpleOption.builder() - .node("potion-effects", "exclude-saturation").type(TypeToken.get(Boolean.class)) + public static final SimpleOption EXCLUDE_WITHER = SimpleOption.builder() + .node("potion-effects", "exclude-wither").type(TypeToken.get(Boolean.class)) .notifyClient() .build(); 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 new file mode 100644 index 00000000..c261e594 --- /dev/null +++ b/api/src/main/java/com/lunarclient/apollo/mods/impl/ModRadio.java @@ -0,0 +1,288 @@ +/* + * 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; +import java.awt.Color; + +/** + * Enjoy some of your favorite songs provided by Styngr. + * + * @since 1.1.7 + */ +public final class ModRadio { + + /** + * No documentation available. + * + * @since 1.1.7 + */ + public static final SimpleOption ENABLED = SimpleOption.builder() + .node("radio", "enabled").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @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) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.7 + */ + public static final NumberOption VOLUME = NumberOption.number() + .node("radio", "volume").type(TypeToken.get(Integer.class)) + .min(0).max(100) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.7 + */ + public static final SimpleOption MUTE_RADIO = SimpleOption.builder() + .node("radio", "mute-radio").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.7 + */ + public static final SimpleOption BACKGROUND = SimpleOption.builder() + .node("radio", "background").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * If this is disabled the background will change size with the text. + * + * @since 1.1.7 + */ + public static final SimpleOption STATIC_BACKGROUND_WIDTH = SimpleOption.builder() + .comment("If this is disabled the background will change size with the text.") + .node("radio", "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.7 + */ + public static final SimpleOption STATIC_BACKGROUND_HEIGHT = SimpleOption.builder() + .comment("If this is disabled the background will change size with the text.") + .node("radio", "static-background-height").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.7 + */ + public static final NumberOption BACKGROUND_WIDTH = NumberOption.number() + .node("radio", "background-width").type(TypeToken.get(Integer.class)) + .min(60).max(300) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.7 + */ + public static final NumberOption BACKGROUND_HEIGHT = NumberOption.number() + .node("radio", "background-height").type(TypeToken.get(Integer.class)) + .min(22).max(64) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.7 + */ + public static final SimpleOption BORDER = SimpleOption.builder() + .node("radio", "border").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.7 + */ + public static final NumberOption BORDER_THICKNESS = NumberOption.number() + .node("radio", "border-thickness").type(TypeToken.get(Float.class)) + .min(0.5F).max(3.0F) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.7 + */ + public static final SimpleOption BORDER_COLOR = SimpleOption.builder() + .node("radio", "border-color").type(TypeToken.get(Color.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.7 + */ + public static final SimpleOption BACKGROUND_COLOR = SimpleOption.builder() + .node("radio", "background-color").type(TypeToken.get(Color.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.7 + */ + public static final SimpleOption SHOW_COVER_ART = SimpleOption.builder() + .node("radio", "show-cover-art").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.7 + */ + public static final SimpleOption SHOW_PROGRESS = SimpleOption.builder() + .node("radio", "show-progress").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.7 + */ + public static final SimpleOption SONG_SCROLL_ANIMATION = SimpleOption.builder() + .node("radio", "song-scroll-animation").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.7 + */ + public static final SimpleOption SHOW_WHEN_NOTHING_PLAYING = SimpleOption.builder() + .node("radio", "show-when-nothing-playing").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.7 + */ + public static final SimpleOption BOLD_ARIST_NAME = SimpleOption.builder() + .node("radio", "bold-arist-name").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.7 + */ + public static final SimpleOption BOLD_SONG_NAME = SimpleOption.builder() + .node("radio", "bold-song-name").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.7 + */ + public static final SimpleOption SHOW_DURATION = SimpleOption.builder() + .node("radio", "show-duration").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.7 + */ + public static final SimpleOption SHOW_PLAY_BUTTON = SimpleOption.builder() + .node("radio", "show-play-button").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.7 + */ + public static final SimpleOption SONG_NAME_TEXT_COLOR = SimpleOption.builder() + .node("radio", "song-name-text-color").type(TypeToken.get(Color.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.7 + */ + public static final SimpleOption ARTIST_NAME_TEXT_COLOR = SimpleOption.builder() + .node("radio", "artist-name-text-color").type(TypeToken.get(Color.class)) + .notifyClient() + .build(); + + /** + * No documentation available. + * + * @since 1.1.7 + */ + public static final SimpleOption RADIO_PROGRESS_BAR_COLOR = SimpleOption.builder() + .node("radio", "radio-progress-bar-color").type(TypeToken.get(Color.class)) + .notifyClient() + .build(); + + private ModRadio() { + } + +} 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 f151b8ad..359241a5 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,28 @@ public final class ModSkyblock { .notifyClient() .build(); + /** + * Shows the creation date of the item in the lore. + * + * @since 1.1.7 + */ + public static final SimpleOption SKY_BLOCK_CREATION_DATE = SimpleOption.builder() + .comment("Shows the creation date of the item in the lore.") + .node("skyblock", "sky-block-creation-date").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + + /** + * Shows the item's SkyBlock ID in the lore. + * + * @since 1.1.7 + */ + public static final SimpleOption SKY_BLOCK_ITEM_ID = SimpleOption.builder() + .comment("Shows the item's SkyBlock ID in the lore.") + .node("skyblock", "sky-block-item-id").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + /** * Makes Giant HP more visible by showing their HP at their feet. * @@ -159,6 +181,16 @@ public final class ModSkyblock { .notifyClient() .build(); + /** + * No documentation available. + * + * @since 1.1.7 + */ + public static final SimpleOption DUNGEON_SECRETS_COLLECTED = SimpleOption.builder() + .node("skyblock", "dungeon-secrets-collected").type(TypeToken.get(Boolean.class)) + .notifyClient() + .build(); + /** * Changes crop hitboxes with their 1.12+ variant. Only enabled on Hypixel or singleplayer. * @@ -308,6 +340,18 @@ public final class ModSkyblock { .notifyClient() .build(); + /** + * Provides a general line thickness option that applies to most features with box/line rendering. + * + * @since 1.1.7 + */ + public static final NumberOption SKYBLOCK_LINE_THICKNESS = NumberOption.number() + .comment("Provides a general line thickness option that applies to most features with box/line rendering.") + .node("skyblock", "skyblock-line-thickness").type(TypeToken.get(Float.class)) + .min(1.0F).max(10.0F) + .notifyClient() + .build(); + private ModSkyblock() { } diff --git a/api/src/main/java/com/lunarclient/apollo/module/combat/CombatModule.java b/api/src/main/java/com/lunarclient/apollo/module/combat/CombatModule.java index b5aa2fe9..3a57de46 100644 --- a/api/src/main/java/com/lunarclient/apollo/module/combat/CombatModule.java +++ b/api/src/main/java/com/lunarclient/apollo/module/combat/CombatModule.java @@ -43,7 +43,7 @@ public final class CombatModule extends ApolloModule { * @since 1.0.4 */ public static final SimpleOption DISABLE_MISS_PENALTY = Option.builder() - .comment("Set to 'true' to disable the hit delay on 1.8, otherwise 'false'.") + .comment("Set to 'true' to remove the miss penalty on all versions 1.8 and above, otherwise 'false'.") .node("disable-miss-penalty").type(TypeToken.get(Boolean.class)) .defaultValue(false).notifyClient().build(); diff --git a/api/src/main/java/com/lunarclient/apollo/module/glint/GlintModule.java b/api/src/main/java/com/lunarclient/apollo/module/glint/GlintModule.java new file mode 100644 index 00000000..0b8ed970 --- /dev/null +++ b/api/src/main/java/com/lunarclient/apollo/module/glint/GlintModule.java @@ -0,0 +1,44 @@ +/* + * This file is part of Apollo, licensed under the MIT License. + * + * Copyright (c) 2023 Moonsworth + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +package com.lunarclient.apollo.module.glint; + +import com.lunarclient.apollo.module.ApolloModule; +import com.lunarclient.apollo.module.ModuleDefinition; +import org.jetbrains.annotations.ApiStatus; + +/** + * Represents the glint module. + * + * @since 1.1.7 + */ +@ApiStatus.NonExtendable +@ModuleDefinition(id = "glint", name = "Glint") +public class GlintModule extends ApolloModule { + + @Override + public boolean isClientNotify() { + return true; + } + +} diff --git a/api/src/main/java/com/lunarclient/apollo/module/inventory/InventoryModule.java b/api/src/main/java/com/lunarclient/apollo/module/inventory/InventoryModule.java new file mode 100644 index 00000000..968b48a6 --- /dev/null +++ b/api/src/main/java/com/lunarclient/apollo/module/inventory/InventoryModule.java @@ -0,0 +1,48 @@ +/* + * This file is part of Apollo, licensed under the MIT License. + * + * Copyright (c) 2023 Moonsworth + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +package com.lunarclient.apollo.module.inventory; + +import com.lunarclient.apollo.module.ApolloModule; +import com.lunarclient.apollo.module.ModuleDefinition; +import org.jetbrains.annotations.ApiStatus; + +/** + * Represents the inventory module. + * + * @since 1.1.7 + */ +@ApiStatus.NonExtendable +@ModuleDefinition(id = "inventory", name = "Inventory") +public class InventoryModule extends ApolloModule { + + protected InventoryModule() { + this.registerOptions(ApolloModule.ENABLE_OPTION_OFF); + } + + @Override + public boolean isClientNotify() { + return true; + } + +} diff --git a/api/src/main/java/com/lunarclient/apollo/module/saturation/SaturationModule.java b/api/src/main/java/com/lunarclient/apollo/module/saturation/SaturationModule.java new file mode 100644 index 00000000..a1f40bba --- /dev/null +++ b/api/src/main/java/com/lunarclient/apollo/module/saturation/SaturationModule.java @@ -0,0 +1,44 @@ +/* + * This file is part of Apollo, licensed under the MIT License. + * + * Copyright (c) 2023 Moonsworth + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +package com.lunarclient.apollo.module.saturation; + +import com.lunarclient.apollo.module.ApolloModule; +import com.lunarclient.apollo.module.ModuleDefinition; +import org.jetbrains.annotations.ApiStatus; + +/** + * Represents the saturation module. + * + * @since 1.1.7 + */ +@ApiStatus.NonExtendable +@ModuleDefinition(id = "saturation", name = "Saturation") +public class SaturationModule extends ApolloModule { + + @Override + public boolean isClientNotify() { + return true; + } + +} diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/ApolloExamplePlugin.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/ApolloExamplePlugin.java index 4526747e..3043153b 100644 --- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/ApolloExamplePlugin.java +++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/ApolloExamplePlugin.java @@ -58,14 +58,17 @@ import com.lunarclient.apollo.example.common.commands.module.CombatCommand; import com.lunarclient.apollo.example.common.commands.module.CooldownCommand; import com.lunarclient.apollo.example.common.commands.module.EntityCommand; +import com.lunarclient.apollo.example.common.commands.module.GlintCommand; import com.lunarclient.apollo.example.common.commands.module.GlowCommand; import com.lunarclient.apollo.example.common.commands.module.HologramCommand; +import com.lunarclient.apollo.example.common.commands.module.InventoryCommand; import com.lunarclient.apollo.example.common.commands.module.LimbCommand; import com.lunarclient.apollo.example.common.commands.module.ModSettingsCommand; import com.lunarclient.apollo.example.common.commands.module.NametagCommand; import com.lunarclient.apollo.example.common.commands.module.NickHiderCommand; import com.lunarclient.apollo.example.common.commands.module.NotificationCommand; import com.lunarclient.apollo.example.common.commands.module.RichPresenceCommand; +import com.lunarclient.apollo.example.common.commands.module.SaturationCommand; import com.lunarclient.apollo.example.common.commands.module.ServerRuleCommand; import com.lunarclient.apollo.example.common.commands.module.StaffModCommand; import com.lunarclient.apollo.example.common.commands.module.StopwatchCommand; @@ -84,14 +87,17 @@ import com.lunarclient.apollo.example.common.modules.impl.CombatExample; import com.lunarclient.apollo.example.common.modules.impl.CooldownExample; import com.lunarclient.apollo.example.common.modules.impl.EntityExample; +import com.lunarclient.apollo.example.common.modules.impl.GlintExample; import com.lunarclient.apollo.example.common.modules.impl.GlowExample; import com.lunarclient.apollo.example.common.modules.impl.HologramExample; +import com.lunarclient.apollo.example.common.modules.impl.InventoryExample; import com.lunarclient.apollo.example.common.modules.impl.LimbExample; import com.lunarclient.apollo.example.common.modules.impl.ModSettingsExample; import com.lunarclient.apollo.example.common.modules.impl.NametagExample; import com.lunarclient.apollo.example.common.modules.impl.NickHiderExample; import com.lunarclient.apollo.example.common.modules.impl.NotificationExample; import com.lunarclient.apollo.example.common.modules.impl.RichPresenceExample; +import com.lunarclient.apollo.example.common.modules.impl.SaturationExample; import com.lunarclient.apollo.example.common.modules.impl.ServerRuleExample; import com.lunarclient.apollo.example.common.modules.impl.StaffModExample; import com.lunarclient.apollo.example.common.modules.impl.StopwatchExample; @@ -177,14 +183,17 @@ public class ApolloExamplePlugin extends JavaPlugin { private CombatExample combatExample; private CooldownExample cooldownExample; private EntityExample entityExample; + private GlintExample glintExample; private GlowExample glowExample; private HologramExample hologramExample; + private InventoryExample inventoryExample; private LimbExample limbExample; private ModSettingsExample modSettingsExample; private NametagExample nametagExample; private NickHiderExample nickHiderExample; private NotificationExample notificationExample; private RichPresenceExample richPresenceExample; + private SaturationExample saturationExample; private ServerRuleExample serverRuleExample; private StaffModExample staffModExample; private StopwatchExample stopwatchExample; @@ -222,14 +231,17 @@ private void registerCommands() { this.getCommand("combat").setExecutor(new CombatCommand()); this.getCommand("cooldown").setExecutor(new CooldownCommand()); this.getCommand("entity").setExecutor(new EntityCommand()); + this.getCommand("glint").setExecutor(new GlintCommand()); this.getCommand("glow").setExecutor(new GlowCommand()); this.getCommand("hologram").setExecutor(new HologramCommand()); + this.getCommand("inventory").setExecutor(new InventoryCommand()); this.getCommand("limb").setExecutor(new LimbCommand()); this.getCommand("modsettings").setExecutor(new ModSettingsCommand()); this.getCommand("nametag").setExecutor(new NametagCommand()); this.getCommand("nickhider").setExecutor(new NickHiderCommand()); this.getCommand("notification").setExecutor(new NotificationCommand()); this.getCommand("richpresence").setExecutor(new RichPresenceCommand()); + this.getCommand("saturation").setExecutor(new SaturationCommand()); this.getCommand("serverrule").setExecutor(new ServerRuleCommand()); this.getCommand("staffmod").setExecutor(new StaffModCommand()); this.getCommand("stopwatch").setExecutor(new StopwatchCommand()); @@ -267,6 +279,10 @@ public void changeImplementationType(ApolloExampleType type) { private void registerModuleExamples() { this.spamPacketDebug = new SpamPacketDebug(); + this.glintExample = new GlintExample(); + this.inventoryExample = new InventoryExample(); + this.saturationExample = new SaturationExample(); + switch (TYPE) { case API: { this.beamExample = new BeamApiExample(); diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/ChatApiExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/ChatApiExample.java index 25e4a776..317d2826 100644 --- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/ChatApiExample.java +++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/ChatApiExample.java @@ -24,29 +24,46 @@ package com.lunarclient.apollo.example.api.examples; import com.lunarclient.apollo.Apollo; +import com.lunarclient.apollo.example.ApolloExamplePlugin; import com.lunarclient.apollo.example.common.modules.impl.ChatExample; import com.lunarclient.apollo.module.chat.ChatModule; import com.lunarclient.apollo.recipients.Recipients; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.format.NamedTextColor; +import org.bukkit.scheduler.BukkitRunnable; public class ChatApiExample extends ChatExample { private final ChatModule chatModule = Apollo.getModuleManager().getModule(ChatModule.class); - private int countdown = 5; - @Override public void displayLiveChatMessageExample() { - this.chatModule.displayLiveChatMessage(Recipients.ofEveryone(), - Component.text("Game starting in ", NamedTextColor.GREEN) - .append(Component.text(this.countdown, NamedTextColor.BLUE)), - 13 - ); - - if (--this.countdown == 0) { - this.countdown = 5; - } + BukkitRunnable runnable = new BukkitRunnable() { + + private int countdown = 5; + + @Override + public void run() { + if (this.countdown > 0) { + ChatApiExample.this.chatModule.displayLiveChatMessage(Recipients.ofEveryone(), + Component.text("Game starting in ", NamedTextColor.GREEN) + .append(Component.text(this.countdown, NamedTextColor.BLUE)), + 13 + ); + + this.countdown--; + } else { + ChatApiExample.this.chatModule.displayLiveChatMessage(Recipients.ofEveryone(), + Component.text("Game started! ", NamedTextColor.GREEN), + 13 + ); + + this.cancel(); + } + } + }; + + runnable.runTaskTimer(ApolloExamplePlugin.getPlugin(), 0L, 20L); } @Override diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/TebexApiExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/TebexApiExample.java index 36829578..c318a3e1 100644 --- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/TebexApiExample.java +++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/TebexApiExample.java @@ -38,13 +38,27 @@ public class TebexApiExample extends TebexExample { @Override public void displayTebexEmbeddedCheckoutExample(Player viewer, String basketIdent, String locale) { Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId()); - apolloPlayerOpt.ifPresent(apolloPlayer -> { - if (apolloPlayer.getTebexEmbeddedCheckoutSupport() == TebexEmbeddedCheckoutSupport.UNSUPPORTED) { - return; - } - this.tebexModule.displayTebexEmbeddedCheckout(apolloPlayer, basketIdent, locale); - }); + if (!apolloPlayerOpt.isPresent()) { + viewer.sendMessage("Complete your purchase at https://pay.tebex.io/" + basketIdent); + return; + } + + ApolloPlayer apolloPlayer = apolloPlayerOpt.get(); + TebexEmbeddedCheckoutSupport embeddedCheckoutSupport = apolloPlayer.getTebexEmbeddedCheckoutSupport(); + + if (embeddedCheckoutSupport == TebexEmbeddedCheckoutSupport.UNSUPPORTED) { + viewer.sendMessage("Complete your purchase at https://pay.tebex.io/" + basketIdent); + return; + } + + this.tebexModule.displayTebexEmbeddedCheckout(apolloPlayerOpt.get(), basketIdent, locale); + + if (embeddedCheckoutSupport == TebexEmbeddedCheckoutSupport.OVERLAY) { + viewer.sendMessage("Opening checkout as game overlay!"); + } else { + viewer.sendMessage("Opening checkout in an external window!"); + } } } diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/ItemUtil.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/ItemUtil.java new file mode 100644 index 00000000..a7070e1d --- /dev/null +++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/ItemUtil.java @@ -0,0 +1,74 @@ +/* + * This file is part of Apollo, licensed under the MIT License. + * + * Copyright (c) 2023 Moonsworth + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +package com.lunarclient.apollo.example.common; + +import net.minecraft.server.v1_8_R3.NBTTagCompound; +import org.bukkit.Material; +import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; + +public final class ItemUtil { + + public static ItemStack itemWithName(Material material, String name) { + ItemStack item = new ItemStack(material); + + ItemMeta itemMeta = item.getItemMeta(); + itemMeta.setDisplayName(name); + + item.setItemMeta(itemMeta); + return item; + } + + public static ItemStack addTag(ItemStack item, String key, Object value) { + net.minecraft.server.v1_8_R3.ItemStack nmsItem = CraftItemStack.asNMSCopy(item); + NBTTagCompound tag = nmsItem.hasTag() ? nmsItem.getTag() : new NBTTagCompound(); + + NBTTagCompound lunarTag = tag.getCompound("lunar"); + if (lunarTag == null) { + lunarTag = new NBTTagCompound(); + } + + if (value instanceof Integer) { + lunarTag.setInt(key, (Integer) value); + } else if (value instanceof Double) { + lunarTag.setDouble(key, (Double) value); + } else if (value instanceof Float) { + lunarTag.setFloat(key, (Float) value); + } else if (value instanceof Boolean) { + lunarTag.setBoolean(key, (Boolean) value); + } else if (value instanceof String) { + lunarTag.setString(key, (String) value); + } + + tag.set("lunar", lunarTag); + nmsItem.setTag(tag); + + return CraftItemStack.asBukkitCopy(nmsItem); + } + + private ItemUtil() { + } + +} diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/GlintCommand.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/GlintCommand.java new file mode 100644 index 00000000..8f0578dc --- /dev/null +++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/GlintCommand.java @@ -0,0 +1,54 @@ +/* + * This file is part of Apollo, licensed under the MIT License. + * + * Copyright (c) 2023 Moonsworth + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +package com.lunarclient.apollo.example.common.commands.module; + +import com.lunarclient.apollo.example.ApolloExamplePlugin; +import com.lunarclient.apollo.example.common.modules.impl.GlintExample; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.jetbrains.annotations.NotNull; + +public class GlintCommand implements CommandExecutor { + + @Override + public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) { + if (!(sender instanceof Player)) { + sender.sendMessage("Player only!"); + return true; + } + + Player player = (Player) sender; + GlintExample glintExample = ApolloExamplePlugin.getPlugin().getGlintExample(); + + if (glintExample.glintModuleExample(player)) { + player.sendMessage("Giving items..."); + } else { + player.sendMessage("Displaying menu..."); + } + + return true; + } +} diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/InventoryCommand.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/InventoryCommand.java new file mode 100644 index 00000000..2059a63d --- /dev/null +++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/InventoryCommand.java @@ -0,0 +1,54 @@ +/* + * This file is part of Apollo, licensed under the MIT License. + * + * Copyright (c) 2023 Moonsworth + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +package com.lunarclient.apollo.example.common.commands.module; + +import com.lunarclient.apollo.example.ApolloExamplePlugin; +import com.lunarclient.apollo.example.common.modules.impl.InventoryExample; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.jetbrains.annotations.NotNull; + +public class InventoryCommand implements CommandExecutor { + + @Override + public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) { + if (!(sender instanceof Player)) { + sender.sendMessage("Player only!"); + return true; + } + + Player player = (Player) sender; + InventoryExample inventoryExample = ApolloExamplePlugin.getPlugin().getInventoryExample(); + + if (inventoryExample.inventoryModuleExample(player)) { + player.sendMessage("Giving items..."); + } else { + player.sendMessage("Displaying menu..."); + } + + return true; + } +} diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/SaturationCommand.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/SaturationCommand.java new file mode 100644 index 00000000..f909a727 --- /dev/null +++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/SaturationCommand.java @@ -0,0 +1,54 @@ +/* + * This file is part of Apollo, licensed under the MIT License. + * + * Copyright (c) 2023 Moonsworth + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +package com.lunarclient.apollo.example.common.commands.module; + +import com.lunarclient.apollo.example.ApolloExamplePlugin; +import com.lunarclient.apollo.example.common.modules.impl.SaturationExample; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.jetbrains.annotations.NotNull; + +public class SaturationCommand implements CommandExecutor { + + @Override + public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) { + if (!(sender instanceof Player)) { + sender.sendMessage("Player only!"); + return true; + } + + Player player = (Player) sender; + SaturationExample saturationExample = ApolloExamplePlugin.getPlugin().getSaturationExample(); + + if (saturationExample.saturationModuleExample(player)) { + player.sendMessage("Giving items..."); + } else { + player.sendMessage("Displaying menu..."); + } + + return true; + } +} diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/GlintExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/GlintExample.java new file mode 100644 index 00000000..60a3a54a --- /dev/null +++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/GlintExample.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.example.common.modules.impl; + +import com.lunarclient.apollo.example.common.ItemUtil; +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; + +public class GlintExample extends NMSExample { + + public boolean glintModuleExample(Player player) { + if (this.isOneEight()) { + this.glintModuleNMSExample(player); + return false; + } else { + this.glintModuleCommandExample(player); + return true; + } + } + + 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\"}}}}"); + } + + public void glintModuleNMSExample(Player player) { + Inventory inventory = Bukkit.createInventory(player, 5 * 9); + + inventory.setItem(11, ItemUtil.addTag(new ItemStack(Material.DIAMOND_HELMET), "glint", "#FF5733")); + inventory.setItem(14, ItemUtil.addTag(new ItemStack(Material.DIAMOND_HELMET), "glint", "#33FF57")); + inventory.setItem(17, ItemUtil.addTag(new ItemStack(Material.DIAMOND_HELMET), "glint", "#3357FF")); + inventory.setItem(29, ItemUtil.addTag(new ItemStack(Material.DIAMOND_HELMET), "glint", "#FFD700")); + inventory.setItem(33, ItemUtil.addTag(new ItemStack(Material.DIAMOND_HELMET), "glint", -16711936)); + + player.openInventory(inventory); + } + +} diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/InventoryExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/InventoryExample.java new file mode 100644 index 00000000..fe447983 --- /dev/null +++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/InventoryExample.java @@ -0,0 +1,99 @@ +/* + * This file is part of Apollo, licensed under the MIT License. + * + * Copyright (c) 2023 Moonsworth + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +package com.lunarclient.apollo.example.common.modules.impl; + +import com.lunarclient.apollo.example.common.ItemUtil; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; + +public class InventoryExample extends NMSExample { + + public boolean inventoryModuleExample(Player player) { + if (this.isOneEight()) { + this.inventoryModuleNMSExample(player); + return false; + } else { + this.inventoryModuleCommandExample(player); + return true; + } + } + + 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\"}}}}"); + } + + public void inventoryModuleNMSExample(Player player) { + Inventory inventory = Bukkit.createInventory(player, 5 * 9); + + ItemStack unclickableItem = ItemUtil.itemWithName( + Material.STONE, + ChatColor.RED.toString() + ChatColor.BOLD + "UNCLICKABLE" + ); + + inventory.setItem(11, ItemUtil.addTag(unclickableItem, "unclickable", true)); + + ItemStack copyToClipboardItem = ItemUtil.itemWithName( + Material.PAPER, + ChatColor.BLUE.toString() + ChatColor.BOLD + "COPY TO CLIPBOARD" + ); + + copyToClipboardItem = ItemUtil.addTag(copyToClipboardItem, "unclickable", true); + inventory.setItem(14, ItemUtil.addTag(copyToClipboardItem, "copyToClipboard", "lunarclient.com")); + + ItemStack openUrlItem = ItemUtil.itemWithName( + Material.TORCH, + ChatColor.GOLD.toString() + ChatColor.BOLD + "OPEN URL" + ); + + openUrlItem = ItemUtil.addTag(openUrlItem, "unclickable", true); + inventory.setItem(17, ItemUtil.addTag(openUrlItem, "openUrl", "https://lunarclient.com")); + + ItemStack suggestCommandItem = ItemUtil.itemWithName( + Material.BOOK, + ChatColor.GREEN.toString() + ChatColor.BOLD + "SUGGEST COMMAND" + ); + + suggestCommandItem = ItemUtil.addTag(suggestCommandItem, "unclickable", true); + inventory.setItem(29, ItemUtil.addTag(suggestCommandItem, "suggestCommand", "/apollo")); + + ItemStack runCommandItem = ItemUtil.itemWithName( + Material.BOOK_AND_QUILL, + ChatColor.LIGHT_PURPLE.toString() + ChatColor.BOLD + "RUN COMMAND" + ); + + runCommandItem = ItemUtil.addTag(runCommandItem, "unclickable", true); + inventory.setItem(33, ItemUtil.addTag(runCommandItem, "runCommand", "/apollo")); + + player.openInventory(inventory); + } + +} diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/NMSExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/NMSExample.java new file mode 100644 index 00000000..ad11f51f --- /dev/null +++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/NMSExample.java @@ -0,0 +1,38 @@ +/* + * This file is part of Apollo, licensed under the MIT License. + * + * Copyright (c) 2023 Moonsworth + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +package com.lunarclient.apollo.example.common.modules.impl; + +import com.lunarclient.apollo.example.common.modules.ApolloExample; +import org.bukkit.Bukkit; + +public class NMSExample extends ApolloExample { + + public boolean isOneEight() { + return Bukkit.getServer().getClass() + .getPackage().getName() + .split("\\.")[3] + .startsWith("v1_8"); + } + +} diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/SaturationExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/SaturationExample.java new file mode 100644 index 00000000..4d0b5924 --- /dev/null +++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/SaturationExample.java @@ -0,0 +1,73 @@ +/* + * This file is part of Apollo, licensed under the MIT License. + * + * Copyright (c) 2023 Moonsworth + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +package com.lunarclient.apollo.example.common.modules.impl; + +import com.lunarclient.apollo.example.common.ItemUtil; +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; + +public class SaturationExample extends NMSExample { + + public boolean saturationModuleExample(Player player) { + if (this.isOneEight()) { + this.saturationModuleNMSExample(player); + return false; + } else { + this.saturationModuleCommandExample(player); + return true; + } + } + + 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}}}}"); + } + + public void saturationModuleNMSExample(Player player) { + Inventory inventory = Bukkit.createInventory(player, 3 * 9); + + ItemStack apple = new ItemStack(Material.APPLE); + ItemUtil.addTag(apple, "hunger", 22); + ItemUtil.addTag(apple, "saturation", 3); + + ItemStack apple2 = new ItemStack(Material.APPLE); + ItemUtil.addTag(apple, "hunger", 7); + ItemUtil.addTag(apple, "saturation", 7); + + ItemStack apple3 = new ItemStack(Material.APPLE); + ItemUtil.addTag(apple, "hunger", 30); + ItemUtil.addTag(apple, "saturation", 26); + + inventory.setItem(11, apple); + inventory.setItem(14, apple2); + inventory.setItem(17, apple3); + + player.openInventory(inventory); + } + +} diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/ChatJsonExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/ChatJsonExample.java index 092285e6..cb6ae53f 100644 --- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/ChatJsonExample.java +++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/ChatJsonExample.java @@ -24,31 +24,48 @@ package com.lunarclient.apollo.example.json.examples; import com.google.gson.JsonObject; +import com.lunarclient.apollo.example.ApolloExamplePlugin; import com.lunarclient.apollo.example.common.modules.impl.ChatExample; import com.lunarclient.apollo.example.json.AdventureUtil; import com.lunarclient.apollo.example.json.JsonPacketUtil; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.format.NamedTextColor; +import org.bukkit.scheduler.BukkitRunnable; public class ChatJsonExample extends ChatExample { - private int countdown = 5; - @Override public void displayLiveChatMessageExample() { - JsonObject message = new JsonObject(); - message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.chat.v1.DisplayLiveChatMessageMessage"); - message.addProperty("message_id", 13); - message.addProperty("adventure_json_lines", AdventureUtil.toJson( - Component.text("Game starting in ", NamedTextColor.GREEN) - .append(Component.text(this.countdown, NamedTextColor.BLUE)) - )); + BukkitRunnable runnable = new BukkitRunnable() { - if (--this.countdown == 0) { - this.countdown = 5; - } + private int countdown = 5; - JsonPacketUtil.broadcastPacket(message); + @Override + public void run() { + JsonObject message = new JsonObject(); + message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.chat.v1.DisplayLiveChatMessageMessage"); + message.addProperty("message_id", 13); + + if (this.countdown > 0) { + message.addProperty("adventure_json_lines", AdventureUtil.toJson( + Component.text("Game starting in ", NamedTextColor.GREEN) + .append(Component.text(this.countdown, NamedTextColor.BLUE)) + )); + + JsonPacketUtil.broadcastPacket(message); + this.countdown--; + } else { + message.addProperty("adventure_json_lines", AdventureUtil.toJson( + Component.text("Game started! ", NamedTextColor.GREEN) + )); + + JsonPacketUtil.broadcastPacket(message); + this.cancel(); + } + } + }; + + runnable.runTaskTimer(ApolloExamplePlugin.getPlugin(), 0L, 20L); } @Override diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/listeners/ApolloPlayerJsonListener.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/listeners/ApolloPlayerJsonListener.java index 1df631db..688378e8 100644 --- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/listeners/ApolloPlayerJsonListener.java +++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/listeners/ApolloPlayerJsonListener.java @@ -72,7 +72,14 @@ private void onRegisterChannel(PlayerRegisterChannelEvent event) { return; } - this.onApolloRegister(event.getPlayer()); + Player player = event.getPlayer(); + JsonPacketUtil.enableModules(player); + + // Sending the player's world name to the client is required for some modules + JsonPacketUtil.sendPacket(player, this.createUpdatePlayerWorldMessage(player)); + + this.playersRunningApollo.add(player.getUniqueId()); + player.sendMessage("You are using LunarClient!"); } @EventHandler @@ -94,14 +101,4 @@ private boolean isPlayerRunningApollo(Player player) { return this.playersRunningApollo.contains(player.getUniqueId()); } - private void onApolloRegister(Player player) { - JsonPacketUtil.enableModules(player); - - // Sending the player's world name to the client is required for some modules - JsonPacketUtil.sendPacket(player, this.createUpdatePlayerWorldMessage(player)); - - this.playersRunningApollo.add(player.getUniqueId()); - player.sendMessage("You are using LunarClient!"); - } - } diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/ChatProtoExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/ChatProtoExample.java index adda6d26..1ca24849 100644 --- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/ChatProtoExample.java +++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/ChatProtoExample.java @@ -25,31 +25,47 @@ import com.lunarclient.apollo.chat.v1.DisplayLiveChatMessageMessage; import com.lunarclient.apollo.chat.v1.RemoveLiveChatMessageMessage; +import com.lunarclient.apollo.example.ApolloExamplePlugin; import com.lunarclient.apollo.example.common.modules.impl.ChatExample; import com.lunarclient.apollo.example.proto.AdventureUtil; import com.lunarclient.apollo.example.proto.ProtobufPacketUtil; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.format.NamedTextColor; +import org.bukkit.scheduler.BukkitRunnable; public class ChatProtoExample extends ChatExample { - private int countdown = 5; - @Override public void displayLiveChatMessageExample() { - DisplayLiveChatMessageMessage message = DisplayLiveChatMessageMessage.newBuilder() - .setAdventureJsonLines(AdventureUtil.toJson( - Component.text("Game starting in ", NamedTextColor.GREEN) - .append(Component.text(this.countdown, NamedTextColor.BLUE))) - ) - .setMessageId(13) - .build(); + BukkitRunnable runnable = new BukkitRunnable() { - if (--this.countdown == 0) { - this.countdown = 5; - } + private int countdown = 5; - ProtobufPacketUtil.broadcastPacket(message); + @Override + public void run() { + DisplayLiveChatMessageMessage.Builder builder = DisplayLiveChatMessageMessage.newBuilder() + .setMessageId(13); + + if (this.countdown > 0) { + builder.setAdventureJsonLines(AdventureUtil.toJson( + Component.text("Game starting in ", NamedTextColor.GREEN) + .append(Component.text(this.countdown, NamedTextColor.BLUE))) + ); + + ProtobufPacketUtil.broadcastPacket(builder.build()); + this.countdown--; + } else { + builder.setAdventureJsonLines(AdventureUtil.toJson( + Component.text("Game started! ", NamedTextColor.GREEN)) + ); + + ProtobufPacketUtil.broadcastPacket(builder.build()); + this.cancel(); + } + } + }; + + runnable.runTaskTimer(ApolloExamplePlugin.getPlugin(), 0L, 20L); } @Override diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/listeners/ApolloPacketReceiveProtoListener.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/listeners/ApolloPacketReceiveProtoListener.java index 37c22bd9..214cd6fc 100644 --- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/listeners/ApolloPacketReceiveProtoListener.java +++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/listeners/ApolloPacketReceiveProtoListener.java @@ -34,6 +34,7 @@ import com.lunarclient.apollo.packetenrichment.v1.PlayerChatOpenMessage; import com.lunarclient.apollo.packetenrichment.v1.PlayerInfo; import com.lunarclient.apollo.packetenrichment.v1.PlayerUseItemMessage; +import com.lunarclient.apollo.player.v1.EmbeddedCheckoutSupport; import com.lunarclient.apollo.player.v1.ModMessage; import com.lunarclient.apollo.player.v1.PlayerHandshakeMessage; import java.util.List; @@ -76,6 +77,7 @@ private void onPlayerHandshake(PlayerHandshakeMessage message) { MinecraftVersion minecraftVersion = message.getMinecraftVersion(); LunarClientVersion lunarClientVersion = message.getLunarClientVersion(); + EmbeddedCheckoutSupport checkoutSupport = message.getEmbeddedCheckoutSupport(); String gitBranch = lunarClientVersion.getGitBranch(); String gitCommit = lunarClientVersion.getGitCommit(); String semVer = lunarClientVersion.getSemver(); diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/listeners/ApolloPlayerProtoListener.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/listeners/ApolloPlayerProtoListener.java index 1a6553ba..07791f15 100644 --- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/listeners/ApolloPlayerProtoListener.java +++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/listeners/ApolloPlayerProtoListener.java @@ -71,7 +71,14 @@ private void onRegisterChannel(PlayerRegisterChannelEvent event) { return; } - this.onApolloRegister(event.getPlayer()); + Player player = event.getPlayer(); + ProtobufPacketUtil.enableModules(player); + + // Sending the player's world name to the client is required for some modules + ProtobufPacketUtil.sendPacket(player, this.createUpdatePlayerWorldMessage(player)); + + this.playersRunningApollo.add(player.getUniqueId()); + player.sendMessage("You are using LunarClient!"); } @EventHandler @@ -92,14 +99,4 @@ private boolean isPlayerRunningApollo(Player player) { return this.playersRunningApollo.contains(player.getUniqueId()); } - private void onApolloRegister(Player player) { - ProtobufPacketUtil.enableModules(player); - - // Sending the player's world name to the client is required for some modules - ProtobufPacketUtil.sendPacket(player, this.createUpdatePlayerWorldMessage(player)); - - this.playersRunningApollo.add(player.getUniqueId()); - player.sendMessage("You are using LunarClient!"); - } - } diff --git a/bukkit-example/src/main/resources/plugin.yml b/bukkit-example/src/main/resources/plugin.yml index 9daf502d..a354a518 100644 --- a/bukkit-example/src/main/resources/plugin.yml +++ b/bukkit-example/src/main/resources/plugin.yml @@ -1,6 +1,6 @@ name: Apollo-Example main: com.lunarclient.apollo.example.ApolloExamplePlugin -version: 1.1.6 +version: 1.1.7 author: Moonsworth softdepend: [ Apollo-Bukkit ] api-version: 1.13 @@ -22,10 +22,14 @@ commands: description: "Cooldowns!" entity: description: "Entity!" + glint: + description: "Glint!" glow: description: "Glow!" hologram: description: "Holograms!" + inventory: + description: "Inventory!" limb: description: "Limb!" modsettings: @@ -38,6 +42,8 @@ commands: description: "Notifications!" richpresence: description: "Rich Presence!" + saturation: + description: "Saturation!" serverrule: description: "Server Rule!" staffmod: diff --git a/bukkit/src/main/java/com/lunarclient/apollo/ApolloBukkitPlatform.java b/bukkit/src/main/java/com/lunarclient/apollo/ApolloBukkitPlatform.java index 30c0e552..f2be6e51 100644 --- a/bukkit/src/main/java/com/lunarclient/apollo/ApolloBukkitPlatform.java +++ b/bukkit/src/main/java/com/lunarclient/apollo/ApolloBukkitPlatform.java @@ -42,10 +42,12 @@ import com.lunarclient.apollo.module.cooldown.CooldownModuleImpl; import com.lunarclient.apollo.module.entity.EntityModule; import com.lunarclient.apollo.module.entity.EntityModuleImpl; +import com.lunarclient.apollo.module.glint.GlintModule; import com.lunarclient.apollo.module.glow.GlowModule; import com.lunarclient.apollo.module.glow.GlowModuleImpl; import com.lunarclient.apollo.module.hologram.HologramModule; import com.lunarclient.apollo.module.hologram.HologramModuleImpl; +import com.lunarclient.apollo.module.inventory.InventoryModule; import com.lunarclient.apollo.module.limb.LimbModule; import com.lunarclient.apollo.module.limb.LimbModuleImpl; import com.lunarclient.apollo.module.modsetting.ModSettingModule; @@ -59,6 +61,7 @@ import com.lunarclient.apollo.module.packetenrichment.PacketEnrichmentModule; import com.lunarclient.apollo.module.richpresence.RichPresenceModule; import com.lunarclient.apollo.module.richpresence.RichPresenceModuleImpl; +import com.lunarclient.apollo.module.saturation.SaturationModule; import com.lunarclient.apollo.module.serverrule.ServerRuleModule; import com.lunarclient.apollo.module.staffmod.StaffModModule; import com.lunarclient.apollo.module.staffmod.StaffModModuleImpl; @@ -127,8 +130,10 @@ public void onEnable() { .addModule(CombatModule.class) .addModule(CooldownModule.class, new CooldownModuleImpl()) .addModule(EntityModule.class, new EntityModuleImpl()) + .addModule(GlintModule.class) .addModule(GlowModule.class, new GlowModuleImpl()) .addModule(HologramModule.class, new HologramModuleImpl()) + .addModule(InventoryModule.class) .addModule(LimbModule.class, new LimbModuleImpl()) .addModule(ModSettingModule.class) .addModule(NametagModule.class, new NametagModuleImpl()) @@ -136,6 +141,7 @@ public void onEnable() { .addModule(NotificationModule.class, new NotificationModuleImpl()) .addModule(PacketEnrichmentModule.class, new PacketEnrichmentImpl()) .addModule(RichPresenceModule.class, new RichPresenceModuleImpl()) + .addModule(SaturationModule.class) .addModule(ServerRuleModule.class) .addModule(StaffModModule.class, new StaffModModuleImpl()) .addModule(StopwatchModule.class, new StopwatchModuleImpl()) diff --git a/bukkit/src/platform-loader/resources/plugin.yml b/bukkit/src/platform-loader/resources/plugin.yml index 50226f2c..0b857350 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.6 +version: 1.1.7 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 f8c41af6..d5c8fb66 100644 --- a/bungee/src/main/java/com/lunarclient/apollo/ApolloBungeePlatform.java +++ b/bungee/src/main/java/com/lunarclient/apollo/ApolloBungeePlatform.java @@ -50,6 +50,8 @@ import com.lunarclient.apollo.module.nametag.NametagModuleImpl; import com.lunarclient.apollo.module.notification.NotificationModule; import com.lunarclient.apollo.module.notification.NotificationModuleImpl; +import com.lunarclient.apollo.module.richpresence.RichPresenceModule; +import com.lunarclient.apollo.module.richpresence.RichPresenceModuleImpl; import com.lunarclient.apollo.module.serverrule.ServerRuleModule; import com.lunarclient.apollo.module.staffmod.StaffModModule; import com.lunarclient.apollo.module.staffmod.StaffModModuleImpl; @@ -118,6 +120,7 @@ public void onEnable() { .addModule(ModSettingModule.class) .addModule(NametagModule.class, new NametagModuleImpl()) .addModule(NotificationModule.class, new NotificationModuleImpl()) + .addModule(RichPresenceModule.class, new RichPresenceModuleImpl()) .addModule(ServerRuleModule.class) .addModule(StaffModModule.class, new StaffModModuleImpl()) .addModule(StopwatchModule.class, new StopwatchModuleImpl()) diff --git a/bungee/src/platform-loader/resources/plugin.yml b/bungee/src/platform-loader/resources/plugin.yml index 468d6693..0f658e1b 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.6 +version: 1.1.7 author: Moonsworth diff --git a/deploy.sh b/deploy.sh index 78f0ec25..3dbb32ae 100755 --- a/deploy.sh +++ b/deploy.sh @@ -1,7 +1,7 @@ # Deploy apollo to the test server set -e ./gradlew clean build -scp bukkit/build/libs/apollo-bukkit-1.1.6.jar ubuntu@147.135.8.94:/home/ubuntu/apollo/plugins/ -scp bukkit-example/build/libs/apollo-bukkit-example-1.1.6.jar ubuntu@147.135.8.94:/home/ubuntu/apollo/plugins/ -scp bukkit/build/libs/apollo-bukkit-1.1.6.jar ubuntu@147.135.8.94:/home/ubuntu/lctest/plugins/ -scp bukkit-example/build/libs/apollo-bukkit-example-1.1.6.jar ubuntu@147.135.8.94:/home/ubuntu/lctest/plugins/ +scp bukkit/build/libs/apollo-bukkit-1.1.7.jar ubuntu@147.135.8.94:/home/ubuntu/apollo/plugins/ +scp bukkit-example/build/libs/apollo-bukkit-example-1.1.7.jar ubuntu@147.135.8.94:/home/ubuntu/apollo/plugins/ +scp bukkit/build/libs/apollo-bukkit-1.1.7.jar ubuntu@147.135.8.94:/home/ubuntu/lctest/plugins/ +scp bukkit-example/build/libs/apollo-bukkit-example-1.1.7.jar ubuntu@147.135.8.94:/home/ubuntu/lctest/plugins/ diff --git a/docs/developers/events.mdx b/docs/developers/events.mdx index 29da98b5..860343cd 100644 --- a/docs/developers/events.mdx +++ b/docs/developers/events.mdx @@ -11,7 +11,7 @@ Apollo provides its own listener based event system, similar to the existing eve
ApolloRegisterPlayerEvent -#### ApolloRegisterPlayerEvent +### ApolloRegisterPlayerEvent _Called when the player joins the server using Lunar Client._ @@ -24,7 +24,7 @@ _Called when the player joins the server using Lunar Client._
ApolloUnregisterPlayerEvent -#### ApolloUnregisterPlayerEvent +### ApolloUnregisterPlayerEvent _Called when the player leaves the server using Lunar Client._ @@ -37,7 +37,7 @@ _Called when the player leaves the server using Lunar Client._
ApolloPlayerHandshakeEvent -#### ApolloPlayerHandshakeEvent +### ApolloPlayerHandshakeEvent _Called when the client sends a PlayerHandshakeMessage._ @@ -52,7 +52,7 @@ _Called when the client sends a PlayerHandshakeMessage._
Minecraft Version Information -##### All `MinecraftVersion minecraftVersion` Versions +**All `MinecraftVersion minecraftVersion` Versions** - V1_7 - V1_8 @@ -85,7 +85,7 @@ _Called when the client sends a PlayerHandshakeMessage._
Lunar Client Version Information -##### How `LunarClientVersion lunarClientVersion` Works +**How `lunarClientVersion` Works** This returns all the attributes about the version of Lunar Client the player is using. @@ -100,7 +100,7 @@ This returns all the attributes about the version of Lunar Client the player is
LunarClientMod (Installed Mods) Information -##### How `List installedMods` Works +**How `installedMods` Works** This returns a list of each mod, and its respective attributes. @@ -129,7 +129,7 @@ This returns a list of each mod, and its respective attributes.
ApolloReceivePacketEvent -#### ApolloReceivePacketEvent +### ApolloReceivePacketEvent _Called when the Apollo player receives an Apollo packet from Lunar Client._ @@ -143,7 +143,7 @@ _Called when the Apollo player receives an Apollo packet from Lunar Client._
ApolloSendPacketEvent -#### ApolloSendPacketEvent +### ApolloSendPacketEvent _Called when the Apollo player sends an Apollo packet to Lunar Client._ @@ -159,7 +159,7 @@ _Called when the Apollo player sends an Apollo packet to Lunar Client._
ApolloUpdateOptionEvent -#### ApolloUpdateOptionEvent +### ApolloUpdateOptionEvent _Called when an option is updated._ @@ -177,7 +177,7 @@ _Called when an option is updated._
ApolloPlayerChatCloseEvent -#### ApolloPlayerChatCloseEvent +### ApolloPlayerChatCloseEvent _Called when the player closes their chat._ @@ -191,7 +191,7 @@ _Called when the player closes their chat._
ApolloPlayerChatOpenEvent -#### ApolloPlayerChatOpenEvent +### ApolloPlayerChatOpenEvent _Called when the player opens their chat._ @@ -205,7 +205,7 @@ _Called when the player opens their chat._
ApolloPlayerAttackEvent -#### ApolloPlayerAttackEvent +### ApolloPlayerAttackEvent _Called when the player attacks another player._ @@ -221,7 +221,7 @@ _Called when the player attacks another player._
ApolloPlayerUseItemEvent -#### ApolloPlayerUseItemEvent +### ApolloPlayerUseItemEvent _Called when the player uses an item (1.16.1+)._ diff --git a/docs/developers/lightweight/json/player-detection.mdx b/docs/developers/lightweight/json/player-detection.mdx index ad182689..80b67ac2 100644 --- a/docs/developers/lightweight/json/player-detection.mdx +++ b/docs/developers/lightweight/json/player-detection.mdx @@ -37,6 +37,7 @@ public class ApolloPlayerJsonListener implements Listener { return; } + Player player = event.getPlayer(); JsonPacketUtil.enableModules(player); // Sending the player's world name to the client is required for some modules diff --git a/docs/developers/lightweight/protobuf/player-detection.mdx b/docs/developers/lightweight/protobuf/player-detection.mdx index 12d59a6a..40c8af50 100644 --- a/docs/developers/lightweight/protobuf/player-detection.mdx +++ b/docs/developers/lightweight/protobuf/player-detection.mdx @@ -27,6 +27,7 @@ public class ApolloPlayerProtoListener implements Listener { return; } + Player player = event.getPlayer(); ProtobufPacketUtil.enableModules(player); // Sending the player's world name to the client is required for some modules diff --git a/docs/developers/mods/_meta.json b/docs/developers/mods/_meta.json index 33066fdc..3fb09178 100644 --- a/docs/developers/mods/_meta.json +++ b/docs/developers/mods/_meta.json @@ -51,6 +51,7 @@ "potioneffects": "PotionEffects", "pvpinfo": "PvpInfo", "quickplay": "Quickplay", + "radio": "Radio", "reachdisplay": "ReachDisplay", "replaymod": "Replaymod", "saturation": "Saturation", diff --git a/docs/developers/mods/coordinates.mdx b/docs/developers/mods/coordinates.mdx index eaac3d15..d50cd9d6 100644 --- a/docs/developers/mods/coordinates.mdx +++ b/docs/developers/mods/coordinates.mdx @@ -29,12 +29,6 @@ public void toggleCoordinatesExample(Player viewer, boolean value) { - Minimum: `0.5F` - Maximum: `1.5F` -- __`BACKGROUND`__ - - Config Key: `background` - - Values - - Type: `Boolean` - - Default: `true` - - __`TEXT_SHADOW`__ - Config Key: `text-shadow` - Values @@ -47,6 +41,12 @@ public void toggleCoordinatesExample(Player viewer, boolean value) { - Type: `Boolean` - Default: `true` +- __`BACKGROUND`__ + - Config Key: `background` + - Values + - Type: `Boolean` + - Default: `true` + - __`BORDER`__ - Config Key: `border` - Values diff --git a/docs/developers/mods/daycounter.mdx b/docs/developers/mods/daycounter.mdx index 84208afa..b81d78a8 100644 --- a/docs/developers/mods/daycounter.mdx +++ b/docs/developers/mods/daycounter.mdx @@ -116,6 +116,7 @@ public void toggleDayCounterExample(Player viewer, boolean value) { - Default: `#FFFFFFFF` - __`USE_WORLD_TYPE`__ + - If enabled, this will show the day of the world. If disabled, it will display your playtime in that world. - Config Key: `use-world-type` - Values - Type: `Boolean` diff --git a/docs/developers/mods/potioneffects.mdx b/docs/developers/mods/potioneffects.mdx index 29b6009d..db4c0d6d 100644 --- a/docs/developers/mods/potioneffects.mdx +++ b/docs/developers/mods/potioneffects.mdx @@ -97,134 +97,140 @@ public void togglePotionEffectsExample(Player viewer, boolean value) { - Type: `Boolean` - Default: `false` -- __`EXCLUDE_SPEED`__ - - Config Key: `exclude-speed` +- __`EXCLUDE_ABSORPTION`__ + - Config Key: `exclude-absorption` - Values - Type: `Boolean` - Default: `false` -- __`EXCLUDE_SLOWNESS`__ - - Config Key: `exclude-slowness` +- __`EXCLUDE_BLINDNESS`__ + - Config Key: `exclude-blindness` - Values - Type: `Boolean` - Default: `false` -- __`EXCLUDE_JUMP_BOOST`__ - - Config Key: `exclude-jump-boost` +- __`EXCLUDE_FIRE_RES`__ + - Config Key: `exclude-fire-res` - Values - Type: `Boolean` - Default: `false` -- __`EXCLUDE_REGEN`__ - - Config Key: `exclude-regen` +- __`EXCLUDE_HASTE`__ + - Config Key: `exclude-haste` - Values - Type: `Boolean` - Default: `false` -- __`EXCLUDE_FIRE_RES`__ - - Config Key: `exclude-fire-res` +- __`EXCLUDE_HEALTH_BOOST`__ + - Config Key: `exclude-health-boost` - Values - Type: `Boolean` - Default: `false` -- __`EXCLUDE_WATER_BREATHING`__ - - Config Key: `exclude-water-breathing` +- __`EXCLUDE_HUNGER`__ + - Config Key: `exclude-hunger` - Values - Type: `Boolean` - Default: `false` -- __`EXCLUDE_NIGHT_VISION`__ - - Config Key: `exclude-night-vision` +- __`EXCLUDE_INSTANT_DAMAGE`__ + - Config Key: `exclude-instant-damage` - Values - Type: `Boolean` - Default: `false` -- __`EXCLUDE_WEAKNESS`__ - - Config Key: `exclude-weakness` +- __`EXCLUDE_INSTANT_HEALTH`__ + - Config Key: `exclude-instant-health` - Values - Type: `Boolean` - Default: `false` -- __`EXCLUDE_POISON`__ - - Config Key: `exclude-poison` +- __`EXCLUDE_INVIS`__ + - Config Key: `exclude-invis` - Values - Type: `Boolean` - Default: `false` -- __`EXCLUDE_STRENGTH`__ - - Config Key: `exclude-strength` +- __`EXCLUDE_JUMP_BOOST`__ + - Config Key: `exclude-jump-boost` - Values - Type: `Boolean` - Default: `false` -- __`EXCLUDE_HASTE`__ - - Config Key: `exclude-haste` +- __`EXCLUDE_MINING_FATIGUE`__ + - Config Key: `exclude-mining-fatigue` - Values - Type: `Boolean` - Default: `false` -- __`EXCLUDE_INVIS`__ - - Config Key: `exclude-invis` +- __`EXCLUDE_NAUSEA`__ + - Config Key: `exclude-nausea` - Values - Type: `Boolean` - Default: `false` -- __`EXCLUDE_MINING_FATIGUE`__ - - Config Key: `exclude-mining-fatigue` +- __`EXCLUDE_NIGHT_VISION`__ + - Config Key: `exclude-night-vision` - Values - Type: `Boolean` - Default: `false` -- __`EXCLUDE_INSTANT_HEALTH`__ - - Config Key: `exclude-instant-health` +- __`EXCLUDE_POISON`__ + - Config Key: `exclude-poison` - Values - Type: `Boolean` - Default: `false` -- __`EXCLUDE_INSTANT_DAMAGE`__ - - Config Key: `exclude-instant-damage` +- __`EXCLUDE_REGEN`__ + - Config Key: `exclude-regen` - Values - Type: `Boolean` - Default: `false` -- __`EXCLUDE_NAUSEA`__ - - Config Key: `exclude-nausea` +- __`EXCLUDE_RESISTANCE`__ + - Config Key: `exclude-resistance` - Values - Type: `Boolean` - Default: `false` -- __`EXCLUDE_BLINDNESS`__ - - Config Key: `exclude-blindness` +- __`EXCLUDE_SATURATION`__ + - Config Key: `exclude-saturation` - Values - Type: `Boolean` - Default: `false` -- __`EXCLUDE_HUNGER`__ - - Config Key: `exclude-hunger` +- __`EXCLUDE_SLOWNESS`__ + - Config Key: `exclude-slowness` - Values - Type: `Boolean` - Default: `false` -- __`EXCLUDE_WITHER`__ - - Config Key: `exclude-wither` +- __`EXCLUDE_SPEED`__ + - Config Key: `exclude-speed` - Values - Type: `Boolean` - Default: `false` -- __`EXCLUDE_HEALTH_BOOST`__ - - Config Key: `exclude-health-boost` +- __`EXCLUDE_STRENGTH`__ + - Config Key: `exclude-strength` - Values - Type: `Boolean` - Default: `false` -- __`EXCLUDE_ABSORPTION`__ - - Config Key: `exclude-absorption` +- __`EXCLUDE_WATER_BREATHING`__ + - Config Key: `exclude-water-breathing` - Values - Type: `Boolean` - Default: `false` -- __`EXCLUDE_SATURATION`__ - - Config Key: `exclude-saturation` +- __`EXCLUDE_WEAKNESS`__ + - Config Key: `exclude-weakness` + - Values + - Type: `Boolean` + - Default: `false` + +- __`EXCLUDE_WITHER`__ + - Config Key: `exclude-wither` - Values - Type: `Boolean` - Default: `false` diff --git a/docs/developers/mods/radio.mdx b/docs/developers/mods/radio.mdx new file mode 100644 index 00000000..737d4930 --- /dev/null +++ b/docs/developers/mods/radio.mdx @@ -0,0 +1,173 @@ +# Radio + +Enjoy some of your favorite songs provided by Styngr. + +## Integration + +### How to toggle the mod + +```java +public void toggleRadioExample(Player viewer, boolean value) { + Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId()); + apolloPlayerOpt.ifPresent(apolloPlayer -> this.modSettingModule.getOptions().set(apolloPlayer, ModRadio.ENABLED, value)); +} +``` + +## Available options + +- __`ENABLED`__ + - Config Key: `enabled` + - Values + - 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 + - Type: `Integer` + - Default: `50` + - Minimum: `0` + - Maximum: `100` + +- __`MUTE_RADIO`__ + - Config Key: `mute-radio` + - Values + - Type: `Boolean` + - Default: `false` + +- __`BACKGROUND`__ + - Config Key: `background` + - Values + - 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: `140` + - Minimum: `60` + - Maximum: `300` + +- __`BACKGROUND_HEIGHT`__ + - Config Key: `background-height` + - Values + - Type: `Integer` + - Default: `24` + - Minimum: `22` + - Maximum: `64` + +- __`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` + +- __`BORDER_COLOR`__ + - Config Key: `border-color` + - Values + - Type: `String` + - Default: `#9F000000` + +- __`BACKGROUND_COLOR`__ + - Config Key: `background-color` + - Values + - Type: `String` + - Default: `#6F000000` + +- __`SHOW_COVER_ART`__ + - Config Key: `show-cover-art` + - Values + - Type: `Boolean` + - Default: `true` + +- __`SHOW_PROGRESS`__ + - Config Key: `show-progress` + - Values + - Type: `Boolean` + - Default: `true` + +- __`SONG_SCROLL_ANIMATION`__ + - Config Key: `song-scroll-animation` + - Values + - Type: `Boolean` + - Default: `true` + +- __`SHOW_WHEN_NOTHING_PLAYING`__ + - Config Key: `show-when-nothing-playing` + - Values + - Type: `Boolean` + - Default: `false` + +- __`BOLD_ARIST_NAME`__ + - Config Key: `bold-arist-name` + - Values + - Type: `Boolean` + - Default: `false` + +- __`BOLD_SONG_NAME`__ + - Config Key: `bold-song-name` + - Values + - Type: `Boolean` + - Default: `true` + +- __`SHOW_DURATION`__ + - Config Key: `show-duration` + - Values + - Type: `Boolean` + - Default: `true` + +- __`SHOW_PLAY_BUTTON`__ + - Config Key: `show-play-button` + - Values + - Type: `Boolean` + - Default: `true` + +- __`SONG_NAME_TEXT_COLOR`__ + - Config Key: `song-name-text-color` + - Values + - Type: `String` + - Default: `#FFFFFFFF` + +- __`ARTIST_NAME_TEXT_COLOR`__ + - Config Key: `artist-name-text-color` + - Values + - Type: `String` + - Default: `#FFFFFFFF` + +- __`RADIO_PROGRESS_BAR_COLOR`__ + - Config Key: `radio-progress-bar-color` + - Values + - Type: `String` + - Default: `#FF4F94FC` + diff --git a/docs/developers/mods/skyblock.mdx b/docs/developers/mods/skyblock.mdx index 08b3dd8c..a5e9963c 100644 --- a/docs/developers/mods/skyblock.mdx +++ b/docs/developers/mods/skyblock.mdx @@ -86,6 +86,20 @@ public void toggleHypixelSkyblockExample(Player viewer, boolean value) { - Type: `Boolean` - Default: `false` +- __`SKY_BLOCK_CREATION_DATE`__ + - Shows the creation date of the item in the lore. + - Config Key: `sky-block-creation-date` + - Values + - Type: `Boolean` + - Default: `false` + +- __`SKY_BLOCK_ITEM_ID`__ + - Shows the item's SkyBlock ID in the lore. + - Config Key: `sky-block-item-id` + - Values + - Type: `Boolean` + - Default: `false` + - __`SHOW_GIANT_HPAT_FEET`__ - Makes Giant HP more visible by showing their HP at their feet. - Config Key: `show-giant-h-p-at-feet` @@ -93,6 +107,12 @@ public void toggleHypixelSkyblockExample(Player viewer, boolean value) { - Type: `Boolean` - Default: `false` +- __`DUNGEON_SECRETS_COLLECTED`__ + - Config Key: `dungeon-secrets-collected` + - Values + - Type: `Boolean` + - Default: `false` + - __`TALLER_CROPS`__ - Changes crop hitboxes with their 1.12+ variant. Only enabled on Hypixel or singleplayer. - Config Key: `taller-crops` @@ -186,3 +206,12 @@ public void toggleHypixelSkyblockExample(Player viewer, boolean value) { - Type: `Boolean` - Default: `false` +- __`SKYBLOCK_LINE_THICKNESS`__ + - Provides a general line thickness option that applies to most features with box/line rendering. + - Config Key: `skyblock-line-thickness` + - Values + - Type: `Float` + - Default: `4.0F` + - Minimum: `1.0F` + - Maximum: `10.0F` + diff --git a/docs/developers/modules/_meta.json b/docs/developers/modules/_meta.json index d345ddf9..8d24bb7e 100644 --- a/docs/developers/modules/_meta.json +++ b/docs/developers/modules/_meta.json @@ -9,6 +9,7 @@ "glint": "Glint", "glow": "Glow", "hologram": "Hologram", + "inventory": "Inventory", "limb": "Limb", "modsetting": "Mod Setting", "nametag": "Nametag", @@ -21,6 +22,7 @@ "staffmod": "Staff Mod", "stopwatch": "Stopwatch", "team": "Team", + "tebex": "Tebex", "title": "Title", "tntcountdown": "TNT Countdown", "transfer": "Transfer", diff --git a/docs/developers/modules/beam.mdx b/docs/developers/modules/beam.mdx index 75a4e4c8..709fc57c 100644 --- a/docs/developers/modules/beam.mdx +++ b/docs/developers/modules/beam.mdx @@ -129,7 +129,7 @@ Custom colors can be created from any RGB values using `new Color(int red, int g -### Displaying a Beam +**Displaying a Beam** ```java public void displayBeamExample(Player viewer) { @@ -143,7 +143,7 @@ public void displayBeamExample(Player viewer) { } ``` -### Removing a Beam +**Removing a Beam** ```java public void removeBeamExample(Player viewer) { @@ -155,7 +155,7 @@ public void removeBeamExample(Player viewer) { } ``` -### Resetting all Beams +**Resetting all Beams** ```java public void resetBeamsExample(Player viewer) { @@ -168,7 +168,7 @@ public void resetBeamsExample(Player viewer) { -### Displaying a Beam +**Displaying a Beam** ```java public void displayBeamExample(Player viewer) { @@ -184,7 +184,7 @@ public void displayBeamExample(Player viewer) { } ``` -### Removing a Beam +**Removing a Beam** ```java public void removeBeamExample(Player viewer) { @@ -196,7 +196,7 @@ public void removeBeamExample(Player viewer) { } ``` -### Resetting all Beams +**Resetting all Beams** ```java public void resetBeamsExample(Player viewer) { diff --git a/docs/developers/modules/border.mdx b/docs/developers/modules/border.mdx index 98f70da1..3532abea 100644 --- a/docs/developers/modules/border.mdx +++ b/docs/developers/modules/border.mdx @@ -1,4 +1,5 @@ import { Tab, Tabs } from 'nextra-theme-docs' +import { Callout } from 'nextra-theme-docs' # Border Module @@ -12,6 +13,10 @@ The border module not only enhances Minecraft's current world border system, but - Custom border colors can be provided. - Ability to generate and display multiple world borders at once. + + This module is only supported for 1.7 to 1.12 versions of Lunar Client. + + ## Integration ### Sample Code @@ -157,7 +162,7 @@ Custom colors can be created from any RGB values using `new Color(int red, int g -### Displaying a Border +**Displaying a Border** ```java public void displayBorderExample(Player viewer) { @@ -176,7 +181,7 @@ public void displayBorderExample(Player viewer) { } ``` -### Removing a Border +**Removing a Border** ```java public void removeBorderExample(Player viewer) { @@ -188,7 +193,7 @@ public void removeBorderExample(Player viewer) { } ``` -### Resetting all Borders +**Resetting all Borders** ```java public void resetBordersExample(Player viewer) { @@ -201,7 +206,7 @@ public void resetBordersExample(Player viewer) { -### Displaying a Border +**Displaying a Border** ```java public void displayBorderExample(Player viewer) { @@ -220,7 +225,7 @@ public void displayBorderExample(Player viewer) { } ``` -### Removing a Border +**Removing a Border** ```java public void removeBorderExample(Player viewer) { @@ -232,7 +237,7 @@ public void removeBorderExample(Player viewer) { } ``` -### Resetting all Borders +**Resetting all Borders** ```java public void resetBordersExample(Player viewer) { diff --git a/docs/developers/modules/chat.mdx b/docs/developers/modules/chat.mdx index b73d70c4..add6a7fc 100644 --- a/docs/developers/modules/chat.mdx +++ b/docs/developers/modules/chat.mdx @@ -27,18 +27,31 @@ Explore each integration by cycling through each tab, to find the best fit for y ### Displaying a Live Chat Message ```java -private int countdown = 5; - public void displayLiveChatMessageExample() { - this.chatModule.displayLiveChatMessage(Recipients.ofEveryone(), - Component.text("Game starting in ", NamedTextColor.GREEN) - .append(Component.text(this.countdown, NamedTextColor.BLUE)), - 13 - ); - - if (--this.countdown == 0) { - this.countdown = 5; - } + BukkitRunnable runnable = new BukkitRunnable() { + + private int countdown = 5; + + @Override + public void run() { + ChatApiExample.this.chatModule.displayLiveChatMessage(Recipients.ofEveryone(), + Component.text("Game starting in ", NamedTextColor.GREEN) + .append(Component.text(this.countdown, NamedTextColor.BLUE)), + 13 + ); + + if (--this.countdown == 0) { + ChatApiExample.this.chatModule.displayLiveChatMessage(Recipients.ofEveryone(), + Component.text("Game started! ", NamedTextColor.GREEN), + 13 + ); + + this.cancel(); + } + } + }; + + runnable.runTaskTimer(ApolloExamplePlugin.getPlugin(), 0L, 20L); } ``` @@ -54,29 +67,44 @@ public void removeLiveChatMessageExample() { -### Displaying a Live Chat Message +**Displaying a Live Chat Message** ```java -private int countdown = 5; - +@Override public void displayLiveChatMessageExample() { - DisplayLiveChatMessageMessage message = DisplayLiveChatMessageMessage.newBuilder() - .setAdventureJsonLines(AdventureUtil.toJson( - Component.text("Game starting in ", NamedTextColor.GREEN) - .append(Component.text(this.countdown, NamedTextColor.BLUE))) - ) - .setMessageId(13) - .build(); - - if (--this.countdown == 0) { - this.countdown = 5; - } - - ProtobufPacketUtil.broadcastPacket(message); + BukkitRunnable runnable = new BukkitRunnable() { + + private int countdown = 5; + + @Override + public void run() { + DisplayLiveChatMessageMessage.Builder builder = DisplayLiveChatMessageMessage.newBuilder() + .setMessageId(13); + + if (this.countdown > 0) { + builder.setAdventureJsonLines(AdventureUtil.toJson( + Component.text("Game starting in ", NamedTextColor.GREEN) + .append(Component.text(this.countdown, NamedTextColor.BLUE))) + ); + + ProtobufPacketUtil.broadcastPacket(builder.build()); + this.countdown--; + } else { + builder.setAdventureJsonLines(AdventureUtil.toJson( + Component.text("Game started! ", NamedTextColor.GREEN)) + ); + + ProtobufPacketUtil.broadcastPacket(builder.build()); + this.cancel(); + } + } + }; + + runnable.runTaskTimer(ApolloExamplePlugin.getPlugin(), 0L, 20L); } ``` -### Removing a Live Chat Message +**Removing a Live Chat Message** ```java public void removeLiveChatMessageExample() { @@ -92,29 +120,45 @@ public void removeLiveChatMessageExample() { -### Displaying a Live Chat Message +**Displaying a Live Chat Message** ```java -private int countdown = 5; - +@Override public void displayLiveChatMessageExample() { - JsonObject message = new JsonObject(); - message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.chat.v1.DisplayLiveChatMessageMessage"); - message.addProperty("message_id", 13); - message.addProperty("adventure_json_lines", AdventureUtil.toJson( - Component.text("Game starting in ", NamedTextColor.GREEN) - .append(Component.text(this.countdown, NamedTextColor.BLUE)) - )); - - if (--this.countdown == 0) { - this.countdown = 5; - } - - JsonPacketUtil.broadcastPacket(message); + BukkitRunnable runnable = new BukkitRunnable() { + + private int countdown = 5; + + @Override + public void run() { + JsonObject message = new JsonObject(); + message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.chat.v1.DisplayLiveChatMessageMessage"); + message.addProperty("message_id", 13); + + if (this.countdown > 0) { + message.addProperty("adventure_json_lines", AdventureUtil.toJson( + Component.text("Game starting in ", NamedTextColor.GREEN) + .append(Component.text(this.countdown, NamedTextColor.BLUE)) + )); + + JsonPacketUtil.broadcastPacket(message); + this.countdown--; + } else { + message.addProperty("adventure_json_lines", AdventureUtil.toJson( + Component.text("Game started! ", NamedTextColor.GREEN) + )); + + JsonPacketUtil.broadcastPacket(message); + this.cancel(); + } + } + }; + + runnable.runTaskTimer(ApolloExamplePlugin.getPlugin(), 0L, 20L); } ``` -### Removing a Live Chat Message +**Removing a Live Chat Message** ```java public void removeLiveChatMessageExample() { diff --git a/docs/developers/modules/coloredfire.mdx b/docs/developers/modules/coloredfire.mdx index 5a70cbaf..1db9444c 100644 --- a/docs/developers/modules/coloredfire.mdx +++ b/docs/developers/modules/coloredfire.mdx @@ -62,7 +62,7 @@ public void resetColoredFiresExample(Player viewer) { -### Override a Fire Color +**Override a Fire Color** ```java public void overrideColoredFireExample(UUID burningPlayer) { @@ -75,7 +75,7 @@ public void overrideColoredFireExample(UUID burningPlayer) { } ``` -### Removing a Fire Color +**Removing a Fire Color** ```java public void resetColoredFireExample(UUID burningPlayer) { @@ -87,7 +87,7 @@ public void resetColoredFireExample(UUID burningPlayer) { } ``` -### Resetting all Fire Colors +**Resetting all Fire Colors** ```java public void resetColoredFiresExample(Player viewer) { @@ -100,7 +100,7 @@ public void resetColoredFiresExample(Player viewer) { -### Override a Fire Color +**Override a Fire Color** ```java public void overrideColoredFireExample(UUID burningPlayer) { @@ -113,7 +113,7 @@ public void overrideColoredFireExample(UUID burningPlayer) { } ``` -### Removing a Fire Color +**Removing a Fire Color** ```java public void resetColoredFireExample(UUID burningPlayer) { @@ -125,7 +125,7 @@ public void resetColoredFireExample(UUID burningPlayer) { } ``` -### Resetting all Fire Colors +**Resetting all Fire Colors** ```java public void resetColoredFiresExample(Player viewer) { diff --git a/docs/developers/modules/combat.mdx b/docs/developers/modules/combat.mdx index 7bda044f..06e6382c 100644 --- a/docs/developers/modules/combat.mdx +++ b/docs/developers/modules/combat.mdx @@ -1,4 +1,4 @@ -import { Callout } from 'nextra-theme-docs' +import { Tab, Tabs } from 'nextra-theme-docs' # Combat Module @@ -6,11 +6,58 @@ import { Callout } from 'nextra-theme-docs' The combat module allows you to modify certain aspects of combat that are usually handled client-sided. -* Adds the ability to disable the 1.8 miss penalty, commonly known as 'hit-delay'. +- Adds the ability to disable the miss penalty, on all versions 1.8 and above. - - This is a bare bones module to add support for the legacy-API feature 'LEGACY_COMBAT'. - +### Sample Code +Explore each integration by cycling through each tab, to find the best fit for your requirements and needs. + + + + + +### Toggle Miss Penalty + +```java +public void setDisableMissPenalty(boolean value) { + this.combatModule.getOptions().set(CombatModule.DISABLE_MISS_PENALTY, value); +} +``` + + + + + +### Toggle Miss Penalty + +```java +public void setDisableMissPenalty(boolean value) { + Map properties = new HashMap<>(); + properties.put("disable-miss-penalty", Value.newBuilder().setBoolValue(value).build()); + + ConfigurableSettings settings = ProtobufPacketUtil.createModuleMessage("combat", properties); + ProtobufPacketUtil.broadcastPacket(settings); +} +``` + + + + + +### Toggle Miss Penalty + +```java +public void setDisableMissPenalty(boolean value) { + Map properties = new HashMap<>(); + properties.put("disable-miss-penalty", value); + + JsonObject message = JsonUtil.createEnableModuleObjectWithType("combat", properties); + JsonPacketUtil.broadcastPacket(message); +} +``` + + + + ## Available options diff --git a/docs/developers/modules/cooldown.mdx b/docs/developers/modules/cooldown.mdx index e0bf5edc..3567967e 100644 --- a/docs/developers/modules/cooldown.mdx +++ b/docs/developers/modules/cooldown.mdx @@ -114,7 +114,7 @@ public void resetCooldownsExample(Player viewer) { -### Displaying a Cooldown with an item +**Displaying a Cooldown with an item** ```java public void displayCooldownItemExample(Player viewer) { @@ -128,7 +128,7 @@ public void displayCooldownItemExample(Player viewer) { } ``` -### Displaying a Cooldown with a resource +**Displaying a Cooldown with a resource** ```java public void displayCooldownResourceExample(Player viewer) { @@ -142,7 +142,7 @@ public void displayCooldownResourceExample(Player viewer) { } ``` -### Removing a Cooldown +**Removing a Cooldown** ```java public void removeCooldownExample(Player viewer) { @@ -154,7 +154,7 @@ public void removeCooldownExample(Player viewer) { } ``` -### Resetting all Cooldowns +**Resetting all Cooldowns** ```java public void resetCooldownsExample(Player viewer) { @@ -167,7 +167,7 @@ public void resetCooldownsExample(Player viewer) { -### Displaying a Cooldown with an item +**Displaying a Cooldown with an item** ```java public void displayCooldownItemExample(Player viewer) { @@ -181,7 +181,7 @@ public void displayCooldownItemExample(Player viewer) { } ``` -### Displaying a Cooldown with a resource +**Displaying a Cooldown with a resource** ```java public void displayCooldownResourceExample(Player viewer) { @@ -195,7 +195,7 @@ public void displayCooldownResourceExample(Player viewer) { } ``` -### Removing a Cooldown +**Removing a Cooldown** ```java public void removeCooldownExample(Player viewer) { @@ -207,7 +207,7 @@ public void removeCooldownExample(Player viewer) { } ``` -### Resetting all Cooldowns +**Resetting all Cooldowns** ```java public void resetCooldownsExample(Player viewer) { diff --git a/docs/developers/modules/entity.mdx b/docs/developers/modules/entity.mdx index 6ca479ba..0bbeaff1 100644 --- a/docs/developers/modules/entity.mdx +++ b/docs/developers/modules/entity.mdx @@ -100,7 +100,7 @@ public void resetFlippedEntityExample(Player viewer) { -### Override Sheep rainbow state +**Override Sheep rainbow state** ```java public void overrideRainbowSheepExample(Player viewer) { @@ -116,7 +116,7 @@ public void overrideRainbowSheepExample(Player viewer) { } ``` -### Reset Sheep rainbow state +**Reset Sheep rainbow state** ```java public void resetRainbowSheepExample(Player viewer) { @@ -132,7 +132,7 @@ public void resetRainbowSheepExample(Player viewer) { } ``` -### Override Entity flip state +**Override Entity flip state** ```java public void flipEntityExample(Player viewer) { @@ -150,7 +150,7 @@ public void flipEntityExample(Player viewer) { } ``` -### Reset Entity flip state +**Reset Entity flip state** ```java public void resetFlippedEntityExample(Player viewer) { @@ -172,7 +172,7 @@ public void resetFlippedEntityExample(Player viewer) { -### Override Sheep rainbow state +**Override Sheep rainbow state** ```java public void overrideRainbowSheepExample(Player viewer) { @@ -188,7 +188,7 @@ public void overrideRainbowSheepExample(Player viewer) { } ``` -### Reset Sheep rainbow state +**Reset Sheep rainbow state** ```java public void resetRainbowSheepExample(Player viewer) { @@ -204,7 +204,7 @@ public void resetRainbowSheepExample(Player viewer) { } ``` -### Override Entity flip state +**Override Entity flip state** ```java public void flipEntityExample(Player viewer) { @@ -222,7 +222,7 @@ public void flipEntityExample(Player viewer) { } ``` -### Reset Entity flip state +**Reset Entity flip state** ```java public void resetFlippedEntityExample(Player viewer) { diff --git a/docs/developers/modules/glint.mdx b/docs/developers/modules/glint.mdx index 0592ed4d..a1af4cfb 100644 --- a/docs/developers/modules/glint.mdx +++ b/docs/developers/modules/glint.mdx @@ -1,3 +1,4 @@ +import { Tab, Tabs } from 'nextra-theme-docs' import { Callout } from 'nextra-theme-docs' # Glint Module @@ -28,3 +29,98 @@ You set a custom NBT, with the tag `{lunar:{glint:value}}` then set the `{value} Examples: - `{lunar:{glint:-65535}}` will display a light blue glint. - `{lunar:{glint:"#FFFF00"}}` will display a yellow glint. + +### Sample Code +Explore each integration by cycling through each tab, to find the best fit for your requirements and needs. + + + + + +**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,tag:{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,tag:{lunar:{glint:"#FFD700"}}}}` + +`/summon item ~ ~1 ~ {Item:{id:"minecraft:diamond_helmet",Count:1b,tag:{lunar:{glint:"-16711936"}}}}` + + + + + + + This example is compatible only with Spigot 1.8. + + +**Item Creation** + +```java +public void glintModuleNMSExample(Player player) { + Inventory inventory = Bukkit.createInventory(player, 5 * 9); + + inventory.setItem(11, ItemUtil.addTag(new ItemStack(Material.DIAMOND_HELMET), "glint", "#FF5733")); + inventory.setItem(14, ItemUtil.addTag(new ItemStack(Material.DIAMOND_HELMET), "glint", "#33FF57")); + inventory.setItem(17, ItemUtil.addTag(new ItemStack(Material.DIAMOND_HELMET), "glint", "#3357FF")); + inventory.setItem(29, ItemUtil.addTag(new ItemStack(Material.DIAMOND_HELMET), "glint", "#FFD700")); + inventory.setItem(33, ItemUtil.addTag(new ItemStack(Material.DIAMOND_HELMET), "glint", -16711936)); + + player.openInventory(inventory); +} +``` + +**Helper Class** + +```java +public final class ItemUtil { + + public static ItemStack itemWithName(Material material, String name) { + ItemStack item = new ItemStack(material); + + ItemMeta itemMeta = item.getItemMeta(); + itemMeta.setDisplayName(name); + + item.setItemMeta(itemMeta); + return item; + } + + public static ItemStack addTag(ItemStack item, String key, Object value) { + net.minecraft.server.v1_8_R3.ItemStack nmsItem = CraftItemStack.asNMSCopy(item); + NBTTagCompound tag = nmsItem.hasTag() ? nmsItem.getTag() : new NBTTagCompound(); + + NBTTagCompound lunarTag = tag.getCompound("lunar"); + if (lunarTag == null) { + lunarTag = new NBTTagCompound(); + } + + if (value instanceof Integer) { + lunarTag.setInt(key, (Integer) value); + } else if (value instanceof Double) { + lunarTag.setDouble(key, (Double) value); + } else if (value instanceof Float) { + lunarTag.setFloat(key, (Float) value); + } else if (value instanceof Boolean) { + lunarTag.setBoolean(key, (Boolean) value); + } else if (value instanceof String) { + lunarTag.setString(key, (String) value); + } + + tag.set("lunar", lunarTag); + nmsItem.setTag(tag); + + return CraftItemStack.asBukkitCopy(nmsItem); + } + + private ItemUtil() { + } + +} +``` + + + + diff --git a/docs/developers/modules/glow.mdx b/docs/developers/modules/glow.mdx index 38952b2d..ec71a80f 100644 --- a/docs/developers/modules/glow.mdx +++ b/docs/developers/modules/glow.mdx @@ -1,4 +1,5 @@ import { Tab, Tabs } from 'nextra-theme-docs' +import { Callout } from 'nextra-theme-docs' # Glow Module @@ -10,6 +11,10 @@ The glow module allows you to take advantage of the vanilla Minecraft Glow Effec - Adds improvements to glow effect for Lunar Client users. - Customizable colors for the glow effect, different from the vanilla Minecraft colors. + + In Version 1.12, Optifine's 'Fast Render' setting alters player rendering. This is expected behavior for Optifine. + + ![Glow Module Example](https://i.imgur.com/Ra3r363.png#center)
@@ -66,7 +71,7 @@ public void resetGlowEffectsExample(Player viewer) { -### Override a Glow Effect +**Override a Glow Effect** ```java public void overrideGlowEffectExample(UUID glowingPlayer) { @@ -79,7 +84,7 @@ public void overrideGlowEffectExample(UUID glowingPlayer) { } ``` -### Removing a Glow Effect +**Removing a Glow Effect** ```java public void resetGlowEffectExample(UUID glowingPlayer) { @@ -91,7 +96,7 @@ public void resetGlowEffectExample(UUID glowingPlayer) { } ``` -### Resetting all Glow Effects +**Resetting all Glow Effects** ```java public void resetGlowEffectsExample(Player viewer) { @@ -104,7 +109,7 @@ public void resetGlowEffectsExample(Player viewer) { -### Override a Glow Effect +**Override a Glow Effect** ```java public void overrideGlowEffectExample(UUID glowingPlayer) { @@ -117,7 +122,7 @@ public void overrideGlowEffectExample(UUID glowingPlayer) { } ``` -### Removing a Glow Effect +**Removing a Glow Effect** ```java public void resetGlowEffectExample(UUID glowingPlayer) { @@ -129,7 +134,7 @@ public void resetGlowEffectExample(UUID glowingPlayer) { } ``` -### Resetting all Glow Effects +**Resetting all Glow Effects** ```java public void resetGlowEffectsExample(Player viewer) { diff --git a/docs/developers/modules/hologram.mdx b/docs/developers/modules/hologram.mdx index 36259a35..5cc88206 100644 --- a/docs/developers/modules/hologram.mdx +++ b/docs/developers/modules/hologram.mdx @@ -125,7 +125,7 @@ public void resetHologramsExample(Player viewer) { -### Displaying a Hologram +**Displaying a Hologram** ```java public void displayHologramExample() { @@ -157,7 +157,7 @@ public void displayHologramExample() { } ``` -### Removing a Hologram +**Removing a Hologram** ```java public void removeHologramExample() { @@ -169,7 +169,7 @@ public void removeHologramExample() { } ``` -### Resetting all Holograms +**Resetting all Holograms** ```java public void resetHologramsExample(Player viewer) { @@ -182,7 +182,7 @@ public void resetHologramsExample(Player viewer) { -### Displaying a Hologram +**Displaying a Hologram** ```java public void displayHologramExample() { @@ -213,7 +213,7 @@ public void displayHologramExample() { } ``` -### Removing a Hologram +**Removing a Hologram** ```java public void removeHologramExample() { @@ -225,7 +225,7 @@ public void removeHologramExample() { } ``` -### Resetting all Holograms +**Resetting all Holograms** ```java public void resetHologramsExample(Player viewer) { diff --git a/docs/developers/modules/inventory.mdx b/docs/developers/modules/inventory.mdx new file mode 100644 index 00000000..802b00d1 --- /dev/null +++ b/docs/developers/modules/inventory.mdx @@ -0,0 +1,156 @@ +import { Tab, Tabs } from 'nextra-theme-docs' +import { Callout } from 'nextra-theme-docs' + +# Inventory Module + +## Overview + +The inventory module allows you to create customizable and professional user interfaces for Lunar Client users. + +- Add custom NBT tags to items to control how users interact with them on click. + - Ability to make items unclickable. (Cancels the event client-side) + - Ability to open URLs. (Respects chat privacy settings) + - Ability to suggest & run commands. (Handled client-side) + - Ability to copy to clipboard. + + + This module is disabled by default, if you wish to use this module you will need to enable it in `config.yml`. + + +## Integration + +### Sample Code +Explore each integration by cycling through each tab, to find the best fit for your requirements and needs. + + + + + +**Unclickable Item** + +`/summon item ~ ~1 ~ {Item:{id:"minecraft:stone",Count:1b,tag:{display:{Name:"§c§lUNCLICKABLE"},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"}}}}` + +**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"}}}}` + +**Suggest Command Item** + +`/summon item ~ ~1 ~ {Item:{id:"minecraft:book",Count:1b,tag:{display:{Name:"§2§lSUGGEST COMMAND"},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"}}}}` + + + + + + + This example is compatible only with Spigot 1.8. + + +**Item Creation** + +```java +public void inventoryModuleNMSExample(Player player) { + Inventory inventory = Bukkit.createInventory(player, 5 * 9); + + ItemStack unclickableItem = ItemUtil.itemWithName( + Material.STONE, + ChatColor.RED.toString() + ChatColor.BOLD + "UNCLICKABLE" + ); + + inventory.setItem(11, ItemUtil.addTag(unclickableItem, "unclickable", true)); + + ItemStack copyToClipboardItem = ItemUtil.itemWithName( + Material.PAPER, + ChatColor.BLUE.toString() + ChatColor.BOLD + "COPY TO CLIPBOARD" + ); + + copyToClipboardItem = ItemUtil.addTag(copyToClipboardItem, "unclickable", true); + inventory.setItem(14, ItemUtil.addTag(copyToClipboardItem, "copyToClipboard", "lunarclient.com")); + + ItemStack openUrlItem = ItemUtil.itemWithName( + Material.TORCH, + ChatColor.GOLD.toString() + ChatColor.BOLD + "OPEN URL" + ); + + openUrlItem = ItemUtil.addTag(openUrlItem, "unclickable", true); + inventory.setItem(17, ItemUtil.addTag(openUrlItem, "openUrl", "https://lunarclient.com")); + + ItemStack suggestCommandItem = ItemUtil.itemWithName( + Material.BOOK, + ChatColor.GREEN.toString() + ChatColor.BOLD + "SUGGEST COMMAND" + ); + + suggestCommandItem = ItemUtil.addTag(suggestCommandItem, "unclickable", true); + inventory.setItem(29, ItemUtil.addTag(suggestCommandItem, "suggestCommand", "/apollo")); + + ItemStack runCommandItem = ItemUtil.itemWithName( + Material.BOOK_AND_QUILL, + ChatColor.LIGHT_PURPLE.toString() + ChatColor.BOLD + "RUN COMMAND" + ); + + runCommandItem = ItemUtil.addTag(runCommandItem, "unclickable", true); + inventory.setItem(33, ItemUtil.addTag(runCommandItem, "runCommand", "/apollo")); + + player.openInventory(inventory); +} +``` + +**Helper Class** + +```java +public final class ItemUtil { + + public static ItemStack itemWithName(Material material, String name) { + ItemStack item = new ItemStack(material); + + ItemMeta itemMeta = item.getItemMeta(); + itemMeta.setDisplayName(name); + + item.setItemMeta(itemMeta); + return item; + } + + public static ItemStack addTag(ItemStack item, String key, Object value) { + net.minecraft.server.v1_8_R3.ItemStack nmsItem = CraftItemStack.asNMSCopy(item); + NBTTagCompound tag = nmsItem.hasTag() ? nmsItem.getTag() : new NBTTagCompound(); + + NBTTagCompound lunarTag = tag.getCompound("lunar"); + if (lunarTag == null) { + lunarTag = new NBTTagCompound(); + } + + if (value instanceof Integer) { + lunarTag.setInt(key, (Integer) value); + } else if (value instanceof Double) { + lunarTag.setDouble(key, (Double) value); + } else if (value instanceof Float) { + lunarTag.setFloat(key, (Float) value); + } else if (value instanceof Boolean) { + lunarTag.setBoolean(key, (Boolean) value); + } else if (value instanceof String) { + lunarTag.setString(key, (String) value); + } + + tag.set("lunar", lunarTag); + nmsItem.setTag(tag); + + return CraftItemStack.asBukkitCopy(nmsItem); + } + + private ItemUtil() { + } + +} +``` + + + + diff --git a/docs/developers/modules/limb.mdx b/docs/developers/modules/limb.mdx index a05d10c4..93afc8e9 100644 --- a/docs/developers/modules/limb.mdx +++ b/docs/developers/modules/limb.mdx @@ -122,7 +122,7 @@ public void resetBodyExample(Player viewer, Player target) { -### Hide Armor Pieces +**Hide Armor Pieces** ```java public void hideArmorExample(Player viewer, Player target) { @@ -135,7 +135,7 @@ public void hideArmorExample(Player viewer, Player target) { } ``` -### Reset Armor Pieces +**Reset Armor Pieces** ```java public void resetArmorExample(Player viewer, Player target) { @@ -148,7 +148,7 @@ public void resetArmorExample(Player viewer, Player target) { } ``` -### Hide Body Parts +**Hide Body Parts** ```java public void hideBodyExample(Player viewer, Player target) { @@ -161,7 +161,7 @@ public void hideBodyExample(Player viewer, Player target) { } ``` -### Reset Body Parts +**Reset Body Parts** ```java public void resetBodyExample(Player viewer, Player target) { @@ -178,7 +178,7 @@ public void resetBodyExample(Player viewer, Player target) { -### Hide Armor Pieces +**Hide Armor Pieces** ```java public void hideArmorExample(Player viewer, Player target) { @@ -196,7 +196,7 @@ public void hideArmorExample(Player viewer, Player target) { } ``` -### Reset Armor Pieces +**Reset Armor Pieces** ```java public void resetArmorExample(Player viewer, Player target) { @@ -214,7 +214,7 @@ public void resetArmorExample(Player viewer, Player target) { } ``` -### Hide Body Parts +**Hide Body Parts** ```java public void hideBodyExample(Player viewer, Player target) { @@ -232,7 +232,7 @@ public void hideBodyExample(Player viewer, Player target) { } ``` -### Reset Body Parts +**Reset Body Parts** ```java public void resetBodyExample(Player viewer, Player target) { diff --git a/docs/developers/modules/modsetting.mdx b/docs/developers/modules/modsetting.mdx index 7afb5de3..d20f98fe 100644 --- a/docs/developers/modules/modsetting.mdx +++ b/docs/developers/modules/modsetting.mdx @@ -59,7 +59,7 @@ public void broadcastDisableLightingModExample(Player viewer) { -### Disable Lighting Mod +**Disable Lighting Mod** ```java public void disableLightingModExample(Player viewer) { @@ -71,7 +71,7 @@ public void disableLightingModExample(Player viewer) { } ``` -### Reset Lighting Mod to it's default value +**Reset Lighting Mod to it's default value** ```java public void rollbackLightingModEnabledState(Player viewer) { @@ -84,7 +84,7 @@ public void rollbackLightingModEnabledState(Player viewer) { } ``` -### Broadcast Disable Lighting Mod the an entire server +**Broadcast Disable Lighting Mod the an entire server** ```java public void broadcastDisableLightingModExample() { @@ -100,7 +100,7 @@ public void broadcastDisableLightingModExample() { -### Disable Lighting Mod +**Disable Lighting Mod** ```java public void disableLightingModExample(Player viewer) { @@ -112,7 +112,7 @@ public void disableLightingModExample(Player viewer) { } ``` -### Reset Lighting Mod to it's default value +**Reset Lighting Mod to it's default value** ```java public void rollbackLightingModEnabledState(Player viewer) { @@ -125,7 +125,7 @@ public void rollbackLightingModEnabledState(Player viewer) { } ``` -### Broadcast Disable Lighting Mod the an entire server +**Broadcast Disable Lighting Mod the an entire server** ```java public void broadcastDisableLightingModExample() { diff --git a/docs/developers/modules/nametag.mdx b/docs/developers/modules/nametag.mdx index bace711d..58451baa 100644 --- a/docs/developers/modules/nametag.mdx +++ b/docs/developers/modules/nametag.mdx @@ -101,7 +101,7 @@ public void resetNametagsExample(Player viewer) { -### Override a Nametag +**Override a Nametag** ```java public void overrideNametagExample(Player target) { @@ -128,7 +128,7 @@ public void overrideNametagExample(Player target) { } ``` -### Reset a Nametag +**Reset a Nametag** ```java public void resetNametagExample(Player target) { @@ -140,7 +140,7 @@ public void resetNametagExample(Player target) { } ``` -### Resetting all Nametags +**Resetting all Nametags** ```java public void resetNametagsExample(Player viewer) { @@ -153,7 +153,7 @@ public void resetNametagsExample(Player viewer) { -### Override a Nametag +**Override a Nametag** ```java public void overrideNametagExample(Player target) { @@ -180,7 +180,7 @@ public void overrideNametagExample(Player target) { } ``` -### Reset a Nametag +**Reset a Nametag** ```java public void resetNametagExample(Player target) { @@ -192,7 +192,7 @@ public void resetNametagExample(Player target) { } ``` -### Resetting all Nametags +**Resetting all Nametags** ```java public void resetNametagsExample(Player viewer) { diff --git a/docs/developers/modules/nickhider.mdx b/docs/developers/modules/nickhider.mdx index 4122158b..3b0cbe7c 100644 --- a/docs/developers/modules/nickhider.mdx +++ b/docs/developers/modules/nickhider.mdx @@ -39,7 +39,7 @@ public void resetNickExample(Player viewer) { -### Override a Nick +**Override a Nick** ```java public void overrideNickExample(Player viewer) { @@ -51,7 +51,7 @@ public void overrideNickExample(Player viewer) { } ``` -### Reset a Nick +**Reset a Nick** ```java public void resetNickExample(Player viewer) { @@ -64,7 +64,7 @@ public void resetNickExample(Player viewer) { -### Override a Nick +**Override a Nick** ```java public void overrideNickExample(Player viewer) { @@ -76,7 +76,7 @@ public void overrideNickExample(Player viewer) { } ``` -### Reset a Nick +**Reset a Nick** ```java public void resetNickExample(Player viewer) { diff --git a/docs/developers/modules/notification.mdx b/docs/developers/modules/notification.mdx index 81ed896d..ad3dface 100644 --- a/docs/developers/modules/notification.mdx +++ b/docs/developers/modules/notification.mdx @@ -109,7 +109,7 @@ If this field is left empty (null) it'll display a generic info icon, as display -### Displaying a Notification +**Displaying a Notification** ```java public void displayNotificationExample(Player viewer) { @@ -133,7 +133,7 @@ public void displayNotificationExample(Player viewer) { } ``` -### Resetting all Notifications +**Resetting all Notifications** ```java public void resetNotificationsExample(Player viewer) { @@ -146,7 +146,7 @@ public void resetNotificationsExample(Player viewer) { -### Displaying a Notification +**Displaying a Notification** ```java public void displayNotificationExample(Player viewer) { @@ -170,7 +170,7 @@ public void displayNotificationExample(Player viewer) { } ``` -### Resetting all Notifications +**Resetting all Notifications** ```java public void resetNotificationsExample(Player viewer) { diff --git a/docs/developers/modules/richpresence.mdx b/docs/developers/modules/richpresence.mdx index a144b6a7..51fecbff 100644 --- a/docs/developers/modules/richpresence.mdx +++ b/docs/developers/modules/richpresence.mdx @@ -120,7 +120,7 @@ public void resetServerRichPresenceExample(Player viewer) { -### Override Rich Presence +**Override Rich Presence** ```java public void overrideServerRichPresenceExample(Player viewer) { @@ -139,7 +139,7 @@ public void overrideServerRichPresenceExample(Player viewer) { } ``` -### Reset Rich Presence +**Reset Rich Presence** ```java public void resetServerRichPresenceExample(Player viewer) { @@ -152,7 +152,7 @@ public void resetServerRichPresenceExample(Player viewer) { -### Override Rich Presence +**Override Rich Presence** ```java public void overrideServerRichPresenceExample(Player viewer) { @@ -171,7 +171,7 @@ public void overrideServerRichPresenceExample(Player viewer) { } ``` -### Reset Rich Presence +**Reset Rich Presence** ```java public void resetServerRichPresenceExample(Player viewer) { diff --git a/docs/developers/modules/saturation.mdx b/docs/developers/modules/saturation.mdx index b7053a3a..40e3ccf9 100644 --- a/docs/developers/modules/saturation.mdx +++ b/docs/developers/modules/saturation.mdx @@ -1,3 +1,4 @@ +import { Tab, Tabs } from 'nextra-theme-docs' import { Callout } from 'nextra-theme-docs' # Saturation Module @@ -29,3 +30,104 @@ You set a custom NBT, with the tag `lunar{hunger:{value}}` then set the `{value} ### How to set custom saturation level of an item You set a custom NBT, with the tag `lunar{saturation:{value}}` then set the `{value}` to the value of the saturation level you want to display on the item. The value should be a float. + +### Sample Code +Explore each integration by cycling through each tab, to find the best fit for your requirements and needs. + + + + + +**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,tag:{lunar:{hunger:7,saturation:7}}}}` + +`/summon item ~ ~1 ~ {Item:{id:"minecraft:apple",Count:1b,tag:{lunar:{hunger:30,saturation:26}}}}` + + + + + + + This example is compatible only with Spigot 1.8. + + +**Item Creation** + +```java +public void saturationModuleNMSExample(Player player) { + Inventory inventory = Bukkit.createInventory(player, 3 * 9); + + ItemStack apple = new ItemStack(Material.APPLE); + ItemUtil.addTag(apple, "hunger", 22); + ItemUtil.addTag(apple, "saturation", 3); + + ItemStack apple2 = new ItemStack(Material.APPLE); + ItemUtil.addTag(apple, "hunger", 7); + ItemUtil.addTag(apple, "saturation", 7); + + ItemStack apple3 = new ItemStack(Material.APPLE); + ItemUtil.addTag(apple, "hunger", 30); + ItemUtil.addTag(apple, "saturation", 26); + + inventory.setItem(11, apple); + inventory.setItem(14, apple2); + inventory.setItem(17, apple3); + + player.openInventory(inventory); +} +``` + +**Helper Class** + +```java +public final class ItemUtil { + + public static ItemStack itemWithName(Material material, String name) { + ItemStack item = new ItemStack(material); + + ItemMeta itemMeta = item.getItemMeta(); + itemMeta.setDisplayName(name); + + item.setItemMeta(itemMeta); + return item; + } + + public static ItemStack addTag(ItemStack item, String key, Object value) { + net.minecraft.server.v1_8_R3.ItemStack nmsItem = CraftItemStack.asNMSCopy(item); + NBTTagCompound tag = nmsItem.hasTag() ? nmsItem.getTag() : new NBTTagCompound(); + + NBTTagCompound lunarTag = tag.getCompound("lunar"); + if (lunarTag == null) { + lunarTag = new NBTTagCompound(); + } + + if (value instanceof Integer) { + lunarTag.setInt(key, (Integer) value); + } else if (value instanceof Double) { + lunarTag.setDouble(key, (Double) value); + } else if (value instanceof Float) { + lunarTag.setFloat(key, (Float) value); + } else if (value instanceof Boolean) { + lunarTag.setBoolean(key, (Boolean) value); + } else if (value instanceof String) { + lunarTag.setString(key, (String) value); + } + + tag.set("lunar", lunarTag); + nmsItem.setTag(tag); + + return CraftItemStack.asBukkitCopy(nmsItem); + } + + private ItemUtil() { + } + +} +``` + + + + diff --git a/docs/developers/modules/serverrule.mdx b/docs/developers/modules/serverrule.mdx index 7f1d6143..fb4e8fd0 100644 --- a/docs/developers/modules/serverrule.mdx +++ b/docs/developers/modules/serverrule.mdx @@ -56,7 +56,7 @@ public void setNametagRenderDistanceExample(int value) { -### Toggle Anti Portal Traps +**Toggle Anti Portal Traps** ```java public void setAntiPortalTraps(boolean value) { @@ -68,7 +68,7 @@ public void setAntiPortalTraps(boolean value) { } ``` -### Override Nametag Render Distance +**Override Nametag Render Distance** ```java public void setOverrideNametagRenderDistance(Player viewer, boolean value) { @@ -80,7 +80,7 @@ public void setOverrideNametagRenderDistance(Player viewer, boolean value) { } ``` -### Broadcast Nametag Render Distance +**Broadcast Nametag Render Distance** ```java public void setNametagRenderDistanceExample(int value) { @@ -96,7 +96,7 @@ public void setNametagRenderDistanceExample(int value) { -### Toggle Anti Portal Traps +**Toggle Anti Portal Traps** ```java public void setAntiPortalTraps(boolean value) { @@ -108,7 +108,7 @@ public void setAntiPortalTraps(boolean value) { } ``` -### Override Nametag Render Distance +**Override Nametag Render Distance** ```java public void setOverrideNametagRenderDistance(Player viewer, boolean value) { @@ -120,7 +120,7 @@ public void setOverrideNametagRenderDistance(Player viewer, boolean value) { } ``` -### Broadcast Nametag Render Distance +**Broadcast Nametag Render Distance** ```java public void setNametagRenderDistanceExample(int value) { diff --git a/docs/developers/modules/staffmod.mdx b/docs/developers/modules/staffmod.mdx index 1be7c8af..73f1bad9 100644 --- a/docs/developers/modules/staffmod.mdx +++ b/docs/developers/modules/staffmod.mdx @@ -77,7 +77,7 @@ public void enableStaffModsExample(Player viewer) { } ``` -### Disable Staff Mods +**Disable Staff Mods** ```java public void disableStaffModsExample(Player viewer) { @@ -93,7 +93,7 @@ public void disableStaffModsExample(Player viewer) { -### Enable Staff Mods +**Enable Staff Mods** ```java public void enableStaffModsExample(Player viewer) { @@ -114,7 +114,7 @@ public void enableStaffModsExample(Player viewer) { } ``` -### Disable Staff Mods +**Disable Staff Mods** ```java public void disableStaffModsExample(Player viewer) { diff --git a/docs/developers/modules/stopwatch.mdx b/docs/developers/modules/stopwatch.mdx index 9412318b..e3528e25 100644 --- a/docs/developers/modules/stopwatch.mdx +++ b/docs/developers/modules/stopwatch.mdx @@ -57,7 +57,7 @@ public void resetStopwatchExample(Player viewer) { -### Start Stopwatch +**Start Stopwatch** ```java public void startStopwatchExample(Player viewer) { @@ -66,7 +66,7 @@ public void startStopwatchExample(Player viewer) { } ``` -### Stop Stopwatch +**Stop Stopwatch** ```java public void stopStopwatchExample(Player viewer) { @@ -75,7 +75,7 @@ public void stopStopwatchExample(Player viewer) { } ``` -### Reset Stopwatch +**Reset Stopwatch** ```java public void resetStopwatchExample(Player viewer) { @@ -88,7 +88,7 @@ public void resetStopwatchExample(Player viewer) { -### Start Stopwatch +**Start Stopwatch** ```java public void startStopwatchExample(Player viewer) { @@ -99,7 +99,7 @@ public void startStopwatchExample(Player viewer) { } ``` -### Stop Stopwatch +**Stop Stopwatch** ```java public void stopStopwatchExample(Player viewer) { @@ -110,7 +110,7 @@ public void stopStopwatchExample(Player viewer) { } ``` -### Reset Stopwatch +**Reset Stopwatch** ```java public void resetStopwatchExample(Player viewer) { diff --git a/docs/developers/modules/team.mdx b/docs/developers/modules/team.mdx index bd856ce1..431a6afc 100644 --- a/docs/developers/modules/team.mdx +++ b/docs/developers/modules/team.mdx @@ -445,7 +445,6 @@ public class Team { private JsonObject createTeamMember(Player member) { JsonObject message = new JsonObject(); - message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.team.v1.TeamMember"); message.add("player_uuid", JsonUtil.createUuidObject(member.getUniqueId())); message.addProperty("adventure_json_player_name", AdventureUtil.toJson( Component.text() diff --git a/docs/developers/modules/tebex.mdx b/docs/developers/modules/tebex.mdx new file mode 100644 index 00000000..547c7b72 --- /dev/null +++ b/docs/developers/modules/tebex.mdx @@ -0,0 +1,157 @@ +import { Tab, Tabs } from 'nextra-theme-docs' +import { Callout } from 'nextra-theme-docs' + +# Tebex Module + +## Overview + +The Tebex module allows Lunar Client users to complete purchases directly within the game, providing a faster, more seamless checkout experience. + +**Overlay Mode** + +This mode displays the Tebex checkout flow as an overlay on the Minecraft window, similar to opening an inventory. It provides the most seamless experience and is the preferred method. Overlay mode is only available on **Windows**. + +![Tebex Overlay Example](https://i.imgur.com/1grfRaX.png#center) + +**Window Mode** + +As a fallback, and for **macOS** and **Linux** users, a separate window opens to display the Tebex checkout flow. While not as seamless as overlay mode, this ensures compatibility across all operating systems. + +![Tebex Window Example](https://i.imgur.com/68wBAYZ.png#center) + +## Usage Guidelines + +To ensure a smooth user experience, servers must only open checkout windows from user-initiated actions. Examples include, but aren't limited to: + +**Allowed (User-Initiated Actions):** +- Clicking a link in chat +- Running a command +- Clicking a button in a GUI + +**Not Allowed (Automated/Intrusive Actions):** +- Triggering on login +- Automatically opening at set intervals (e.g., every 30 minutes) +- Automatically opening during flash sales, events, or other promotions without user interaction + +This feature is designed to enhance the user experience by providing a seamless checkout process, misuse of this module, such as creating a disruptive or intrusive purchase flow, will result in restricted access in the future. + +## Integration + +The only piece of information sent from the server to the client to trigger a checkout window is the **Tebex basket ident**. This unique identifier represents an in-progress basket and later converts into a **Tebex transaction ID (tbx-...)** upon purchase. + +Optionally, a **locale** value can also be sent to specify the language and regional formatting used when rendering the checkout window (e.g., `en-US`). If no locale is provided, the default locale settings will be used. + +If a player is not using Lunar Client, the same Tebex basket can be used on the web at: `https://pay.tebex.io/` + +**Example flow** +1. Create a basket using the Tebex Headless API. +2. Add package(s) to basket with Tebex Headless API +3. If the player is using Lunar Client: Send an Apollo packet to open the checkout modal. +4. If the player is not using Lunar Client: Send a chat message with a Tebex payment link. + +**Tebex Headless API** + +Basket idents are created via the [Tebex Headless API](https://docs.tebex.io/developers/headless-api/overview). This API allows programmatic basket creation, package additions, coupon applications, and more. The [Lunar Client Store](https://store.lunarclient.com/) is built on this API, and it is enabled by default for all Tebex stores. + +**Getting started with the Tebex Headless API** + +🔗 [Documentation](https://docs.tebex.io/developers/headless-api/overview)
+🔗 [Java SDK](https://github.com/tebexio/TebexHeadless-OpenAPI/tree/main/sdks/java)
+ +Most implementations of Embedded Checkout only require two API endpoints: +1. Creating a basket +2. Adding packages to a basket + +For simplicity, you may opt to handle these requests manually rather than using the SDK. + +**API Authentication** + +You’ll need your **public token** and **private key** from: [Tebex API Keys](https://creator.tebex.io/developers/api-keys) + + + Never share these credentials with Lunar Client or external servers. They should only be used while communicating with Tebex Headless. + + +### Sample Code +Explore each integration by cycling through each tab to find the best fit for your requirements and needs. + + + + + +**Display Tebex Embedded Checkout** + +```java +public void displayTebexEmbeddedCheckoutExample(Player viewer, String basketIdent, String locale) { + Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId()); + + if (!apolloPlayerOpt.isPresent()) { + viewer.sendMessage("Complete your purchase at https://pay.tebex.io/" + basketIdent); + return; + } + + ApolloPlayer apolloPlayer = apolloPlayerOpt.get(); + TebexEmbeddedCheckoutSupport embeddedCheckoutSupport = apolloPlayer.getTebexEmbeddedCheckoutSupport(); + + if (embeddedCheckoutSupport == TebexEmbeddedCheckoutSupport.UNSUPPORTED) { + viewer.sendMessage("Complete your purchase at https://pay.tebex.io/" + basketIdent); + return; + } + + this.tebexModule.displayTebexEmbeddedCheckout(apolloPlayerOpt.get(), basketIdent, locale); + + if (embeddedCheckoutSupport == TebexEmbeddedCheckoutSupport.OVERLAY) { + viewer.sendMessage("Opening checkout as game overlay!"); + } else { + viewer.sendMessage("Opening checkout in an external window!"); + } +} +``` + + + + + +**Display Tebex Embedded Checkout** + + + To detect embedded checkout support type visit [Apollo Serverbound packets](/apollo/developers/lightweight/protobuf/serverbound-packets) + + +```java +public void displayTebexEmbeddedCheckoutExample(Player viewer, String basketIdent, String locale) { + OpenTebexEmbeddedCheckoutMessage.Builder builder = OpenTebexEmbeddedCheckoutMessage.newBuilder() + .setBasketIdent(basketIdent); + + if (locale != null) { + builder.setLocale(locale); + } + + OpenTebexEmbeddedCheckoutMessage message = builder.build(); + ProtobufPacketUtil.sendPacket(viewer, message); +} +``` + + + + + +**Display Tebex Embedded Checkout** + +```java +public void displayTebexEmbeddedCheckoutExample(Player viewer, String basketIdent, String locale) { + JsonObject message = new JsonObject(); + message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.tebex.v1.OpenTebexEmbeddedCheckoutMessage"); + message.addProperty("basket_ident", basketIdent); + + if (locale != null) { + message.addProperty("locale", locale); + } + + JsonPacketUtil.sendPacket(viewer, message); +} +``` + + + + diff --git a/docs/developers/modules/title.mdx b/docs/developers/modules/title.mdx index 21209901..78649ac8 100644 --- a/docs/developers/modules/title.mdx +++ b/docs/developers/modules/title.mdx @@ -133,7 +133,7 @@ public void resetTitlesExample(Player viewer) { -### Displaying a Title +**Displaying a Title** ```java public void displayTitleExample(Player viewer) { @@ -156,7 +156,7 @@ public void displayTitleExample(Player viewer) { } ``` -### Displaying a Interpolated Title +**Displaying a Interpolated Title** ```java public void displayTitleInterpolatedExample(Player viewer) { @@ -181,7 +181,7 @@ public void displayTitleInterpolatedExample(Player viewer) { } ``` -### Resetting all Titles +**Resetting all Titles** ```java public void resetTitlesExample(Player viewer) { @@ -194,7 +194,7 @@ public void resetTitlesExample(Player viewer) { -### Displaying a Title +**Displaying a Title** ```java public void displayTitleExample(Player viewer) { @@ -217,7 +217,7 @@ public void displayTitleExample(Player viewer) { } ``` -### Displaying a Interpolated Title +**Displaying a Interpolated Title** ```java public void displayTitleInterpolatedExample(Player viewer) { @@ -242,7 +242,7 @@ public void displayTitleInterpolatedExample(Player viewer) { } ``` -### Resetting all Titles +**Resetting all Titles** ```java public void resetTitlesExample(Player viewer) { diff --git a/docs/developers/modules/tntcountdown.mdx b/docs/developers/modules/tntcountdown.mdx index 18a2f598..ec36f708 100644 --- a/docs/developers/modules/tntcountdown.mdx +++ b/docs/developers/modules/tntcountdown.mdx @@ -66,7 +66,7 @@ public void clearTntCountdownOptionExample() { -### Set TNT Countdown Ticks Option +**Set TNT Countdown Ticks Option** ```java public void setTntCountdownExample() { @@ -78,7 +78,7 @@ public void setTntCountdownExample() { } ``` -### Spawn TNT with Custom Tick amount +**Spawn TNT with Custom Tick amount** ```java private static Method entityGetter; @@ -127,7 +127,7 @@ public void overrideTntCountdownExample(Player viewer) { } ``` -### Reset TNT Countdown Ticks Options +**Reset TNT Countdown Ticks Options** ```java public void clearTntCountdownOptionExample() { @@ -139,7 +139,7 @@ public void clearTntCountdownOptionExample() { } ``` -### Modify Fuse Ticks on TNT Spawn +**Modify Fuse Ticks on TNT Spawn** ```java @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @@ -173,7 +173,7 @@ private void onTntSpawn(EntitySpawnEvent event) { -### Create TNT Countdown Message +**Create TNT Countdown Message** ```java private JsonObject createTNTCountdownMessage(Entity entity, int ticks) { @@ -185,7 +185,7 @@ private JsonObject createTNTCountdownMessage(Entity entity, int ticks) { } ``` -### Set TNT Countdown Ticks Option +**Set TNT Countdown Ticks Option** ```java public void setTntCountdownExample() { @@ -197,7 +197,7 @@ public void setTntCountdownExample() { } ``` -### Spawn TNT with Custom Tick amount +**Spawn TNT with Custom Tick amount** ```java private static Method entityGetter; @@ -241,7 +241,7 @@ public void overrideTntCountdownExample(Player viewer) { } ``` -### Reset TNT Countdown Ticks Options +**Reset TNT Countdown Ticks Options** ```java public void clearTntCountdownOptionExample() { @@ -253,7 +253,7 @@ public void clearTntCountdownOptionExample() { } ``` -### Modify Fuse Ticks on TNT Spawn +**Modify Fuse Ticks on TNT Spawn** ```java @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) diff --git a/docs/developers/modules/transfer.mdx b/docs/developers/modules/transfer.mdx index 088a5602..8a279dd6 100644 --- a/docs/developers/modules/transfer.mdx +++ b/docs/developers/modules/transfer.mdx @@ -162,7 +162,7 @@ public void pingExample(Player viewer) { -### Transfer Player +**Transfer Player** ```java public void transferExample(Player player) { @@ -198,7 +198,7 @@ public void transferExample(Player player) { } ``` -### Ping Servers +**Ping Servers** You can provide up to `10` different addresses per ping packet. @@ -250,7 +250,7 @@ public void pingExample(Player player) { This example is not implemented. -### Transfer Player +**Transfer Player** ```java public void transferExample(Player player) { @@ -258,7 +258,7 @@ public void transferExample(Player player) { } ``` -### Ping Servers +**Ping Servers** ```java public void pingExample(Player player) { diff --git a/docs/developers/modules/vignette.mdx b/docs/developers/modules/vignette.mdx index 3a0db638..cda4e17b 100644 --- a/docs/developers/modules/vignette.mdx +++ b/docs/developers/modules/vignette.mdx @@ -60,7 +60,7 @@ public void resetVignetteExample(Player viewer) { -### Display Vignette +**Display Vignette** ```java public void displayVignetteExample(Player viewer) { @@ -73,7 +73,7 @@ public void displayVignetteExample(Player viewer) { } ``` -### Reset Vignette +**Reset Vignette** ```java public void resetVignetteExample(Player viewer) { @@ -86,7 +86,7 @@ public void resetVignetteExample(Player viewer) { -### Display Vignette +**Display Vignette** ```java public void displayVignetteExample(Player viewer) { @@ -99,7 +99,7 @@ public void displayVignetteExample(Player viewer) { } ``` -### Reset Vignette +**Reset Vignette** ```java public void resetVignetteExample(Player viewer) { diff --git a/docs/developers/modules/waypoint.mdx b/docs/developers/modules/waypoint.mdx index 560cd1ac..d085c409 100644 --- a/docs/developers/modules/waypoint.mdx +++ b/docs/developers/modules/waypoint.mdx @@ -148,7 +148,7 @@ Custom colors can be created from any RGB values using `new Color(int red, int g Make sure the server is sending the world name to the client as show in the [Player Detection](/apollo/developers/lightweight/protobuf/player-detection) example. -### Displaying a Waypoint +**Displaying a Waypoint** ```java public void displayWaypointExample(Player viewer) { @@ -164,7 +164,7 @@ public void displayWaypointExample(Player viewer) { } ``` -### Removing a Waypoint +**Removing a Waypoint** ```java public void removeWaypointExample(Player viewer) { @@ -176,7 +176,7 @@ public void removeWaypointExample(Player viewer) { } ``` -### Resetting all Waypoints +**Resetting all Waypoints** ```java public void resetWaypointsExample(Player viewer) { @@ -190,10 +190,10 @@ public void resetWaypointsExample(Player viewer) { - Make sure the server is sending the world name to the client as show in the [Player Detection](/apollo/developers/lightweight/protobuf/player-detection) example. + Make sure the server is sending the world name to the client as show in the [Player Detection](/apollo/developers/lightweight/json/player-detection) example. -### Displaying a Waypoint +**Displaying a Waypoint** ```java public void displayWaypointExample(Player viewer) { @@ -211,7 +211,7 @@ public void displayWaypointExample(Player viewer) { } ``` -### Removing a Waypoint +**Removing a Waypoint** ```java public void removeWaypointExample(Player viewer) { @@ -223,7 +223,7 @@ public void removeWaypointExample(Player viewer) { } ``` -### Resetting all Waypoints +**Resetting all Waypoints** ```java public void resetWaypointsExample(Player viewer) { diff --git a/docs/developers/options.mdx b/docs/developers/options.mdx index cc73e9b1..bdd38300 100644 --- a/docs/developers/options.mdx +++ b/docs/developers/options.mdx @@ -3,8 +3,8 @@ Options are used by the Apollo modules to manage any settings they may have to use on the server or send to the client. Many options set by the modules can be modified from the configuration, which will be generated when you start Apollo for the first time. -Alongside changing options globally, options can be modified to only effect a specific player. This can be useful for setting a unique list of waypoints the player can see when they join for example. -While a specific player has an option set on them, it will ignore any changes made to the options global value. You can remove the option from the specific player to make them use the global value again. +Alongside changing options globally, options can be modified to only effect a specific player. This can be useful for setting a unique list of waypoints the player can see when they join, for example. +While a specific player has an option set on them, it will ignore any changes made to the option's global value. You can remove the option from the specific player to make them use the global value again. ## Integration @@ -19,7 +19,7 @@ public void setTntCountdownOptionExample(Player viewer) { ``` ### Options Methods -`.get(Option)` retrives the global value of the option, or the options default value if it was not set. +`.get(Option)` retrieves the global value of the option, or the options default value if it was not set. ```java .get(TntCountdownModule.TNT_TICKS) diff --git a/docs/downloads.mdx b/docs/downloads.mdx index b80f6218..31b6bd98 100644 --- a/docs/downloads.mdx +++ b/docs/downloads.mdx @@ -8,7 +8,7 @@ import router from "next/router"; - Below you can download the latest release of Apollo for Bukkit, BungeeCord and Velocity. + Below you can download the latest release of Apollo for Bukkit, BungeeCord, and Velocity. Need just the essentials? [Lightweight](/apollo/developers/lightweight/introduction) allows you to use Apollo features without the full plugin! -### Useful Links +## Useful Links 🔗 [Lunar Client Website](https://www.lunarclient.com/)
🔗 [Lunar Client Developers Discord](https://discord.gg/3T9Atyb6pf)
diff --git a/docs/server-owners/commands.mdx b/docs/server-owners/commands.mdx index 68977aa2..0ef14e28 100644 --- a/docs/server-owners/commands.mdx +++ b/docs/server-owners/commands.mdx @@ -18,6 +18,7 @@ Apollo comes with some built-in commands to make your life easier. * Description: Forcefully updates Apollo to the latest version. * Permission: `apollo.command` +## LunarClient Command * `/lunarclient ` * Description: The command to check whether the player is using Lunar Client. diff --git a/docs/server-owners/config.mdx b/docs/server-owners/config.mdx index 833c6093..4fdd7459 100644 --- a/docs/server-owners/config.mdx +++ b/docs/server-owners/config.mdx @@ -14,7 +14,7 @@ The settings in the `mods.yml` will override the mod options for players on Luna ## Mod Configuration Example - The following example is not a complete list of mod settings or guaranteed to be up to date. + The following example is not a complete list of mod settings or guaranteed to be up-to-date. You should refer to the mods documentation ([example](/apollo/developers/mods/2ditems)) for the latest mod settings. diff --git a/gradle.properties b/gradle.properties index e650d1e5..15ff62e7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ group=com.lunarclient -version=1.1.6 +version=1.1.7 description=The API for interacting with Lunar Client players. org.gradle.parallel=true diff --git a/velocity/src/main/java/com/lunarclient/apollo/ApolloVelocityPlatform.java b/velocity/src/main/java/com/lunarclient/apollo/ApolloVelocityPlatform.java index 4c643033..59c409da 100644 --- a/velocity/src/main/java/com/lunarclient/apollo/ApolloVelocityPlatform.java +++ b/velocity/src/main/java/com/lunarclient/apollo/ApolloVelocityPlatform.java @@ -50,6 +50,8 @@ import com.lunarclient.apollo.module.nametag.NametagModuleImpl; import com.lunarclient.apollo.module.notification.NotificationModule; import com.lunarclient.apollo.module.notification.NotificationModuleImpl; +import com.lunarclient.apollo.module.richpresence.RichPresenceModule; +import com.lunarclient.apollo.module.richpresence.RichPresenceModuleImpl; import com.lunarclient.apollo.module.serverrule.ServerRuleModule; import com.lunarclient.apollo.module.staffmod.StaffModModule; import com.lunarclient.apollo.module.staffmod.StaffModModuleImpl; @@ -94,7 +96,7 @@ @Plugin( id = "apollo", name = "Apollo-Velocity", - version = "1.1.6", + version = "1.1.7", url = "https://moonsworth.com", description = "Implementation of Apollo for Velocity", authors = {"Moonsworth"} @@ -175,6 +177,7 @@ public void onProxyInitialization(ProxyInitializeEvent event) { .addModule(ModSettingModule.class) .addModule(NametagModule.class, new NametagModuleImpl()) .addModule(NotificationModule.class, new NotificationModuleImpl()) + .addModule(RichPresenceModule.class, new RichPresenceModuleImpl()) .addModule(ServerRuleModule.class) .addModule(StaffModModule.class, new StaffModModuleImpl()) .addModule(StopwatchModule.class, new StopwatchModuleImpl())