GH-1021 make builtin versions not customizable
They use attributes not defined in the OneSix format.
This commit is contained in:
parent
ff64b6cf1d
commit
b9e06b5da0
@ -53,16 +53,28 @@ bool MinecraftVersion::isMinecraftVersion()
|
||||
return true;
|
||||
}
|
||||
|
||||
// 1. assume the local file is good. load, check. If it's good, apply.
|
||||
// 2. if discrepancies are found, fall out and fail (impossible to apply incomplete version).
|
||||
void MinecraftVersion::applyFileTo(MinecraftProfile *version)
|
||||
{
|
||||
getVersionFile()->applyTo(version);
|
||||
if(m_versionSource == Local && getVersionFile())
|
||||
{
|
||||
getVersionFile()->applyTo(version);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw VersionIncomplete(QObject::tr("Can't apply incomplete/builtin Minecraft version %1").arg(m_name));
|
||||
}
|
||||
}
|
||||
|
||||
QJsonDocument MinecraftVersion::toJson(bool saveOrder)
|
||||
{
|
||||
return getVersionFile()->toJson(saveOrder);
|
||||
if(m_versionSource == Local && getVersionFile())
|
||||
{
|
||||
return getVersionFile()->toJson(saveOrder);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw VersionIncomplete(QObject::tr("Can't write incomplete/builtin Minecraft version %1").arg(m_name));
|
||||
}
|
||||
}
|
||||
|
||||
VersionFilePtr MinecraftVersion::getVersionFile()
|
||||
@ -76,6 +88,22 @@ VersionFilePtr MinecraftVersion::getVersionFile()
|
||||
return loadedVersionFile;
|
||||
}
|
||||
|
||||
bool MinecraftVersion::isCustomizable()
|
||||
{
|
||||
switch(m_versionSource)
|
||||
{
|
||||
case Local:
|
||||
case Remote:
|
||||
// locally cached file, or a remote file that we can acquire can be customized
|
||||
return true;
|
||||
case Builtin:
|
||||
// builtins do not follow the normal OneSix format. They are not customizable.
|
||||
default:
|
||||
// Everything else is undefined and therefore not customizable.
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void MinecraftVersion::applyTo(MinecraftProfile *version)
|
||||
{
|
||||
|
@ -52,10 +52,7 @@ public: /* methods */
|
||||
{
|
||||
return false;
|
||||
}
|
||||
virtual bool isCustomizable() override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
virtual bool isCustomizable() override;
|
||||
virtual bool isRemovable() override
|
||||
{
|
||||
return false;
|
||||
|
@ -224,6 +224,7 @@ bool RawLibrary::filesExist(const QDir &base) const
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
QString RawLibrary::url() const
|
||||
{
|
||||
if (!m_absolute_url.isEmpty())
|
||||
|
Loading…
Reference in New Issue
Block a user