From d919a77c043bfcfd611c211a539602371ba67b83 Mon Sep 17 00:00:00 2001 From: tplansky Date: Thu, 28 Dec 2023 01:52:24 +0100 Subject: [PATCH] Spelling and other fixes --- .../decentsoftware/holograms/api/DHAPI.java | 24 +++++++++---------- .../custom/CustomTextAnimation.java | 2 +- .../holograms/api/commands/CommandBase.java | 2 +- .../holograms/api/holograms/Hologram.java | 4 ++-- .../holograms/api/holograms/HologramLine.java | 12 +++++----- .../api/holograms/HologramManager.java | 8 +++---- .../holograms/api/holograms/HologramPage.java | 2 +- .../api/holograms/objects/HologramObject.java | 2 +- .../holograms/api/utils/Common.java | 4 ++-- .../holograms/api/utils/DExecutor.java | 6 ++--- .../utils/color/patterns/GradientPattern.java | 6 +++-- .../api/utils/color/patterns/Pattern.java | 2 +- .../utils/color/patterns/RainbowPattern.java | 2 +- .../utils/color/patterns/SolidPattern.java | 2 +- .../event/DecentHologramsReloadEvent.java | 2 +- 15 files changed, 41 insertions(+), 39 deletions(-) diff --git a/src/main/java/eu/decentsoftware/holograms/api/DHAPI.java b/src/main/java/eu/decentsoftware/holograms/api/DHAPI.java index eef091e1..eb06651b 100644 --- a/src/main/java/eu/decentsoftware/holograms/api/DHAPI.java +++ b/src/main/java/eu/decentsoftware/holograms/api/DHAPI.java @@ -18,8 +18,8 @@ import java.util.List; /** - * A simple access point to the DecentHolograms API. Using this class - * you can easily manipulate with holograms and their contents. + * A simple access point to the DecentHolograms API. + * Using this class, you can manipulate with holograms and their contents. * * @author d0by * @since 2.0.12 @@ -411,7 +411,7 @@ public static HologramLine addHologramLine(HologramPage page, ItemStack item) th } /** - * Add a new line into hologram page. + * Add a new line into the hologram page. * * @param page The page. * @param content New lines content. @@ -432,7 +432,7 @@ public static HologramLine addHologramLine(HologramPage page, String content) th * @param lineIndex Index of the new line. * @param material Material for new item line content. * @return The new line. - * @throws IllegalArgumentException If hologram or material is null or the indexes are invalid. + * @throws IllegalArgumentException If the hologram or material is null or the indexes are invalid. */ public static HologramLine insertHologramLine(Hologram hologram, int lineIndex, Material material) throws IllegalArgumentException { Validate.notNull(material); @@ -446,7 +446,7 @@ public static HologramLine insertHologramLine(Hologram hologram, int lineIndex, * @param lineIndex Index of the new line. * @param item ItemStack for new item line content. * @return The new line. - * @throws IllegalArgumentException If hologram or item is null or the indexes are invalid. + * @throws IllegalArgumentException If the hologram or item is null or the indexes are invalid. */ public static HologramLine insertHologramLine(Hologram hologram, int lineIndex, ItemStack item) throws IllegalArgumentException { Validate.notNull(item); @@ -474,7 +474,7 @@ public static HologramLine insertHologramLine(Hologram hologram, int lineIndex, * @param lineIndex Index of the new line. * @param material Material for the new line content. * @return The new line. - * @throws IllegalArgumentException If hologram or material is null or the indexes are invalid. + * @throws IllegalArgumentException If the hologram or material is null or the indexes are invalid. */ public static HologramLine insertHologramLine(Hologram hologram, int pageIndex, int lineIndex, Material material) throws IllegalArgumentException { Validate.notNull(material); @@ -489,7 +489,7 @@ public static HologramLine insertHologramLine(Hologram hologram, int pageIndex, * @param lineIndex Index of the new line. * @param item ItemStack for the new line content. * @return The new line. - * @throws IllegalArgumentException If hologram or item is null or the indexes are invalid. + * @throws IllegalArgumentException If the hologram or item is null or the indexes are invalid. */ public static HologramLine insertHologramLine(Hologram hologram, int pageIndex, int lineIndex, ItemStack item) throws IllegalArgumentException { Validate.notNull(item); @@ -522,7 +522,7 @@ public static HologramLine insertHologramLine(Hologram hologram, int pageIndex, * @param index Index of the new line. * @param material Material as new line content. * @return The new line. - * @throws IllegalArgumentException If page or material is null or the indexes are invalid. + * @throws IllegalArgumentException If the page or material is null or the indexes are invalid. */ public static HologramLine insertHologramLine(HologramPage page, int index, Material material) throws IllegalArgumentException { Validate.notNull(material); @@ -536,7 +536,7 @@ public static HologramLine insertHologramLine(HologramPage page, int index, Mate * @param index Index of the new line. * @param item ItemStack as new line content. * @return The new line. - * @throws IllegalArgumentException If page or item is null or the indexes are invalid. + * @throws IllegalArgumentException If the page or item is null or the indexes are invalid. */ public static HologramLine insertHologramLine(HologramPage page, int index, ItemStack item) throws IllegalArgumentException { Validate.notNull(item); @@ -550,7 +550,7 @@ public static HologramLine insertHologramLine(HologramPage page, int index, Item * @param index Index of the new line. * @param content New lines content. * @return The new line. - * @throws IllegalArgumentException If page or content is null or the indexes are invalid. + * @throws IllegalArgumentException If the page or content is null or the indexes are invalid. */ public static HologramLine insertHologramLine(HologramPage page, int index, String content) throws IllegalArgumentException { HologramLine oldLine = page.getLine(index); @@ -609,7 +609,7 @@ public static void setHologramLine(HologramLine line, String content) throws Ill // Set the new content line.setContent(content); - // If the new type is the same as the previous type, just update. + // If the new type is the same as the previous type, update. if ((prevType == HologramLineType.TEXT || prevType == HologramLineType.HEAD || prevType == HologramLineType.SMALLHEAD) && prevType == line.getType()) { line.update(); } @@ -835,7 +835,7 @@ public static void setHologramLines(Hologram hologram, List lines) throw * @param hologram The hologram. * @param pageIndex The page. * @param lines The new lines. - * @throws IllegalArgumentException If hologram or lines is null. + * @throws IllegalArgumentException If hologram or lines are null. */ public static void setHologramLines(Hologram hologram, int pageIndex, List lines) throws IllegalArgumentException { Validate.notNull(hologram); diff --git a/src/main/java/eu/decentsoftware/holograms/api/animations/custom/CustomTextAnimation.java b/src/main/java/eu/decentsoftware/holograms/api/animations/custom/CustomTextAnimation.java index 3f18d177..3680b077 100644 --- a/src/main/java/eu/decentsoftware/holograms/api/animations/custom/CustomTextAnimation.java +++ b/src/main/java/eu/decentsoftware/holograms/api/animations/custom/CustomTextAnimation.java @@ -12,7 +12,7 @@ public class CustomTextAnimation extends TextAnimation { private static final DecentHolograms DECENT_HOLOGRAMS = DecentHologramsAPI.get(); - private final @NonNull List steps; + private final List steps; public CustomTextAnimation(@NonNull String name, int speed, int pause, @NonNull List steps) { super(name, speed, pause); diff --git a/src/main/java/eu/decentsoftware/holograms/api/commands/CommandBase.java b/src/main/java/eu/decentsoftware/holograms/api/commands/CommandBase.java index 612ab593..ccdbd712 100644 --- a/src/main/java/eu/decentsoftware/holograms/api/commands/CommandBase.java +++ b/src/main/java/eu/decentsoftware/holograms/api/commands/CommandBase.java @@ -61,7 +61,7 @@ public interface CommandBase { CommandBase getSubCommand(String name); /** - * Get names of all sub commands. + * Get the names of all sub commands. * * @return names of all sub commands. */ diff --git a/src/main/java/eu/decentsoftware/holograms/api/holograms/Hologram.java b/src/main/java/eu/decentsoftware/holograms/api/holograms/Hologram.java index e8b1d5be..b1578b10 100644 --- a/src/main/java/eu/decentsoftware/holograms/api/holograms/Hologram.java +++ b/src/main/java/eu/decentsoftware/holograms/api/holograms/Hologram.java @@ -216,7 +216,7 @@ public static Hologram fromFile(final @NotNull String filePath) throws LocationP protected final Lock lock = new ReentrantLock(); /** - * This object server as a mutex for all visibility related operations. + * This object server as a mutex for all visibility-related operations. *

* For example, when we want to hide a hologram, that's already being * updated on another thread, we would need to wait for the update to @@ -392,7 +392,7 @@ public void setFacing(float facing) { super.setFacing(facing); - // Update the facing for all lines, that don't already have a different facing set. + // Update the facing for all lines, that don't yet have a different facing set. // We want to keep the hologram facing working as a "default" value, but we don't want // it to override custom line facing. for (HologramPage page : this.pages) { diff --git a/src/main/java/eu/decentsoftware/holograms/api/holograms/HologramLine.java b/src/main/java/eu/decentsoftware/holograms/api/holograms/HologramLine.java index d579176a..b5fc122b 100644 --- a/src/main/java/eu/decentsoftware/holograms/api/holograms/HologramLine.java +++ b/src/main/java/eu/decentsoftware/holograms/api/holograms/HologramLine.java @@ -168,7 +168,7 @@ public String toString() { *

* This method also parses the content and updates the line. *

- * NOTE: The new content can be null but if it is, it will be + * NOTE: The new content can be null, but if it is, it will be * replaced with an empty string. It is recommended to not use * null as content. * @@ -346,9 +346,9 @@ private String parsePlaceholders(@NotNull String string, @NonNull Player player, if (papi) { string = PAPI.setPlaceholders(player, string); if (string == null) { - // Some PlacehoderAPI placeholders might be replaced with null, so if the line content + // Some PlaceholderAPI placeholders might be replaced with null, so if the line content // is just a single placeholder, there is a possibility that the line will be null. So, - // if that happens, just replace the null with an empty string. + // if that happens, replace the null with an empty string. string = ""; } } @@ -370,7 +370,7 @@ private String parseCustomReplacements() { * Check if the given player has the permission to see this line, if any. * * @param player The player. - * @return True if the player has the permission to see this line, false otherwise. + * @return True, if the player has the permission to see this line, false otherwise. */ public boolean hasPermission(@NonNull Player player) { return permission == null || permission.isEmpty() || player.hasPermission(permission); @@ -381,7 +381,7 @@ public boolean hasPermission(@NonNull Player player) { * if the player has the permission to see this line and if they are in the display * range. Then it updates the visibility accordingly. * - * @param player The player to update visbility for. + * @param player The player to update visibility for. */ public void updateVisibility(@NonNull Player player) { if (isVisible(player) && !(hasPermission(player) && isInDisplayRange(player))) { @@ -530,7 +530,7 @@ public boolean isInDisplayRange(@NonNull Player player) { @SuppressWarnings("BooleanMethodIsAlwaysInverted") public boolean isInUpdateRange(@NonNull Player player) { - return parent == null || parent.getParent().isInDisplayRange(player); + return parent == null || parent.getParent().isInUpdateRange(player); } public double getOffsetX() { diff --git a/src/main/java/eu/decentsoftware/holograms/api/holograms/HologramManager.java b/src/main/java/eu/decentsoftware/holograms/api/holograms/HologramManager.java index a8f027d9..34301506 100644 --- a/src/main/java/eu/decentsoftware/holograms/api/holograms/HologramManager.java +++ b/src/main/java/eu/decentsoftware/holograms/api/holograms/HologramManager.java @@ -30,7 +30,7 @@ public class HologramManager extends Ticked { private final Set temporaryLines = ConcurrentHashMap.newKeySet(); /** - * Map of holograms to load, when their respective world loads. + * Map of holograms to load when their respective world loads. *

* There were issues with world management plugins loading worlds * after holograms. Due to that, holograms in these worlds were skipped @@ -48,7 +48,7 @@ public HologramManager(DecentHolograms decentHolograms) { this.decentHolograms = decentHolograms; this.register(); - S.async(this::reload); // Reload when worlds are ready + S.async(this::reload); // Reload when the worlds are ready } @Override @@ -89,11 +89,11 @@ public void updateVisibility(@NonNull Player player, @NonNull Hologram hologram) } /** - * Spawn a temporary line that is going to disappear after the given duration. + * Spawn a temporary line going to disappear after the given duration. * * @param location Location of the line. * @param content Content of the line. - * @param duration Duration to disappear after. (in ticks) + * @param duration Duration to disappear after. (In ticks) * @return The Hologram Line. */ public HologramLine spawnTemporaryHologramLine(@NonNull Location location, String content, long duration) { diff --git a/src/main/java/eu/decentsoftware/holograms/api/holograms/HologramPage.java b/src/main/java/eu/decentsoftware/holograms/api/holograms/HologramPage.java index 30c49b81..439b0f62 100644 --- a/src/main/java/eu/decentsoftware/holograms/api/holograms/HologramPage.java +++ b/src/main/java/eu/decentsoftware/holograms/api/holograms/HologramPage.java @@ -301,7 +301,7 @@ public void executeActions(@NonNull Player player, @NonNull ClickType clickType) String actionData = action.getData(); if (actionName.contains("_PAGE") && actionData == null) { action.setData(getParent().getName()); - } else if (actionName.equals("PAGE") && actionData != null && actionData.matches("[\\d]+")) { + } else if (actionName.equals("PAGE") && actionData != null && actionData.matches("\\d+")) { action.setData(getParent().getName() + ":" + actionData); } diff --git a/src/main/java/eu/decentsoftware/holograms/api/holograms/objects/HologramObject.java b/src/main/java/eu/decentsoftware/holograms/api/holograms/objects/HologramObject.java index 98927312..dac874c0 100644 --- a/src/main/java/eu/decentsoftware/holograms/api/holograms/objects/HologramObject.java +++ b/src/main/java/eu/decentsoftware/holograms/api/holograms/objects/HologramObject.java @@ -153,7 +153,7 @@ public Set getViewers() { } /** - * Get List of all players that currently see this hologram. + * Get the List of all players that currently see this hologram. * * @return List of all players that currently see this hologram. */ diff --git a/src/main/java/eu/decentsoftware/holograms/api/utils/Common.java b/src/main/java/eu/decentsoftware/holograms/api/utils/Common.java index 2a5772c1..7c1a499a 100644 --- a/src/main/java/eu/decentsoftware/holograms/api/utils/Common.java +++ b/src/main/java/eu/decentsoftware/holograms/api/utils/Common.java @@ -38,7 +38,7 @@ public static int randomInt(int min, int max) { } /** - * @return Random float between 0 and 1 + * @return Random float between zero and one. */ public static float randomFloat() { return ThreadLocalRandom.current().nextFloat(); @@ -190,7 +190,7 @@ private static int parseInt(String string) { /** * Check whether the given plugin is enabled. * - * @param name The plugins name. + * @param name The plugin's name. * @return The boolean. */ public static boolean isPluginEnabled(String name) { diff --git a/src/main/java/eu/decentsoftware/holograms/api/utils/DExecutor.java b/src/main/java/eu/decentsoftware/holograms/api/utils/DExecutor.java index 3c49af5f..5605e2e8 100644 --- a/src/main/java/eu/decentsoftware/holograms/api/utils/DExecutor.java +++ b/src/main/java/eu/decentsoftware/holograms/api/utils/DExecutor.java @@ -18,7 +18,7 @@ public class DExecutor { /** * Initialize DExecutor. This method will set up ExecutorService for DecentHolograms. * - * @param threads Amount of threads to use. + * @param threads Number of threads to use. */ public static void init(int threads) { if (!initialized) { @@ -94,8 +94,8 @@ public static void execute(@NonNull Runnable runnable) { service.execute(runnable); } - private final @NonNull ExecutorService executor; - private final @NonNull DList> running; + private final ExecutorService executor; + private final DList> running; DExecutor(@NonNull ExecutorService executor, int estimate) { this.executor = executor; diff --git a/src/main/java/eu/decentsoftware/holograms/api/utils/color/patterns/GradientPattern.java b/src/main/java/eu/decentsoftware/holograms/api/utils/color/patterns/GradientPattern.java index 92d772ec..30d6a860 100644 --- a/src/main/java/eu/decentsoftware/holograms/api/utils/color/patterns/GradientPattern.java +++ b/src/main/java/eu/decentsoftware/holograms/api/utils/color/patterns/GradientPattern.java @@ -10,14 +10,16 @@ */ public class GradientPattern implements Pattern { - private static final java.util.regex.Pattern PATTERN = java.util.regex.Pattern.compile("[<{]#([A-Fa-f0-9]{6})[}>](((?![<{]#[A-Fa-f0-9]{6}[}>]).)*)[<{]/#([A-Fa-f0-9]{6})[}>]"); + private static final java.util.regex.Pattern PATTERN = java.util.regex.Pattern.compile( + "[<{]#([A-Fa-f0-9]{6})[}>](((?![<{]#[A-Fa-f0-9]{6}[}>]).)*)[<{]/#([A-Fa-f0-9]{6})[}>]" + ); /** * Applies a gradient pattern to the provided String. * Output might be the same as the input if this pattern is not present. * * @param string The String to which this pattern should be applied to - * @return The new String with applied pattern + * @return The new String with an applied pattern */ public String process(String string) { Matcher matcher = PATTERN.matcher(string); diff --git a/src/main/java/eu/decentsoftware/holograms/api/utils/color/patterns/Pattern.java b/src/main/java/eu/decentsoftware/holograms/api/utils/color/patterns/Pattern.java index 95a56178..addae20f 100644 --- a/src/main/java/eu/decentsoftware/holograms/api/utils/color/patterns/Pattern.java +++ b/src/main/java/eu/decentsoftware/holograms/api/utils/color/patterns/Pattern.java @@ -10,7 +10,7 @@ public interface Pattern { * Output might be the same as the input if this pattern is not present. * * @param string The String to which this pattern should be applied to - * @return The new String with applied pattern + * @return The new String with an applied pattern */ String process(String string); diff --git a/src/main/java/eu/decentsoftware/holograms/api/utils/color/patterns/RainbowPattern.java b/src/main/java/eu/decentsoftware/holograms/api/utils/color/patterns/RainbowPattern.java index 2595c452..3b00c598 100644 --- a/src/main/java/eu/decentsoftware/holograms/api/utils/color/patterns/RainbowPattern.java +++ b/src/main/java/eu/decentsoftware/holograms/api/utils/color/patterns/RainbowPattern.java @@ -13,7 +13,7 @@ public class RainbowPattern implements Pattern { * Output might be the same as the input if this pattern is not present. * * @param string The String to which this pattern should be applied to - * @return The new String with applied pattern + * @return The new String with an applied pattern */ public String process(String string) { Matcher matcher = pattern.matcher(string); diff --git a/src/main/java/eu/decentsoftware/holograms/api/utils/color/patterns/SolidPattern.java b/src/main/java/eu/decentsoftware/holograms/api/utils/color/patterns/SolidPattern.java index 8edef5e4..c296d47b 100644 --- a/src/main/java/eu/decentsoftware/holograms/api/utils/color/patterns/SolidPattern.java +++ b/src/main/java/eu/decentsoftware/holograms/api/utils/color/patterns/SolidPattern.java @@ -13,7 +13,7 @@ public class SolidPattern implements Pattern { * Output might be the same as the input if this pattern is not present. * * @param string The String to which this pattern should be applied to - * @return The new String with applied pattern + * @return The new String with an applied pattern */ public String process(String string) { Matcher matcher = PATTERN.matcher(string); diff --git a/src/main/java/eu/decentsoftware/holograms/event/DecentHologramsReloadEvent.java b/src/main/java/eu/decentsoftware/holograms/event/DecentHologramsReloadEvent.java index f0b142e8..6f6ab8ec 100644 --- a/src/main/java/eu/decentsoftware/holograms/event/DecentHologramsReloadEvent.java +++ b/src/main/java/eu/decentsoftware/holograms/event/DecentHologramsReloadEvent.java @@ -3,7 +3,7 @@ import org.bukkit.event.HandlerList; /** - * This event is called after DecentHolograms plugin is reloaded. + * This event is called after the DecentHolograms plugin is reloaded. * * @author d0by * @since 2.7.8