Skip to content

chore: clean up CloudKey#549

Merged
Citymonstret merged 8 commits into2.0.0-devfrom
chore/2.0.0/key-cleanup
Dec 7, 2023
Merged

chore: clean up CloudKey#549
Citymonstret merged 8 commits into2.0.0-devfrom
chore/2.0.0/key-cleanup

Conversation

@Citymonstret
Copy link
Copy Markdown
Member

This PR gets rid of SimpleCloudKey, and exposes static factory methods in CloudKey that reference an immutable implementation.

CloudKey is turned into an abstract class with a final implementation of equals (and hashCode) to enforce the requirement that only the names are checked for equality.

The prefixes are dropped from the CloudKey accessors.

Alexander Söderberg added 2 commits December 6, 2023 17:26
This PR removes `CommandMeta.Key` and replaces all usage of it with `CloudKey`. It existed because of legacy reasons, and we no longer have a use for it.

SimpleCommandMeta no longer has to be referenced directly, and the command meta builder has been extracted and no longer exposes the implementation. The class remains public and non-final in case anyone wants to extend it.

The `CommandManager#createDefaultCommandMeta` method has a default implementation that returns an empty instance. It is very rare for the implementation of this to do anything else anyway.
This PR gets rid of SimpleCloudKey, and exposes static factory methods in CloudKey that reference an immutable implementation.

CloudKey is turned into an abstract class with a final implementation of equals (and hashCode) to enforce the requirement that only the names are checked for equality.

The prefixes are dropped from the CloudKey accessors.
@Citymonstret Citymonstret added this to the 2.0.0 milestone Dec 6, 2023
@github-actions
Copy link
Copy Markdown

github-actions bot commented Dec 6, 2023

Test Results

  73 files  +  1    73 suites  +1   11s ⏱️ -10s
461 tests +16  461 ✔️ +16  0 💤 ±0  0 ±0 
473 runs  +16  473 ✔️ +16  0 💤 ±0  0 ±0 

Results for commit 0ce310f. ± Comparison against base commit 5ce1a86.

♻️ This comment has been updated with latest results.

@jpenilla
Copy link
Copy Markdown
Member

jpenilla commented Dec 6, 2023

CloudKeyHolder#getKey could probably be renamed to cloudKey or just key

Alexander Söderberg added 5 commits December 7, 2023 05:19
both CommandContext and CommandMeta now implement CloudKeyRegistry, which makes the API a lot more consistent.

This also ensures that there are consistent overloads using strings and CloudKeyHolder.
Base automatically changed from chore/2.0.0/meta-cleanup to 2.0.0-dev December 7, 2023 09:12
# Conflicts:
#	cloud-core/src/main/java/cloud/commandframework/extra/confirmation/CommandConfirmationManager.java
#	cloud-core/src/main/java/cloud/commandframework/meta/CommandMeta.java
#	cloud-core/src/main/java/cloud/commandframework/meta/CommandMetaBuilder.java
#	cloud-core/src/main/java/cloud/commandframework/meta/SimpleCommandMeta.java
#	cloud-core/src/test/java/cloud/commandframework/CommandBeanTest.java
#	cloud-core/src/test/java/cloud/commandframework/CommandPermissionTest.java
#	cloud-core/src/test/java/cloud/commandframework/CommandTreeTest.java
#	cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/BukkitCommandMeta.java
#	cloud-minecraft/cloud-fabric/src/main/java/cloud/commandframework/fabric/FabricServerCommandManager.java
#	cloud-minecraft/cloud-sponge7/src/main/java/cloud/commandframework/sponge7/SpongeMetaKeys.java
#	examples/example-bukkit/src/main/java/cloud/commandframework/examples/bukkit/feature/ProcessorExample.java
@Citymonstret Citymonstret marked this pull request as ready for review December 7, 2023 09:13
@Citymonstret Citymonstret merged commit 98fa43d into 2.0.0-dev Dec 7, 2023
@Citymonstret Citymonstret deleted the chore/2.0.0/key-cleanup branch December 7, 2023 09:21
@Citymonstret Citymonstret mentioned this pull request Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants