Skip to content

Commit

Permalink
Add missing Javadocs and warning suppressions
Browse files Browse the repository at this point in the history
  • Loading branch information
srnyx committed May 16, 2023
1 parent 7f87f0b commit ca24ec6
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 7 deletions.
Expand Up @@ -83,6 +83,7 @@ public interface CooldownType {
*
* @return the duration of the cooldown in milliseconds
*/
@SuppressWarnings("SameReturnValue")
long getDuration();
}
}
Expand Up @@ -16,6 +16,7 @@
/**
* Represents the options for the API
*/
@SuppressWarnings("CanBeFinal")
public class AnnoyingOptions {
/**
* <i>{@code RECOMMENDED}</i> The ID of the plugin on <a href="https://bstats.org">bStats</a>
Expand Down
Expand Up @@ -9,6 +9,13 @@
* An extension of {@link PlaceholderExpansion} to allow for easier creation of PlaceholderAPI expansions
*/
public abstract class AnnoyingPAPIExpansion extends PlaceholderExpansion {
/**
* Constructor for the {@link AnnoyingPAPIExpansion} class
*/
public AnnoyingPAPIExpansion() {
// Only exists to provide a Javadoc
}

/**
* The {@link AnnoyingPlugin plugin} that this expansion is for
*
Expand Down
25 changes: 25 additions & 0 deletions api/src/main/java/xyz/srnyx/annoyingapi/MinecraftVersion.java
Expand Up @@ -4,13 +4,38 @@
import org.jetbrains.annotations.Nullable;


/**
* Represents a Minecraft version
*/
public class MinecraftVersion {
/**
* The version string
*/
@NotNull public final String version;
/**
* The major version
*/
public final int major;
/**
* The minor version
*/
public final int minor;
/**
* The patch version
*/
@Nullable public final Integer patch;
/**
* The version as a unique integer
*/
public final int value;

/**
* Creates a new {@link MinecraftVersion}
*
* @param version {@link #version}
*
* @throws IllegalArgumentException if the version does not match the format {@code MAJOR.MINOR} or {@code MAJOR.MINOR.PATCH}
*/
public MinecraftVersion(@NotNull String version) {
this.version = version;
final String[] split = version.split("\\.");
Expand Down
21 changes: 14 additions & 7 deletions api/src/main/java/xyz/srnyx/annoyingapi/file/AnnoyingFile.java
Expand Up @@ -157,7 +157,7 @@ public void log(@NotNull Level level, @Nullable String key, @NotNull String mess
}

/**
* Gets an {@link AttributeModifier} from the path
* Gets an {@link AttributeModifier} from the path. See <a href="https://api.srnyx.com/wiki/file-objects">the wiki</a> for more information
*
* @param path the path to the node
*
Expand All @@ -170,7 +170,7 @@ public AttributeModifier getAttributeModifier(@NotNull String path) {
}

/**
* Gets an {@link AttributeModifier} from the path
* Gets an {@link AttributeModifier} from the path. See <a href="https://api.srnyx.com/wiki/file-objects">the wiki</a> for more information
*
* @param path the path to the node
* @param def the default value
Expand Down Expand Up @@ -229,7 +229,7 @@ public AttributeModifier getAttributeModifier(@NotNull String path, @Nullable At
}

/**
* Gets an {@link ItemStack} from the path
* Gets an {@link ItemStack} from the path. See <a href="https://api.srnyx.com/wiki/file-objects">the wiki</a> for more information
*
* @param path the path to the node
*
Expand All @@ -242,12 +242,12 @@ public ItemStack getItemStack(@NotNull String path) {
}

/**
* Gets an {@link ItemStack} from the path
* Gets an {@link ItemStack} from the path. See <a href="https://api.srnyx.com/wiki/file-objects">the wiki</a> for more information
*
* @param path the path to the node
* @param def the default value
*
* @return the {@link ItemStack} or {@code def} if it's invalid
* @return the {@link ItemStack} or {@code def} if it's invalid
*/
@Override @Nullable
public ItemStack getItemStack(@NotNull String path, @Nullable ItemStack def) {
Expand Down Expand Up @@ -347,7 +347,7 @@ public ItemStack getItemStack(@NotNull String path, @Nullable ItemStack def) {
}

/**
* Gets a {@link Recipe} from the YAML
* Gets a {@link Recipe} from the YAML. See <a href="https://api.srnyx.com/wiki/file-objects">the wiki</a> for more information
*
* @param path the path to get the recipe from
* @param name the name of the recipe (only used in 1.12+ for the {@code NamespacedKey})
Expand All @@ -361,7 +361,7 @@ public Recipe getRecipe(@NotNull String path, @Nullable String name) {
}

/**
* Gets a {@link Recipe} from the YAML
* Gets a {@link Recipe} from the YAML. See <a href="https://api.srnyx.com/wiki/file-objects">the wiki</a> for more information
*
* @param path the path to get the recipe from
* @param name the name of the recipe (only used in 1.12+ for the {@code NamespacedKey})
Expand Down Expand Up @@ -449,6 +449,13 @@ public static class FileOptions {
*/
public boolean canBeEmpty = true;

/**
* Creates a new {@link FileOptions} instance
*/
public FileOptions() {
// Only exists to provide a Javadoc
}

/**
* Sets the {@link #canBeEmpty}
*
Expand Down
Expand Up @@ -66,6 +66,13 @@ public static class ResourceOptions extends AnnoyingFile.FileOptions {
*/
public boolean createDefaultFile = true;

/**
* Constructs a new {@link ResourceOptions} with the default values
*/
public ResourceOptions() {
// Only exists to provide a Javadoc
}

/**
* Sets {@link #createDefaultFile}
*
Expand Down
Expand Up @@ -7,6 +7,10 @@
import java.util.Map;


/**
* A utility class for quickly generating {@link Map maps}
*/
@SuppressWarnings("DuplicatedCode")
public class MapUtility {
/**
* Generates a map from a list of keys and a list of values
Expand Down

0 comments on commit ca24ec6

Please sign in to comment.