Skip to content

Commit bd9776a

Browse files
committed
More javadocs
1 parent f3715be commit bd9776a

File tree

17 files changed

+111
-55
lines changed

17 files changed

+111
-55
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,6 @@ I'd like to express my profound gratitude to the following people for really hel
6868
* @DeadSilenceIV: [XItemStack issues](https://github.com/CryptoMorin/XSeries/commits?author=DeadSilenceIV)
6969
* @AV3RG: [XTag](https://github.com/CryptoMorin/XSeries/commit/988fee3a0fc80697f99804ca7c13108976f26acd)
7070
* @SirLeezus: [XItemStack issues](https://github.com/CryptoMorin/XSeries/commits?author=SirLeezus)
71-
* @datatags: For responding to various issues and reporting them.
71+
* @datatags: [ParticleDisplay revamp](https://github.com/CryptoMorin/XSeries/pull/265) and for responding to various issues and reporting them.
7272

7373
I hope that I didn't forget anyone ;)

pom.xml

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,13 @@
6060
<id>nms-repo</id>
6161
<url>https://repo.codemc.org/repository/nms/</url>
6262
</repository>
63-
<!-- <repository>-->
64-
<!-- &lt;!&ndash; Sometimes codemc's snapshots don't have the mojang packages. &ndash;&gt;-->
65-
<!-- <id>minecraft-repo</id>-->
66-
<!-- <url>https://libraries.minecraft.net/</url>-->
67-
<!-- </repository>-->
63+
<!-- <repository>-->
64+
<!-- &lt;!&ndash; Sometimes codemc's snapshots don't have the mojang packages. &ndash;&gt;-->
65+
<!-- &lt;!&ndash; https://libraries.minecraft.net/com/mojang/authlib/VERSION/authlib-VERSION.jar &ndash;&gt;-->
66+
<!-- <id>minecraft-libraries</id>-->
67+
<!-- <name>Minecraft Libraries</name>-->
68+
<!-- <url>https://libraries.minecraft.net/</url>-->
69+
<!-- </repository>-->
6870
</repositories>
6971

7072
<properties>
@@ -85,25 +87,20 @@
8587
</properties>
8688

8789
<dependencies>
88-
<!-- <dependency>-->
89-
<!-- <groupId>com.mojang</groupId>-->
90-
<!-- <artifactId>authlib</artifactId>-->
91-
<!-- <version>1.5.25</version>-->
92-
<!-- <scope>provided</scope>-->
93-
<!-- </dependency>-->
94-
<!-- <dependency>-->
95-
<!-- <groupId>org.jetbrains</groupId>-->
96-
<!-- <artifactId>annotations</artifactId>-->
97-
<!-- <version>24.1.0</version>-->
98-
<!-- </dependency>-->
90+
<!-- <dependency>-->
91+
<!-- <groupId>com.mojang</groupId>-->
92+
<!-- <artifactId>authlib</artifactId>-->
93+
<!-- <version>6.0.54</version>-->
94+
<!-- <scope>provided</scope>-->
95+
<!-- </dependency>-->
9996
<dependency>
10097
<groupId>org.spigotmc</groupId>
10198
<artifactId>spigot</artifactId>
10299
<version>${spigotVersion}</version>
103100
<scope>provided</scope>
104101
</dependency>
105-
<!-- https://mvnrepository.com/artifact/org.jetbrains/annotations -->
106102
<dependency>
103+
<!-- https://mvnrepository.com/artifact/org.jetbrains/annotations -->
107104
<groupId>org.jetbrains</groupId>
108105
<artifactId>annotations</artifactId>
109106
<version>24.1.0</version>

src/main/java/com/cryptomorin/xseries/XMaterial.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ public enum XMaterial /* implements com.cryptomorin.xseries.abstractions.Materia
595595
FERMENTED_SPIDER_EYE,
596596
FERN(2, "LONG_GRASS"),
597597
/**
598-
* For some reasons filled map items are really special.
598+
* For some reason, filled map items are really special.
599599
* Their data value starts from 0 and every time a player
600600
* creates a new map that maps data value increases.
601601
* <a href="https://github.com/CryptoMorin/XSeries/issues/91">GitHub Issue</a>
@@ -1935,9 +1935,14 @@ public static XMaterial matchXMaterial(@Nonnull ItemStack item) {
19351935
// If this happens to more materials in the future, I might have to change the system.
19361936
if (supports(13) && !supports(14)) {
19371937
// https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/diff/src/main/java/org/bukkit/Material.java?until=67d908a9830c71267ee740f5bddd728ce9c64cc7
1938-
if (material.equals("CACTUS_GREEN")) return GREEN_DYE;
1939-
if (material.equals("ROSE_RED")) return RED_DYE;
1940-
if (material.equals("DANDELION_YELLOW")) return YELLOW_DYE;
1938+
switch (material) {
1939+
case "CACTUS_GREEN":
1940+
return GREEN_DYE;
1941+
case "ROSE_RED":
1942+
return RED_DYE;
1943+
case "DANDELION_YELLOW":
1944+
return YELLOW_DYE;
1945+
}
19411946
}
19421947

19431948
// Check FILLED_MAP enum for more info.

src/main/java/com/cryptomorin/xseries/XPotion.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ private static List<String> split(@Nonnull String str, @SuppressWarnings("SamePa
271271
* SLOWNESS 200 10
272272
* 1, 10000, 100 %50
273273
* </pre>
274-
* The last argument (the amplifier can also have a chance which if not met, returns null.
274+
* The last argument can also include a chance (written in percent) which if not met, returns null.
275275
*
276276
* @param potion the potion string to parse.
277277
* @return a potion effect, or null if the potion type is wrong.
@@ -291,8 +291,7 @@ public static Effect parseEffect(@Nullable String potion) {
291291
if (chanceIndex != -1) {
292292
try {
293293
chance = Double.parseDouble(split.get(2).substring(chanceIndex + 1));
294-
} catch (NumberFormatException ex) {
295-
chance = 100;
294+
} catch (NumberFormatException ignored) {
296295
}
297296
}
298297
}

src/main/java/com/cryptomorin/xseries/messages/ActionBar.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
* For static Action bars you'll need to send the packet every
5858
* 2 seconds (40 ticks) for it to stay on the screen without fading.
5959
* <p>
60-
* PacketPlayOutTitle: https://wiki.vg/Protocol#Title
60+
* <a href="https://wiki.vg/Protocol#Title">PacketPlayOutTitle</a>
6161
*
6262
* @author Crypto Morin
6363
* @version 4.0.0
@@ -259,7 +259,7 @@ public static void clearActionBar(@Nonnull Player player) {
259259
/**
260260
* Clear the action bar by sending an empty message to all the online players.
261261
*
262-
* @see #clearActionBar(Player player)
262+
* @see #clearActionBar(Player)
263263
* @since 2.1.1
264264
*/
265265
public static void clearPlayersActionBar() {
@@ -294,7 +294,7 @@ public void run() {
294294
}
295295
sendActionBar(player, message);
296296
}
297-
// Re-sends the messages every 2 seconds so it doesn't go away from the player's screen.
297+
// Re-sends the messages every 2 seconds, so it doesn't go away from the player's screen.
298298
}.runTaskTimerAsynchronously(plugin, 0L, 40L);
299299
}
300300

@@ -325,7 +325,7 @@ public void run() {
325325
ex.printStackTrace();
326326
}
327327
}
328-
// Re-sends the messages every 2 seconds so it doesn't go away from the player's screen.
328+
// Re-sends the messages every 2 seconds, so it doesn't go away from the player's screen.
329329
}.runTaskTimerAsynchronously(plugin, 0L, 40L);
330330
}
331331
}

