Make GameObjectSpawned Immutable with @Value

This commit is contained in:
Dutta64
2020-06-27 05:47:00 -06:00
committed by Lucwousin
parent 956fc953ea
commit 3c76031534
3 changed files with 6 additions and 10 deletions

View File

@@ -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;
} }

View File

@@ -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);
}); });

View File

@@ -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