Skip to content

Commit

Permalink
Update Javadocs
Browse files Browse the repository at this point in the history
  • Loading branch information
srnyx committed Dec 4, 2022
1 parent 727cd76 commit 459aea9
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 12 deletions.
3 changes: 3 additions & 0 deletions src/main/java/xyz/srnyx/annoyingapi/AnnoyingListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
import org.jetbrains.annotations.NotNull;


/**
* A listener that can be registered to the Bukkit event system
*/
public interface AnnoyingListener extends Listener {
/**
* Registers the listener to the {@link #getPlugin()}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public class AnnoyingCooldown {
/**
* Creates and starts a cooldown of the specified {@link AnnoyingCooldownType} for the specified player
*
* @param plugin the plugin that is creating the cooldown
* @param uuid the player's UUID
* @param type the cooldown type
*/
Expand Down
24 changes: 13 additions & 11 deletions src/main/java/xyz/srnyx/annoyingapi/download/AnnoyingDownload.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,27 @@
*/
public class AnnoyingDownload {
@NotNull private final AnnoyingPlugin plugin;
@NotNull private final Set<AnnoyingDependency> plugins;
@NotNull private final Set<AnnoyingDependency> dependencies;
private AnnoyingDownloadFinish finish;
private int remaining = 0;

/**
* Constructor for {@link AnnoyingDownload} with multiple plugins
* Constructor for {@link AnnoyingDownload} with multiple dependencies
*
* @param plugins the plugins (represented as {@link AnnoyingDependency}) to download
* @param plugin the plugin that is downloading the dependencies
* @param dependencies the {@link AnnoyingDependency}s to download
*/
@Contract(pure = true)
public AnnoyingDownload(@NotNull AnnoyingPlugin plugin, @NotNull Set<AnnoyingDependency> plugins) {
public AnnoyingDownload(@NotNull AnnoyingPlugin plugin, @NotNull Set<AnnoyingDependency> dependencies) {
this.plugin = plugin;
this.plugins = plugins;
this.dependencies = dependencies;
}

/**
* Constructor for {@link AnnoyingDownload} with a single plugin
* Constructor for {@link AnnoyingDownload} with a single dependency
*
* @param plugin the plugin (represented as {@link AnnoyingDependency}) to download
* @param plugin the plugin that is downloading the {@link AnnoyingDependency}
* @param dependency the {@link AnnoyingDependency} to download
*/
public AnnoyingDownload(@NotNull AnnoyingPlugin plugin, @NotNull AnnoyingDependency dependency) {
this(plugin, Set.of(dependency));
Expand All @@ -63,8 +65,8 @@ public AnnoyingDownload(@NotNull AnnoyingPlugin plugin, @NotNull AnnoyingDepende
*/
public void downloadPlugins(@Nullable AnnoyingDownloadFinish finish) {
this.finish = finish;
remaining = plugins.size();
plugins.forEach(dependency -> new Thread(() -> attemptDownload(dependency)).start());
remaining = dependencies.size();
dependencies.forEach(dependency -> new Thread(() -> attemptDownload(dependency)).start());
}

/**
Expand Down Expand Up @@ -235,8 +237,8 @@ private void downloadFile(@NotNull AnnoyingDependency dependency, @NotNull Annoy
private void finish() {
remaining--;
if (remaining == 0) {
plugin.log(Level.INFO, "\n&a&lAll &2&l" + plugins.size() + "&a&l plugins have been processed!\n&aPlease resolve any errors and then restart the server.");
if (finish != null) finish.onFinish(plugins);
plugin.log(Level.INFO, "\n&a&lAll &2&l" + dependencies.size() + "&a&l plugins have been processed!\n&aPlease resolve any errors and then restart the server.");
if (finish != null) finish.onFinish(dependencies);
}
}
}
2 changes: 2 additions & 0 deletions src/main/java/xyz/srnyx/annoyingapi/file/AnnoyingData.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public class AnnoyingData extends YamlConfiguration implements AnnoyingFile {
/**
* Constructs and loads a new {@link AnnoyingData} from the path
*
* @param plugin the plugin that is creating the file
* @param path the path to the file (relative to {@code data} folder in the plugin's folder)
* @param canBeEmpty whether the file can be empty. If false, the file will be deleted if it's empty when {@link #save()} is used
*/
Expand All @@ -36,6 +37,7 @@ public AnnoyingData(@NotNull AnnoyingPlugin plugin, @NotNull String path, boolea
/**
* Constructs and loads a new {@link AnnoyingData} from the path
*
* @param plugin the plugin that is creating the file
* @param path the path to the file (inside {@code /data/})
*/
public AnnoyingData(@NotNull AnnoyingPlugin plugin, @NotNull String path) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ public class AnnoyingMessage {
/**
* Constructs a new {@link AnnoyingMessage} with the specified key
*
* @param key the key of the message
* @param plugin the plugin getting the message
* @param key the key of the message
*/
public AnnoyingMessage(@NotNull AnnoyingPlugin plugin, @NotNull String key) {
this.plugin = plugin;
Expand Down

0 comments on commit 459aea9

Please sign in to comment.