Skip to content

Add Nexus deploy workflow, Maven publishing, and utility classes#4

Merged
ericlmao merged 14 commits intoreleasefrom
snapshot
Mar 1, 2026
Merged

Add Nexus deploy workflow, Maven publishing, and utility classes#4
ericlmao merged 14 commits intoreleasefrom
snapshot

Conversation

@ericlmao
Copy link
Member

@ericlmao ericlmao commented Mar 1, 2026

This pull request introduces several improvements across the codebase, focusing on modularizing GUI menu logic, enhancing test coverage for utility classes, and updating build configuration to support JUnit 5 testing. The most impactful changes are the extraction of menu interaction logic into a dedicated utility class for maintainability, the addition of comprehensive unit tests for core utilities, and the upgrade of the build system to leverage modern testing frameworks.

Refactoring and Codebase Organization

  • Extracted common menu interaction logic from ChestMenu and HopperMenu into the new MenuInteractionUtil class, replacing duplicated code for click handling, menu opening, button refreshing, button addition, and click cancellation checks. This significantly improves maintainability and reduces code duplication. [1] [2] [3] [4] [5] [6] [7]

Testing and Quality Assurance

  • Added new unit test classes for NumberUtil, TimeUtil, IntList, and OptionalBool utilities, increasing test coverage and ensuring correctness of utility methods. [1] [2] [3] [4]

Build System and Dependency Updates

  • Updated common/build.gradle.kts to use JUnit 5 (JUnit Jupiter) for testing, including the JUnit BOM and platform launcher, and configured the test task to use JUnit Platform. This modernizes the testing infrastructure and enables the new tests to run. [1] [2]

Utility Method Improvements

  • Refactored NumberUtil.condense(BigDecimal, char[]) for clarity and maintainability by using an intermediate variable and clearer branching.
  • Minor comment improvement in TimeUtil.parseUnitFormat for whitespace handling, increasing readability.

Documentation

  • Added a comprehensive .github/copilot-instructions.md for the desloppify codebase health scanner, detailing workflow, commands, and integration with VS Code Copilot.

ericlmao and others added 14 commits February 25, 2026 13:23
Add a GitHub Actions workflow to deploy artifacts to Negative Games Nexus for release and snapshot branches. The workflow sets up JDK 21 and Gradle, injects Nexus credentials into ~/.gradle/gradle.properties from secrets, adjusts module apiVersion for release/snapshot branches, and runs ./gradlew publish with an isRelease flag.

Update root build.gradle.kts to apply maven-publish and configure a nexus repository that selects snapshots or releases based on the isRelease property and reads credentials from gradle.properties. Add maven-publish and shadow publishing configuration to common and paper modules: set module ids, domain, apiVersion, Java 21 toolchain, disable the plain jar, configure shadowJar as the published artifact, and include POM metadata (license, developer, url).
Switch sed targets from build.gradle to build.gradle.kts and update the regexes to match Kotlin DSL variable declarations (var apiVersion = "...") for both release and snapshot branches. This ensures version bump/removal works for build.gradle.kts files. Also add a missing newline at end of file.
Delete the tasks.jar { enabled = false } block from common/build.gradle.kts so the default jar task is no longer disabled. This restores normal jar packaging behavior while keeping the shadowJar configuration (archiveBaseName and archiveVersion) intact.
Add project README documenting modules, usage, and APIs. Introduce PaperCommand interface (CloudCommand specialized for CommandSourceStack) and update PaperCommandRegistry to discover/register PaperCommand beans (remove unused CloudCommand import). This aligns command discovery with the Paper-specific command type and adds library documentation.
Introduce IntList with a static parse(List<String>) method that converts strings into a List<Integer>. Supports single integers and inclusive ranges (e.g., "5-10"); input segments are trimmed before parsing. Useful for parsing config or input lists; invalid numeric input will throw NumberFormatException.
Introduce JsonUtil, a final utility class (Slf4j) providing Gson-based JSON file operations. Adds methods to load/save objects: loadFromFile, loadTypeFromFile, loadFromDirectory, saveToFile and saveTypeToFile. Uses UTF-8 encoding, Optional/Collection return types, basic file existence checks and error logging, and prevents instantiation.
Introduce a Cooldowns Spring component and Bukkit Listener to manage per-player, per-key cooldowns. Uses a Guava Table backed by concurrent maps to store expiry timestamps (epoch millis), provides addCooldown overloads (millis and Duration) and an isOnCooldown check. Clears a player's cooldowns on PlayerQuitEvent to prevent memory leaks.
Introduce OptionalBool to wrap boolean values and provide Optional-like, functional-style operations. The class uses singleton instances for true/false, offers isTrue/isFalse checks, conditional executors (ifTrue, ifFalse, ifTrueOrElse) and mapping utilities (mapIfTrue, mapIfFalse, mapIfTrueOrElse) that return Optional or computed values. Also overrides equals, hashCode, and toString. Placed in games.negative.engine.util for use across the codebase.
Introduce a new Reloadable interface with a single reload() method and implement plugin reload handling in PaperPlugin. PaperPlugin now invokes Reloadable beans via invokeBeans, calling their reload methods and logging any failures using SLF4J (@slf4j). Adds the new common interface file and updates imports in the Paper module.
PaperPlugin: onEnable now invokes Spring beans of type org.bukkit.event.Listener and registers them with the server PluginManager, logging any registration failures. Added the Listener import. PaperCommandRegistry: added an info log "Registering commands" at the start of onEnable to surface command registration in logs.
Update apiVersion from 1.0.0 to 1.1.0 in common/build.gradle.kts and paper/build.gradle.kts to reflect the API minor release.
Centralize repeated GUI logic by adding MenuInteractionUtil (processClick, openMenu, refreshButton, addButton, checkCancelClick) and update ChestMenu, HopperMenu and PaginatedMenu to delegate to it. Add unit tests for IntList, NumberUtil, OptionalBool and TimeUtil and configure JUnit in common/build.gradle.kts (useJUnitPlatform and junit dependencies). Small cleanups: tweak NumberUtil.condense and a TimeUtil comment, remove an unused import in PaperLocalizationPlatform, adjust JsonUtil imports, add .github/copilot-instructions.md, and ignore /.desloppify in .gitignore. These changes reduce duplication in GUI classes and improve test coverage.
@ericlmao ericlmao merged commit fa3a079 into release Mar 1, 2026
1 check passed
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.

1 participant