Skip to content

Conversation

@SrBedrock
Copy link
Member

No description provided.

SrBedrock and others added 30 commits October 1, 2023 04:37
* Melhoria do Helper

* Resolvido problema com contagem de clã

* Removido sub-comando x1clan player

* Pequenas melhorias
SrBedrock and others added 9 commits September 18, 2025 20:47
Set PlayerJoinEvent handler priority to LOWEST and add @NotNull annotation for event parameter. Removed code that reinstated players in active games after NPC proxy restoration, simplifying the restoration logic.
Deleted DISCONNECT_TRACKING_SUMMARY.md, IMPLEMENTATION_SUMMARY.md, MANUAL_TEST_SCENARIOS.md, and NPC_PROXY_SYSTEM.md from .github/copilot. These files contained implementation details, testing scenarios, and system documentation for the NPC proxy and disconnect tracking systems.
Updated method parameters to use 'final' for immutability and replaced usages of 'list.get(0)' with 'list.getFirst()' for clarity and modern Java practices. Also improved string and collection handling, and updated Maven compiler target/source to Java 21.
Introduces a 'bypass-reasons' config option to prevent NPC proxy creation for specific quit messages (e.g., 'banned'). Updates BaseGame and PlayerQuitListener to support passing the quit message and checking against the bypass list.
Enhanced the logic for determining NPC proxy bypass reasons by normalizing and matching quit messages more flexibly. The bypass check now strips color codes, trims, and compares lowercased messages, allowing partial matches and handling null values.
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
* Initial plan

* Implement NPC proxy system with FancyNpcs integration

Co-authored-by: SrBedrock <[email protected]>

* Complete NPC proxy system with cleanup, tests, and documentation

Co-authored-by: SrBedrock <[email protected]>

* Add final implementation summary documentation

Co-authored-by: SrBedrock <[email protected]>

* feat: Implement vanilla provider with configurable mob types for NPC proxies

Co-authored-by: SrBedrock <[email protected]>

* fix: Address code review feedback - use isPluginEnabled, make NpcProxySpawnEvent cancellable, fix formatting

Co-authored-by: SrBedrock <[email protected]>

* fix: Remove EntityTargetEvent handler from NpcProxyListener and set AI to false in VanillaProvider

Co-authored-by: SrBedrock <[email protected]>

* feat: Implement disconnect tracking system with configurable limits and timeouts

Co-authored-by: SrBedrock <[email protected]>

* docs: Add disconnect tracking system implementation summary and tests

Co-authored-by: SrBedrock <[email protected]>

* fix: Address FancyNpcs 2.7.0 API compatibility issues and missing UUID import

Co-authored-by: SrBedrock <[email protected]>

* Refactor test variable declarations for clarity

Updated test files to use 'final' for local variables and replaced wildcard static imports with explicit imports for assertion methods. These changes improve code readability and maintainability in unit tests for CombatLogService and DisconnectTrackingService.

* Refactor NPC proxy and combat tracking logic

Refactored NPC proxy handling, combat log, and disconnect tracking services for improved clarity and reliability. Updated event listeners and proxy restoration logic to use more consistent variable naming, final modifiers, and streamlined method calls. Removed unused imports and simplified internal data structures for combat and disconnect records.

* fix: Add scheduler mock support and fix Java 17 compatibility

Co-authored-by: SrBedrock <[email protected]>

* fix: Address MockBukkit and Java version concerns - use testable design pattern for scheduler mocking

Co-authored-by: SrBedrock <[email protected]>

* Add testable scheduler pattern for DisconnectTrackingService testing with Java 17 compatibility

Co-authored-by: SrBedrock <[email protected]>

* fix: Make NpcProxySpawnEvent cancellable and fire before spawning NPC

Co-authored-by: SrBedrock <[email protected]>

* Revert "Add testable scheduler pattern for DisconnectTrackingService testing with Java 17 compatibility"

This reverts commit 4725ef4.

* Revert "fix: Make NpcProxySpawnEvent cancellable and fire before spawning NPC"

This reverts commit 6f667f9.

* Improve NPC proxy cleanup and add debug logging

Refactored NPC proxy cleanup in BaseGame to clear disconnect tracking for all participants at game end. Added debug logging in NpcProxyListener when a damaged entity is not an NPC proxy.

* Update logging and add annotations for test compatibility

Changed NPC creation log message to include entity ID for better traceability. Updated DisconnectTrackingServiceTest to use @NotNull annotation and improved parameter naming for compatibility and clarity.

* Handle null and empty blockedProtocols in ViaVersionHook

