-
-
Notifications
You must be signed in to change notification settings - Fork 21
GH-1210 Add placeholder documentation automation. #1210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
458cf71
Add placeholder documentation automation.
vLuckyyy 0f5dc67
Add homes-related placeholders to documentation
vLuckyyy c002230
Add placeholder documentation for home-related features
vLuckyyy 8ed84bd
Update placeholder documentation to include prefixed names and remove…
vLuckyyy 03821b5
wip
CitralFlo c4424f8
Follow review feedback. standarize messages.
vLuckyyy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
...-docs-api/src/main/java/com/eternalcode/annotations/scan/placeholder/PlaceholderDocs.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| package com.eternalcode.annotations.scan.placeholder; | ||
|
|
||
| import java.lang.annotation.ElementType; | ||
| import java.lang.annotation.Retention; | ||
| import java.lang.annotation.RetentionPolicy; | ||
| import java.lang.annotation.Target; | ||
|
|
||
| @Retention(RetentionPolicy.RUNTIME) | ||
| @Target({ ElementType.METHOD, ElementType.FIELD }) | ||
| public @interface PlaceholderDocs { | ||
|
|
||
| /** | ||
| * The name of the placeholder (without % symbols) | ||
| * Example: "afk" for %afk% | ||
| */ | ||
| String name(); | ||
|
|
||
| /** | ||
| * Description of what the placeholder does | ||
| */ | ||
| String description(); | ||
|
|
||
| /** | ||
| * Example output of the placeholder | ||
| */ | ||
| String example(); | ||
|
|
||
| /** | ||
| * Return type of the placeholder | ||
| */ | ||
| String returnType(); | ||
|
|
||
| /** | ||
| * Category for grouping placeholders | ||
| */ | ||
| String category() default "General"; | ||
|
|
||
| /** | ||
| * Whether the placeholder requires a player context | ||
| */ | ||
| boolean requiresPlayer(); | ||
| } |
11 changes: 11 additions & 0 deletions
11
...ocs-api/src/main/java/com/eternalcode/annotations/scan/placeholder/PlaceholderResult.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| package com.eternalcode.annotations.scan.placeholder; | ||
|
|
||
| public record PlaceholderResult( | ||
| String name, | ||
| String description, | ||
| String example, | ||
| String returnType, | ||
| String category, | ||
| boolean requiresPlayer | ||
| ) { | ||
| } |
24 changes: 24 additions & 0 deletions
24
...i/src/main/java/com/eternalcode/annotations/scan/placeholder/PlaceholderScanResolver.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,24 @@ | ||||||
| package com.eternalcode.annotations.scan.placeholder; | ||||||
|
|
||||||
| import com.eternalcode.annotations.scan.EternalScanRecord; | ||||||
| import com.eternalcode.annotations.scan.SingleAnnotationScanResolver; | ||||||
|
|
||||||
| public class PlaceholderScanResolver extends SingleAnnotationScanResolver<PlaceholderDocs, PlaceholderResult> { | ||||||
|
|
||||||
| public PlaceholderScanResolver() { | ||||||
| super(PlaceholderDocs.class); | ||||||
| } | ||||||
|
|
||||||
| @Override | ||||||
| public PlaceholderResult resolve(EternalScanRecord record, PlaceholderDocs annotation) { | ||||||
| String prefixedName = "%eternalcore_" + annotation.name() + "%"; | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| return new PlaceholderResult( | ||||||
| prefixedName, | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| annotation.description(), | ||||||
| annotation.example(), | ||||||
| annotation.returnType(), | ||||||
| annotation.category(), | ||||||
| annotation.requiresPlayer() | ||||||
| ); | ||||||
| } | ||||||
| } | ||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.