From 92abe0fce253758e5e6626f5e0fbfc6d75f1fd42 Mon Sep 17 00:00:00 2001 From: Staartvin Date: Sat, 16 Nov 2019 17:55:49 +0100 Subject: [PATCH] Remove todo's that weren't really todo's! --- .../pluginlibrary/hooks/AutorankHook.java | 252 +++++++++--------- .../pluginlibrary/hooks/EssentialsXHook.java | 4 - .../pluginlibrary/hooks/FactionsHook.java | 4 - .../pluginlibrary/hooks/McMMOHook.java | 4 - .../pluginlibrary/hooks/OnTimeHook.java | 2 - .../hooks/QuestsAlternative.java | 3 - .../pluginlibrary/hooks/QuestsHook.java | 2 - .../hooks/SavageFactionsHook.java | 4 - .../pluginlibrary/hooks/StatsHook.java | 1 - .../pluginlibrary/hooks/StatzHook.java | 6 +- .../pluginlibrary/hooks/WorldGuardHook.java | 4 - 11 files changed, 120 insertions(+), 166 deletions(-) diff --git a/src/me/staartvin/plugins/pluginlibrary/hooks/AutorankHook.java b/src/me/staartvin/plugins/pluginlibrary/hooks/AutorankHook.java index e71120c..9eea9c3 100644 --- a/src/me/staartvin/plugins/pluginlibrary/hooks/AutorankHook.java +++ b/src/me/staartvin/plugins/pluginlibrary/hooks/AutorankHook.java @@ -17,155 +17,141 @@ * link. *

