Make GameObjectSpawned Immutable with @Value
This commit is contained in:
@@ -24,22 +24,22 @@
|
|||||||
*/
|
*/
|
||||||
package net.runelite.api.events;
|
package net.runelite.api.events;
|
||||||
|
|
||||||
|
import lombok.Value;
|
||||||
import net.runelite.api.GameObject;
|
import net.runelite.api.GameObject;
|
||||||
import net.runelite.api.Tile;
|
import net.runelite.api.Tile;
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An event where a {@link GameObject} is added to a {@link Tile}.
|
* An event where a {@link GameObject} is added to a {@link Tile}.
|
||||||
*/
|
*/
|
||||||
@Data
|
@Value
|
||||||
public class GameObjectSpawned implements Event
|
public class GameObjectSpawned implements Event
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The affected tile.
|
* The affected tile.
|
||||||
*/
|
*/
|
||||||
private Tile tile;
|
Tile tile;
|
||||||
/**
|
/**
|
||||||
* The newly spawned game object.
|
* The newly spawned game object.
|
||||||
*/
|
*/
|
||||||
private GameObject gameObject;
|
GameObject gameObject;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -170,9 +170,7 @@ public class GameEventManager
|
|||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
.forEach(object ->
|
.forEach(object ->
|
||||||
{
|
{
|
||||||
final GameObjectSpawned objectSpawned = new GameObjectSpawned();
|
final GameObjectSpawned objectSpawned = new GameObjectSpawned(tile, object);
|
||||||
objectSpawned.setTile(tile);
|
|
||||||
objectSpawned.setGameObject(object);
|
|
||||||
eventBus.post(GameObjectSpawned.class, objectSpawned);
|
eventBus.post(GameObjectSpawned.class, objectSpawned);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -432,9 +432,7 @@ public abstract class RSTileMixin implements RSTile
|
|||||||
|
|
||||||
logger.trace("Game object spawn: {}", current.getId());
|
logger.trace("Game object spawn: {}", current.getId());
|
||||||
|
|
||||||
GameObjectSpawned gameObjectSpawned = new GameObjectSpawned();
|
GameObjectSpawned gameObjectSpawned = new GameObjectSpawned(this, current);
|
||||||
gameObjectSpawned.setTile(this);
|
|
||||||
gameObjectSpawned.setGameObject(current);
|
|
||||||
client.getCallbacks().post(GameObjectSpawned.class, gameObjectSpawned);
|
client.getCallbacks().post(GameObjectSpawned.class, gameObjectSpawned);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user