Add GameObjectsChanged event
This commit is contained in:
@@ -33,6 +33,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import net.runelite.api.Actor;
|
import net.runelite.api.Actor;
|
||||||
import net.runelite.api.ChatMessageType;
|
import net.runelite.api.ChatMessageType;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
|
import net.runelite.api.GameObject;
|
||||||
import net.runelite.api.MainBufferProvider;
|
import net.runelite.api.MainBufferProvider;
|
||||||
import net.runelite.api.MenuAction;
|
import net.runelite.api.MenuAction;
|
||||||
import net.runelite.api.MessageNode;
|
import net.runelite.api.MessageNode;
|
||||||
@@ -40,6 +41,7 @@ import net.runelite.api.PacketBuffer;
|
|||||||
import net.runelite.api.Point;
|
import net.runelite.api.Point;
|
||||||
import net.runelite.api.Projectile;
|
import net.runelite.api.Projectile;
|
||||||
import net.runelite.api.Skill;
|
import net.runelite.api.Skill;
|
||||||
|
import net.runelite.api.Tile;
|
||||||
import net.runelite.client.RuneLite;
|
import net.runelite.client.RuneLite;
|
||||||
import net.runelite.client.chat.ChatMessageManager;
|
import net.runelite.client.chat.ChatMessageManager;
|
||||||
import net.runelite.client.events.*;
|
import net.runelite.client.events.*;
|
||||||
@@ -109,6 +111,14 @@ public class Hooks
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param name Hook-name that was used in the @Hook-annotation.
|
||||||
|
* @param idx The index if hooked to an array. -1 if not hooked to an
|
||||||
|
* array.
|
||||||
|
* @param object The object where the hook was placed in, NOT the
|
||||||
|
* variable that was hooked to.
|
||||||
|
*/
|
||||||
public static void callHook(String name, int idx, Object object)
|
public static void callHook(String name, int idx, Object object)
|
||||||
{
|
{
|
||||||
switch (name)
|
switch (name)
|
||||||
@@ -176,6 +186,19 @@ public class Hooks
|
|||||||
eventBus.post(resizeableChanged);
|
eventBus.post(resizeableChanged);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case "gameObjectsChanged":
|
||||||
|
if (idx != -1) // this happens from the field assignment
|
||||||
|
{
|
||||||
|
// GameObject that was changed.
|
||||||
|
GameObject go = ((Tile) object).getGameObjects()[idx];
|
||||||
|
if (go != null)
|
||||||
|
{
|
||||||
|
GameObjectsChanged gameObjectsChanged = new GameObjectsChanged();
|
||||||
|
gameObjectsChanged.setGameObject(go);
|
||||||
|
eventBus.post(gameObjectsChanged);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
log.warn("Unknown event {} triggered on {}", name, object);
|
log.warn("Unknown event {} triggered on {}", name, object);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, Robin Weymans <Robin.weymans@gmail.com>
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||||
|
* list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
package net.runelite.client.events;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import net.runelite.api.GameObject;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class GameObjectsChanged
|
||||||
|
{
|
||||||
|
private GameObject gameObject;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user