Use Object.equals for Overlays
- Generated equals from Lombok can cause falsy equals checks and so match with unrelated overlay. - Do not add overlay twice to overlay list based on equals Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
This commit is contained in:
@@ -27,10 +27,12 @@ package net.runelite.client.ui.overlay;
|
|||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.Point;
|
import java.awt.Point;
|
||||||
import java.awt.Rectangle;
|
import java.awt.Rectangle;
|
||||||
import lombok.Data;
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
import net.runelite.client.ui.overlay.components.LayoutableRenderableEntity;
|
import net.runelite.client.ui.overlay.components.LayoutableRenderableEntity;
|
||||||
|
|
||||||
@Data
|
@Getter
|
||||||
|
@Setter
|
||||||
public abstract class Overlay implements LayoutableRenderableEntity
|
public abstract class Overlay implements LayoutableRenderableEntity
|
||||||
{
|
{
|
||||||
private Point preferredLocation;
|
private Point preferredLocation;
|
||||||
|
|||||||
@@ -109,6 +109,11 @@ public class OverlayManager
|
|||||||
*/
|
*/
|
||||||
public synchronized boolean add(final Overlay overlay)
|
public synchronized boolean add(final Overlay overlay)
|
||||||
{
|
{
|
||||||
|
if (overlays.contains(overlay))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
final boolean add = overlays.add(overlay);
|
final boolean add = overlays.add(overlay);
|
||||||
|
|
||||||
if (add)
|
if (add)
|
||||||
|
|||||||
Reference in New Issue
Block a user