Skip to content

Conversation

@ItsNature
Copy link
Collaborator

@ItsNature ItsNature commented Apr 2, 2025

Overview

Description:
Remove the Bukkit-specific implementation from the TNT Countdown Module, which was the only module in the API containing direct event handling. This change aligns the module with the rest of the project

Changes:

  • Removed Bukkit event listeners from the TNT Countdown Module.
  • The example code now manually triggers the functionality that was previously invoked via the Bukkit implementation.
  • Added TntCountdownModule#setTntCountdown(Recipients, ApolloEntity, ticks)

Code Example:

Spawn TNT with Custom Tick amount

public void overrideTntCountdownExample(Player viewer) {
    int customTicks = 200;
 
    TNTPrimed entity = viewer.getWorld().spawn(viewer.getLocation(), TNTPrimed.class);
    entity.setFuseTicks(customTicks);
 
    ApolloEntity apolloEntity = new ApolloEntity(entity.getEntityId(), entity.getUniqueId());
    this.tntCountdownModule.setTntCountdown(Recipients.ofEveryone(), apolloEntity, customTicks);
}

Modify Fuse Ticks on TNT Spawn

@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
private void onTntSpawn(EntitySpawnEvent event) {
    String entityName = event.getEntityType().name();
    if (!entityName.equals("PRIMED_TNT") && !entityName.equals("TNT")) {
        return;
    }
 
    TNTPrimed primed = (TNTPrimed) event.getEntity();
    int customTicks = this.tntCountdownModule.getOptions().get(TntCountdownModule.TNT_TICKS);
    int defaultTicks = TntCountdownModule.TNT_TICKS.getDefaultValue();
    int currentTicks = primed.getFuseTicks();
 
    if (currentTicks != defaultTicks && !this.tntCountdownModule.getOptions().get(TntCountdownModule.OVERRIDE_CUSTOM_TICKS)) {
        customTicks = currentTicks;
 
        this.tntCountdownModule.setTntCountdown(Recipients.ofEveryone(),
            new ApolloEntity(primed.getEntityId(), primed.getUniqueId()),
            customTicks
        );
    }
 
    primed.setFuseTicks(customTicks);
}

Review Request Checklist

  • Your code follows the style guidelines of this project.
  • I have performed a self-review of my code.
  • I have tested this change myself. (If applicable)
  • I have made corresponding changes to the documentation. (If applicable)
  • The branch name follows the projects naming conventions. (e.g. feature/add-module & bugfix/fix-issue)

@ItsNature ItsNature added the type: Enhancement Feature improvement or addition label Apr 2, 2025
@ItsNature ItsNature merged commit 6266cb7 into version/1.1.8 Apr 8, 2025
2 checks passed
@ItsNature ItsNature deleted the module/remove-tnt-countdown-bukkit-implementation branch April 8, 2025 17:43
@ItsNature ItsNature mentioned this pull request Apr 25, 2025
ItsNature added a commit that referenced this pull request May 5, 2025
* Deploy as 1.1.7-SNAPSHOT

* Various documentation improvements (#185)

* fixes

* remove unnecessary headers

* remove unnecessary headers from beam module

* remove unnecessary headers

* test

* use bold instead of header

* update border color

* Lightweight Documentation Fixes & Improvements (#186)

* Fix waypoint warning hyperlink redirecting to the wrong page

* Remove @type from Team json example

* better live chat message example

* Add new modules & versions (#187)

* Fix Rich Presence Module not working on bungee & velocity (#189)

* Docs - Improvements (#188)

* Update Combat#DISABLE_MISS_PENALTY comment

* add callouts

* fix lightweight player detection examples not matching

---------

Co-authored-by: TrentinTheKid <25537885+TrentinTheKid@users.noreply.github.com>

* Add Combat module lightweight example docs (#191)

* Feature - NBT Apollo Modules (#195)

* Add Glint, Saturation & Inventory Apollo Modules

* Disable Inventory Module by default

* Feature - Inventory Module (#193)

* Inventory module implementation

* Add inventory to meta.json

* Add callout

* Fix commands format

* Add glint & saturation example integration

* Add unclickable to each item

* Update inventory code example

* Add inventory module overview

* docs: Add disabled by default callout

---------

Co-authored-by: TrentinTheKid <25537885+TrentinTheKid@users.noreply.github.com>

* Sync LunarClient Mods & Options (#196)

* Sync LunarClient Mods & Options

* Update version tags to 1.1.7

---------

Co-authored-by: LunarClient Bot <lc-bot@moonsworth.com>

* Documentation - Tebex Module (#199)

* Prepare tebex module for release

* Add Tebex Module documentation

* Fix import order

* minor changes

* Add TebexEmbeddedCheckoutSupport#UNSUPPORTED

---------

Co-authored-by: Trentin <25537885+TrentinTheKid@users.noreply.github.com>

* Bump to 1.1.7 (#197)

* Deploy as 1.1.8-SNAPSHOT

* Decouple Gradle Example Implementations into Separate Modules (#200)

* Split bukkit example implementations (API, Json & Proto) to its own gradle modules & improve deploy script

* Rename apollo test server in deploy script

* Remove TnT Countdown Bukkit implementation (#202)

* Feature - Auto Text Hotkey Module (#203)

* Add Auto Text Hotkey Module

* Add `BLOCK_TEXT_INPUTS` boolean option

* add overview

* add word

* Add `BLOCK_CHAT_MESSAGE_TEXT_INPUTS` option

* Add `BLOCK_CHAT_MESSAGE_TEXT_INPUTS` examples

---------

Co-authored-by: TrentinTheKid <25537885+TrentinTheKid@users.noreply.github.com>

* Test Framework - Add Apollo payload & Border collision tests    (#205)

* Add border collision test

* Improve payload & handshake detection

* Folia Support (#201)

* Add Folia Support

* Add folia to: bug-report.yml, deploy.yml, platform-utilities.mdx

* Register AutoTextHotkeyModule

* Register TntCountdownModule

* Add new download buttons

* Rescaled assets

* Use proper asset name

* Change background height

* Unchange beackground height

* bukkit-example plugin folia support

* chore: improved download page

* chore: update discord urls

* gradle: Fix dynamic dependencies

* Test deploy

* Undo deploy test changes

* Don't wrap title text

* Update Discord URLs

---------

Co-authored-by: Connor Lewis <50084106+imconnorngl@users.noreply.github.com>
Co-authored-by: TrentinTheKid <25537885+TrentinTheKid@users.noreply.github.com>

* Sync LunarClient Mods & Options (#206)

* Sync LunarClient Mods & Options

* Update version tags to 1.1.8

---------

Co-authored-by: LunarClient Bot <lc-bot@moonsworth.com>

* Bump to 1.1.8 (#207)

---------

Co-authored-by: Trentin <25537885+TrentinTheKid@users.noreply.github.com>
Co-authored-by: LunarClient Bot <lc-bot@moonsworth.com>
Co-authored-by: Connor Lewis <50084106+imconnorngl@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: Enhancement Feature improvement or addition

Development

Successfully merging this pull request may close these issues.

4 participants