* Date created: 14:21:44 12 aug. 2015 - * - * @author Staartvin * + * @author Staartvin */ public class AutorankHook extends LibraryHook { - private Autorank autorank; - - /* - * (non-Javadoc) - * - * @see me.staartvin.plugins.pluginlibrary.LibraryHook#isAvailable() - */ - @Override - public boolean isAvailable() { - // TODO Auto-generated method stub + private Autorank autorank; + /* + * (non-Javadoc) + * + * @see me.staartvin.plugins.pluginlibrary.LibraryHook#isAvailable() + */ + @Override + public boolean isAvailable() { return true; - } - - /* - * (non-Javadoc) - * - * @see me.staartvin.plugins.pluginlibrary.LibraryHook#hook() - */ - @Override - public boolean hook() { - // TODO Auto-generated method stub - - if (!isAvailable()) - return false; - - autorank = (Autorank) this.getPlugin().getServer().getPluginManager() + } + + /* + * (non-Javadoc) + * + * @see me.staartvin.plugins.pluginlibrary.LibraryHook#hook() + */ + @Override + public boolean hook() { + if (!isAvailable()) + return false; + + autorank = (Autorank) this.getPlugin().getServer().getPluginManager() .getPlugin(Library.AUTORANK.getInternalPluginName()); - return autorank != null; - } - - /** - * Gets playtime of a player in minutes on this local server. - * - * @param uuid - * UUID of the player - * @return amount of minutes a player has played. - */ - public int getLocalPlayTime(UUID uuid) { + return autorank != null; + } + + /** + * Gets playtime of a player in minutes on this local server. + * + * @param uuid UUID of the player + * @return amount of minutes a player has played. + */ + public int getLocalPlayTime(UUID uuid) { if (!this.isAvailable()) return -1; - return autorank.getAPI().getLocalPlayTime(uuid); - } - - /** - * When Autorank is set up on multiple servers in the same network, it will - * sum a player's time across all servers.
- * If a player plays on server A for 10 minutes and on server B for 15 - * minutes, the global time will be 25 minutes.
- * This method allows you to get the global time of a player in minutes. - * - * @param uuid - * UUID of the player - * @return amount of minutes a player has played across all servers in the - * network. - */ - public int getGlobalPlayTime(UUID uuid) { + return autorank.getAPI().getLocalPlayTime(uuid); + } + + /** + * When Autorank is set up on multiple servers in the same network, it will + * sum a player's time across all servers.
+ * If a player plays on server A for 10 minutes and on server B for 15 + * minutes, the global time will be 25 minutes.
+ * This method allows you to get the global time of a player in minutes. + * + * @param uuid UUID of the player + * @return amount of minutes a player has played across all servers in the + * network. + */ + public int getGlobalPlayTime(UUID uuid) { if (!this.isAvailable()) return -1; - return autorank.getAPI().getGlobalPlayTime(uuid); - } - - /** - * When a player is in a permission group that has requirements before the - * player can rank up,
- * this method will show all the requirements that the player should - * complete before he ranks up.
- * This method does not take into account which requirements are already - * completed by the player.
- * If you only want the requirements that have yet to be completed by the - * player,
- * use {@link #getFailedRequirements(Player)}.
- * This method merely copies the config of Autorank and is used for getting - * all the requirements of a player's permission group. - * - * @param player - * Player to get the requirements for. - * @return A list of all requirements - */ - public List getAllRequirements(Player player) { + return autorank.getAPI().getGlobalPlayTime(uuid); + } + + /** + * When a player is in a permission group that has requirements before the + * player can rank up,
+ * this method will show all the requirements that the player should + * complete before he ranks up.
+ * This method does not take into account which requirements are already + * completed by the player.
+ * If you only want the requirements that have yet to be completed by the + * player,
+ * use {@link #getFailedRequirements(Player)}.
+ * This method merely copies the config of Autorank and is used for getting + * all the requirements of a player's permission group. + * + * @param player Player to get the requirements for. + * @return A list of all requirements + */ + public List getAllRequirements(Player player) { if (!this.isAvailable()) return new ArrayList<>(); - return autorank.getAPI().getAllRequirements(player); - } - - /** - * See {@link #getAllRequirements(Player)} for more info.
- * This method only returns the requirements that have yet to be completed - * by the player. - * - * @param player - * Player to get the requirements for. - * @return A list of all requirements that should still be completed. - */ - public List getFailedRequirements(Player player) { + return autorank.getAPI().getAllRequirements(player); + } + + /** + * See {@link #getAllRequirements(Player)} for more info.
+ * This method only returns the requirements that have yet to be completed + * by the player. + * + * @param player Player to get the requirements for. + * @return A list of all requirements that should still be completed. + */ + public List getFailedRequirements(Player player) { if (!this.isAvailable()) return new ArrayList<>(); - return autorank.getAPI().getFailedRequirements(player); - } - - /** - * Gets a list of all permission groups a player is currently in.
- * Most permission plugins only allow a player to be in one group at the - * time, but some allow multiple. - * - * @param player - * Player to get the groups of. - * @return a list of groups a player is part of. - */ - public Collection getPermissionGroups(Player player) { + return autorank.getAPI().getFailedRequirements(player); + } + + /** + * Gets a list of all permission groups a player is currently in.
+ * Most permission plugins only allow a player to be in one group at the + * time, but some allow multiple. + * + * @param player Player to get the groups of. + * @return a list of groups a player is part of. + */ + public Collection getPermissionGroups(Player player) { if (!this.isAvailable()) return new ArrayList<>(); - return autorank.getPermPlugHandler().getPermissionPlugin().getPlayerGroups(player); - } - - /** - * Registers a custom requirement to Autorank.
- * Users of Autorank can use different requirements already coded by the - * author,
- * but it's also possible to add your own requirements.
- * For more info about custom requirements and results, see:
- * - * https://github.com/Armarr/Autorank-2/wiki/Developer's-API#custom- - * requirements - * - * @param requirementName - * Name of the requirement. - * @param req - * The custom requirement class for Autorank to use. - */ + return autorank.getPermPlugHandler().getPermissionPlugin().getPlayerGroups(player); + } + + /** + * Registers a custom requirement to Autorank.
+ * Users of Autorank can use different requirements already coded by the + * author,
+ * but it's also possible to add your own requirements.
+ * For more info about custom requirements and results, see:
+ * + * https://github.com/Armarr/Autorank-2/wiki/Developer's-API#custom- + * requirements + * + * @param requirementName Name of the requirement. + * @param req The custom requirement class for Autorank to use. + */ public void registerRequirement(String requirementName, Class req) { if (!this.isAvailable()) return; - autorank.getAPI().registerRequirement(requirementName, req); - } - - /** - * @see #registerRequirement(String, Class) - * @param resultName - * The name of the result. - * @param res - * The custom result class for Autorank to use. - */ - public void registerResult(String resultName, + autorank.getAPI().registerRequirement(requirementName, req); + } + + /** + * @param resultName The name of the result. + * @param res The custom result class for Autorank to use. + * @see #registerRequirement(String, Class) + */ + public void registerResult(String resultName, Class res) { if (!this.isAvailable()) return; - autorank.getAPI().registerResult(resultName, res); - } + autorank.getAPI().registerResult(resultName, res); + } } diff --git a/src/me/staartvin/plugins/pluginlibrary/hooks/EssentialsXHook.java b/src/me/staartvin/plugins/pluginlibrary/hooks/EssentialsXHook.java index 14c8ef9..cb23791 100644 --- a/src/me/staartvin/plugins/pluginlibrary/hooks/EssentialsXHook.java +++ b/src/me/staartvin/plugins/pluginlibrary/hooks/EssentialsXHook.java @@ -25,8 +25,6 @@ public class EssentialsXHook extends LibraryHook { */ @Override public boolean isAvailable() { - // TODO Auto-generated method stub - return this.getPlugin().getServer().getPluginManager().isPluginEnabled(Library.ESSENTIALSX.getInternalPluginName()); } @@ -37,8 +35,6 @@ public boolean isAvailable() { */ @Override public boolean hook() { - // TODO Auto-generated method stub - if (!isAvailable()) return false; diff --git a/src/me/staartvin/plugins/pluginlibrary/hooks/FactionsHook.java b/src/me/staartvin/plugins/pluginlibrary/hooks/FactionsHook.java index bb638ec..710bdf0 100644 --- a/src/me/staartvin/plugins/pluginlibrary/hooks/FactionsHook.java +++ b/src/me/staartvin/plugins/pluginlibrary/hooks/FactionsHook.java @@ -34,8 +34,6 @@ public class FactionsHook extends LibraryHook { */ @Override public boolean isAvailable() { - // TODO Auto-generated method stub - return this.getPlugin().getServer().getPluginManager().isPluginEnabled(Library.FACTIONS.getInternalPluginName()); } @@ -46,8 +44,6 @@ public boolean isAvailable() { */ @Override public boolean hook() { - // TODO Auto-generated method stub - if (!isAvailable()) return false; diff --git a/src/me/staartvin/plugins/pluginlibrary/hooks/McMMOHook.java b/src/me/staartvin/plugins/pluginlibrary/hooks/McMMOHook.java index 4ee3f38..106a605 100644 --- a/src/me/staartvin/plugins/pluginlibrary/hooks/McMMOHook.java +++ b/src/me/staartvin/plugins/pluginlibrary/hooks/McMMOHook.java @@ -34,8 +34,6 @@ public class McMMOHook extends LibraryHook { */ @Override public boolean isAvailable() { - // TODO Auto-generated method stub - return this.getPlugin().getServer().getPluginManager().isPluginEnabled(Library.MCMMO.getInternalPluginName()); } @@ -46,8 +44,6 @@ public boolean isAvailable() { */ @Override public boolean hook() { - // TODO Auto-generated method stub - if (!isAvailable()) return false; diff --git a/src/me/staartvin/plugins/pluginlibrary/hooks/OnTimeHook.java b/src/me/staartvin/plugins/pluginlibrary/hooks/OnTimeHook.java index 37b6fcf..cefa9be 100644 --- a/src/me/staartvin/plugins/pluginlibrary/hooks/OnTimeHook.java +++ b/src/me/staartvin/plugins/pluginlibrary/hooks/OnTimeHook.java @@ -27,8 +27,6 @@ public class OnTimeHook extends LibraryHook { */ @Override public boolean isAvailable() { - // TODO Auto-generated method stub - return this.getPlugin().getServer().getPluginManager().isPluginEnabled(Library.ONTIME.getInternalPluginName()); } diff --git a/src/me/staartvin/plugins/pluginlibrary/hooks/QuestsAlternative.java b/src/me/staartvin/plugins/pluginlibrary/hooks/QuestsAlternative.java index b97b7dd..a15edae 100644 --- a/src/me/staartvin/plugins/pluginlibrary/hooks/QuestsAlternative.java +++ b/src/me/staartvin/plugins/pluginlibrary/hooks/QuestsAlternative.java @@ -29,7 +29,6 @@ public class QuestsAlternative extends LibraryHook { */ @Override public boolean isAvailable() { - // TODO Auto-generated method stub Plugin plugin = this.getPlugin().getServer().getPluginManager().getPlugin(Library.QUESTS_ALTERNATIVE .getInternalPluginName()); @@ -45,8 +44,6 @@ public boolean isAvailable() { */ @Override public boolean hook() { - // TODO Auto-generated method stub - if (!isAvailable()) return false; diff --git a/src/me/staartvin/plugins/pluginlibrary/hooks/QuestsHook.java b/src/me/staartvin/plugins/pluginlibrary/hooks/QuestsHook.java index e095d60..9f32759 100644 --- a/src/me/staartvin/plugins/pluginlibrary/hooks/QuestsHook.java +++ b/src/me/staartvin/plugins/pluginlibrary/hooks/QuestsHook.java @@ -39,8 +39,6 @@ public boolean isAvailable() { */ @Override public boolean hook() { - // TODO Auto-generated method stub - if (!isAvailable()) return false; diff --git a/src/me/staartvin/plugins/pluginlibrary/hooks/SavageFactionsHook.java b/src/me/staartvin/plugins/pluginlibrary/hooks/SavageFactionsHook.java index cfe0fa0..e7a8531 100644 --- a/src/me/staartvin/plugins/pluginlibrary/hooks/SavageFactionsHook.java +++ b/src/me/staartvin/plugins/pluginlibrary/hooks/SavageFactionsHook.java @@ -36,8 +36,6 @@ public class SavageFactionsHook extends LibraryHook { */ @Override public boolean isAvailable() { - // TODO Auto-generated method stub - return this.getPlugin().getServer().getPluginManager().isPluginEnabled(Library.SAVAGE_FACTIONS .getInternalPluginName()); } @@ -49,8 +47,6 @@ public boolean isAvailable() { */ @Override public boolean hook() { - // TODO Auto-generated method stub - if (!isAvailable()) return false; diff --git a/src/me/staartvin/plugins/pluginlibrary/hooks/StatsHook.java b/src/me/staartvin/plugins/pluginlibrary/hooks/StatsHook.java index 617ed0a..18d953d 100644 --- a/src/me/staartvin/plugins/pluginlibrary/hooks/StatsHook.java +++ b/src/me/staartvin/plugins/pluginlibrary/hooks/StatsHook.java @@ -31,7 +31,6 @@ public class StatsHook extends LibraryHook { */ @Override public boolean isAvailable() { - // TODO Auto-generated method stub return this.getPlugin().getServer().getPluginManager().isPluginEnabled(Library.STATS.getInternalPluginName()); } diff --git a/src/me/staartvin/plugins/pluginlibrary/hooks/StatzHook.java b/src/me/staartvin/plugins/pluginlibrary/hooks/StatzHook.java index 667b046..f745c4f 100644 --- a/src/me/staartvin/plugins/pluginlibrary/hooks/StatzHook.java +++ b/src/me/staartvin/plugins/pluginlibrary/hooks/StatzHook.java @@ -26,9 +26,7 @@ public class StatzHook extends LibraryHook { */ @Override public boolean isAvailable() { - // TODO Auto-generated method stub - - return true; + return true; } /* @@ -38,8 +36,6 @@ public boolean isAvailable() { */ @Override public boolean hook() { - // TODO Auto-generated method stub - if (!isAvailable()) return false; diff --git a/src/me/staartvin/plugins/pluginlibrary/hooks/WorldGuardHook.java b/src/me/staartvin/plugins/pluginlibrary/hooks/WorldGuardHook.java index bac17dd..c4d235d 100644 --- a/src/me/staartvin/plugins/pluginlibrary/hooks/WorldGuardHook.java +++ b/src/me/staartvin/plugins/pluginlibrary/hooks/WorldGuardHook.java @@ -27,8 +27,6 @@ public class WorldGuardHook extends LibraryHook { */ @Override public boolean isAvailable() { - // TODO Auto-generated method stub - return this.getPlugin().getServer().getPluginManager().isPluginEnabled(Library.WORLDGUARD .getInternalPluginName()); } @@ -40,8 +38,6 @@ public boolean isAvailable() { */ @Override public boolean hook() { - // TODO Auto-generated method stub - if (!isAvailable()) return false;