Updated isPlayerVersionBlocked to return false if blockedProtocols is null or empty, preventing potential NullPointerException. Also annotated getBlockedProtocols with @nullable for clarity.

* Use Locale.ROOT for provider config normalization

Replaces String.toLowerCase() with toLowerCase(Locale.ROOT) when normalizing the provider config value to ensure consistent case conversion across different locales.

* Remove combat service test classes

Deleted CombatLogServiceTest and DisconnectTrackingServiceTest from the test suite. This reduces test coverage for combat-related services and may be part of a refactor or cleanup.

* Remove CombatLogService and related proxy combat tracking

Deleted CombatLogService and removed all references to it from TitansBattle, BaseGame, and NpcProxyListener. NPC proxy damage events are now cancelled directly in NpcProxyListener, simplifying proxy handling and eliminating combat log tracking for proxies.

* Refactor NPC proxy system to remove health tracking

Removed health management from NPC proxy logic and related classes, simplifying NpcHandle and NpcProvider interfaces. Deleted NpcProxyListener and updated event, provider, and handle implementations to no longer track or set NPC health. This streamlines proxy spawning and event handling, focusing on presence rather than health state.

* Remove health restoration on NPC proxy despawn

The player's health is no longer restored from the NPC proxy when rejoining. This change simplifies the proxy restoration process and removes the health assignment, focusing on location teleportation, event firing, proxy despawn, and game reinstatement.

* Move documentation files to .github/copilot directory

Renamed DISCONNECT_TRACKING_SUMMARY.md, IMPLEMENTATION_SUMMARY.md, MANUAL_TEST_SCENARIOS.md, and NPC_PROXY_SYSTEM.md to the .github/copilot directory for better organization. Also deleted the TitansBattle [install-simpleclans].run.xml Maven run configuration file.

* Update .gitignore and remove ArmaBattle.iml

Expanded .gitignore to cover Eclipse, Maven, Java, IntelliJ, and VS Code files for better IDE and build tool compatibility. Deleted ArmaBattle.iml to avoid tracking IDE-specific configuration.

* Remove NpcProxy event classes and related event calls

Deleted NpcProxySpawnEvent, NpcProxyDespawnEvent, and NpcProxyDeathEvent classes. Removed all usages of these events in BaseGame and PlayerJoinListener, simplifying NPC proxy handling and eliminating custom event firing.

* Refactor disconnect tracking and restore player kit

Made setKit method in BaseGame public to allow external calls. Simplified DisconnectTrackingService by removing unused fields and methods related to reconnected state. Updated PlayerJoinListener to restore player kit upon reinstatement after reconnecting.

* Remove NPC proxy and disconnect limit messages

Eliminated broadcast messages and language keys related to NPC proxy spawning and player elimination due to disconnect limits. Cleaned up config options and removed the unused language-en_US.yml file for consistency.

* Make NPC providers and handles sealed and final

Changed NpcProvider and NpcHandle interfaces to sealed, restricting their implementations to known classes. Marked CitizensProvider, FancyNpcsProvider, and VanillaProvider as final. Refactored VanillaNpcHandle to be a record within VanillaProvider. This improves type safety and clarity of the NPC provider hierarchy.

* Add final keyword to method parameters for clarity

Refactored multiple classes to use the 'final' keyword for method parameters, improving code readability and preventing accidental reassignment. No functional changes were made; this is a code style and maintainability update.

* Move inventory clearing logic on player disconnect

Relocated the inventory clearing logic for players using kits from the disconnect handler to ensure it only runs for non-combat situations. This improves clarity and correctness in handling player disconnect events.

* Refactor PlayerJoinListener event handling

Set PlayerJoinEvent handler priority to LOWEST and add @NotNull annotation for event parameter. Removed code that reinstated players in active games after NPC proxy restoration, simplifying the restoration logic.

* Remove copilot system documentation files

Deleted DISCONNECT_TRACKING_SUMMARY.md, IMPLEMENTATION_SUMMARY.md, MANUAL_TEST_SCENARIOS.md, and NPC_PROXY_SYSTEM.md from .github/copilot. These files contained implementation details, testing scenarios, and system documentation for the NPC proxy and disconnect tracking systems.

* Refactor code to use 'final' and List.getFirst()

Updated method parameters to use 'final' for immutability and replaced usages of 'list.get(0)' with 'list.getFirst()' for clarity and modern Java practices. Also improved string and collection handling, and updated Maven compiler target/source to Java 21.

* Add NPC proxy bypass reasons for player disconnects

Introduces a 'bypass-reasons' config option to prevent NPC proxy creation for specific quit messages (e.g., 'banned'). Updates BaseGame and PlayerQuitListener to support passing the quit message and checking against the bypass list.

