Merge pull request #2934 from open-osrs/config-sync
client: disable runelite config sync, keep profiles
This commit is contained in:
@@ -164,9 +164,6 @@ public class ConfigManager
|
|||||||
|
|
||||||
public final void switchSession(AccountSession session)
|
public final void switchSession(AccountSession session)
|
||||||
{
|
{
|
||||||
// Ensure existing config is saved
|
|
||||||
sendConfig();
|
|
||||||
|
|
||||||
if (session == null)
|
if (session == null)
|
||||||
{
|
{
|
||||||
this.session = null;
|
this.session = null;
|
||||||
@@ -175,7 +172,6 @@ public class ConfigManager
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.session = session;
|
this.session = session;
|
||||||
this.configClient = new ConfigClient(okHttpClient, session.getUuid());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.propertiesFile = getPropertiesFile();
|
this.propertiesFile = getPropertiesFile();
|
||||||
@@ -204,51 +200,7 @@ public class ConfigManager
|
|||||||
|
|
||||||
public void load()
|
public void load()
|
||||||
{
|
{
|
||||||
if (configClient == null)
|
loadFromFile();
|
||||||
{
|
|
||||||
loadFromFile();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Configuration configuration;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
configuration = configClient.get();
|
|
||||||
}
|
|
||||||
catch (IOException ex)
|
|
||||||
{
|
|
||||||
log.debug("Unable to load configuration from client, using saved configuration from disk", ex);
|
|
||||||
loadFromFile();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (configuration.getConfig() == null || configuration.getConfig().isEmpty())
|
|
||||||
{
|
|
||||||
log.debug("No configuration from client, using saved configuration on disk");
|
|
||||||
loadFromFile();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Properties newProperties = new Properties();
|
|
||||||
for (ConfigEntry entry : configuration.getConfig())
|
|
||||||
{
|
|
||||||
newProperties.setProperty(entry.getKey(), entry.getValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
log.debug("Loading in config from server");
|
|
||||||
swapProperties(newProperties, false);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
saveToFile(propertiesFile);
|
|
||||||
|
|
||||||
log.debug("Updated configuration on disk with the latest version");
|
|
||||||
}
|
|
||||||
catch (IOException ex)
|
|
||||||
{
|
|
||||||
log.warn("Unable to update configuration on disk", ex);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void swapProperties(Properties newProperties, boolean saveToServer)
|
private void swapProperties(Properties newProperties, boolean saveToServer)
|
||||||
|
|||||||
Reference in New Issue
Block a user