From d727def4badda82101099be4b3e5ed07ebee769e Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sun, 14 Feb 2016 17:06:52 +0100 Subject: [PATCH 1/4] Move the command --- src/main/java/fr/xephi/authme/command/CommandInitializer.java | 4 ++-- .../executable/{converter => authme}/ConverterCommand.java | 2 +- .../java/fr/xephi/authme/converter/ForceFlatToSqlite.java | 2 -- .../java/fr/xephi/authme/listener/AuthMePlayerListener.java | 1 - .../java/fr/xephi/authme/process/join/AsynchronousJoin.java | 1 - .../java/fr/xephi/authme/process/login/AsynchronousLogin.java | 1 - .../java/fr/xephi/authme/process/register/AsyncRegister.java | 2 -- 7 files changed, 3 insertions(+), 10 deletions(-) rename src/main/java/fr/xephi/authme/command/executable/{converter => authme}/ConverterCommand.java (98%) diff --git a/src/main/java/fr/xephi/authme/command/CommandInitializer.java b/src/main/java/fr/xephi/authme/command/CommandInitializer.java index 12d07f9e..d89864ce 100644 --- a/src/main/java/fr/xephi/authme/command/CommandInitializer.java +++ b/src/main/java/fr/xephi/authme/command/CommandInitializer.java @@ -5,6 +5,7 @@ import fr.xephi.authme.command.executable.HelpCommand; import fr.xephi.authme.command.executable.authme.AccountsCommand; import fr.xephi.authme.command.executable.authme.AuthMeCommand; import fr.xephi.authme.command.executable.authme.ChangePasswordAdminCommand; +import fr.xephi.authme.command.executable.authme.ConverterCommand; import fr.xephi.authme.command.executable.authme.FirstSpawnCommand; import fr.xephi.authme.command.executable.authme.ForceLoginCommand; import fr.xephi.authme.command.executable.authme.GetEmailCommand; @@ -24,7 +25,6 @@ import fr.xephi.authme.command.executable.authme.UnregisterAdminCommand; import fr.xephi.authme.command.executable.authme.VersionCommand; import fr.xephi.authme.command.executable.captcha.CaptchaCommand; import fr.xephi.authme.command.executable.changepassword.ChangePasswordCommand; -import fr.xephi.authme.command.executable.converter.ConverterCommand; import fr.xephi.authme.command.executable.email.AddEmailCommand; import fr.xephi.authme.command.executable.email.ChangeEmailCommand; import fr.xephi.authme.command.executable.email.EmailBaseCommand; @@ -383,7 +383,7 @@ public final class CommandInitializer { // Register the base converter command CommandDescription CONVERTER_BASE = CommandDescription.builder() - .parent(null) + .parent(AUTHME_BASE) .labels("converter", "convert", "conv") .description("Converter Command") .detailedDescription("Converter command for AuthMeReloaded.") diff --git a/src/main/java/fr/xephi/authme/command/executable/converter/ConverterCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/ConverterCommand.java similarity index 98% rename from src/main/java/fr/xephi/authme/command/executable/converter/ConverterCommand.java rename to src/main/java/fr/xephi/authme/command/executable/authme/ConverterCommand.java index cb3f6c7f..e3414480 100644 --- a/src/main/java/fr/xephi/authme/command/executable/converter/ConverterCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/authme/ConverterCommand.java @@ -1,4 +1,4 @@ -package fr.xephi.authme.command.executable.converter; +package fr.xephi.authme.command.executable.authme; import fr.xephi.authme.AuthMe; import fr.xephi.authme.command.CommandService; diff --git a/src/main/java/fr/xephi/authme/converter/ForceFlatToSqlite.java b/src/main/java/fr/xephi/authme/converter/ForceFlatToSqlite.java index 443e20ac..c87297d8 100644 --- a/src/main/java/fr/xephi/authme/converter/ForceFlatToSqlite.java +++ b/src/main/java/fr/xephi/authme/converter/ForceFlatToSqlite.java @@ -7,8 +7,6 @@ import fr.xephi.authme.datasource.DataSourceType; import fr.xephi.authme.datasource.SQLite; import fr.xephi.authme.settings.NewSetting; import fr.xephi.authme.settings.properties.DatabaseSettings; -import fr.xephi.authme.util.StringUtils; - import java.sql.SQLException; /** diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index b15007e6..fc6a1540 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -12,7 +12,6 @@ import fr.xephi.authme.cache.limbo.LimboPlayer; import fr.xephi.authme.output.MessageKey; import fr.xephi.authme.output.Messages; import fr.xephi.authme.permission.PermissionsManager; -import fr.xephi.authme.permission.PlayerPermission; import fr.xephi.authme.permission.PlayerStatePermission; import fr.xephi.authme.settings.Settings; import fr.xephi.authme.util.GeoLiteAPI; diff --git a/src/main/java/fr/xephi/authme/process/join/AsynchronousJoin.java b/src/main/java/fr/xephi/authme/process/join/AsynchronousJoin.java index 052045b6..5d65929a 100644 --- a/src/main/java/fr/xephi/authme/process/join/AsynchronousJoin.java +++ b/src/main/java/fr/xephi/authme/process/join/AsynchronousJoin.java @@ -12,7 +12,6 @@ import fr.xephi.authme.events.SpawnTeleportEvent; import fr.xephi.authme.listener.AuthMePlayerListener; import fr.xephi.authme.output.MessageKey; import fr.xephi.authme.output.Messages; -import fr.xephi.authme.permission.PlayerPermission; import fr.xephi.authme.permission.PlayerStatePermission; import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.Spawn; diff --git a/src/main/java/fr/xephi/authme/process/login/AsynchronousLogin.java b/src/main/java/fr/xephi/authme/process/login/AsynchronousLogin.java index 19b75f34..7ac10e25 100644 --- a/src/main/java/fr/xephi/authme/process/login/AsynchronousLogin.java +++ b/src/main/java/fr/xephi/authme/process/login/AsynchronousLogin.java @@ -23,7 +23,6 @@ import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitTask; -import java.util.Date; import java.util.List; /** diff --git a/src/main/java/fr/xephi/authme/process/register/AsyncRegister.java b/src/main/java/fr/xephi/authme/process/register/AsyncRegister.java index 29616fe5..c9ce3f6c 100644 --- a/src/main/java/fr/xephi/authme/process/register/AsyncRegister.java +++ b/src/main/java/fr/xephi/authme/process/register/AsyncRegister.java @@ -1,13 +1,11 @@ package fr.xephi.authme.process.register; import fr.xephi.authme.AuthMe; -import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.datasource.DataSource; import fr.xephi.authme.output.MessageKey; import fr.xephi.authme.output.Messages; -import fr.xephi.authme.permission.PlayerPermission; import fr.xephi.authme.permission.PlayerStatePermission; import fr.xephi.authme.security.HashAlgorithm; import fr.xephi.authme.security.crypts.HashedPassword; From 15792f01e934eb0b0de73d631127afa38ada34df Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sun, 14 Feb 2016 17:38:13 +0100 Subject: [PATCH 2/4] Fix docs --- README.md | 2 +- src/main/resources/plugin.yml | 5 +---- src/tools/docs/commands.md | 4 ++-- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index c862068f..ff0b7f4d 100644 --- a/README.md +++ b/README.md @@ -122,7 +122,7 @@ typing commands or using the inventory. It can also kick players with uncommonly
  • Website Integration
  • Click here for an example of the Config file
  • How to convert from Rakamak -
  • Convert from FlatFile (auths.db but not the sqlite one) to MySQL: /converter +
  • Convert from FlatFile (auths.db but not the sqlite one) to MySQL: /authme converter

  • diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index be7b792f..bf63b364 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -16,7 +16,7 @@ softdepend: commands: authme: description: AuthMe op commands - usage: '/authme reload|register playername password|changepassword playername password|unregister playername|version' + usage: '/authme reload|register playername password|changepassword playername password|unregister playername|version|converter' register: description: Register an account usage: /register @@ -40,9 +40,6 @@ commands: captcha: description: Captcha command usage: /captcha - converter: - description: Converter from different other auth plugins - usage: /converter permissions: authme.admin.*: description: Give access to all admin commands. diff --git a/src/tools/docs/commands.md b/src/tools/docs/commands.md index 39efe977..34a743d3 100644 --- a/src/tools/docs/commands.md +++ b/src/tools/docs/commands.md @@ -70,7 +70,7 @@ brackets; optional arguments are enclosed in square brackets (`[ ]`). - **/captcha** <captcha>: Captcha command for AuthMeReloaded.
    Requires `authme.player.captcha` - **/captcha help** [query]: View detailed help pages about AuthMeReloaded captcha commands. -- **/converter** <job>: Converter command for AuthMeReloaded. +- **/authme converter** <job>: Converter command for AuthMeReloaded.
    Requires `authme.admin.converter` -- **/converter help** [query]: View detailed help pages about AuthMeReloaded converter commands. +- **/authme converter help** [query]: View detailed help pages about AuthMeReloaded converter commands. From 715622826f1e67ec50c63fadab90ffdbef1c468f Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Fri, 19 Feb 2016 16:38:18 +0100 Subject: [PATCH 3/4] Fix command registration --- .../authme/command/CommandInitializer.java | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/main/java/fr/xephi/authme/command/CommandInitializer.java b/src/main/java/fr/xephi/authme/command/CommandInitializer.java index d89864ce..0f73effa 100644 --- a/src/main/java/fr/xephi/authme/command/CommandInitializer.java +++ b/src/main/java/fr/xephi/authme/command/CommandInitializer.java @@ -269,6 +269,17 @@ public final class CommandInitializer { .executableCommand(new VersionCommand()) .build(); + CommandDescription.builder() + .parent(AUTHME_BASE) + .labels("converter", "convert", "conv") + .description("Converter Command") + .detailedDescription("Converter command for AuthMeReloaded.") + .withArgument("job", "Conversion job: xauth / crazylogin / rakamak / " + + "royalauth / vauth / sqlitetosql", false) + .permissions(OP_ONLY, AdminPermission.CONVERTER) + .executableCommand(new ConverterCommand()) + .build(); + // Register the base login command final CommandDescription LOGIN_BASE = CommandDescription.builder() .parent(null) @@ -381,18 +392,6 @@ public final class CommandInitializer { .executableCommand(new CaptchaCommand()) .build(); - // Register the base converter command - CommandDescription CONVERTER_BASE = CommandDescription.builder() - .parent(AUTHME_BASE) - .labels("converter", "convert", "conv") - .description("Converter Command") - .detailedDescription("Converter command for AuthMeReloaded.") - .withArgument("job", "Conversion job: xauth / crazylogin / rakamak / " + - "royalauth / vauth / sqlitetosql", false) - .permissions(OP_ONLY, AdminPermission.CONVERTER) - .executableCommand(new ConverterCommand()) - .build(); - Set baseCommands = ImmutableSet.of( AUTHME_BASE, LOGIN_BASE, @@ -401,8 +400,7 @@ public final class CommandInitializer { UNREGISTER_BASE, CHANGE_PASSWORD_BASE, EMAIL_BASE, - CAPTCHA_BASE, - CONVERTER_BASE); + CAPTCHA_BASE); setHelpOnAllBases(baseCommands); return baseCommands; From 4620ead3115ff053c3fd43e88c1ef58ee5c023e5 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Fri, 19 Feb 2016 16:42:48 +0100 Subject: [PATCH 4/4] Fix number of commands in test --- .../java/fr/xephi/authme/command/CommandInitializerTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/fr/xephi/authme/command/CommandInitializerTest.java b/src/test/java/fr/xephi/authme/command/CommandInitializerTest.java index f8b0d256..62c2b890 100644 --- a/src/test/java/fr/xephi/authme/command/CommandInitializerTest.java +++ b/src/test/java/fr/xephi/authme/command/CommandInitializerTest.java @@ -50,7 +50,7 @@ public class CommandInitializerTest { // It obviously doesn't make sense to test much of the concrete data // that is being initialized; we just want to guarantee with this test // that data is indeed being initialized and we take a few "probes" - assertThat(commands.size(), equalTo(9)); + assertThat(commands.size(), equalTo(8)); assertThat(commandsIncludeLabel(commands, "authme"), equalTo(true)); assertThat(commandsIncludeLabel(commands, "register"), equalTo(true)); assertThat(commandsIncludeLabel(commands, "help"), equalTo(false));