Commit Graph

94 Commits

Author SHA1 Message Date
Teriuihi 9563e9641f Add skip phase command to bypass game phases
Introduced a new `/ctf skipphase` command allowing admins to skip the current game phase. Updated relevant classes to handle phase-skipping logic and ensure proper game state transitions. Added corresponding message configuration and subcommand registration.
2025-02-11 21:45:14 +01:00
Teriuihi aad63f174e Refactor phase transitions and add particle effects for flags
Simplified phase transition logic by removing unnecessary parameters and added proper executor shutdown at the end of the game. Enhanced visuals by introducing particle effects around flags when a team wins. Also implemented a method to skip the current game phase.
2025-02-11 21:41:33 +01:00
Teriuihi 66c24d852d Refactor and enhance flag capture notification system.
Extracted the flag capture notification logic into a dedicated method for better readability and reusability. Added team-specific title messages to notify players of the flag capture, improving clarity and game immersion.
2025-02-11 21:27:34 +01:00
Teriuihi 7acf39b600 Fix armor color setting method from BGR to RGB.
The method for setting armor colors was incorrect and used `Color.fromBGR` instead of `Color.fromRGB`. This ensures proper color rendering and aligns with expected behavior.
2025-02-11 21:27:26 +01:00
Teriuihi 6f99402d16 Add TURN_IN_RADIUS config and spawn particles at turn in point as well
Introduced a new TURN_IN_RADIUS configuration parameter to manage flag turn-in distance. Refactored particle spawning logic to use configurable radii and adjusted related methods accordingly for better flexibility and maintainability.
2025-02-11 21:08:20 +01:00
Teriuihi 5f2fb8fe0a Send death message with respawn timer on player death
Players now receive a formatted message indicating their death and the respawn time remaining. This enhances feedback and improves the overall player experience.
2025-02-09 22:12:50 +01:00
Teriuihi dbcbb10079 Refactor player status handling and improve flag logic
Rename OnPlayerJoin to OnPlayerOnlineStatus, adding logic for player disconnects. Enhance OnPlayerDeath and Flag classes to handle flag reset and notifications when a flag carrier dies or disconnects.
2025-02-09 22:10:48 +01:00
Teriuihi 7070165a94 Rename WINNING_SCORE to CAPTURE_SCORE in GameConfig.
Updated variable and configuration references to reflect the renaming of WINNING_SCORE to CAPTURE_SCORE for clarity and consistency. Adjusted related usage in Flag class to align with the new naming convention.
2025-02-09 22:01:12 +01:00
Teriuihi 8411db57a1 Update flag capture radius to use configurable value
Replaced the hardcoded 10-block radius with a configurable value from GameConfig.FLAG.CAPTURE_RADIUS. This ensures the capture radius can be easily adjusted without code changes and improves flexibility.
2025-02-09 22:00:51 +01:00
Teriuihi 498ed774a4 Increase particle trail density and remove obsolete comment.
Updated the particle trail to spawn three particles instead of one, enhancing visual clarity. Also removed an outdated TODO comment that is no longer relevant to the functionality.
2025-02-09 21:59:12 +01:00
Teriuihi e95dabccac Set breakable items to unbreakable in class creators
Made items unbreakable for Engineer, Tank, and Fighter classes to improve durability and gameplay consistency. This change ensures tools and equipment don't wear out during use, aligning with game design goals.
2025-02-09 21:57:41 +01:00
Teriuihi 6ae2563d16 Set death message to empty Component on player death.
Replaced `null` with `Component.empty()` for the death message to comply with updated API standards and improve code clarity.
2025-02-09 21:57:27 +01:00
Teriuihi 91ee3cf8f9 Add blocking mechanics for snowball hits
Introduced a check to disable snowball damage if the target is blocking and the impact angle is within 80 degrees. Extended `SnowballHitConsumer` to include the `Snowball` object for more accurate handling of hits. This improves gameplay by allowing players to block snowball attacks with proper positioning.
2025-02-09 21:57:16 +01:00
Teriuihi 4af509eb5f Fix world border config loading and phase transition logic
Made DEFAULT_SIZE in GameConfig mutable and ensured it updates dynamically from the configuration. Corrected phase transition logic in RunningGame to prevent potential out-of-bounds errors. Updated capture radius and build version.
2025-02-09 04:30:19 +01:00
Teriuihi 4f8a7a0416 Clear player potion effects on class reset
Ensure active potion effects are removed when resetting a player's class. This prevents lingering effects from other classes, maintaining consistent game behavior.
2025-02-08 23:11:41 +01:00
Teriuihi 55b88a950d Refactor snowball event handling for better readability.
Renamed method for clarity and improved team player checks. Added debug logs for unsupported scenarios and ensured no actions occur when players hit teammates. These changes enhance code maintainability and prevent unintended behavior.
2025-02-08 23:09:09 +01:00
Teriuihi 172f9a29a2 Add throw speed to item lore in GameClass
This update enhances the item lore display by including the throw speed attribute alongside health and damage. It improves clarity for players by providing more comprehensive item stats directly on the display.
2025-02-08 23:06:51 +01:00
Teriuihi 8718ca0918 Refactor world border handling for game phases.
Removed world border size from `GamePhase` and centralized configuration in `GameConfig`. Updated logic to use `WorldBorderSettings` dynamically, ensuring all phases define valid world border behavior. Adjusted related methods to improve maintainability and clarity.
2025-02-08 23:06:10 +01:00
Teriuihi 728e8b7486 Add configurable respawn time to GameConfig
Introduced a new RESPAWN section in GameConfig for managing respawn time settings. Updated OnPlayerDeath to use the configurable value instead of a hardcoded duration. This allows greater flexibility for game configuration.
2025-02-08 23:01:43 +01:00
Teriuihi 74cf3589c0 Refactor configuration handling and add world border support
Moved FLAG settings from Config to GameConfig for better modularity. Introduced world border configuration with types and sizes for different game phases. Updated related classes to utilize new configuration structure and added error handling to prevent runtime failures.
2025-02-08 23:00:04 +01:00
Teriuihi d7432c9b89 Change flag color to black banner.
Updated the default flag item from a cyan banner to a black banner.
2025-02-08 21:56:56 +01:00
Teriuihi 7ed4c20d29 Update OnPlayerDeath to delay respawning
Modified the OnPlayerDeath event to schedule game class application with a 10-second delay after player death instead of immediately applying it.
2025-02-08 21:56:23 +01:00
Teriuihi 33578027d3 Refactor game class handling and fix GUI inventory usage.
Simplified game class retrieval by removing redundant data structures and combining logic. Updated GUI inventory to ensure tasks are run on the main thread using Bukkit's scheduler. Improved code organization by centralizing class selection logic in `TeamPlayer`.
2025-02-08 21:56:05 +01:00
Teriuihi a52efb9dbb Remove unnecessary logging in resetWorldBorder method
Removed a debug log statement in the resetWorldBorder method as it was redundant. This improves code cleanliness and avoids excessive log clutter during game phase transitions.
2025-02-08 21:06:22 +01:00
Teriuihi 72dc1af903 Add flag turn-in location to team functionality
Introduced a new `flagTurnInLocation` property to the `Team` class, used to determine where players return flags. Updated relevant logic in `Flag` and `CreateTeam` to utilize this new property, including reducing the required distance for flag turn-in.
2025-02-08 21:03:01 +01:00
Teriuihi e93580bea9 Automatically show class selection when the phase starts 2025-02-08 20:56:15 +01:00
Teriuihi 53de0fe217 Remove logging in TeamPlayer for world border
Removed redundant log messages in the `resetWorldBorder` method to reduce clutter and improve clarity.
2025-02-08 20:55:37 +01:00
Teriuihi b8afe209bc Remove unused variable in resetWorldBorder method
Deleted an unused `IWorldBorder` variable in the `resetWorldBorder` method to clean up the code. This change helps improve readability and eliminates unnecessary declarations.
2025-02-08 20:45:30 +01:00
Teriuihi be7b508667 Integrate WorldBorderAPI and enhance game phase functionality
Added WorldBorderAPI dependency to manage player boundaries dynamically during game phases. Updated game phases, respawn mechanics, and class selection to utilize the WorldBorderAPI. Reworked related components to improve boundary handling, ensuring consistent gameplay flow and preparation for future enhancements.
2025-02-08 20:45:06 +01:00
Teriuihi e5077b40c5 Add Engineer class to class selection
Integrated the Engineer class into the game by utilizing the EngineerCreator. This ensures teams now have access to the Engineer role during class selection, enhancing gameplay diversity.
2025-02-08 15:21:17 +01:00
Teriuihi 6bb4673b08 Add Engineer class and update Tank, Fighter, and GameClass
Introduced the Engineer class with unique tools, functionality, and creation logic. Updated the Tank class to make its constructor public and adjusted its creator to use the appropriate class. Enhanced GameClass to append health and damage details to display item lore dynamically.
2025-02-08 15:19:32 +01:00
Teriuihi a175d1829b Refactor class creators with annotations and utility methods.
Added @Contract, @NotNull, and @Unmodifiable annotations for better code safety and clarity. Refactored utility methods in `TankCreator` and `FighterCreator` to enhance readability and reuse, including extracting item creation logic for tools and display items.
2025-02-08 15:02:42 +01:00
Teriuihi a4f96297c2 Improve CTF gameplay mechanics and particle effects
Updated class selection to restrict changes during non-selection phases and adjusted spawn radius. Added flag particle trails and square border effects, improving visual feedback. Enhanced flag handling, clearing trails when the carrier is lost or offline.
2025-02-08 00:39:05 +01:00
Teriuihi 9eccb130e5 Add Tank class and update Fighter tools in CTF game
Introduced a new Tank game class with specialized attributes and equipment, and added it to the class selection setup. Enhanced the Fighter class by introducing a healing potion tool to improve gameplay utility. These changes enhance gameplay diversity and team strategies.
2025-02-08 00:05:46 +01:00
Teriuihi 4aa6a0d512 Add player respawn handling with custom logic
Introduced a new event handler for player respawn to set custom spawn locations and apply game class attributes. This ensures players rejoin the game with the correct state after death.
2025-02-07 23:55:53 +01:00
Teriuihi 6f77135426 Refactor snowball handling and improve player interactions
Renamed OnSnowballHit to SnowballEvent and expanded functionality to handle projectile launches. Added InventoryItemInteractionEvent to manage item pickup and drop behavior. Updated player join logic to clear inventory, assign players to teams, and teleport them appropriately based on game state.
2025-02-07 23:48:40 +01:00
Teriuihi e7ce788086 Updated TODO list 2025-02-07 23:25:21 +01:00
Teriuihi ad421015ff Reset player health on game end.
Ensure players have full health when the game ends by resetting their max health attribute and current health to default values. Logged an error if the max health attribute is unavailable.
2025-02-07 23:25:10 +01:00
Teriuihi 73c11ab1ca Add GUI framework for class selection in CTF
Introduced a GUI system to facilitate class selection in the CTF game. This includes an abstract GUIInventory, GUIListener for event handling, and a ClassSelectionGUI for selecting classes. Also, added the "selectclass" command and integrated the GUI with game mechanics for improved player interaction.
2025-02-07 23:22:50 +01:00
Teriuihi 6a9721d0e7 Implemented remaining phases and got the plugin to the minimum viable product
Introduced new flag-related mechanics and game phases including `CombatPhase`, `EndedPhase`, and relevant event handling for better gameplay management. Enhanced team and player functionalities while making incremental adjustments to improve overall code structure.
2025-02-07 22:25:19 +01:00
Teriuihi 076f39279e Add method to clear teams in GameManager
Introduced a `clearTeams` method in `GameManager` to reset the teams list. Updated `Main.java` to call this method, ensuring teams are cleared before processing.
2025-01-24 21:14:39 +01:00
Teriuihi fcf5dc7b7c Refactor class creation and integrate FighterCreator
Abstracted default class creation logic into dedicated FighterCreator class for better modularity. Updated GameManager and ClassSelectionPhase to utilize this new structure, enabling dynamic class creation based on team color. Adjusted TODO.md to mark completed changes.
2025-01-24 21:03:19 +01:00
Teriuihi 5a87784d71 Add JSON configuration support and new team management commands
Introduced JSON-based configuration handling for teams using Jackson and validation utilities. Added commands for reloading configurations and creating teams with support for saving and loading team data. Refactored related classes to integrate with the new system.
2025-01-24 20:12:27 +01:00
Teriuihi 6e38d42f2d Add initial Capture the Flag plugin implementation
Implemented the core structure for a Capture the Flag (CTF) plugin. This includes team management, game phases, player classes, command handling, and configuration support. The project is set up with Gradle for dependency management and provides placeholders for future feature expansion.
2025-01-24 17:49:17 +01:00