Skip to content

Commit 418c246

Browse files
Overhaul documentation and add javaDoc task (#26)
* Add java doc tasks * Add or improve documentation * Overhaul phase documentation * Small documentation adjustments * Add constructor documentation Add constructor documentation * Remove generic comment * Add missing documentation * Documentation changes * Improve parameter documentation * Improve constructor documentation * Fix typo in documentation --------- Co-authored-by: theEvilReaper <[email protected]>
1 parent 7f0c26b commit 418c246

27 files changed

+769
-206
lines changed

build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ java {
1313
toolchain {
1414
languageVersion.set(JavaLanguageVersion.of(21))
1515
}
16+
withJavadocJar()
17+
withSourcesJar()
1618
}
1719

1820
dependencies {

src/main/java/net/theevilreaper/xerus/api/ColorData.java

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
import org.jetbrains.annotations.NotNull;
88

99
/**
10-
* The class combines all colors of DyeColor, ChatColor and the wool blocks into enum values.
11-
* So for each color you have all the matching values.
10+
* Represents a mapping of visual color variants using text color, dye color, block material, and a string identifier.
11+
* Each constant aligns with a specific base color and can be used to harmonize visual elements across different systems.
1212
*
1313
* @author theEvilReaper
1414
* @version 1.5.0
@@ -17,24 +17,53 @@
1717
@SuppressWarnings("java:S3252")
1818
public enum ColorData {
1919

20+
/** Aligns with the aqua color. */
2021
AQUA(NamedTextColor.AQUA, DyeColor.LIGHT_BLUE, Material.LIGHT_BLUE_WOOL, "colorAqua"),
22+
23+
/** Aligns with the dark aqua color. */
2124
DARK_AQUA(NamedTextColor.DARK_AQUA, DyeColor.CYAN, Material.CYAN_WOOL, "colorCyan"),
25+
26+
/** Aligns with the black color. */
2227
BLACK(NamedTextColor.BLACK, DyeColor.BLACK, Material.BLACK_WOOL, "colorBlack"),
28+
29+
/** Aligns with the blue color. */
2330
BLUE(NamedTextColor.BLUE, DyeColor.LIGHT_BLUE, Material.BLUE_WOOL, "colorBlue"),
31+
32+
/** Aligns with the dark blue color. */
2433
DARK_BLUE(NamedTextColor.DARK_BLUE, DyeColor.BLUE, Material.BLUE_WOOL, "colorDarkBlue"),
34+
35+
/** Aligns with the brown/gold color. */
2536
GOLD(NamedTextColor.GOLD, DyeColor.ORANGE, Material.ORANGE_WOOL, "colorOrange"),
37+
38+
/** Aligns with the gray color. */
2639
GRAY(NamedTextColor.GRAY, DyeColor.GRAY, Material.LIGHT_GRAY_WOOL, "colorLightGray"),
40+
41+
/** Aligns with the dark gray color. */
2742
DARK_GREY(NamedTextColor.DARK_GRAY, DyeColor.GRAY, Material.GRAY_WOOL, "colorDarkGray"),
43+
44+
/** Aligns with the green color. */
2845
GREEN(NamedTextColor.DARK_GREEN, DyeColor.GREEN, Material.GREEN_WOOL, "colorGreen"),
46+
47+
/** Aligns with the light green color. */
2948
LIGHT_GREEN(NamedTextColor.GREEN, DyeColor.LIME, Material.LIME_WOOL, "colorLime"),
49+
50+
/** Aligns with the purple color. */
3051
PURPLE(NamedTextColor.DARK_PURPLE, DyeColor.PURPLE, Material.PURPLE_WOOL, "colorPurple"),
52+
53+
/** Aligns with the light purple color. */
3154
LIGHT_PURPLE(NamedTextColor.LIGHT_PURPLE, DyeColor.MAGENTA, Material.MAGENTA_WOOL, "colorMagenta"),
55+
56+
/** Aligns with the red color. */
3257
RED(NamedTextColor.RED, DyeColor.RED, Material.RED_WOOL, "colorRed"),
58+
59+
/** Aligns with the dark red color. */
3360
DARK_RED(NamedTextColor.DARK_RED, DyeColor.RED, Material.RED_WOOL, "colorDarkRed"),
61+
62+
/** Aligns with the yellow color. */
3463
YELLOW(NamedTextColor.YELLOW, DyeColor.YELLOW, Material.YELLOW_WOOL, "colorYellow"),
35-
WHITE(NamedTextColor.WHITE, DyeColor.WHITE, Material.WHITE_WOOL, "colorWhite")
3664

37-
;
65+
/** Aligns with the white color. */
66+
WHITE(NamedTextColor.WHITE, DyeColor.WHITE, Material.WHITE_WOOL, "colorWhite");
3867

3968
//Reduce defensive copies from the array, because values() returns each call a new array!
4069
private static final ColorData[] VALUES = values();
@@ -111,7 +140,7 @@ public enum ColorData {
111140

112141
/**
113142
* Returns an array which contains all given color data values.
114-
* Please use this method because its reduce defensive copies from the array,
143+
* Please use this method because it reduces defensive copies from the array,
115144
* because values() returns each call a new array!
116145
*
117146
* @return an array with the color data values

src/main/java/net/theevilreaper/xerus/api/event/GameFinishEvent.java

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,10 @@
55

66
/**
77
* This event signals the end of a game when a specific defined condition is met.
8-
* The event supports various end-game conditions through a generic structure (<T>).
8+
* The event supports various end-game conditions through a generic structure.
99
* If the game has a more advanced use case, this event can be extended by other classes.
10-
* Example usage:
11-
* Suppose you have a game with a custom end-game condition involving player scores.
12-
* You can create a subclass of this event as follows:
13-
* {@code
14-
* public class CustomGameEndEvent extends GameEndEvent<CustomGameData> {
15-
* // Additional customizations for your game's end event
16-
* }
17-
* <p>
18-
* @param <T> The generic structure representing the end-game condition data
10+
*
11+
* @param <T> the type of the end-game condition
1912
* @author theEvilReaper
2013
* @version 1.0.0
2114
* @since 1.2.0

src/main/java/net/theevilreaper/xerus/api/kit/ArmorSlot.java

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,47 @@
44
import org.jetbrains.annotations.NotNull;
55

66
/**
7+
* The {@link ArmorSlot} enum contains all available armor slots.
8+
*
79
* @author theEvilReaper
810
* @version 1.0.0
911
* @since 1.2.0
1012
**/
1113
public enum ArmorSlot {
1214

13-
BOOTS(EquipmentSlot.BOOTS),
14-
LEGGINGS(EquipmentSlot.LEGGINGS),
15+
/**
16+
* Represents the helmet slot.
17+
*/
18+
HELMET(EquipmentSlot.HELMET),
19+
/**
20+
* Represents the chestplate slot.
21+
*/
1522
CHESTPLATE(EquipmentSlot.CHESTPLATE),
16-
HELMET(EquipmentSlot.HELMET);
23+
/**
24+
* Represents the legging's slot.
25+
*/
26+
LEGGINGS(EquipmentSlot.LEGGINGS),
27+
/**
28+
* Represents the boots slot.
29+
*/
30+
BOOTS(EquipmentSlot.BOOTS);
1731

1832
final EquipmentSlot slot;
1933

34+
/**
35+
* Creates a new {@link ArmorSlot} with the given equipment slot.
36+
* @param slot the equipment slot to use.
37+
*/
2038
ArmorSlot(@NotNull EquipmentSlot slot) {
2139
this.slot = slot;
2240
}
2341

24-
public EquipmentSlot getSlot() {
42+
/**
43+
* Returns the underlying equipment slot.
44+
*
45+
* @return the slot
46+
*/
47+
public @NotNull EquipmentSlot getSlot() {
2548
return slot;
2649
}
2750
}

src/main/java/net/theevilreaper/xerus/api/kit/BaseKit.java

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
import static net.minestom.server.inventory.PlayerInventory.INVENTORY_SIZE;
1111

1212
/**
13+
* The {@link BaseKit} is an abstract layer implementation of the {@link Kit} interface.
14+
* It contains the general structure of a kit and can be used to define custom implementations.
15+
*
1316
* @author theEvilReaper
1417
* @version 1.0.0
1518
* @since 1.2.0
@@ -20,42 +23,63 @@ public abstract class BaseKit implements Kit {
2023
protected EnumMap<ArmorSlot, IItem> armorItems;
2124
protected IItem[] items;
2225

26+
/**
27+
* Creates a new instance of the {@link BaseKit}.
28+
*
29+
* @param armorItems whether the kit should contain armor items
30+
*/
2331
protected BaseKit(boolean armorItems) {
2432
this.items = new IItem[INVENTORY_SIZE];
2533
if (armorItems) {
2634
this.armorItems = new EnumMap<>(ArmorSlot.class);
2735
}
2836
}
2937

38+
/**
39+
* {@inheritDoc}}
40+
*/
3041
@Override
3142
public void setArmorItem(@NotNull ArmorSlot slot, @NotNull IItem item) {
3243
this.armorItems.put(slot, item);
3344
}
3445

46+
/**
47+
* {@inheritDoc}}
48+
*/
3549
@Override
3650
public void setArmorItems(@NotNull EnumMap<ArmorSlot, IItem> armorItems) {
3751
this.armorItems = armorItems;
3852
}
3953

54+
/**
55+
* {@inheritDoc}}
56+
*/
4057
@Override
4158
public void setItem(int index, @NotNull IItem item) {
42-
Check.argCondition(index > items.length, "The index is to high");
59+
Check.argCondition(index > items.length, "The index is to high");
4360
items[index] = item;
4461
}
4562

63+
/**
64+
* {@inheritDoc}}
65+
*/
4666
@Override
4767
public void setItems(IItem[] items) {
4868
Check.argCondition(items.length != this.items.length, "The given array has not the same index (" + INVENTORY_SIZE + ")");
4969
this.items = items;
5070
}
5171

72+
/**
73+
* {@inheritDoc}}
74+
*/
5275
@Override
5376
public void setIcon(@NotNull IItem icon) {
5477
this.icon = icon;
5578
}
5679

5780
/**
5881
* Returns the underlying icon from the kit.
82+
*
5983
* @return The underlying icon which is an object from {@link IItem}
6084
*/
6185
@Override

src/main/java/net/theevilreaper/xerus/api/kit/Kit.java

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,25 @@
1212
import java.util.Locale;
1313

1414
/**
15+
* The {@link Kit} interface provides all basic methods that a kit should have.
16+
*
1517
* @author theEvilReaper
1618
* @version 1.0.0
1719
* @since 1.2.0
1820
**/
1921
public interface Kit extends ItemShiftOption {
2022

23+
/**
24+
* The maximum number of armor items that can be set.
25+
*/
2126
int MAX_ARMOR_ITEMS = 4;
2227

2328
/**
2429
* Creates a new instance of the kit.
25-
* @param name The name of the kit
30+
*
31+
* @param name The name of the kit
2632
* @param armorItems Whether the kit should contain armor items
27-
* @return The created instance
33+
* @return the created instance
2834
*/
2935
@Contract(value = "_, _ -> new", pure = true)
3036
static @NotNull KitImpl of(@NotNull Component name, boolean armorItems) {
@@ -33,69 +39,85 @@ public interface Kit extends ItemShiftOption {
3339

3440
/**
3541
* Set the icon for the kit.
42+
*
3643
* @param item the item to set
3744
*/
3845
void setIcon(@NotNull IItem item);
3946

4047
/**
4148
* Add an item to a specific position in the array for the armor items.
49+
*
4250
* @param slot The index where the item should be set
4351
* @param item The item to set
4452
*/
4553
void setArmorItem(@NotNull ArmorSlot slot, @NotNull IItem item);
4654

4755
/**
4856
* Set the armor items directly per array.
57+
*
4958
* @param items The items to set
5059
*/
5160
void setArmorItems(@NotNull EnumMap<ArmorSlot, IItem> items);
5261

5362
/**
5463
* Add an item to a specific position in the array for the hotBar items.
64+
*
5565
* @param index The index where the item should be set
56-
* @param item The item to set
66+
* @param item The item to set
5767
*/
5868
void setItem(int index, @NotNull IItem item);
5969

6070
/**
6171
* Set all hotbar items directly per array.
72+
*
6273
* @param items The items to set
6374
*/
6475
void setItems(@NotNull IItem... items);
6576

6677
/**
6778
* Returns the identifier of the kit.
79+
*
6880
* @return the underlying value
6981
*/
7082
String getIdentifier();
7183

7284
/**
7385
* Gets the name of the kit.
86+
*
7487
* @return the underlying value
7588
*/
76-
default Component getName() { return getName(null); }
89+
default Component getName() {
90+
return getName(null);
91+
}
7792

7893
/**
79-
* Returns the name of the kit.
94+
* Returns the name of the kit depending on the given locale as a {@link Component}.
95+
*
96+
* @param locale The locale to determine the right name
8097
* @return the underlying value
8198
*/
8299
Component getName(@UnknownNullability Locale locale);
83100

84101
/**
85102
* Returns the description from the kit.
103+
*
86104
* @return the underlying value
87105
*/
88-
default Component getDescription() { return getDescription(null); }
106+
default Component getDescription() {
107+
return getDescription(null);
108+
}
89109

90110
/**
91111
* Returns the description from the kit.
112+
*
92113
* @param locale The locale to determine the right description
93114
* @return The underlying value
94115
*/
95116
Component getDescription(@UnknownNullability Locale locale);
96117

97118
/**
98119
* Returns the icon from the kit.
120+
*
99121
* @return the underlying value
100122
*/
101123
@Nullable

0 commit comments

Comments
 (0)