cannonplugin: Check world when drawing overlay

This commit is contained in:
Hexagon
2020-10-04 22:44:46 -03:00
parent 9499c365ea
commit dabc933fa8
2 changed files with 7 additions and 2 deletions

View File

@@ -62,7 +62,7 @@ class CannonOverlay extends Overlay
@Override
public Dimension render(Graphics2D graphics)
{
if (!plugin.isCannonPlaced() || plugin.getCannonPosition() == null)
if (!plugin.isCannonPlaced() || plugin.getCannonPosition() == null || plugin.getCannonWorld() != client.getWorld())
{
return null;
}

View File

@@ -86,6 +86,9 @@ public class CannonPlugin extends Plugin
@Getter
private WorldPoint cannonPosition;
@Getter
private int cannonWorld = -1;
@Getter
private GameObject cannon;
@@ -139,6 +142,7 @@ public class CannonPlugin extends Plugin
overlayManager.remove(cannonOverlay);
overlayManager.remove(cannonSpotOverlay);
cannonPlaced = false;
cannonWorld = -1;
cannonPosition = null;
cannonBallNotificationSent = false;
cballsLeft = 0;
@@ -247,6 +251,7 @@ public class CannonPlugin extends Plugin
&& localPlayer.getAnimation() == AnimationID.BURYING_BONES)
{
cannonPosition = gameObject.getWorldLocation();
cannonWorld = client.getWorld();
cannon = gameObject;
}
}
@@ -257,7 +262,7 @@ public class CannonPlugin extends Plugin
{
Projectile projectile = event.getProjectile();
if ((projectile.getId() == CANNONBALL || projectile.getId() == GRANITE_CANNONBALL) && cannonPosition != null)
if ((projectile.getId() == CANNONBALL || projectile.getId() == GRANITE_CANNONBALL) && cannonPosition != null && cannonWorld == client.getWorld())
{
WorldPoint projectileLoc = WorldPoint.fromLocal(client, projectile.getX1(), projectile.getY1(), client.getPlane());