Skip to content

feat: add public API module - #242

Open
Jakubk15 wants to merge 27 commits into
masterfrom
codex/issue-176-api-module
Open

feat: add public API module#242
Jakubk15 wants to merge 27 commits into
masterfrom
codex/issue-176-api-module

Conversation

@Jakubk15

Copy link
Copy Markdown
Member

Summary

  • split the project into parcellockers-api and parcellockers-plugin modules
  • expose stable parcel and locker contracts, domain models, events, and the ParcelLockersProvider entry point
  • publish the API as com.eternalcode:parcellockers-api:0.5.0-BETA with sources and Javadocs
  • keep plugin-only administrative and lifecycle operations outside the published API artifact
  • harden parcel dispatch, collection, rollback, item-storage reservation, compensation, and per-parcel operation serialization required by the new public facade
  • use JSpecify for nullness metadata

Why

External plugins currently cannot depend on a small, supported ParcelLockers contract without coupling to the complete plugin implementation. The new module provides a consumer-facing artifact for listening to events and managing parcels and lockers through service interfaces.

Impact

Existing plugin wiring now registers the public API provider during startup and clears it during shutdown. Consumers can compile against the API artifact while implementation details remain in the plugin module and deployable shadow JAR.

Verification

  • ./gradlew :parcellockers-api:test --rerun-tasks
  • explicit non-integration :parcellockers-plugin:test matrix covering all 17 unit-test classes
  • git diff --check

Both Gradle test runs completed with BUILD SUCCESSFUL on the final commit.

Docker/Testcontainers integration tests were intentionally skipped. H2/PostgreSQL schema-upgrade and cross-table transaction scenarios will be verified manually.

Closes #176

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@Jakubk15 Jakubk15 left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

  • Ensure you're using imports, not fully qualified class names
  • Keep it simple and stupid, do not use overly complicated enterprise-grade callbacks and atomicity for a simple Minecraft plugin
  • Ensure the tests are actually worth it rather than blind-writing tests for every feature
  • Answer why PublicParcelService and PluginParcelService cannot be merged

mavenLocal()
maven {
name = "eternalcodeReleases"
url = uri("https://repo.eternalcode.pl/releases")

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

include snapshot publishing

import org.bukkit.command.CommandSender;
import org.bukkit.inventory.ItemStack;

public class ItemStorageManager {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

is this level of atomicity really needed here?

Comment on lines +18 to +22
/**
* Atomically inserts a parcel if its UUID is not already present.
*
* @return true only when this call inserted the row
*/

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

is atomicity really needed everywhere in this class?


@Override
public CompletableFuture<Boolean> saveIfAbsent(Parcel parcel) {
Objects.requireNonNull(parcel, "Parcel cannot be null");

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

we don't need Objects#requireNonNull everywhere, we trust ourselves, other users should handle it on their end i believe

UpdateBuilder<ParcelTable, Object> builder = dao.updateBuilder();
builder.updateColumnValue(STATUS_COLUMN, ParcelStatus.COLLECTED);
builder.where()
var where = builder.where()

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

use explicit type

return result;
}

private static void validateSend(Player sender, Parcel parcel, List<ItemStack> items) {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

question: is all of the validation stuff here REALLY needed?

Comment on lines +57 to +59
when(repository.delete(org.mockito.ArgumentMatchers.any()))
.thenReturn(CompletableFuture.completedFuture(1));
when(repository.save(org.mockito.ArgumentMatchers.any()))

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

import

}
jvmArgs(
"-Dcom.mojang.eula.agree=true",
"-Xlog:aot=info"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Suggested change
"-Xlog:aot=info"

Comment on lines +153 to +154
// jvmArgs("-XX:AOTCacheOutput=server.aot")
jvmArgs("-XX:AOTCache=server.aot")

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Suggested change
// jvmArgs("-XX:AOTCacheOutput=server.aot")
jvmArgs("-XX:AOTCache=server.aot")

use tack instead https://github.com/PaperMC/tack

Comment thread build.gradle.kts
options.release = 21
}
subprojects {
apply(plugin = "java")

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

isn't this considered a legacy way of loading plugins?

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.

Add API module

1 participant