Skip to content

Commit 5748cad

Browse files
committed
docs: write Javadocs
1 parent d1fa103 commit 5748cad

File tree

16 files changed

+191
-87
lines changed

16 files changed

+191
-87
lines changed

AGENTS.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ Javadoc Standards
2929

3030
- Explain the purpose of the class/method in the context of Minecraft server-side rendering.
3131
- Document `@param` and `@return` types, especially for complex types like MolangCompiler or DisplayEntity.
32-
- Include `@since` tags corresponding to the current versioning in build.gradle.kts.
32+
- For Java Record classes, every component (field) must be documented using the `@param` tag.
33+
- Include `@since` tags corresponding to the current versioning in gradle.properties.
3334

3435
### Git & Code Interaction
3536
Commit Messages: Use conventional commits (e.g., docs: add Javadoc for AnimationController).

api/src/main/java/kr/toxicity/model/api/animation/VectorPoint.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
* Vector point
1717
* @param function function
1818
* @param time time
19+
* @param bezier bezier config
1920
* @param interpolator interpolator
2021
*/
2122
public record VectorPoint(@NotNull FloatFunction<Vector3f> function, float time, @NotNull BezierConfig bezier, @NotNull VectorInterpolator interpolator) implements Timed {

api/src/main/java/kr/toxicity/model/api/data/blueprint/BlueprintElement.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,7 @@ record Cube(
344344

345345
/**
346346
* Gets max length of this cube
347+
* @param origin origin
347348
* @return cube length
348349
*/
349350
public float max(@NotNull Float3 origin) {

api/src/main/java/kr/toxicity/model/api/data/raw/ModelElement.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,9 @@ default boolean isSupported() {
6767

6868
/**
6969
* A raw model's locator
70-
* @param name
71-
* @param uuid
70+
* @param name name
71+
* @param uuid uuid
72+
* @param position position
7273
*/
7374
record Locator(
7475
@NotNull String name,
@@ -100,7 +101,7 @@ record Locator(
100101

101102
/**
102103
* A raw model's camera
103-
* @param uuid
104+
* @param uuid uuid
104105
*/
105106
record Camera(
106107
@NotNull String uuid
@@ -120,8 +121,8 @@ record Camera(
120121

121122
/**
122123
* A raw model's null object
123-
* @param name
124-
* @param uuid
124+
* @param name name
125+
* @param uuid uuid
125126
* @param ikTarget ik target
126127
* @param ikSource ik source
127128
* @param position position

api/src/main/java/kr/toxicity/model/api/data/raw/ModelTexture.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public record ModelTexture(
3535

3636
/**
3737
* Converts this texture to blueprint textures
38+
* @param context context
3839
* @return converted textures
3940
*/
4041
public @NotNull BlueprintTexture toBlueprint(@NotNull ModelLoadContext context) {

api/src/main/java/kr/toxicity/model/api/manager/ModelManager.java

Lines changed: 61 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,31 @@
2020
import java.util.function.Consumer;
2121

2222
/**
23-
* Model Manager
23+
* Manages all loaded models and provides access to them.
24+
* <p>
25+
* This manager is the primary entry point for retrieving {@link ModelRenderer} instances,
26+
* which are used to create and control model trackers.
27+
* </p>
28+
*
29+
* @since 1.15.2
2430
*/
2531
public interface ModelManager {
2632

2733
/**
28-
* Gets renderer by name
29-
* @param name name
30-
* @return renderer or null
34+
* Retrieves a model renderer by its name.
35+
*
36+
* @param name the name of the model
37+
* @return the model renderer, or null if not found
38+
* @since 1.15.2
3139
*/
3240
@Nullable ModelRenderer model(@NotNull String name);
3341

3442

3543
/**
36-
* @deprecated Use ModelManager#model instead.
37-
* @param name name
38-
* @return renderer or null
44+
* @deprecated Use {@link #model(String)} instead.
45+
* @param name the name of the model
46+
* @return the model renderer, or null if not found
47+
* @since 1.15.2
3948
*/
4049
@Deprecated
4150
@Nullable
@@ -44,72 +53,88 @@ default ModelRenderer renderer(@NotNull String name) {
4453
}
4554

4655
/**
47-
* Gets all renderers
48-
* @return all renderers
56+
* Returns a collection of all loaded model renderers.
57+
*
58+
* @return an unmodifiable collection of models
59+
* @since 1.15.2
4960
*/
5061
@NotNull @Unmodifiable
5162
Collection<ModelRenderer> models();
5263

5364
/**
54-
* Gets all key of renderer
55-
* @return keys
65+
* Returns a set of all loaded model names.
66+
*
67+
* @return an unmodifiable set of model keys
68+
* @since 1.15.2
5669
*/
5770
@NotNull @Unmodifiable
5871
Set<String> modelKeys();
5972

6073
/**
61-
* Gets all renderers for player animation.
62-
* @return renderers
74+
* Returns a collection of all renderers designated for player limb animations.
75+
*
76+
* @return an unmodifiable collection of limb models
77+
* @since 1.15.2
6378
*/
6479
@NotNull @Unmodifiable
6580
Collection<ModelRenderer> limbs();
6681

6782
/**
68-
* Gets renderer for player animation by name.
69-
* @param name renderer's name
70-
* @return renderer or null
83+
* Retrieves a player limb renderer by its name.
84+
*
85+
* @param name the name of the limb model
86+
* @return the limb renderer, or null if not found
87+
* @since 1.15.2
7188
*/
7289
@Nullable ModelRenderer limb(@NotNull String name);
7390

7491
/**
75-
* Gets all key of renderer
76-
* @return keys
92+
* Returns a set of all loaded player limb model names.
93+
*
94+
* @return an unmodifiable set of limb keys
95+
* @since 1.15.2
7796
*/
7897
@NotNull @Unmodifiable
7998
Set<String> limbKeys();
8099

81100

82101
/**
83-
* Play's animation to this player
84-
* @param player player
85-
* @param model model name
86-
* @param animation animation name
87-
* @return whether to success
102+
* Plays an animation on a player.
103+
*
104+
* @param player the target player
105+
* @param model the name of the limb model
106+
* @param animation the name of the animation
107+
* @return true if the animation started successfully
108+
* @since 1.15.2
88109
*/
89110
default boolean animate(@NotNull Player player, @NotNull String model, @NotNull String animation) {
90111
return animate(player, model, animation, AnimationModifier.DEFAULT_WITH_PLAY_ONCE);
91112
}
92113

93114
/**
94-
* Play's animation to this player with a specific loop type.
95-
* @param player player
96-
* @param model model name
97-
* @param animation animation name
98-
* @param modifier modifier
99-
* @return whether to success
115+
* Plays an animation on a player with a specific modifier.
116+
*
117+
* @param player the target player
118+
* @param model the name of the limb model
119+
* @param animation the name of the animation
120+
* @param modifier the animation modifier
121+
* @return true if the animation started successfully
122+
* @since 1.15.2
100123
*/
101124
default boolean animate(@NotNull Player player, @NotNull String model, @NotNull String animation, @NotNull AnimationModifier modifier) {
102125
return animate(player, model, animation, modifier, t -> {});
103126
}
104127

105128
/**
106-
* Play's animation to this player with a specific loop type.
107-
* @param player player
108-
* @param model model name
109-
* @param animation animation name
110-
* @param modifier modifier
111-
* @param consumer consumer
112-
* @return whether to success
129+
* Plays an animation on a player with a modifier and a configuration consumer.
130+
*
131+
* @param player the target player
132+
* @param model the name of the limb model
133+
* @param animation the name of the animation
134+
* @param modifier the animation modifier
135+
* @param consumer a consumer to configure the created tracker
136+
* @return true if the animation started successfully
137+
* @since 1.15.2
113138
*/
114139
default boolean animate(@NotNull Player player, @NotNull String model, @NotNull String animation, @NotNull AnimationModifier modifier, @NotNull Consumer<EntityTracker> consumer) {
115140
var get = limb(model);

api/src/main/java/kr/toxicity/model/api/manager/PlayerManager.java

Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
*/
77
package kr.toxicity.model.api.manager;
88

9-
import kr.toxicity.model.api.BetterModel;
10-
import kr.toxicity.model.api.animation.AnimationModifier;
11-
import kr.toxicity.model.api.data.renderer.ModelRenderer;
129
import kr.toxicity.model.api.nms.PlayerChannelHandler;
1310
import org.bukkit.entity.Player;
1411
import org.jetbrains.annotations.NotNull;
@@ -17,37 +14,33 @@
1714
import java.util.UUID;
1815

1916
/**
20-
* Player manager
17+
* Manages player-specific data and network channels.
18+
* <p>
19+
* This manager is responsible for injecting and retrieving {@link PlayerChannelHandler} instances,
20+
* which are essential for sending custom packets to players.
21+
* </p>
22+
*
23+
* @since 1.15.2
2124
*/
2225
public interface PlayerManager {
2326
/**
24-
* Gets player channel handler
25-
* @param uuid player's uuid
26-
* @return channel handler or null
27+
* Retrieves the channel handler for a player by their UUID.
28+
*
29+
* @param uuid the player's UUID
30+
* @return the channel handler, or null if not found
31+
* @since 1.15.2
2732
*/
2833
@Nullable PlayerChannelHandler player(@NotNull UUID uuid);
2934

3035
/**
31-
* Get or creates channel handler
32-
* Do not use this with fake player, instead use PlayerManager#player(UUID)
33-
* @param player player
34-
* @return channel handler
36+
* Gets or creates the channel handler for a player.
37+
* <p>
38+
* Note: This should not be used with fake players. Use {@link #player(UUID)} instead for those cases.
39+
* </p>
40+
*
41+
* @param player the player
42+
* @return the channel handler
43+
* @since 1.15.2
3544
*/
3645
@NotNull PlayerChannelHandler player(@NotNull Player player);
37-
38-
@Deprecated(forRemoval = true)
39-
@Nullable
40-
default ModelRenderer limb(@NotNull String name) {
41-
return BetterModel.limbOrNull(name);
42-
}
43-
44-
@Deprecated(forRemoval = true)
45-
default boolean animate(@NotNull Player player, @NotNull String model, @NotNull String animation) {
46-
return BetterModel.plugin().modelManager().animate(player, model, animation);
47-
}
48-
49-
@Deprecated(forRemoval = true)
50-
default boolean animate(@NotNull Player player, @NotNull String model, @NotNull String animation, @NotNull AnimationModifier modifier) {
51-
return BetterModel.plugin().modelManager().animate(player, model, animation, modifier);
52-
}
53-
}
46+
}

api/src/main/java/kr/toxicity/model/api/manager/ProfileManager.java

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,38 @@
1111
import org.jetbrains.annotations.NotNull;
1212

1313
/**
14-
* Profile manager
14+
* Manages the resolution and creation of model profiles (skins).
15+
* <p>
16+
* This manager allows configuring the strategy for fetching profiles (e.g., from Mojang API, cache, or custom sources)
17+
* and creating skin instances from raw texture data.
18+
* </p>
19+
*
20+
* @since 1.15.2
1521
*/
1622
public interface ProfileManager {
1723

1824
/**
19-
* Gets current supplier
20-
* @return current supplier
25+
* Returns the current profile supplier strategy.
26+
*
27+
* @return the profile supplier
28+
* @since 1.15.2
2129
*/
2230
@NotNull ModelProfileSupplier supplier();
2331

2432
/**
25-
* Loads skin from raw textures
26-
* @param rawTextures textures
27-
* @return skin
33+
* Creates a {@link ModelProfileSkin} from a raw texture string (Base64 encoded).
34+
*
35+
* @param rawTextures the raw texture data
36+
* @return the created skin profile
37+
* @since 1.15.2
2838
*/
2939
@NotNull ModelProfileSkin skin(@NotNull String rawTextures);
3040

3141
/**
32-
* Sets supplier
33-
* @param supplier new supplier
42+
* Sets the profile supplier strategy.
43+
*
44+
* @param supplier the new profile supplier
45+
* @since 1.15.2
3446
*/
3547
void supplier(@NotNull ModelProfileSupplier supplier);
3648
}

api/src/main/java/kr/toxicity/model/api/manager/ReloadInfo.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,22 @@
1111
import org.bukkit.command.CommandSender;
1212
import org.jetbrains.annotations.NotNull;
1313

14+
/**
15+
* Represents the context for a plugin reload operation.
16+
* <p>
17+
* This record holds information about who initiated the reload and whether certain parts of the reload should be skipped.
18+
* </p>
19+
*
20+
* @param skipConfig whether to skip reloading the main configuration file
21+
* @param sender the command sender who initiated the reload
22+
* @since 1.15.2
23+
*/
1424
@Builder
1525
public record ReloadInfo(boolean skipConfig, @NotNull CommandSender sender) {
26+
/**
27+
* The default reload info, representing a standard reload initiated from the console.
28+
* @since 1.15.2
29+
*/
1630
public static final ReloadInfo DEFAULT = ReloadInfo.builder()
1731
.skipConfig(false)
1832
.sender(Bukkit.getConsoleSender())

api/src/main/java/kr/toxicity/model/api/manager/ScriptManager.java

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,29 @@
1212
import org.jetbrains.annotations.Nullable;
1313

1414
/**
15-
* Script manager
15+
* Manages the parsing and registration of animation scripts.
16+
* <p>
17+
* This manager allows for the creation of custom script logic that can be embedded within animations.
18+
* </p>
19+
*
20+
* @since 1.15.2
1621
*/
1722
public interface ScriptManager {
1823
/**
19-
* Creates a script for line
20-
* @param script raw script
21-
* @return entity script
24+
* Parses a raw script string into an {@link AnimationScript}.
25+
*
26+
* @param script the raw script string
27+
* @return the parsed script, or null if parsing failed
28+
* @since 1.15.2
2229
*/
2330
@Nullable AnimationScript build(@NotNull String script);
2431

2532
/**
26-
* Adds script parser to registry
27-
* @param name parser name
28-
* @param script script builder
33+
* Registers a new script builder.
34+
*
35+
* @param name the name of the parser/builder
36+
* @param script the script builder instance
37+
* @since 1.15.2
2938
*/
3039
void addBuilder(@NotNull String name, @NotNull ScriptBuilder script);
3140
}

0 commit comments

Comments
 (0)