From f87ffc906cfc325a4bea4241aaa93eef1d9babaa Mon Sep 17 00:00:00 2001 From: EpicKnarvik97 Date: Sat, 9 Oct 2021 03:57:24 +0200 Subject: [PATCH] Minor comment and formatting cleanup --- README.md | 15 +++++++-------- .../net/knarcraft/stargate/LanguageLoader.java | 1 - .../java/net/knarcraft/stargate/Stargate.java | 10 ++++++---- .../stargate/listener/PortalEventListener.java | 4 ++++ .../java/net/knarcraft/stargate/portal/Gate.java | 2 +- .../net/knarcraft/stargate/portal/Portal.java | 2 +- .../knarcraft/stargate/portal/PortalOption.java | 3 +++ .../knarcraft/stargate/thread/StarGateThread.java | 6 +++--- 8 files changed, 25 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index f2d7f84..b1d13c4 100644 --- a/README.md +++ b/README.md @@ -234,9 +234,8 @@ normal buttons cannot be used since they'd fall off. Using wall coral fans work `SHULKER_BOX` works too. Using `AIR` for a closed underwater gate looks weird, so `WATER` might be better. If using `AIR` for the closed gate, -you need to make sure it actually contains air when creating it. -For partially submerged portals, like ones used for boat teleportation, you need to keep water away -from the portal entrance/opening until it's been created. +you need to make sure it actually contains air when creating it. For partially submerged portals, like ones used for +boat teleportation, you need to keep water away from the portal entrance/opening until it's been created. # Configuration @@ -278,9 +277,9 @@ debugging: It is possible to customize all the messages Stargate displays, including the [Stargate] prefix. You can find the strings in plugins/Stargate/lang/chosenLanguage.txt. -If a string is removed, or left blank, it will default to the default english string. There are some special cases -regarding messages. When you see %variableName%, you need to keep this part in your string, as it will be replaced -with relevant values. +If a string is removed, or left blank, it will default to the default english string. There are some special cases +regarding messages. When you see %variableName%, you need to keep this part in your string, as it will be replaced with +relevant values. The full list of strings is as follows: @@ -368,8 +367,8 @@ bungeeSign=Teleport to #### \[Version 0.8.0.0] PseudoKnight fork -- Update for 1.13/1.14 compatibility. This update changes gate layouts to use new material names instead of numeric ids. You - need to update your gate layout configs. +- Update for 1.13/1.14 compatibility. This update changes gate layouts to use new material names instead of numeric ids. + You need to update your gate layout configs. - Adds "verifyPortals" config option, which sets whether an old stargate's blocks are verified when loaded. - Adds UUID support. (falls back to player names) diff --git a/src/main/java/net/knarcraft/stargate/LanguageLoader.java b/src/main/java/net/knarcraft/stargate/LanguageLoader.java index edae036..b3b24d9 100644 --- a/src/main/java/net/knarcraft/stargate/LanguageLoader.java +++ b/src/main/java/net/knarcraft/stargate/LanguageLoader.java @@ -16,7 +16,6 @@ import java.util.Set; */ public class LanguageLoader { - // Variables private final String languageFolder; private final Map loadedBackupStrings; private String chosenLanguage; diff --git a/src/main/java/net/knarcraft/stargate/Stargate.java b/src/main/java/net/knarcraft/stargate/Stargate.java index 741b1f0..a187dd1 100644 --- a/src/main/java/net/knarcraft/stargate/Stargate.java +++ b/src/main/java/net/knarcraft/stargate/Stargate.java @@ -73,11 +73,11 @@ public class Stargate extends JavaPlugin { private String dataFolderPath; public static ChatColor signColor; - // Used for debug + //Used for debug public static boolean debuggingEnabled = false; public static boolean permissionDebuggingEnabled = false; - // HashMap of player names for Bungee support + //HashMap of player names for Bungee support public static final Map bungeeQueue = new HashMap<>(); //World names that contain stargates public static final HashSet managedWorlds = new HashSet<>(); @@ -189,7 +189,9 @@ public class Stargate extends JavaPlugin { * @param error

Whether the message sent is an error

*/ private static void sendMessage(CommandSender player, String message, boolean error) { - if (message.isEmpty()) return; + if (message.isEmpty()) { + return; + } //Replace color codes with green? What's the deal with the dollar sign? message = message.replaceAll("(&([a-f0-9]))", "\u00A7$2"); if (error) { @@ -330,7 +332,7 @@ public class Stargate extends JavaPlugin { this.loadGates(); this.loadAllPortals(); - // Check to see if Economy is loaded yet. + //Check to see if Economy is loaded yet. setupVaultEconomy(); //Run necessary threads diff --git a/src/main/java/net/knarcraft/stargate/listener/PortalEventListener.java b/src/main/java/net/knarcraft/stargate/listener/PortalEventListener.java index 8b54f8e..c4b2451 100644 --- a/src/main/java/net/knarcraft/stargate/listener/PortalEventListener.java +++ b/src/main/java/net/knarcraft/stargate/listener/PortalEventListener.java @@ -6,6 +6,9 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.world.PortalCreateEvent; +/** + * Listens for and cancels relevant portal events + */ public class PortalEventListener implements Listener { @EventHandler @@ -13,6 +16,7 @@ public class PortalEventListener implements Listener { if (event.isCancelled()) { return; } + //Cancel nether portal creation when the portal is a StarGate portal for (BlockState block : event.getBlocks()) { if (PortalHandler.getByBlock(block.getBlock()) != null) { event.setCancelled(true); diff --git a/src/main/java/net/knarcraft/stargate/portal/Gate.java b/src/main/java/net/knarcraft/stargate/portal/Gate.java index 8fd74bd..e071b60 100644 --- a/src/main/java/net/knarcraft/stargate/portal/Gate.java +++ b/src/main/java/net/knarcraft/stargate/portal/Gate.java @@ -30,7 +30,7 @@ public class Gate { private final Material portalClosedBlock; private final Material portalButton; - // Economy information + //Economy information private final int useCost; private final int createCost; private final int destroyCost; diff --git a/src/main/java/net/knarcraft/stargate/portal/Portal.java b/src/main/java/net/knarcraft/stargate/portal/Portal.java index f4dc24a..f48c60d 100644 --- a/src/main/java/net/knarcraft/stargate/portal/Portal.java +++ b/src/main/java/net/knarcraft/stargate/portal/Portal.java @@ -513,7 +513,7 @@ public class Portal { /** * Adjusts the rotation of the player to face out from the portal * - * @param exit

The location the player will exit from

+ * @param exit

The location the player will exit from

*/ private void adjustRotation(Location exit) { int adjust = 0; diff --git a/src/main/java/net/knarcraft/stargate/portal/PortalOption.java b/src/main/java/net/knarcraft/stargate/portal/PortalOption.java index e989aec..6b68418 100644 --- a/src/main/java/net/knarcraft/stargate/portal/PortalOption.java +++ b/src/main/java/net/knarcraft/stargate/portal/PortalOption.java @@ -1,5 +1,8 @@ package net.knarcraft.stargate.portal; +/** + * Each enum value represents one option a portal can have/use + */ public enum PortalOption { /** diff --git a/src/main/java/net/knarcraft/stargate/thread/StarGateThread.java b/src/main/java/net/knarcraft/stargate/thread/StarGateThread.java index 521b388..b869971 100644 --- a/src/main/java/net/knarcraft/stargate/thread/StarGateThread.java +++ b/src/main/java/net/knarcraft/stargate/thread/StarGateThread.java @@ -13,10 +13,10 @@ public class StarGateThread implements Runnable { @Override public void run() { long time = System.currentTimeMillis() / 1000; - // Close open portals + //Close open portals for (Iterator iterator = Stargate.openPortalsQueue.iterator(); iterator.hasNext(); ) { Portal portal = iterator.next(); - // Skip always open and non-open gates + //Skip always open and non-open gates if (portal.getOptions().isAlwaysOn() || !portal.isOpen()) { continue; } @@ -25,7 +25,7 @@ public class StarGateThread implements Runnable { iterator.remove(); } } - // Deactivate active portals + //Deactivate active portals for (Iterator iterator = Stargate.activePortalsQueue.iterator(); iterator.hasNext(); ) { Portal portal = iterator.next(); if (!portal.isActive()) {