Merge pull request #101 from AuthMe-Team/move-convert-command

Move the converter command [WIP]
This commit is contained in:
Gabriele C 2016-02-19 16:49:11 +01:00
commit c11fa9f158
8 changed files with 17 additions and 27 deletions

View File

@ -122,7 +122,7 @@ typing commands or using the inventory. It can also kick players with uncommonly
</li><li><a href="http://dev.bukkit.org/server-mods/authme-reloaded/pages/web-site-integration/">Website Integration</a> </li><li><a href="http://dev.bukkit.org/server-mods/authme-reloaded/pages/web-site-integration/">Website Integration</a>
</li><li><a href="https://raw.githubusercontent.com/Xephi/AuthMeReloaded/master/src/main/resources/config.yml">Click here for an example of the Config file</a> </li><li><a href="https://raw.githubusercontent.com/Xephi/AuthMeReloaded/master/src/main/resources/config.yml">Click here for an example of the Config file</a>
</li><li><a href="http://dev.bukkit.org/server-mods/authme-reloaded/pages/how-to-import-database-from-rakamak/">How to convert from Rakamak</a> </li><li><a href="http://dev.bukkit.org/server-mods/authme-reloaded/pages/how-to-import-database-from-rakamak/">How to convert from Rakamak</a>
</li><li>Convert from FlatFile (auths.db but not the sqlite one) to MySQL: /converter </li><li>Convert from FlatFile (auths.db but not the sqlite one) to MySQL: /authme converter
</li></ul> </li></ul>
<hr> <hr>

View File

@ -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.AccountsCommand;
import fr.xephi.authme.command.executable.authme.AuthMeCommand; import fr.xephi.authme.command.executable.authme.AuthMeCommand;
import fr.xephi.authme.command.executable.authme.ChangePasswordAdminCommand; 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.FirstSpawnCommand;
import fr.xephi.authme.command.executable.authme.ForceLoginCommand; import fr.xephi.authme.command.executable.authme.ForceLoginCommand;
import fr.xephi.authme.command.executable.authme.GetEmailCommand; 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.authme.VersionCommand;
import fr.xephi.authme.command.executable.captcha.CaptchaCommand; import fr.xephi.authme.command.executable.captcha.CaptchaCommand;
import fr.xephi.authme.command.executable.changepassword.ChangePasswordCommand; 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.AddEmailCommand;
import fr.xephi.authme.command.executable.email.ChangeEmailCommand; import fr.xephi.authme.command.executable.email.ChangeEmailCommand;
import fr.xephi.authme.command.executable.email.EmailBaseCommand; import fr.xephi.authme.command.executable.email.EmailBaseCommand;
@ -269,6 +269,17 @@ public final class CommandInitializer {
.executableCommand(new VersionCommand()) .executableCommand(new VersionCommand())
.build(); .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 // Register the base login command
final CommandDescription LOGIN_BASE = CommandDescription.builder() final CommandDescription LOGIN_BASE = CommandDescription.builder()
.parent(null) .parent(null)
@ -381,18 +392,6 @@ public final class CommandInitializer {
.executableCommand(new CaptchaCommand()) .executableCommand(new CaptchaCommand())
.build(); .build();
// Register the base converter command
CommandDescription CONVERTER_BASE = CommandDescription.builder()
.parent(null)
.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<CommandDescription> baseCommands = ImmutableSet.of( Set<CommandDescription> baseCommands = ImmutableSet.of(
AUTHME_BASE, AUTHME_BASE,
LOGIN_BASE, LOGIN_BASE,
@ -401,8 +400,7 @@ public final class CommandInitializer {
UNREGISTER_BASE, UNREGISTER_BASE,
CHANGE_PASSWORD_BASE, CHANGE_PASSWORD_BASE,
EMAIL_BASE, EMAIL_BASE,
CAPTCHA_BASE, CAPTCHA_BASE);
CONVERTER_BASE);
setHelpOnAllBases(baseCommands); setHelpOnAllBases(baseCommands);
return baseCommands; return baseCommands;

View File

@ -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.AuthMe;
import fr.xephi.authme.command.CommandService; import fr.xephi.authme.command.CommandService;

View File

@ -7,8 +7,6 @@ import fr.xephi.authme.datasource.DataSourceType;
import fr.xephi.authme.datasource.SQLite; import fr.xephi.authme.datasource.SQLite;
import fr.xephi.authme.settings.NewSetting; import fr.xephi.authme.settings.NewSetting;
import fr.xephi.authme.settings.properties.DatabaseSettings; import fr.xephi.authme.settings.properties.DatabaseSettings;
import fr.xephi.authme.util.StringUtils;
import java.sql.SQLException; import java.sql.SQLException;
/** /**

View File

@ -23,7 +23,6 @@ import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitTask; import org.bukkit.scheduler.BukkitTask;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**

View File

@ -1,13 +1,11 @@
package fr.xephi.authme.process.register; package fr.xephi.authme.process.register;
import fr.xephi.authme.AuthMe; import fr.xephi.authme.AuthMe;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.datasource.DataSource; import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.output.MessageKey; import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.output.Messages; import fr.xephi.authme.output.Messages;
import fr.xephi.authme.permission.PlayerPermission;
import fr.xephi.authme.permission.PlayerStatePermission; import fr.xephi.authme.permission.PlayerStatePermission;
import fr.xephi.authme.security.HashAlgorithm; import fr.xephi.authme.security.HashAlgorithm;
import fr.xephi.authme.security.crypts.HashedPassword; import fr.xephi.authme.security.crypts.HashedPassword;

View File

@ -16,7 +16,7 @@ softdepend:
commands: commands:
authme: authme:
description: AuthMe op commands 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: register:
description: Register an account description: Register an account
usage: /register <password> <confirmpassword> usage: /register <password> <confirmpassword>
@ -40,9 +40,6 @@ commands:
captcha: captcha:
description: Captcha command description: Captcha command
usage: /captcha <code> usage: /captcha <code>
converter:
description: Converter from different other auth plugins
usage: /converter <datatype>
permissions: permissions:
authme.admin.*: authme.admin.*:
description: Give access to all admin commands. description: Give access to all admin commands.

View File

@ -50,7 +50,7 @@ public class CommandInitializerTest {
// It obviously doesn't make sense to test much of the concrete data // 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 is being initialized; we just want to guarantee with this test
// that data is indeed being initialized and we take a few "probes" // 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, "authme"), equalTo(true));
assertThat(commandsIncludeLabel(commands, "register"), equalTo(true)); assertThat(commandsIncludeLabel(commands, "register"), equalTo(true));
assertThat(commandsIncludeLabel(commands, "help"), equalTo(false)); assertThat(commandsIncludeLabel(commands, "help"), equalTo(false));