#1146 List available converter, reference converters Wiki page in config.yml
This commit is contained in:
@@ -316,7 +316,7 @@ public class CommandInitializer {
|
||||
.description("Converter command")
|
||||
.detailedDescription("Converter command for AuthMeReloaded.")
|
||||
.withArgument("job", "Conversion job: xauth / crazylogin / rakamak / "
|
||||
+ "royalauth / vauth / sqliteToSql / mysqlToSqlite / loginsecurity", false)
|
||||
+ "royalauth / vauth / sqliteToSql / mysqlToSqlite / loginsecurity", true)
|
||||
.permission(AdminPermission.CONVERTER)
|
||||
.executableCommand(ConverterCommand.class)
|
||||
.register();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package fr.xephi.authme.command.executable.authme;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSortedMap;
|
||||
import fr.xephi.authme.ConsoleLogger;
|
||||
import fr.xephi.authme.command.ExecutableCommand;
|
||||
import fr.xephi.authme.datasource.converter.Converter;
|
||||
@@ -41,14 +41,10 @@ public class ConverterCommand implements ExecutableCommand {
|
||||
private Factory<Converter> converterFactory;
|
||||
|
||||
@Override
|
||||
public void executeCommand(final CommandSender sender, List<String> arguments) {
|
||||
// Get the conversion job
|
||||
String job = arguments.get(0);
|
||||
|
||||
// Determine the job type
|
||||
Class<? extends Converter> converterClass = CONVERTERS.get(job.toLowerCase());
|
||||
public void executeCommand(CommandSender sender, List<String> arguments) {
|
||||
Class<? extends Converter> converterClass = getConverterClassFromArgs(arguments);
|
||||
if (converterClass == null) {
|
||||
sender.sendMessage("[AuthMe] Converter does not exist!");
|
||||
sender.sendMessage("Converters: " + String.join(", ", CONVERTERS.keySet()));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -69,7 +65,13 @@ public class ConverterCommand implements ExecutableCommand {
|
||||
});
|
||||
|
||||
// Show a status message
|
||||
sender.sendMessage("[AuthMe] Successfully started " + job);
|
||||
sender.sendMessage("[AuthMe] Successfully started " + arguments.get(0));
|
||||
}
|
||||
|
||||
private static Class<? extends Converter> getConverterClassFromArgs(List<String> arguments) {
|
||||
return arguments.isEmpty()
|
||||
? null
|
||||
: CONVERTERS.get(arguments.get(0).toLowerCase());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -78,7 +80,7 @@ public class ConverterCommand implements ExecutableCommand {
|
||||
* @return map with all available converters
|
||||
*/
|
||||
private static Map<String, Class<? extends Converter>> getConverters() {
|
||||
return ImmutableMap.<String, Class<? extends Converter>>builder()
|
||||
return ImmutableSortedMap.<String, Class<? extends Converter>>naturalOrder()
|
||||
.put("xauth", XAuthConverter.class)
|
||||
.put("crazylogin", CrazyLoginConverter.class)
|
||||
.put("rakamak", RakamakConverter.class)
|
||||
@@ -89,5 +91,4 @@ public class ConverterCommand implements ExecutableCommand {
|
||||
.put("loginsecurity", LoginSecurityConverter.class)
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
package fr.xephi.authme.settings.properties;
|
||||
|
||||
import ch.jalu.configme.Comment;
|
||||
import ch.jalu.configme.SectionComments;
|
||||
import ch.jalu.configme.SettingsHolder;
|
||||
import ch.jalu.configme.properties.Property;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import static ch.jalu.configme.properties.PropertyInitializer.newProperty;
|
||||
|
||||
@@ -47,4 +51,9 @@ public final class ConverterSettings implements SettingsHolder {
|
||||
private ConverterSettings() {
|
||||
}
|
||||
|
||||
@SectionComments
|
||||
public static Map<String, String[]> buildSectionComments() {
|
||||
return ImmutableMap.of("Converter",
|
||||
new String[]{"Converter settings: see https://github.com/AuthMe/AuthMeReloaded/wiki/Converters"});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user