2014-10-19 07:37:25 +02:00
|
|
|
package com.massivecraft.factions.cmd;
|
|
|
|
|
|
|
|
import com.massivecraft.factions.Conf;
|
|
|
|
import com.massivecraft.factions.Conf.Backend;
|
2019-01-27 03:41:25 +01:00
|
|
|
import com.massivecraft.factions.struct.Permission;
|
2014-10-19 07:37:25 +02:00
|
|
|
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");
|
|
|
|
|
2019-01-27 03:41:25 +01:00
|
|
|
this.permission = Permission.CONVERT.node;
|
2019-02-11 05:57:45 +01:00
|
|
|
|
2014-10-19 07:37:25 +02:00
|
|
|
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
|
|
|
}
|