* Improve NPC proxy bypass logic on player disconnect

Enhanced the logic for determining NPC proxy bypass reasons by normalizing and matching quit messages more flexibly. The bypass check now strips color codes, trims, and compares lowercased messages, allowing partial matches and handling null values.

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
@SrBedrock SrBedrock marked this pull request as ready for review October 17, 2025 14:00
Copilot AI review requested due to automatic review settings October 17, 2025 14:00
@SrBedrock
Copy link
Member Author

@copilot review this

@SrBedrock
Copy link
Member Author

@codex review this

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request implements various updates and improvements to the TitansBattle plugin, including a new NPC proxy system for handling player disconnections, spectator mode functionality, new game modes (Boxing and Sumo), and extensive code refactoring for improved maintainability.

Key changes:

  • NPC proxy system with support for FancyNpcs, Citizens, and vanilla entities to handle player disconnections during games
  • Spectator mode with dedicated manager and event listeners
  • New game modes: Boxing (hit-based combat) and Sumo (arena boundary-based elimination)
  • Code modernization with pattern matching, enhanced switch expressions, and final parameters
  • Additional permissions and configuration options for spectator commands, teleport bypass, and ViaVersion protocol blocking

Reviewed Changes

Copilot reviewed 115 out of 121 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
Test files (EliminationTournamentGameTest.java, FakePlayer.java, FakeBukkitTask.java, FakeBukkitScheduler.java) Removed test files
FakeGroup.java Added final modifiers and updated to use getFirst() instead of get(0)
Plugin configuration files (plugin.yml, language files, config.yml) Added new permissions, commands, messages, and NPC proxy configuration
Manager classes Added SpectateManager and refactored existing managers with final parameters
Listener classes Added spectator, player movement, and projectile launch listeners
Game classes Implemented Boxing and Sumo game modes, refactored EliminationTournamentGame
NPC system Added NPC provider infrastructure with FancyNpcs, Citizens, and vanilla implementations
Utility and helper classes Code modernization with stream API, pattern matching, and improved null handling

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting

SrBedrock and others added 9 commits October 23, 2025 19:26
* Hide projectiles from spectators and add getSpectators

Added logic to hide projectiles from spectators when a player shoots a bow. Introduced SpectateManager#getSpectators() to retrieve the current spectator players. Also added @NotNull and @Unmodifiable annotations for improved type safety.

* Remove @Unmodifiable annotation from getSpectators

The @Unmodifiable annotation was removed from the getSpectators method, possibly to allow modification of the returned list or to correct an inaccurate annotation.
Enhanced the isCurrentDuelist and getDuelWinners methods to handle null group and duel cases more safely, preventing potential NullPointerExceptions. Refactored code for clarity and consistency in both group and individual modes.
Added 'final' to local variables in TaskManager.java to improve code clarity and ensure immutability where possible. This change helps prevent accidental reassignment and follows best practices for variable declaration.
* Initial plan

* Implement elapsed time display in /tb status command

Co-authored-by: SrBedrock <[email protected]>

* Add remaining time display and improve code efficiency

Co-authored-by: SrBedrock <[email protected]>

* Apply suggestions from code review

Co-authored-by: Copilot <[email protected]>

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: SrBedrock <[email protected]>
Co-authored-by: ThiagoROX <[email protected]>
Co-authored-by: Copilot <[email protected]>
* Initial plan

* Add time-format configuration option for /tb status command

Co-authored-by: SrBedrock <[email protected]>

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: SrBedrock <[email protected]>
Refactored the /tb status command to better handle games with no expiration time by displaying 'N/A' for unlimited durations. Also updated time calculations and formatting for clarity and consistency.
Moved the formatTime method from TBCommands to the Helper class for better code reuse and organization. Updated TBCommands to use Helper.formatTime and made minor improvements to variable finalization.
Corrected indentation for battleStartTime assignment in BaseGame.java and removed an unused import of @Unmodifiable in SpectateManager.java.
* Move formatTime method to Helper class

Refactored the formatTime method from TBCommands to Helper as a static utility method. Updated TBCommands to use Helper.formatTime, improving code reuse and organization.

* Enhance time formatting for event timers

Refactored Helper.formatTime to support flexible duration patterns with tokens for days, hours, minutes, and seconds. Updated TBCommands to always use the formatted string, and expanded config.yml documentation to describe the new time-format options and supported tokens.

* Import Duration in Helper.java

Added import for java.time.Duration to Helper.java, likely in preparation for using Duration-related functionality.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants