package jas.spawner.modern.command;
import jas.common.JustAnotherSpawner;
import jas.spawner.modern.DefaultProps;
import jas.spawner.modern.MVELProfile;
import jas.spawner.modern.modification.ModSaveConfig;
import java.io.File;
import java.util.List;
import net.minecraft.command.ICommandSender;
import net.minecraft.command.WrongUsageException;
import net.minecraft.server.MinecraftServer;
public class CommandSaveConfig extends CommandJasBase {
public String getCommandName() {
return "saveconfig";
}
/**
* Return the required permission level for this command.
*/
public int getRequiredPermissionLevel() {
return 2;
}
@Override
public String getCommandUsage(ICommandSender commandSender) {
return "commands.jassaveconfig.usage";
}
@Override
public void process(ICommandSender commandSender, String[] stringArgs) {
if (stringArgs.length > 0) {
throw new WrongUsageException("commands.jassaveconfig.usage", new Object[0]);
}
File profileDir = new File(JustAnotherSpawner.getModConfigDirectory(), DefaultProps.MODDIR
+ DefaultProps.WORLDSETTINGSDIR + MVELProfile.PROFILE_FOLDER);
MVELProfile.worldSettings().addChange(
new ModSaveConfig(profileDir, MinecraftServer.getServer().worldServers[0]));
}
/**
* Adds the strings available in this command to the given list of tab completion options.
*/
@Override
public List<String> getTabCompletions(ICommandSender commandSender, String[] stringArgs) {
return null;
}
}