src/main/java/com/cryptomorin/xseries/particles/ParticleDisplay.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
* The format of float list data for a colored particle is:
6565
* <code>[r, g, b, size]</code>
6666
*
67-
* @author Crypto Morin
67+
* @author Crypto Morin, cricri211, datatags
6868
* @version 11.0.1
6969
* @see Particles
7070
*/
@@ -339,7 +339,7 @@ public static ParticleDisplay of(@Nonnull XParticle particle) {
339339
* @since 1.0.0
340340
* @deprecated use {@link #of(Particle)} and {@link #withLocation(Location)}
341341
*/
342-
@Nullable
342+
@Nonnull
343343
@Deprecated
344344
public static ParticleDisplay display(@Nonnull Location location, @Nonnull Particle particle) {
345345
Objects.requireNonNull(location, "Cannot display particle in null location");
@@ -574,7 +574,6 @@ public static ParticleDisplay edit(@Nonnull ParticleDisplay display, @Nonnull Co
574574
* @param display The ParticleDisplay to serialize
575575
* @param section The ConfigurationSection to serialize into
576576
*/
577-
@SuppressWarnings("deprecation")
578577
public static void serialize(ParticleDisplay display, ConfigurationSection section) {
579578
section.set("particle", display.particle.name());
580579

src/main/java/com/cryptomorin/xseries/particles/Particles.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1658,10 +1658,10 @@ public static void dna(double radius, double rate, double extension, int height,
16581658
public static BooleanSupplier dnaReplication(double radius, double rate, int speed, double extension,
16591659
int height, int hydrogenBondDist, ParticleDisplay display) {
16601660
// We'll use the common nucleotide colors.
1661-
ParticleDisplay adenine = ParticleDisplay.colored(null, java.awt.Color.BLUE, 1); // Blue
1662-
ParticleDisplay thymine = ParticleDisplay.colored(null, java.awt.Color.YELLOW, 1); // Yellow
1663-
ParticleDisplay guanine = ParticleDisplay.colored(null, java.awt.Color.GREEN, 1); // Green
1664-
ParticleDisplay cytosine = ParticleDisplay.colored(null, java.awt.Color.RED, 1); // Red
1661+
ParticleDisplay adenine = ParticleDisplay.of(XParticle.DUST).withColor(java.awt.Color.BLUE, 1); // Blue
1662+
ParticleDisplay thymine = ParticleDisplay.of(XParticle.DUST).withColor(java.awt.Color.YELLOW, 1); // Yellow
1663+
ParticleDisplay guanine = ParticleDisplay.of(XParticle.DUST).withColor(java.awt.Color.GREEN, 1); // Green
1664+
ParticleDisplay cytosine = ParticleDisplay.of(XParticle.DUST).withColor(java.awt.Color.RED, 1); // Red
16651665

16661666
return new BooleanSupplier() {
16671667
double y = 0;
@@ -2264,7 +2264,7 @@ private static double[] matrix(double[][] a, double[] m) {
22642264
for (int j = 0; j < colsB; j++) {
22652265
float sum = 0;
22662266
for (int k = 0; k < colsA; k++) {
2267-
sum += a[i][k] * b[k][j];
2267+
sum += (float) (a[i][k] * b[k][j]);
22682268
}
22692269
result[i][j] = sum;
22702270
}
@@ -2627,7 +2627,7 @@ public void run() {
26272627
*/
26282628
public static BooleanSupplier explosionWave(double rate, ParticleDisplay display, ParticleDisplay secDisplay) {
26292629
return new BooleanSupplier() {
2630-
final double addition = Math.PI * 0.1;
2630+
static final double addition = Math.PI * 0.1;
26312631
final double rateDiv = Math.PI / rate;
26322632
double times = Math.PI / 4;
26332633
boolean done = false;

src/main/java/com/cryptomorin/xseries/particles/XParticle.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
* <p>
1010
* This class is mainly used to support {@link Particle}, especially for the "parity change" by
1111
* Spigot in 1.20.5 (see <a href="https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/diff/src/main/java/org/bukkit/Particle.java?until=8a34e009148cc297bcc9eb5c250fc4f5b071c4a7">...</a>).
12+
* @author Crypto Morin, Collin Barber
1213
*/
13-
@SuppressWarnings("UnstableApiUsage")
1414
public enum XParticle {
1515
/**
1616
* EXPLOSION_NORMAL -> POOF (v1.20.5)

src/main/java/com/cryptomorin/xseries/profiles/builder/XSkull.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
import org.bukkit.inventory.meta.SkullMeta;
3737

3838
/**
39-
* <b>XSkull</b> - Apply skull texture from different sources.<br><br>
39+
* A cross-platform way to apply skin texture from different sources to items and blocks.<br><br>
4040
* Skull Meta: <a href="https://hub.spigotmc.org/javadocs/spigot/org/bukkit/inventory/meta/SkullMeta.html">hub.spigotmc.org/.../SkullMeta</a><br>
4141
* Mojang API: <a href="https://wiki.vg/Mojang_API">wiki.vg/Mojang_API</a><br><br>
4242
* <p>
@@ -68,7 +68,7 @@
6868
* will remain as a steve head until the client is completely restarted.
6969
* I don't know if this cache system works across other servers or is just specific to one server.
7070
*
71-
* @author Crypto Morin
71+
* @author Crypto Morin, Erick Alexander
7272
* @version 11.2.0
7373
* @see XMaterial
7474
* @see XReflection

src/main/java/com/cryptomorin/xseries/profiles/exceptions/ProfileChangeException.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
package com.cryptomorin.xseries.profiles.exceptions;
22

3+
import com.cryptomorin.xseries.profiles.builder.ProfileInstruction;
4+
5+
/**
6+
* Aggregate error container for {@link ProfileInstruction#apply()}.
7+
*/
38
public final class ProfileChangeException extends ProfileException {
49
public ProfileChangeException(String message) {
510
super(message);

0 commit comments

Comments
 (0)