From 75d3e5fa20bb43f1a2fca5fafb5fce334fc6f219 Mon Sep 17 00:00:00 2001 From: Rsl1122 Date: Thu, 27 Jul 2017 15:14:07 +0300 Subject: [PATCH 1/2] Adds In-depth help messages to commands (/plan ?) --- .../djrapitops/plan/command/PlanCommand.java | 20 ++++++++++++ .../plan/command/commands/AnalyzeCommand.java | 22 ++++++++++++- .../plan/command/commands/InspectCommand.java | 32 ++++++++++++------- .../plan/command/commands/ListCommand.java | 32 ++++++++++++------- .../plan/command/commands/ManageCommand.java | 21 ++++++++++++ .../command/commands/QuickAnalyzeCommand.java | 22 ++++++++++++- .../command/commands/QuickInspectCommand.java | 22 ++++++++++++- .../command/commands/RegisterCommand.java | 20 ++++++++++++ .../plan/command/commands/SearchCommand.java | 19 +++++++++++ .../plan/command/commands/WebUserCommand.java | 23 +++++++++++++ .../commands/manage/ManageClearCommand.java | 21 ++++++++++++ .../commands/manage/ManageHotswapCommand.java | 19 +++++++++++ .../commands/manage/ManageImportCommand.java | 20 ++++++++++++ .../commands/manage/ManageRemoveCommand.java | 18 +++++++++++ 14 files changed, 286 insertions(+), 25 deletions(-) diff --git a/Plan/src/main/java/com/djrapitops/plan/command/PlanCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/PlanCommand.java index cdd3edb5c..fbf2b4b8c 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/PlanCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/PlanCommand.java @@ -3,6 +3,8 @@ package main.java.com.djrapitops.plan.command; import com.djrapitops.plugin.command.CommandType; import com.djrapitops.plugin.command.TreeCommand; import com.djrapitops.plugin.command.defaultcmds.StatusCommand; +import com.djrapitops.plugin.settings.ColorScheme; +import com.djrapitops.plugin.settings.DefaultMessages; import main.java.com.djrapitops.plan.Permissions; import main.java.com.djrapitops.plan.Plan; import main.java.com.djrapitops.plan.command.commands.*; @@ -27,6 +29,24 @@ public class PlanCommand extends TreeCommand { public PlanCommand(Plan plugin) { super(plugin, "plan", CommandType.CONSOLE, "", "", "plan"); super.setDefaultCommand("inspect"); + setHelp(plugin); + } + + private void setHelp(Plan plugin) { + ColorScheme colorScheme = plugin.getColorScheme(); + + String ball = DefaultMessages.BALL.toString(); + + String mCol = colorScheme.getMainColor(); + String sCol = colorScheme.getSecondaryColor(); + String tCol = colorScheme.getTertiaryColor(); + + String[] help = new String[]{ + mCol +"/plan - Main Command", + tCol+" Used to access all SubCommands & help", + sCol+" /plan - List subcommands", + sCol+" /plan ? - in depth help" + }; } @Override diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/AnalyzeCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/AnalyzeCommand.java index d6de27d6b..da35baaba 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/AnalyzeCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/AnalyzeCommand.java @@ -5,6 +5,8 @@ import com.djrapitops.plugin.command.CommandType; import com.djrapitops.plugin.command.CommandUtils; import com.djrapitops.plugin.command.ISender; import com.djrapitops.plugin.command.SubCommand; +import com.djrapitops.plugin.settings.ColorScheme; +import com.djrapitops.plugin.settings.DefaultMessages; import com.djrapitops.plugin.task.AbsRunnable; import main.java.com.djrapitops.plan.*; import main.java.com.djrapitops.plan.command.ConditionUtils; @@ -34,9 +36,27 @@ public class AnalyzeCommand extends SubCommand { * @param plugin Current instance of Plan */ public AnalyzeCommand(Plan plugin) { - super("analyze, analyse, analysis", CommandType.CONSOLE, Permissions.ANALYZE.getPermission(), Phrase.CMD_USG_ANALYZE.parse()); + super("analyze, analyse, analysis, a", CommandType.CONSOLE, Permissions.ANALYZE.getPermission(), Phrase.CMD_USG_ANALYZE.parse()); this.plugin = plugin; analysisCache = plugin.getAnalysisCache(); + setHelp(plugin); + } + + private void setHelp(Plan plugin) { + ColorScheme colorScheme = plugin.getColorScheme(); + + String ball = DefaultMessages.BALL.toString(); + + String mCol = colorScheme.getMainColor(); + String sCol = colorScheme.getSecondaryColor(); + String tCol = colorScheme.getTertiaryColor(); + + String[] help = new String[]{ + mCol +"Analysis Command", + tCol+" Used to Refresh analysis cache & Access the result page", + sCol+" /plan status can be used to check status of analysis while it is running.", + sCol+" Aliases: analyze, analyse, analysis, a" + }; } @Override diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/InspectCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/InspectCommand.java index 0efb90052..6a45ada52 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/InspectCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/InspectCommand.java @@ -5,6 +5,8 @@ import com.djrapitops.plugin.command.CommandType; import com.djrapitops.plugin.command.CommandUtils; import com.djrapitops.plugin.command.ISender; import com.djrapitops.plugin.command.SubCommand; +import com.djrapitops.plugin.settings.ColorScheme; +import com.djrapitops.plugin.settings.DefaultMessages; import com.djrapitops.plugin.task.AbsRunnable; import com.djrapitops.plugin.utilities.Verify; import main.java.com.djrapitops.plan.*; @@ -15,9 +17,7 @@ import main.java.com.djrapitops.plan.utilities.Check; import main.java.com.djrapitops.plan.utilities.HtmlUtils; import main.java.com.djrapitops.plan.utilities.MiscUtils; import main.java.com.djrapitops.plan.utilities.uuid.UUIDUtility; -import org.bukkit.Bukkit; import org.bukkit.ChatColor; -import org.bukkit.command.CommandException; import java.sql.SQLException; import java.util.UUID; @@ -43,6 +43,24 @@ public class InspectCommand extends SubCommand { this.plugin = plugin; inspectCache = plugin.getInspectCache(); + setHelp(plugin); + } + + private void setHelp(Plan plugin) { + ColorScheme colorScheme = plugin.getColorScheme(); + + String ball = DefaultMessages.BALL.toString(); + + String mCol = colorScheme.getMainColor(); + String sCol = colorScheme.getSecondaryColor(); + String tCol = colorScheme.getTertiaryColor(); + + String[] help = new String[]{ + mCol +"Inspect command", + tCol+" Used to get a link to User's inspect page.", + sCol+" Own inspect page can be accessed with /plan inspect", + sCol+" Alias: /plan " + }; } @Override @@ -135,12 +153,4 @@ public class InspectCommand extends SubCommand { sender.sendMessage(Phrase.CMD_FOOTER + ""); } - - @Deprecated // TODO Will be rewritten to the RslPlugin abstractions in the future. - private void sendLink(ISender sender, String url) throws CommandException { - plugin.getServer().dispatchCommand( - Bukkit.getConsoleSender(), - "tellraw " + sender.getName() + " [\"\",{\"text\":\"" + Phrase.CMD_CLICK_ME + "\",\"underlined\":true," - + "\"clickEvent\":{\"action\":\"open_url\",\"value\":\"" + url + "\"}}]"); - } -} +} \ No newline at end of file diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/ListCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/ListCommand.java index 09a4a9013..06cb62242 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/ListCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/ListCommand.java @@ -4,14 +4,14 @@ import com.djrapitops.plugin.command.CommandType; import com.djrapitops.plugin.command.CommandUtils; import com.djrapitops.plugin.command.ISender; import com.djrapitops.plugin.command.SubCommand; +import com.djrapitops.plugin.settings.ColorScheme; +import com.djrapitops.plugin.settings.DefaultMessages; import main.java.com.djrapitops.plan.Permissions; import main.java.com.djrapitops.plan.Phrase; import main.java.com.djrapitops.plan.Plan; import main.java.com.djrapitops.plan.command.ConditionUtils; import main.java.com.djrapitops.plan.utilities.Check; import main.java.com.djrapitops.plan.utilities.HtmlUtils; -import org.bukkit.Bukkit; -import org.bukkit.command.CommandException; /** * Command used to display link to the player list webpage. @@ -31,9 +31,27 @@ public class ListCommand extends SubCommand { * @param plugin Current instance of Plan */ public ListCommand(Plan plugin) { - super("list", CommandType.CONSOLE, Permissions.INSPECT_OTHER.getPermission(), "List to all cached players", ""); + super("list, pl", CommandType.CONSOLE, Permissions.INSPECT_OTHER.getPermission(), "List to all cached players", ""); this.plugin = plugin; + setHelp(plugin); + } + + private void setHelp(Plan plugin) { + ColorScheme colorScheme = plugin.getColorScheme(); + + String ball = DefaultMessages.BALL.toString(); + + String mCol = colorScheme.getMainColor(); + String sCol = colorScheme.getSecondaryColor(); + String tCol = colorScheme.getTertiaryColor(); + + String[] help = new String[]{ + mCol +"List command", + tCol+" Used to get a link to players page.", + sCol+" Players page contains links to all cached inspect pages.", + sCol+" Alias: /plan pl" + }; } @Override @@ -60,12 +78,4 @@ public class ListCommand extends SubCommand { } sender.sendMessage(Phrase.CMD_FOOTER + ""); } - - @Deprecated // TODO Will be rewritten to the RslPlugin abstractions in the future. - private void sendLink(ISender sender, String url) throws CommandException { - plugin.getServer().dispatchCommand( - Bukkit.getConsoleSender(), - "tellraw " + sender.getName() + " [\"\",{\"text\":\"" + Phrase.CMD_CLICK_ME + "\",\"underlined\":true," - + "\"clickEvent\":{\"action\":\"open_url\",\"value\":\"" + url + "\"}}]"); - } } diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/ManageCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/ManageCommand.java index 8cc6fa2b5..61d424170 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/ManageCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/ManageCommand.java @@ -2,6 +2,8 @@ package main.java.com.djrapitops.plan.command.commands; import com.djrapitops.plugin.command.CommandType; import com.djrapitops.plugin.command.TreeCommand; +import com.djrapitops.plugin.settings.ColorScheme; +import com.djrapitops.plugin.settings.DefaultMessages; import main.java.com.djrapitops.plan.Permissions; import main.java.com.djrapitops.plan.Phrase; import main.java.com.djrapitops.plan.Plan; @@ -24,6 +26,25 @@ public class ManageCommand extends TreeCommand { */ public ManageCommand(Plan plugin) { super(plugin, "manage,m", CommandType.CONSOLE, Permissions.MANAGE.getPermission(), Phrase.CMD_USG_MANAGE + "", "plan m"); + setHelp(plugin); + } + + private void setHelp(Plan plugin) { + ColorScheme colorScheme = plugin.getColorScheme(); + + String ball = DefaultMessages.BALL.toString(); + + String mCol = colorScheme.getMainColor(); + String sCol = colorScheme.getSecondaryColor(); + String tCol = colorScheme.getTertiaryColor(); + + String[] help = new String[]{ + mCol +"Manage command", + tCol+" Used to Manage Database of the plugin.", + sCol+" Alias: /plan m", + sCol+" /plan m - List subcommands", + sCol+" /plan m ? - in depth help" + }; } @Override diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/QuickAnalyzeCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/QuickAnalyzeCommand.java index 5dc463a20..acbe0109c 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/QuickAnalyzeCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/QuickAnalyzeCommand.java @@ -4,6 +4,8 @@ import com.djrapitops.plugin.api.TimeAmount; import com.djrapitops.plugin.command.CommandType; import com.djrapitops.plugin.command.ISender; import com.djrapitops.plugin.command.SubCommand; +import com.djrapitops.plugin.settings.ColorScheme; +import com.djrapitops.plugin.settings.DefaultMessages; import com.djrapitops.plugin.task.AbsRunnable; import main.java.com.djrapitops.plan.Log; import main.java.com.djrapitops.plan.Permissions; @@ -33,9 +35,27 @@ public class QuickAnalyzeCommand extends SubCommand { * @param plugin Current instance of Plan */ public QuickAnalyzeCommand(Plan plugin) { - super("qanalyze, qanalyse, qanalysis", CommandType.CONSOLE, Permissions.QUICK_ANALYZE.getPermission(), Phrase.CMD_USG_QANALYZE.parse()); + super("qanalyze, qanalyse, qanalysis, qa", CommandType.CONSOLE, Permissions.QUICK_ANALYZE.getPermission(), Phrase.CMD_USG_QANALYZE.parse()); this.plugin = plugin; analysisCache = plugin.getAnalysisCache(); + setHelp(plugin); + } + + private void setHelp(Plan plugin) { + ColorScheme colorScheme = plugin.getColorScheme(); + + String ball = DefaultMessages.BALL.toString(); + + String mCol = colorScheme.getMainColor(); + String sCol = colorScheme.getSecondaryColor(); + String tCol = colorScheme.getTertiaryColor(); + + String[] help = new String[]{ + mCol +"Quick Analysis command", + tCol+" Used to get in game info about analysis.", + sCol+" Has less info than full Analysis web page.", + sCol+" Aliases: qanalyze, ganalyse, qanalysis, qa" + }; } @Override diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/QuickInspectCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/QuickInspectCommand.java index 2f93744e9..685da9517 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/QuickInspectCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/QuickInspectCommand.java @@ -4,6 +4,8 @@ import com.djrapitops.plugin.api.TimeAmount; import com.djrapitops.plugin.command.CommandType; import com.djrapitops.plugin.command.ISender; import com.djrapitops.plugin.command.SubCommand; +import com.djrapitops.plugin.settings.ColorScheme; +import com.djrapitops.plugin.settings.DefaultMessages; import com.djrapitops.plugin.task.AbsRunnable; import com.djrapitops.plugin.utilities.Verify; import main.java.com.djrapitops.plan.Log; @@ -37,10 +39,28 @@ public class QuickInspectCommand extends SubCommand { * @param plugin Current instance of Plan */ public QuickInspectCommand(Plan plugin) { - super("qinspect", CommandType.CONSOLE_WITH_ARGUMENTS, Permissions.QUICK_INSPECT.getPermission(), Phrase.CMD_USG_QINSPECT + "", Phrase.ARG_PLAYER + ""); + super("qinspect, qi", CommandType.CONSOLE_WITH_ARGUMENTS, Permissions.QUICK_INSPECT.getPermission(), Phrase.CMD_USG_QINSPECT + "", Phrase.ARG_PLAYER + ""); this.plugin = plugin; inspectCache = plugin.getInspectCache(); + setHelp(plugin); + } + + private void setHelp(Plan plugin) { + ColorScheme colorScheme = plugin.getColorScheme(); + + String ball = DefaultMessages.BALL.toString(); + + String mCol = colorScheme.getMainColor(); + String sCol = colorScheme.getSecondaryColor(); + String tCol = colorScheme.getTertiaryColor(); + + String[] help = new String[]{ + mCol +"Quick Inspect command", + tCol+" Used to get some inspect info in game.", + sCol+" Has less info than full Inspect web page.", + sCol+" Alias: /plan qi" + }; } @Override diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/RegisterCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/RegisterCommand.java index 93bf024d1..50b090409 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/RegisterCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/RegisterCommand.java @@ -4,6 +4,8 @@ import com.djrapitops.plugin.command.CommandType; import com.djrapitops.plugin.command.CommandUtils; import com.djrapitops.plugin.command.ISender; import com.djrapitops.plugin.command.SubCommand; +import com.djrapitops.plugin.settings.ColorScheme; +import com.djrapitops.plugin.settings.DefaultMessages; import com.djrapitops.plugin.task.AbsRunnable; import main.java.com.djrapitops.plan.Log; import main.java.com.djrapitops.plan.Permissions; @@ -34,6 +36,24 @@ public class RegisterCommand extends SubCommand { public RegisterCommand(Plan plugin) { super("register", CommandType.CONSOLE_WITH_ARGUMENTS, "", "Register a user for the webserver", " [name] [access lvl]"); this.plugin = plugin; + setHelp(plugin); + } + + private void setHelp(Plan plugin) { + ColorScheme colorScheme = plugin.getColorScheme(); + + String ball = DefaultMessages.BALL.toString(); + + String mCol = colorScheme.getMainColor(); + String sCol = colorScheme.getSecondaryColor(); + String tCol = colorScheme.getTertiaryColor(); + + String[] help = new String[]{ + mCol +"Web Register command", + tCol+" Used to register a new user for the webserver.", + sCol+" Registering a user for another player requires "+Permissions.MANAGE_WEB.getPerm()+" permission.", + sCol+" Passwords are hashed with PBKDF2 (64,000 iterations of SHA1) using a cryptographically-random salt." + }; } @Override diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/SearchCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/SearchCommand.java index 523be03d7..e0f55a04e 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/SearchCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/SearchCommand.java @@ -3,6 +3,8 @@ package main.java.com.djrapitops.plan.command.commands; import com.djrapitops.plugin.command.CommandType; import com.djrapitops.plugin.command.ISender; import com.djrapitops.plugin.command.SubCommand; +import com.djrapitops.plugin.settings.ColorScheme; +import com.djrapitops.plugin.settings.DefaultMessages; import com.djrapitops.plugin.task.AbsRunnable; import com.djrapitops.plugin.utilities.FormattingUtils; import main.java.com.djrapitops.plan.Permissions; @@ -32,6 +34,23 @@ public class SearchCommand extends SubCommand { public SearchCommand(Plan plugin) { super("search", CommandType.CONSOLE_WITH_ARGUMENTS, Permissions.SEARCH.getPermission(), Phrase.CMD_USG_SEARCH + "", Phrase.ARG_SEARCH + ""); this.plugin = plugin; + setHelp(plugin); + } + + private void setHelp(Plan plugin) { + ColorScheme colorScheme = plugin.getColorScheme(); + + String ball = DefaultMessages.BALL.toString(); + + String mCol = colorScheme.getMainColor(); + String sCol = colorScheme.getSecondaryColor(); + String tCol = colorScheme.getTertiaryColor(); + + String[] help = new String[]{ + mCol +"Search command", + tCol+" Used to get a list of Player names that match the given argument.", + sCol+" Example: /plan search 123 - Finds all users with 123 in their name." + }; } @Override diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/WebUserCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/WebUserCommand.java index b2f485de3..a555ac659 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/WebUserCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/WebUserCommand.java @@ -2,6 +2,8 @@ package main.java.com.djrapitops.plan.command.commands; import com.djrapitops.plugin.command.CommandType; import com.djrapitops.plugin.command.TreeCommand; +import com.djrapitops.plugin.settings.ColorScheme; +import com.djrapitops.plugin.settings.DefaultMessages; import main.java.com.djrapitops.plan.Permissions; import main.java.com.djrapitops.plan.Plan; import main.java.com.djrapitops.plan.command.commands.webuser.WebCheckCommand; @@ -20,6 +22,27 @@ public class WebUserCommand extends TreeCommand { public WebUserCommand(Plan plugin, RegisterCommand register) { super(plugin, "webuser, web", CommandType.CONSOLE, Permissions.MANAGE_WEB.getPerm(), "Manage Webusers", "plan web"); commands.add(register); + setHelp(plugin); + } + + private void setHelp(Plan plugin) { + ColorScheme colorScheme = plugin.getColorScheme(); + + String ball = DefaultMessages.BALL.toString(); + + String mCol = colorScheme.getMainColor(); + String sCol = colorScheme.getSecondaryColor(); + String tCol = colorScheme.getTertiaryColor(); + + String[] help = new String[]{ + mCol +"Web User Manage command", + tCol+" Used to manage web users of the plugin", + sCol+" Users have a permission level:", + tCol+" 0 - Access to all pages", + tCol+" 1 - Access to /players & all inspect pages", + tCol+" 2 - Access to own inspect page", + sCol+" Alias: /plan web" + }; } @Override diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageClearCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageClearCommand.java index 4bbe0ae39..3aeffddde 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageClearCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageClearCommand.java @@ -3,6 +3,8 @@ package main.java.com.djrapitops.plan.command.commands.manage; import com.djrapitops.plugin.command.CommandType; import com.djrapitops.plugin.command.ISender; import com.djrapitops.plugin.command.SubCommand; +import com.djrapitops.plugin.settings.ColorScheme; +import com.djrapitops.plugin.settings.DefaultMessages; import com.djrapitops.plugin.task.AbsRunnable; import com.djrapitops.plugin.utilities.Verify; import main.java.com.djrapitops.plan.Log; @@ -32,6 +34,24 @@ public class ManageClearCommand extends SubCommand { super("clear", CommandType.CONSOLE_WITH_ARGUMENTS, Permissions.MANAGE.getPermission(), Phrase.CMD_USG_MANAGE_CLEAR + "", " [-a]"); this.plugin = plugin; + setHelp(plugin); + } + + private void setHelp(Plan plugin) { + ColorScheme colorScheme = plugin.getColorScheme(); + + String ball = DefaultMessages.BALL.toString(); + + String mCol = colorScheme.getMainColor(); + String sCol = colorScheme.getSecondaryColor(); + String tCol = colorScheme.getTertiaryColor(); + + String[] help = new String[]{ + mCol +"Manage Clear command", + tCol+" Used to delete ALL data in the active database.", + sCol+" Plugin should be reloaded after successful clear.", + sCol+" Alias: /plan pl" + }; } @Override @@ -71,6 +91,7 @@ public class ManageClearCommand extends SubCommand { sender.sendMessage(Phrase.MANAGE_PROCESS_START.parse()); if (database.removeAllData()) { + plugin.getHandler().getDataCache().clear(); sender.sendMessage(Phrase.MANAGE_CLEAR_SUCCESS.toString()); } else { sender.sendMessage(Phrase.MANAGE_PROCESS_FAIL.toString()); diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageHotswapCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageHotswapCommand.java index b9bf70b64..e89b1a06f 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageHotswapCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageHotswapCommand.java @@ -3,6 +3,8 @@ package main.java.com.djrapitops.plan.command.commands.manage; import com.djrapitops.plugin.command.CommandType; import com.djrapitops.plugin.command.ISender; import com.djrapitops.plugin.command.SubCommand; +import com.djrapitops.plugin.settings.ColorScheme; +import com.djrapitops.plugin.settings.DefaultMessages; import com.djrapitops.plugin.utilities.Verify; import main.java.com.djrapitops.plan.Log; import main.java.com.djrapitops.plan.Permissions; @@ -32,6 +34,23 @@ public class ManageHotswapCommand extends SubCommand { super("hotswap", CommandType.CONSOLE_WITH_ARGUMENTS, Permissions.MANAGE.getPermission(), Phrase.CMD_USG_MANAGE_HOTSWAP.toString(), ""); this.plugin = plugin; + setHelp(plugin); + } + + private void setHelp(Plan plugin) { + ColorScheme colorScheme = plugin.getColorScheme(); + + String ball = DefaultMessages.BALL.toString(); + + String mCol = colorScheme.getMainColor(); + String sCol = colorScheme.getSecondaryColor(); + String tCol = colorScheme.getTertiaryColor(); + + String[] help = new String[]{ + mCol +"Manage Hotswap command", + tCol+" Used to change database in use on the fly.", + sCol+" Does not change database if connection fails" + }; } @Override diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageImportCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageImportCommand.java index c9dd9dadd..97dab4ac3 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageImportCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageImportCommand.java @@ -3,6 +3,8 @@ package main.java.com.djrapitops.plan.command.commands.manage; import com.djrapitops.plugin.command.CommandType; import com.djrapitops.plugin.command.ISender; import com.djrapitops.plugin.command.SubCommand; +import com.djrapitops.plugin.settings.ColorScheme; +import com.djrapitops.plugin.settings.DefaultMessages; import com.djrapitops.plugin.task.AbsRunnable; import com.djrapitops.plugin.utilities.FormattingUtils; import com.djrapitops.plugin.utilities.player.Fetch; @@ -39,6 +41,24 @@ public class ManageImportCommand extends SubCommand { public ManageImportCommand(Plan plugin) { super("import", CommandType.CONSOLE, Permissions.MANAGE.getPermission(), Phrase.CMD_USG_MANAGE_IMPORT.toString(), Phrase.ARG_IMPORT.toString()); this.plugin = plugin; + setHelp(plugin); + } + + private void setHelp(Plan plugin) { + ColorScheme colorScheme = plugin.getColorScheme(); + + String ball = DefaultMessages.BALL.toString(); + + String mCol = colorScheme.getMainColor(); + String sCol = colorScheme.getSecondaryColor(); + String tCol = colorScheme.getTertiaryColor(); + + String[] help = new String[]{ + mCol +"Manage Import command", + tCol+" Used to import data from other sources", + sCol+" Analysis will be disabled during import.", + sCol+" If a lot of users are not in the database, saving may take a long time." + }; } @Override diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageRemoveCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageRemoveCommand.java index a66b6cc52..f7b3c4093 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageRemoveCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageRemoveCommand.java @@ -3,6 +3,8 @@ package main.java.com.djrapitops.plan.command.commands.manage; import com.djrapitops.plugin.command.CommandType; import com.djrapitops.plugin.command.ISender; import com.djrapitops.plugin.command.SubCommand; +import com.djrapitops.plugin.settings.ColorScheme; +import com.djrapitops.plugin.settings.DefaultMessages; import com.djrapitops.plugin.task.AbsRunnable; import com.djrapitops.plugin.utilities.Verify; import main.java.com.djrapitops.plan.Log; @@ -35,6 +37,22 @@ public class ManageRemoveCommand extends SubCommand { super("remove", CommandType.CONSOLE_WITH_ARGUMENTS, Permissions.MANAGE.getPermission(), Phrase.CMD_USG_MANAGE_REMOVE.toString(), Phrase.ARG_PLAYER + " [-a]"); this.plugin = plugin; + setHelp(plugin); + } + + private void setHelp(Plan plugin) { + ColorScheme colorScheme = plugin.getColorScheme(); + + String ball = DefaultMessages.BALL.toString(); + + String mCol = colorScheme.getMainColor(); + String sCol = colorScheme.getSecondaryColor(); + String tCol = colorScheme.getTertiaryColor(); + + String[] help = new String[]{ + mCol +"Manage Remove command", + tCol+" Used to Remove user's data from the active database." + }; } @Override From 230eb7fc82ab8f29a9fc43cab33f10c13a186d52 Mon Sep 17 00:00:00 2001 From: Rsl1122 Date: Thu, 27 Jul 2017 15:21:04 +0300 Subject: [PATCH 2/2] Add APF Notification prompt to Join Event Listener. --- ..._destroystokyo_paper_paper_spigot_1_12.xml | 14 ---------- ...itops_abstract_plugin_framework_2_0_1.xml} | 8 +++--- .../data/listeners/PlanPlayerListener.java | 27 ++++++++++++------- Plan/src/main/resources/plugin.yml | 3 ++- 4 files changed, 24 insertions(+), 28 deletions(-) delete mode 100644 Plan/.idea/libraries/Maven__com_destroystokyo_paper_paper_spigot_1_12.xml rename Plan/.idea/libraries/{Maven__com_djrapitops_abstract_plugin_framework_2_0_0.xml => Maven__com_djrapitops_abstract_plugin_framework_2_0_1.xml} (67%) diff --git a/Plan/.idea/libraries/Maven__com_destroystokyo_paper_paper_spigot_1_12.xml b/Plan/.idea/libraries/Maven__com_destroystokyo_paper_paper_spigot_1_12.xml deleted file mode 100644 index 52ad59c0d..000000000 --- a/Plan/.idea/libraries/Maven__com_destroystokyo_paper_paper_spigot_1_12.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Plan/.idea/libraries/Maven__com_djrapitops_abstract_plugin_framework_2_0_0.xml b/Plan/.idea/libraries/Maven__com_djrapitops_abstract_plugin_framework_2_0_1.xml similarity index 67% rename from Plan/.idea/libraries/Maven__com_djrapitops_abstract_plugin_framework_2_0_0.xml rename to Plan/.idea/libraries/Maven__com_djrapitops_abstract_plugin_framework_2_0_1.xml index e90b3b519..826d210d1 100644 --- a/Plan/.idea/libraries/Maven__com_djrapitops_abstract_plugin_framework_2_0_0.xml +++ b/Plan/.idea/libraries/Maven__com_djrapitops_abstract_plugin_framework_2_0_1.xml @@ -1,13 +1,13 @@ - + - + - + - + \ No newline at end of file diff --git a/Plan/src/main/java/com/djrapitops/plan/data/listeners/PlanPlayerListener.java b/Plan/src/main/java/com/djrapitops/plan/data/listeners/PlanPlayerListener.java index c7baf997f..48ce0197c 100644 --- a/Plan/src/main/java/com/djrapitops/plan/data/listeners/PlanPlayerListener.java +++ b/Plan/src/main/java/com/djrapitops/plan/data/listeners/PlanPlayerListener.java @@ -1,8 +1,9 @@ package main.java.com.djrapitops.plan.data.listeners; import com.djrapitops.plugin.task.AbsRunnable; +import com.djrapitops.plugin.utilities.player.Fetch; import com.djrapitops.plugin.utilities.player.Gamemode; -import com.djrapitops.plugin.utilities.player.bukkit.BukkitPlayer; +import com.djrapitops.plugin.utilities.player.IPlayer; import main.java.com.djrapitops.plan.Log; import main.java.com.djrapitops.plan.Plan; import main.java.com.djrapitops.plan.data.UserData; @@ -26,6 +27,7 @@ import java.util.UUID; * Event Listener for PlayerJoin, PlayerQuit and PlayerKickEvents. * * @author Rsl1122 + * @since 2.0.0 */ public class PlanPlayerListener implements Listener { @@ -35,8 +37,7 @@ public class PlanPlayerListener implements Listener { /** * Class Constructor. *

- * Copies the references to multiple handlers from Current instance of - * handler. + * Copies the references to multiple handlers from Current instance of handler. * * @param plugin Current instance of Plan */ @@ -48,41 +49,49 @@ public class PlanPlayerListener implements Listener { /** * PlayerJoinEvent Listener. *

- * If player is a new player, creates a new data in the database for the - * player. Retrieves the UserData, updates and then saves it to the Cache. + * If player is a new player, creates new data for the player. + *

+ * Adds a LoginInfo to the processingQueue if the user is not new. * * @param event The Fired event. */ @EventHandler(priority = EventPriority.MONITOR) public void onPlayerLogin(PlayerJoinEvent event) { Player player = event.getPlayer(); + + IPlayer iPlayer = Fetch.wrapBukkit(player); + plugin.getNotificationCenter().checkNotifications(iPlayer); + UUID uuid = player.getUniqueId(); handler.startSession(uuid); Log.debug(uuid + ": PlayerJoinEvent"); + plugin.getRunnableFactory().createNew(new AbsRunnable("NewPlayerCheckTask") { @Override public void run() { LoginInfo loginInfo = new LoginInfo(uuid, MiscUtils.getTime(), player.getAddress().getAddress(), player.isBanned(), player.getDisplayName(), Gamemode.wrap(player.getGameMode()), 1); boolean isNewPlayer = !plugin.getDB().wasSeenBefore(uuid); + if (isNewPlayer) { - UserData newUserData = NewPlayerCreator.createNewPlayer(BukkitPlayer.wrap(player)); + UserData newUserData = NewPlayerCreator.createNewPlayer(iPlayer); loginInfo.process(newUserData); handler.newPlayer(newUserData); } else { handler.addToPool(loginInfo); } + Log.debug(uuid + ": PlayerJoinEvent_AsyncTask_END, New:" + isNewPlayer); this.cancel(); } }).runTaskAsynchronously(); + Log.debug(uuid + ": PlayerJoinEvent_END"); } /** * PlayerQuitEvent Listener. *

- * Retrieves the current UserData for the Player, updates it, saves the data - * to Database and clears it from cache. + * Adds a LogoutInfo to the processing Queue. * * @param event Fired event */ @@ -100,7 +109,7 @@ public class PlanPlayerListener implements Listener { /** * PlayerKickEvent Listener. *

- * Updates current playerdata and saves it to the Database. + * Adds a KickInfo & LogoutInfo to the processing Queue. * * @param event Fired event */ diff --git a/Plan/src/main/resources/plugin.yml b/Plan/src/main/resources/plugin.yml index 1d827e17c..dd3010eb7 100644 --- a/Plan/src/main/resources/plugin.yml +++ b/Plan/src/main/resources/plugin.yml @@ -106,4 +106,5 @@ permissions: plan.*: children: plan.manage: true - plan.staff: true \ No newline at end of file + plan.staff: true + apf.notify: true \ No newline at end of file