Merge pull request #5946 from Nightfirecat/remove-deprecated-farming-config-migration
time tracking: Remove deprecated config migration
This commit is contained in:
@@ -203,7 +203,6 @@ public class TimeTrackingPlugin extends Plugin
|
||||
@Subscribe
|
||||
public void onUsernameChanged(UsernameChanged e)
|
||||
{
|
||||
farmingTracker.migrateConfiguration();
|
||||
farmingTracker.loadCompletionTimes();
|
||||
birdHouseTracker.loadFromConfig();
|
||||
panel.update();
|
||||
|
||||
@@ -42,9 +42,6 @@ import net.runelite.client.plugins.timetracking.TimeTrackingConfig;
|
||||
@Singleton
|
||||
public class FarmingTracker
|
||||
{
|
||||
@Deprecated
|
||||
private static final String OLD_KEY_NAME = "farmingTracker";
|
||||
|
||||
private final Client client;
|
||||
private final ItemManager itemManager;
|
||||
private final ConfigManager configManager;
|
||||
@@ -262,46 +259,4 @@ public class FarmingTracker
|
||||
completionTimes.put(tab.getKey(), completionTime);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Migrates configuration data from {@code "farmingTracker"} key to {@code "timetracking"} key.
|
||||
* This method should be removed after a reasonable amount of time.
|
||||
*/
|
||||
@Deprecated
|
||||
public void migrateConfiguration()
|
||||
{
|
||||
String username = client.getUsername();
|
||||
|
||||
// migrate autoweed config
|
||||
{
|
||||
String oldGroup = OLD_KEY_NAME + "." + username;
|
||||
String newGroup = TimeTrackingConfig.CONFIG_GROUP + "." + username;
|
||||
String storedValue = configManager.getConfiguration(oldGroup, TimeTrackingConfig.AUTOWEED);
|
||||
|
||||
if (storedValue != null)
|
||||
{
|
||||
configManager.setConfiguration(newGroup, TimeTrackingConfig.AUTOWEED, storedValue);
|
||||
configManager.unsetConfiguration(oldGroup, TimeTrackingConfig.AUTOWEED);
|
||||
}
|
||||
}
|
||||
|
||||
// migrate all saved data in all regions
|
||||
for (FarmingRegion region : farmingWorld.getRegions().values())
|
||||
{
|
||||
String oldGroup = OLD_KEY_NAME + "." + username + "." + region.getRegionID();
|
||||
String newGroup = TimeTrackingConfig.CONFIG_GROUP + "." + username + "." + region.getRegionID();
|
||||
|
||||
for (Varbits varbit : region.getVarbits())
|
||||
{
|
||||
String key = Integer.toString(varbit.getId());
|
||||
String storedValue = configManager.getConfiguration(oldGroup, key);
|
||||
|
||||
if (storedValue != null)
|
||||
{
|
||||
configManager.setConfiguration(newGroup, key, storedValue);
|
||||
configManager.unsetConfiguration(oldGroup, key);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user