2014-10-19 07:37:25 +02:00
|
|
|
package com.massivecraft.factions.cmd;
|
|
|
|
|
|
|
|
import com.massivecraft.factions.Conf;
|
|
|
|
import com.massivecraft.factions.Conf.Backend;
|
|
|
|
import com.massivecraft.factions.zcore.persist.json.FactionsJSON;
|
2014-12-08 00:12:52 +01:00
|
|
|
import com.massivecraft.factions.zcore.util.TL;
|
2014-11-06 01:36:47 +01:00
|
|
|
import org.bukkit.command.ConsoleCommandSender;
|
2014-10-19 07:37:25 +02:00
|
|
|
|
|
|
|
public class CmdConvert extends FCommand {
|
|
|
|
|
|
|
|
public CmdConvert() {
|
|
|
|
this.aliases.add("convert");
|
|
|
|
|
|
|
|
this.requiredArgs.add("[MYSQL|JSON]");
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void perform() {
|
2018-11-07 17:14:42 +01:00
|
|
|
if (!(this.sender instanceof ConsoleCommandSender)) {
|
2014-12-08 00:12:52 +01:00
|
|
|
this.sender.sendMessage(TL.GENERIC_CONSOLEONLY.toString());
|
2014-10-19 07:37:25 +02:00
|
|
|
}
|
|
|
|
Backend nb = Backend.valueOf(this.argAsString(0).toUpperCase());
|
|
|
|
if (nb == Conf.backEnd) {
|
2014-12-08 00:12:52 +01:00
|
|
|
this.sender.sendMessage(TL.COMMAND_CONVERT_BACKEND_RUNNING.toString());
|
2014-10-19 07:37:25 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
switch (nb) {
|
|
|
|
case JSON:
|
|
|
|
FactionsJSON.convertTo();
|
|
|
|
break;
|
|
|
|
default:
|
2014-12-08 00:12:52 +01:00
|
|
|
this.sender.sendMessage(TL.COMMAND_CONVERT_BACKEND_INVALID.toString());
|
2014-10-19 07:37:25 +02:00
|
|
|
return;
|
2014-11-06 01:36:47 +01:00
|
|
|
|
2014-10-19 07:37:25 +02:00
|
|
|
}
|
|
|
|
Conf.backEnd = nb;
|
|
|
|
}
|
|
|
|
|
2015-01-22 00:58:33 +01:00
|
|
|
@Override
|
|
|
|
public TL getUsageTranslation() {
|
|
|
|
return TL.COMMAND_CONVERT_DESCRIPTION;
|
|
|
|
}
|
|
|
|
|
2014-10-19 07:37:25 +02:00
|
|
|
}
|