Skip to content

Commit 7cd6d38

Browse files
committed
Update Javadoc
1 parent 14bbb0f commit 7cd6d38

24 files changed

+340
-49
lines changed

src/eu/endercentral/crazy_advancements/CrazyAdvancementsAPI.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,19 @@
3636
import net.minecraft.network.protocol.game.PacketPlayOutSelectAdvancementTab;
3737
import net.minecraft.resources.MinecraftKey;
3838

39+
/**
40+
* Represents the API's Plugin
41+
*
42+
* @author Axel
43+
*
44+
*/
3945
public class CrazyAdvancementsAPI extends JavaPlugin implements Listener {
4046

4147
private static CrazyAdvancementsAPI instance;
4248

49+
/**
50+
* Criterion Instance for Internal Use
51+
*/
4352
public static final Criterion CRITERION = new Criterion(new CriterionInstance() {
4453
@Override
4554
public JsonObject a(LootSerializationContext arg0) {
@@ -81,6 +90,11 @@ public void onDisable() {
8190
}
8291
}
8392

93+
/**
94+
* Gets the Instance
95+
*
96+
* @return The Instance
97+
*/
8498
public static CrazyAdvancementsAPI getInstance() {
8599
return instance;
86100
}

src/eu/endercentral/crazy_advancements/JSONMessage.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,36 @@
55
import net.minecraft.network.chat.IChatBaseComponent;
66
import net.minecraft.network.chat.IChatBaseComponent.ChatSerializer;
77

8+
/**
9+
* Represents a Message in JSON Format
10+
*
11+
* @author Axel
12+
*
13+
*/
814
public class JSONMessage {
915

1016
private final BaseComponent json;
1117

1218
/**
19+
* Constructor for creating a JSON Message
1320
*
14-
* @param json A JSON representation of an ingame Message {@link <a href="https://github.com/skylinerw/guides/blob/master/java/text%20component.md">Read More</a>}
21+
* @param json A JSON representation of an ingame Message <a href="https://www.spigotmc.org/wiki/the-chat-component-api/">Read More</a>
1522
*/
1623
public JSONMessage(BaseComponent json) {
1724
this.json = json;
1825
}
1926

2027
/**
28+
* Gets the Message as a BaseComponent
2129
*
22-
* @return the JSON representation of an ingame Message
30+
* @return the BaseComponent of an ingame Message
2331
*/
2432
public BaseComponent getJson() {
2533
return json;
2634
}
2735

2836
/**
37+
* Gets an NMS representation of an ingame Message
2938
*
3039
* @return An {@link IChatBaseComponent} representation of an ingame Message
3140
*/

src/eu/endercentral/crazy_advancements/NameKey.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
import net.minecraft.resources.MinecraftKey;
44

5+
/**
6+
* Represents a Unique Name
7+
*
8+
* @author Axel
9+
*
10+
*/
511
public class NameKey {
612

713
private final String namespace;
@@ -10,8 +16,9 @@ public class NameKey {
1016
private transient MinecraftKey mcKey;
1117

1218
/**
19+
* Constructor for creating a NameKey
1320
*
14-
* @param namespace The namespace, choose something representing your plugin/project
21+
* @param namespace The namespace, choose something representing your plugin/project/subproject
1522
* @param key The Unique key inside your namespace
1623
*/
1724
public NameKey(String namespace, String key) {
@@ -20,6 +27,7 @@ public NameKey(String namespace, String key) {
2027
}
2128

2229
/**
30+
* Constructor for creating a NameKey
2331
*
2432
* @param key The key inside the default namespace "minecraft" or a NameSpacedKey seperated by a colon
2533
*/
@@ -37,14 +45,15 @@ public NameKey(String key) {
3745
/**
3846
* Generates a {@link NameKey}
3947
*
40-
* @param from
48+
* @param from The MinecraftKey to generate from
4149
*/
4250
public NameKey(MinecraftKey from) {
4351
this.namespace = from.b().toLowerCase();
4452
this.key = from.a().toLowerCase();
4553
}
4654

4755
/**
56+
* Gets the namespace
4857
*
4958
* @return The namespace
5059
*/
@@ -53,6 +62,7 @@ public String getNamespace() {
5362
}
5463

5564
/**
65+
* Gets the key
5666
*
5767
* @return The key
5868
*/

src/eu/endercentral/crazy_advancements/advancement/Advancement.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@
2828
import net.md_5.bungee.api.chat.TranslatableComponent;
2929
import net.md_5.bungee.api.chat.hover.content.Text;
3030

31+
/**
32+
* Represents an Advancement
33+
*
34+
* @author Axel
35+
*
36+
*/
3137
public class Advancement {
3238

3339
private final NameKey name;
@@ -330,10 +336,10 @@ public AdvancementProgress getProgress(Player player) {
330336
}
331337

332338
/**
333-
* Gets a player's progress
339+
* Gets a Player's progress
334340
*
335341
* @param uuid The uuid of the player to check
336-
* @return
342+
* @return The Player's progress
337343
*/
338344
public AdvancementProgress getProgress(UUID uuid) {
339345
if(!progressMap.containsKey(uuid.toString())) {
@@ -416,6 +422,7 @@ public boolean getVisibilityStatus(Player player) {
416422
/**
417423
* Gets a Toast Notification for this Advancement
418424
*
425+
* @return The Toast Notification
419426
*/
420427
public ToastNotification getToastNotification() {
421428
ToastNotification notification = new ToastNotification(getDisplay().getIcon(), getDisplay().getTitle(), getDisplay().getFrame());
@@ -436,7 +443,7 @@ public void displayToast(Player player) {
436443
* Gets an Advancement Message
437444
*
438445
* @param player Player who has recieved the advancement
439-
* @return
446+
* @return The Advancement Message as a Base Component
440447
*/
441448
public BaseComponent getMessage(Player player) {
442449
String translation = "chat.type.advancement." + display.getFrame().name().toLowerCase();

src/eu/endercentral/crazy_advancements/advancement/AdvancementDisplay.java

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010
import net.md_5.bungee.api.chat.TextComponent;
1111
import net.minecraft.advancements.AdvancementFrameType;
1212

13+
/**
14+
* Represents the Display Information of an Advancement
15+
*
16+
* @author Axel
17+
*
18+
*/
1319
public class AdvancementDisplay {
1420

1521
private ItemStack icon;
@@ -28,8 +34,6 @@ public class AdvancementDisplay {
2834
* @param title Title {@link JSONMessage}
2935
* @param description Description {@link JSONMessage}
3036
* @param frame {@link AdvancementFrame}
31-
* @param showToast Should toast messages be shown
32-
* @param announceChat Should advancements be announced in chat
3337
* @param visibility When an advancement is visible
3438
*/
3539
public AdvancementDisplay(Material icon, JSONMessage title, JSONMessage description, AdvancementFrame frame, AdvancementVisibility visibility) {
@@ -46,8 +50,6 @@ public AdvancementDisplay(Material icon, JSONMessage title, JSONMessage descript
4650
* @param title Title {@link String}
4751
* @param description Description {@link String}
4852
* @param frame {@link AdvancementFrame}
49-
* @param showToast Should toast messages be shown
50-
* @param announceChat Should advancements be announced in chat
5153
* @param visibility When an advancement is visible
5254
*/
5355
public AdvancementDisplay(Material icon, String title, String description, AdvancementFrame frame, AdvancementVisibility visibility) {
@@ -66,8 +68,6 @@ public AdvancementDisplay(Material icon, String title, String description, Advan
6668
* @param description Description {@link JSONMessage}
6769
* @param frame {@link AdvancementFrame}
6870
* @param backgroundTexture Background texture path
69-
* @param showToast Should toast messages be shown
70-
* @param announceChat Should advancements be announced in chat
7171
* @param visibility When an advancement is visible
7272
*/
7373
public AdvancementDisplay(Material icon, JSONMessage title, JSONMessage description, AdvancementFrame frame, String backgroundTexture, AdvancementVisibility visibility) {
@@ -86,8 +86,6 @@ public AdvancementDisplay(Material icon, JSONMessage title, JSONMessage descript
8686
* @param description Description {@link String}
8787
* @param frame {@link AdvancementFrame}
8888
* @param backgroundTexture Background texture path
89-
* @param showToast Should toast messages be shown
90-
* @param announceChat Should advancements be announced in chat
9189
* @param visibility When an advancement is visible
9290
*/
9391
public AdvancementDisplay(Material icon, String title, String description, AdvancementFrame frame, String backgroundTexture, AdvancementVisibility visibility) {
@@ -108,8 +106,6 @@ public AdvancementDisplay(Material icon, String title, String description, Advan
108106
* @param title Title {@link JSONMessage}
109107
* @param description Description {@link JSONMessage}
110108
* @param frame {@link AdvancementFrame}
111-
* @param showToast Should toast messages be shown
112-
* @param announceChat Should advancements be announced in chat
113109
* @param visibility When an advancement is visible
114110
*/
115111
public AdvancementDisplay(ItemStack icon, JSONMessage title, JSONMessage description, AdvancementFrame frame, AdvancementVisibility visibility) {
@@ -126,8 +122,6 @@ public AdvancementDisplay(ItemStack icon, JSONMessage title, JSONMessage descrip
126122
* @param title Title {@link String}
127123
* @param description Description {@link String}
128124
* @param frame {@link AdvancementFrame}
129-
* @param showToast Should toast messages be shown
130-
* @param announceChat Should advancements be announced in chat
131125
* @param visibility When an advancement is visible
132126
*/
133127
public AdvancementDisplay(ItemStack icon, String title, String description, AdvancementFrame frame, AdvancementVisibility visibility) {
@@ -146,8 +140,6 @@ public AdvancementDisplay(ItemStack icon, String title, String description, Adva
146140
* @param description Description {@link JSONMessage}
147141
* @param frame {@link AdvancementFrame}
148142
* @param backgroundTexture Background texture path
149-
* @param showToast Should toast messages be shown
150-
* @param announceChat Should advancements be announced in chat
151143
* @param visibility When an advancement is visible
152144
*/
153145
public AdvancementDisplay(ItemStack icon, JSONMessage title, JSONMessage description, AdvancementFrame frame, String backgroundTexture, AdvancementVisibility visibility) {
@@ -166,8 +158,6 @@ public AdvancementDisplay(ItemStack icon, JSONMessage title, JSONMessage descrip
166158
* @param description Description {@link String}
167159
* @param frame {@link AdvancementFrame}
168160
* @param backgroundTexture Background texture path
169-
* @param showToast Should toast messages be shown
170-
* @param announceChat Should advancements be announced in chat
171161
* @param visibility When an advancement is visible
172162
*/
173163
public AdvancementDisplay(ItemStack icon, String title, String description, AdvancementFrame frame, String backgroundTexture, AdvancementVisibility visibility) {
@@ -180,10 +170,25 @@ public AdvancementDisplay(ItemStack icon, String title, String description, Adva
180170
setVisibility(visibility);
181171
}
182172

173+
/**
174+
* Represents the Frame of an Advancement
175+
*
176+
* @author Axel
177+
*
178+
*/
183179
public static enum AdvancementFrame {
184180

181+
/**
182+
* A Task has the default Frame and defaults to a green Color in Completion Messages
183+
*/
185184
TASK(AdvancementFrameType.a),
185+
/**
186+
* A Goal has a rounded off Frame and defaults to a green Color in Completion Messages
187+
*/
186188
GOAL(AdvancementFrameType.b),
189+
/**
190+
* A Challenge has a differently shaped Frame and defaults to a purple Color in Completion Messages and it's Toast plays a Sound when displayed
191+
*/
187192
CHALLENGE(AdvancementFrameType.c)
188193
;
189194

@@ -193,6 +198,11 @@ private AdvancementFrame(AdvancementFrameType nms) {
193198
this.nms = nms;
194199
}
195200

201+
/**
202+
* Get the NMS Representation of this AdvancementFrame
203+
*
204+
* @return THE NMS Representation
205+
*/
196206
public AdvancementFrameType getNMS() {
197207
return nms;
198208
}
@@ -365,7 +375,7 @@ public void setTitle(String title) {
365375
/**
366376
* Changes the Description
367377
*
368-
* @param title New title {@link JSONMessage}
378+
* @param description New description {@link JSONMessage}
369379
*/
370380
public void setDescription(JSONMessage description) {
371381
this.description = description;
@@ -374,7 +384,7 @@ public void setDescription(JSONMessage description) {
374384
/**
375385
* Changes the Description
376386
*
377-
* @param title New Title {@link String}
387+
* @param description New Description {@link String}
378388
*/
379389
public void setDescription(String description) {
380390
this.description = new JSONMessage(new TextComponent(description));
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,31 @@
11
package eu.endercentral.crazy_advancements.advancement;
22

3+
/**
4+
* Alters the behavior of Advancements
5+
*
6+
* @author Axel
7+
*
8+
*/
39
public enum AdvancementFlag {
410

11+
/**
12+
* Advancements with this Flag will display a Toast upon Completion
13+
*/
514
SHOW_TOAST,
15+
/**
16+
* Advancements with this Flag will broadcast a Message in Chat upon Completion
17+
*/
618
DISPLAY_MESSAGE,
19+
/**
20+
* Advancements with this Flag will be sent with the hidden boolean set to true allowing the creation of empty Advancement Tabs or to draw lines
21+
*/
722
SEND_WITH_HIDDEN_BOOLEAN,
823

924
;
1025

26+
/**
27+
* Shorthand for combining Toast Notifications and Chat Messages
28+
*/
1129
public static final AdvancementFlag[] TOAST_AND_MESSAGE = new AdvancementFlag[] {SHOW_TOAST, DISPLAY_MESSAGE};
1230

1331
}

src/eu/endercentral/crazy_advancements/advancement/AdvancementReward.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,19 @@
22

33
import org.bukkit.entity.Player;
44

5+
/**
6+
* Represents a Reward that is awarded upon Completion of an Advancement
7+
*
8+
* @author Axel
9+
*
10+
*/
511
public abstract class AdvancementReward {
612

13+
/**
14+
* Gives the Reward
15+
*
16+
* @param player The Receiver
17+
*/
718
public abstract void onGrant(Player player);
819

920
}

0 commit comments

Comments
 (0)