Skip to content

v1.12.0

Choose a tag to compare

@theEvilReaper theEvilReaper released this 24 Jul 09:37
· 45 commits to main since this release

1.12.0 - Changelog

πŸš€ Performance & Concurrency

This release brings significant internal improvements to both the Team and Kit subsystems. Core data structures have been migrated from ArrayList/HashMap to ConcurrentHashMap-based collections, improving thread safety and lookup performance across the board.

Team System

  • StandardTeamService now uses a ConcurrentHashMap<Key, Team> instead of ArrayList<Team>, providing O(1) lookups by key instead of linear scans
  • DefaultTeam uses ConcurrentHashMap.newKeySet() for the player set and ConcurrentHashMap for components, making team operations thread-safe
  • getSmallestTeam() now uses Stream.min() instead of a manual index-based loop
  • getTeams() returns List.copyOf(...) instead of Collections.unmodifiableList(...)

Kit System

  • DefaultKitService now uses a ConcurrentHashMap<Key, Kit> for storage, enabling O(1) kit lookups by key
  • BaseKit components are now stored in a ConcurrentHashMap for thread-safe access
  • getKits() returns List.copyOf(...) instead of Collections.unmodifiableList(...)

πŸ› Bug Fixes

Team Event Handling

Team join/leave operations now correctly fire events before mutating state. The EventDispatcher.callCancellable(...) callback handles the actual add/remove, ensuring that cancelled events do not alter team membership.

Before (broken):

if (getPlayers().add(player)) {
    EventDispatcher.callCancellable(teamEvent, consumer != null ? () -> consumer.accept(player) : EMPTY);
}

After (fixed):

if (!canJoin()) return;
PlayerTeamEvent teamEvent = new PlayerTeamEvent(player, this, TeamAction.ADD);
EventDispatcher.callCancellable(teamEvent, () -> {
    if (getPlayers().add(player) && consumer != null) {
        consumer.accept(player);
    }
});

Team Distribution Bounds

  • Fixed DefaultTeamDistributor: the unwrap loop now uses continue instead of return when a team is null, preventing premature termination of the distribution process

Team Capacity Reset

  • setCapacity() now allows resetting to the default capacity (-1) without throwing an IllegalArgumentException

Multi-Player Operations

  • addPlayers() and removePlayers() now create defensive copies of the input collection before filtering, preventing ConcurrentModificationException and unintended mutation of the caller's collection
  • clearPlayers() now correctly wraps getPlayers() in a new HashSet<> before delegating to removePlayers(...) to avoid modifying the set during iteration

♻️ Refactoring

Player Collection API Broadened

The Joinable interface now accepts Collection<Player> instead of Set<Player> for all bulk operations. This is a source-compatible change, existing code using Set<Player> will continue to work without modification.

Changed methods in Joinable:

// Before
void addPlayers(@NotNull Set<Player> players, @Nullable Consumer<Player> consumer);
void removePlayers(@NotNull Set<Player> players, @Nullable Consumer<Player> consumer);

// After
void addPlayers(Collection<Player> players, @Nullable Consumer<Player> consumer);
void removePlayers(Collection<Player> players, @Nullable Consumer<Player> consumer);

Annotation Cleanup

Redundant @NotNull annotations have been removed from parameters and return types across the entire API surface. The project now relies on package-level @NonnullByDefault annotations (package-info.java files) instead of annotating every individual parameter.

Affected classes include:

  • Team, DefaultTeam, TeamService, StandardTeamService
  • Kit, BaseKit, KitService, DefaultKitService
  • Joinable, ItemShiftOption, ColorData
  • Componentable, ColorComponent
  • GameFinishEvent, PlayerTeamEvent, MultiPlayerTeamEvent, PlayerKitChangeEvent
  • TeamDistributor, DefaultTeamDistributor, Splitter, DistributionPlayer, DistributionTeam

⚠️ Breaking Changes

ColorData.DARK_GREY β†’ ColorData.DARK_GRAY

The enum constant has been renamed to follow American English spelling (consistent with Minestom's NamedTextColor.DARK_GRAY).

-ColorData.DARK_GREY
+ColorData.DARK_GRAY

Team.EMPTY Runnable Removed

The static EMPTY runnable field has been removed from the Team interface. Event callbacks now use inline lambdas with null-checks instead.

Joinable Parameter Type Change

Bulk player methods (addPlayers, removePlayers) now accept Collection<Player> instead of Set<Player>. While source-compatible, this may require updates if you used @Override with the old Set<Player> signature.

Full Changelog: 1.11.1...1.12.0