object markers: fix removing markers from multilocs
multilocs whose name changed would not be matched if unmarked after the name change due to the name mismatch, use object id instead.
This commit is contained in:
@@ -416,6 +416,7 @@ public class ObjectIndicatorsPlugin extends Plugin implements KeyListener
|
||||
final WorldPoint worldPoint = WorldPoint.fromLocalInstance(client, object.getLocalLocation());
|
||||
final int regionId = worldPoint.getRegionID();
|
||||
final ObjectPoint point = new ObjectPoint(
|
||||
object.getId(),
|
||||
name,
|
||||
regionId,
|
||||
worldPoint.getRegionX(),
|
||||
@@ -424,10 +425,18 @@ public class ObjectIndicatorsPlugin extends Plugin implements KeyListener
|
||||
|
||||
Set<ObjectPoint> objectPoints = points.computeIfAbsent(regionId, k -> new HashSet<>());
|
||||
|
||||
if (objectPoints.contains(point))
|
||||
if (objects.remove(object))
|
||||
{
|
||||
objectPoints.remove(point);
|
||||
objects.remove(object);
|
||||
// Use object id instead of name to match the object point with this object due to the object name being
|
||||
// able to change because of multilocs.
|
||||
if (!objectPoints.removeIf(op -> (op.getId() == -1 || op.getId() == object.getId())
|
||||
&& op.getRegionX() == worldPoint.getRegionX()
|
||||
&& op.getRegionY() == worldPoint.getRegionY()
|
||||
&& op.getZ() == worldPoint.getPlane()))
|
||||
{
|
||||
log.warn("unable to find object point for unmarked object {}", object.getId());
|
||||
}
|
||||
|
||||
log.debug("Unmarking object: {}", point);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -25,11 +25,16 @@
|
||||
|
||||
package net.runelite.client.plugins.objectindicators;
|
||||
|
||||
import lombok.Value;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Value
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
class ObjectPoint
|
||||
{
|
||||
private int id = -1;
|
||||
private String name;
|
||||
private int regionId;
|
||||
private int regionX;
|
||||
|
||||
Reference in New Issue
Block a user