Reduce code duplicity in resetOverlay method

Use saveOverlay and null all fields to achieve same result.

Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
This commit is contained in:
Tomas Slusny
2018-06-15 10:14:57 +02:00
parent 3cdc2be72f
commit ea051beb4e
2 changed files with 4 additions and 10 deletions

View File

@@ -191,13 +191,10 @@ public class OverlayManager
*/
public synchronized void resetOverlay(final Overlay overlay)
{
final String locationKey = overlay.getName() + OVERLAY_CONFIG_PREFERRED_LOCATION;
final String positionKey = overlay.getName() + OVERLAY_CONFIG_PREFERRED_POSITION;
final String sizeKey = overlay.getName() + OVERLAY_CONFIG_PREFERRED_SIZE;
configManager.unsetConfiguration(RUNELITE_CONFIG_GROUP_NAME, locationKey);
configManager.unsetConfiguration(RUNELITE_CONFIG_GROUP_NAME, positionKey);
configManager.unsetConfiguration(RUNELITE_CONFIG_GROUP_NAME, sizeKey);
rebuildOverlayLayers();
overlay.setPreferredPosition(null);
overlay.setPreferredSize(null);
overlay.setPreferredLocation(null);
saveOverlay(overlay);
}
private synchronized void rebuildOverlayLayers()

View File

@@ -256,9 +256,6 @@ public class OverlayRenderer extends MouseListener implements KeyListener
// detached overlays have no place to reset back to
if (overlay.getPosition() != OverlayPosition.DETACHED)
{
overlay.setPreferredPosition(null);
overlay.setPreferredSize(null);
overlay.setPreferredLocation(null);
overlayManager.resetOverlay(overlay);
}
}