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 {
|
|
|
|
|
2019-08-24 19:18:50 +02:00
|
|
|
public CmdConvert() {
|
|
|
|
this.aliases.add("convert");
|
|
|
|
|
|
|
|
this.permission = Permission.CONVERT.node;
|
|
|
|
|
|
|
|
this.requiredArgs.add("[MYSQL|JSON]");
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void perform() {
|
|
|
|
if (!(this.sender instanceof ConsoleCommandSender)) {
|
|
|
|
this.sender.sendMessage(TL.GENERIC_CONSOLEONLY.toString());
|
|
|
|
}
|
|
|
|
Backend nb = Backend.valueOf(this.argAsString(0).toUpperCase());
|
|
|
|
if (nb == Conf.backEnd) {
|
|
|
|
this.sender.sendMessage(TL.COMMAND_CONVERT_BACKEND_RUNNING.toString());
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (nb == Backend.JSON) {
|
|
|
|
FactionsJSON.convertTo();
|
|
|
|
} else {
|
|
|
|
this.sender.sendMessage(TL.COMMAND_CONVERT_BACKEND_INVALID.toString());
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
Conf.backEnd = nb;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public TL getUsageTranslation() {
|
|
|
|
return TL.COMMAND_CONVERT_DESCRIPTION;
|
|
|
|
}
|
2015-01-22 00:58:33 +01:00
|
|
|
|
2014-10-19 07:37:25 +02:00
|
|
|
}
|