Convert game thread events to singletons (#794)
* Convert game thread events to singletons * Fix checkstyle * Fix copy paste error
This commit is contained in:
@@ -20,6 +20,13 @@ import net.runelite.api.Actor;
|
||||
@Data
|
||||
public class AnimationChanged
|
||||
{
|
||||
public static final AnimationChanged INSTANCE = new AnimationChanged();
|
||||
|
||||
private AnimationChanged()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* The actor that has entered a new animation.
|
||||
*/
|
||||
|
||||
@@ -29,6 +29,13 @@ import lombok.Data;
|
||||
@Data
|
||||
public class AreaSoundEffectPlayed
|
||||
{
|
||||
public static final AreaSoundEffectPlayed INSTANCE = new AreaSoundEffectPlayed();
|
||||
|
||||
private AreaSoundEffectPlayed()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
private int soundId;
|
||||
private int sceneX;
|
||||
private int sceneY;
|
||||
|
||||
@@ -29,6 +29,13 @@ import lombok.Data;
|
||||
@Data
|
||||
public class BeforeMenuRender
|
||||
{
|
||||
public static final BeforeMenuRender INSTANCE = new BeforeMenuRender();
|
||||
|
||||
private BeforeMenuRender()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
private boolean consumed;
|
||||
|
||||
public void consume()
|
||||
|
||||
@@ -29,4 +29,10 @@ package net.runelite.api.events;
|
||||
*/
|
||||
public class BeforeRender
|
||||
{
|
||||
public static final BeforeRender INSTANCE = new BeforeRender();
|
||||
|
||||
private BeforeRender()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,6 +44,13 @@ import lombok.Data;
|
||||
@Data
|
||||
public class BoostedLevelChanged
|
||||
{
|
||||
public static final BoostedLevelChanged INSTANCE = new BoostedLevelChanged();
|
||||
|
||||
private BoostedLevelChanged()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* The skill that has had its level modified.
|
||||
*/
|
||||
|
||||
@@ -29,4 +29,10 @@ package net.runelite.api.events;
|
||||
*/
|
||||
public class CannonballFired
|
||||
{
|
||||
public static final CannonballFired INSTANCE = new CannonballFired();
|
||||
|
||||
private CannonballFired()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@ import net.runelite.api.ChatMessageType;
|
||||
import net.runelite.api.MessageNode;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* An event where a new chat message is received.
|
||||
@@ -40,9 +39,15 @@ import lombok.NoArgsConstructor;
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ChatMessage
|
||||
{
|
||||
public static final ChatMessage INSTANCE = new ChatMessage();
|
||||
|
||||
private ChatMessage()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* The underlying MessageNode for the message.
|
||||
*/
|
||||
|
||||
@@ -24,14 +24,21 @@
|
||||
*/
|
||||
package net.runelite.api.events;
|
||||
|
||||
import lombok.Value;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* An event where the client has joined or left a clan chat.
|
||||
*/
|
||||
@Value
|
||||
@Data
|
||||
public class ClanChanged
|
||||
{
|
||||
public static final ClanChanged INSTANCE = new ClanChanged();
|
||||
|
||||
private ClanChanged()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether or not the client is now in a clan chat.
|
||||
*/
|
||||
|
||||
@@ -25,11 +25,18 @@
|
||||
package net.runelite.api.events;
|
||||
|
||||
import net.runelite.api.ClanMember;
|
||||
import lombok.Value;
|
||||
import lombok.Data;
|
||||
|
||||
@Value
|
||||
@Data
|
||||
public class ClanMemberJoined
|
||||
{
|
||||
public static final ClanMemberJoined INSTANCE = new ClanMemberJoined();
|
||||
|
||||
private ClanMemberJoined()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* The ClanMember that joined
|
||||
*/
|
||||
|
||||
@@ -25,11 +25,18 @@
|
||||
package net.runelite.api.events;
|
||||
|
||||
import net.runelite.api.ClanMember;
|
||||
import lombok.Value;
|
||||
import lombok.Data;
|
||||
|
||||
@Value
|
||||
@Data
|
||||
public class ClanMemberLeft
|
||||
{
|
||||
public static final ClanMemberLeft INSTANCE = new ClanMemberLeft();
|
||||
|
||||
private ClanMemberLeft()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* The ClanMember that left
|
||||
*/
|
||||
|
||||
@@ -29,4 +29,10 @@ package net.runelite.api.events;
|
||||
*/
|
||||
public class ClientTick
|
||||
{
|
||||
public static final ClientTick INSTANCE = new ClientTick();
|
||||
|
||||
private ClientTick()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
*/
|
||||
package net.runelite.api.events;
|
||||
|
||||
import lombok.Value;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* An event where a command has been used in the chat.
|
||||
@@ -41,9 +41,16 @@ import lombok.Value;
|
||||
* set the command field to an empty string. For example, the message ":: hello world!"
|
||||
* will set command to "" and arguments to ["hello", "world!"].
|
||||
*/
|
||||
@Value
|
||||
@Data
|
||||
public class CommandExecuted
|
||||
{
|
||||
public static final CommandExecuted INSTANCE = new CommandExecuted();
|
||||
|
||||
private CommandExecuted()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* The name of the command entered.
|
||||
*/
|
||||
|
||||
@@ -35,6 +35,13 @@ import lombok.Data;
|
||||
@Data
|
||||
public class DecorativeObjectChanged
|
||||
{
|
||||
public static final DecorativeObjectChanged INSTANCE = new DecorativeObjectChanged();
|
||||
|
||||
private DecorativeObjectChanged()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* The affected tile.
|
||||
*/
|
||||
|
||||
@@ -35,6 +35,13 @@ import lombok.Data;
|
||||
@Data
|
||||
public class DecorativeObjectDespawned
|
||||
{
|
||||
public static final DecorativeObjectDespawned INSTANCE = new DecorativeObjectDespawned();
|
||||
|
||||
private DecorativeObjectDespawned()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* The affected tile.
|
||||
*/
|
||||
|
||||
@@ -34,6 +34,13 @@ import lombok.Data;
|
||||
@Data
|
||||
public class DecorativeObjectSpawned
|
||||
{
|
||||
public static final DecorativeObjectSpawned INSTANCE = new DecorativeObjectSpawned();
|
||||
|
||||
private DecorativeObjectSpawned()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* The affected tile.
|
||||
*/
|
||||
|
||||
@@ -33,6 +33,13 @@ import lombok.Data;
|
||||
@Data
|
||||
public class DraggingWidgetChanged
|
||||
{
|
||||
public static final DraggingWidgetChanged INSTANCE = new DraggingWidgetChanged();
|
||||
|
||||
private DraggingWidgetChanged()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether a widget is currently being dragged.
|
||||
*/
|
||||
|
||||
@@ -34,6 +34,13 @@ import lombok.Data;
|
||||
@Data
|
||||
public class ExperienceChanged
|
||||
{
|
||||
public static final ExperienceChanged INSTANCE = new ExperienceChanged();
|
||||
|
||||
private ExperienceChanged()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* The modified skill.
|
||||
*/
|
||||
|
||||
@@ -34,6 +34,13 @@ import net.runelite.api.Tile;
|
||||
@Data
|
||||
public class GameObjectChanged
|
||||
{
|
||||
public static final GameObjectChanged INSTANCE = new GameObjectChanged();
|
||||
|
||||
private GameObjectChanged()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* The affected tile.
|
||||
*/
|
||||
|
||||
@@ -34,6 +34,13 @@ import lombok.Data;
|
||||
@Data
|
||||
public class GameObjectDespawned
|
||||
{
|
||||
public static final GameObjectDespawned INSTANCE = new GameObjectDespawned();
|
||||
|
||||
private GameObjectDespawned()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* The affected tile.
|
||||
*/
|
||||
|
||||
@@ -34,6 +34,13 @@ import lombok.Data;
|
||||
@Data
|
||||
public class GameObjectSpawned
|
||||
{
|
||||
public static final GameObjectSpawned INSTANCE = new GameObjectSpawned();
|
||||
|
||||
private GameObjectSpawned()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* The affected tile.
|
||||
*/
|
||||
|
||||
@@ -33,6 +33,13 @@ import lombok.Data;
|
||||
@Data
|
||||
public class GameStateChanged
|
||||
{
|
||||
public static final GameStateChanged INSTANCE = new GameStateChanged();
|
||||
|
||||
private GameStateChanged()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* The new game state.
|
||||
*/
|
||||
|
||||
@@ -24,8 +24,6 @@
|
||||
*/
|
||||
package net.runelite.api.events;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
// The NPC update event seem to run every server tick,
|
||||
// but having the game tick event after all packets
|
||||
// have been processed is typically more useful.
|
||||
@@ -43,7 +41,12 @@ import lombok.Data;
|
||||
* Note that occurrences that take place purely on the client, such as right
|
||||
* click menus, are independent of the game tick.
|
||||
*/
|
||||
@Data
|
||||
public class GameTick
|
||||
{
|
||||
public static final GameTick INSTANCE = new GameTick();
|
||||
|
||||
private GameTick()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,6 +44,13 @@ import lombok.Data;
|
||||
@Data
|
||||
public class GrandExchangeOfferChanged
|
||||
{
|
||||
public static final GrandExchangeOfferChanged INSTANCE = new GrandExchangeOfferChanged();
|
||||
|
||||
private GrandExchangeOfferChanged()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* The offer that has been modified.
|
||||
*/
|
||||
|
||||
@@ -25,16 +25,24 @@
|
||||
package net.runelite.api.events;
|
||||
|
||||
import net.runelite.api.GraphicsObject;
|
||||
import lombok.Value;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* An event where a new {@link GraphicsObject} has been created.
|
||||
*/
|
||||
@Value
|
||||
@Data
|
||||
public class GraphicsObjectCreated
|
||||
{
|
||||
public static final GraphicsObjectCreated INSTANCE = new GraphicsObjectCreated();
|
||||
|
||||
private GraphicsObjectCreated()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* The newly created graphics object.
|
||||
*/
|
||||
private final GraphicsObject graphicsObject;
|
||||
private GraphicsObject graphicsObject;
|
||||
}
|
||||
|
||||
@@ -34,6 +34,13 @@ import lombok.Data;
|
||||
@Data
|
||||
public class GroundObjectChanged
|
||||
{
|
||||
public static final GroundObjectChanged INSTANCE = new GroundObjectChanged();
|
||||
|
||||
private GroundObjectChanged()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* The affected tile.
|
||||
*/
|
||||
|
||||
@@ -34,6 +34,13 @@ import lombok.Data;
|
||||
@Data
|
||||
public class GroundObjectDespawned
|
||||
{
|
||||
public static final GroundObjectDespawned INSTANCE = new GroundObjectDespawned();
|
||||
|
||||
private GroundObjectDespawned()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* The affected tile.
|
||||
*/
|
||||
|
||||
@@ -34,6 +34,13 @@ import lombok.Data;
|
||||
@Data
|
||||
public class GroundObjectSpawned
|
||||
{
|
||||
public static final GroundObjectSpawned INSTANCE = new GroundObjectSpawned();
|
||||
|
||||
private GroundObjectSpawned()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* The affected tile.
|
||||
*/
|
||||
|
||||
@@ -38,6 +38,13 @@ import lombok.Data;
|
||||
@Data
|
||||
public class HitsplatApplied
|
||||
{
|
||||
public static final HitsplatApplied INSTANCE = new HitsplatApplied();
|
||||
|
||||
private HitsplatApplied()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* The actor the hitsplat was applied to.
|
||||
*/
|
||||
|
||||
@@ -30,5 +30,12 @@ import lombok.Data;
|
||||
@Data
|
||||
public class InteractChanged
|
||||
{
|
||||
public static final InteractChanged INSTANCE = new InteractChanged();
|
||||
|
||||
private InteractChanged()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
private Actor actor;
|
||||
}
|
||||
|
||||
@@ -1,18 +1,26 @@
|
||||
package net.runelite.api.events;
|
||||
|
||||
import net.runelite.api.Actor;
|
||||
import lombok.Value;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* An event called when the actor an actor is interacting with changes
|
||||
*/
|
||||
@Value
|
||||
@Data
|
||||
public class InteractingChanged
|
||||
{
|
||||
private final Actor source;
|
||||
public static final InteractingChanged INSTANCE = new InteractingChanged();
|
||||
|
||||
private InteractingChanged()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
private Actor source;
|
||||
|
||||
/**
|
||||
* Target actor, may be null
|
||||
*/
|
||||
private final Actor target;
|
||||
private Actor target;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,8 @@
|
||||
package net.runelite.api.events;
|
||||
|
||||
import net.runelite.api.ItemContainer;
|
||||
import lombok.Value;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* An event called whenever the stack size of an {@link api.Item}
|
||||
@@ -38,11 +39,18 @@ import lombok.Value;
|
||||
* <li>Dropping an item</li>
|
||||
* </ul>
|
||||
*/
|
||||
@Value
|
||||
@Data
|
||||
public class ItemContainerChanged
|
||||
{
|
||||
public static final ItemContainerChanged INSTANCE = new ItemContainerChanged();
|
||||
|
||||
private ItemContainerChanged()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* The modified item container.
|
||||
*/
|
||||
private final ItemContainer itemContainer;
|
||||
private ItemContainer itemContainer;
|
||||
}
|
||||
|
||||
@@ -26,15 +26,23 @@ package net.runelite.api.events;
|
||||
|
||||
import net.runelite.api.Item;
|
||||
import net.runelite.api.Tile;
|
||||
import lombok.Value;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* Called when an item pile despawns from the ground. When the client loads a new scene,
|
||||
* all item piles are implicitly despawned, and despawn events will not be sent.
|
||||
*/
|
||||
@Value
|
||||
@Data
|
||||
public class ItemDespawned
|
||||
{
|
||||
private final Tile tile;
|
||||
private final Item item;
|
||||
public static final ItemDespawned INSTANCE = new ItemDespawned();
|
||||
|
||||
private ItemDespawned()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
private Tile tile;
|
||||
private Item item;
|
||||
}
|
||||
|
||||
@@ -26,16 +26,23 @@ package net.runelite.api.events;
|
||||
|
||||
import net.runelite.api.Item;
|
||||
import net.runelite.api.Tile;
|
||||
import lombok.Value;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* Called when the quantity of an item pile changes.
|
||||
*/
|
||||
@Value
|
||||
@Data
|
||||
public class ItemQuantityChanged
|
||||
{
|
||||
private final Item item;
|
||||
private final Tile tile;
|
||||
private final int oldQuantity;
|
||||
private final int newQuantity;
|
||||
public static final ItemQuantityChanged INSTANCE = new ItemQuantityChanged();
|
||||
|
||||
private ItemQuantityChanged()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
private Item item;
|
||||
private Tile tile;
|
||||
private int oldQuantity;
|
||||
private int newQuantity;
|
||||
}
|
||||
|
||||
@@ -26,15 +26,22 @@ package net.runelite.api.events;
|
||||
|
||||
import net.runelite.api.Item;
|
||||
import net.runelite.api.Tile;
|
||||
import lombok.Value;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* Called when an item pile spawns on the ground. When the client loads a new scene,
|
||||
* all item piles are implicitly reset and a new spawn event will be sent.
|
||||
*/
|
||||
@Value
|
||||
@Data
|
||||
public class ItemSpawned
|
||||
{
|
||||
private final Tile tile;
|
||||
private final Item item;
|
||||
public static final ItemSpawned INSTANCE = new ItemSpawned();
|
||||
|
||||
private ItemSpawned()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
private Tile tile;
|
||||
private Item item;
|
||||
}
|
||||
|
||||
@@ -29,4 +29,10 @@ package net.runelite.api.events;
|
||||
*/
|
||||
public class LocalPlayerDeath
|
||||
{
|
||||
public static final LocalPlayerDeath INSTANCE = new LocalPlayerDeath();
|
||||
|
||||
private LocalPlayerDeath()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,10 +35,17 @@ import net.runelite.api.MenuEntry;
|
||||
@AllArgsConstructor
|
||||
public class MenuEntryAdded
|
||||
{
|
||||
public static final MenuEntryAdded INSTANCE = new MenuEntryAdded();
|
||||
|
||||
private MenuEntryAdded()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* The MenuEntry object that was actually added
|
||||
*/
|
||||
private final MenuEntry menuEntry;
|
||||
private MenuEntry menuEntry;
|
||||
|
||||
public String getOption()
|
||||
{
|
||||
|
||||
@@ -33,6 +33,13 @@ import lombok.Data;
|
||||
@Data
|
||||
public class MenuOpened
|
||||
{
|
||||
public static final MenuOpened INSTANCE = new MenuOpened();
|
||||
|
||||
private MenuOpened()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* The menu entries in the newly opened menu.
|
||||
* <p>
|
||||
|
||||
@@ -42,6 +42,13 @@ import net.runelite.api.MenuEntry;
|
||||
@Data
|
||||
public class MenuOptionClicked
|
||||
{
|
||||
public static final MenuOptionClicked INSTANCE = new MenuOptionClicked();
|
||||
|
||||
private MenuOptionClicked()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
public MenuOptionClicked(MenuEntry entry)
|
||||
{
|
||||
menuEntry = entry;
|
||||
|
||||
@@ -33,6 +33,13 @@ import lombok.Data;
|
||||
@Data
|
||||
public class MenuShouldLeftClick
|
||||
{
|
||||
public static final MenuShouldLeftClick INSTANCE = new MenuShouldLeftClick();
|
||||
|
||||
private MenuShouldLeftClick()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* If set to true, the menu will open on left click.
|
||||
*/
|
||||
|
||||
@@ -25,16 +25,23 @@
|
||||
package net.runelite.api.events;
|
||||
|
||||
import net.runelite.api.Nameable;
|
||||
import lombok.Value;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* An event where a {@link Nameable} has had their name changed.
|
||||
*/
|
||||
@Value
|
||||
@Data
|
||||
public class NameableNameChanged
|
||||
{
|
||||
public static final NameableNameChanged INSTANCE = new NameableNameChanged();
|
||||
|
||||
private NameableNameChanged()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* The nameable that changed names.
|
||||
*/
|
||||
private final Nameable nameable;
|
||||
private Nameable nameable;
|
||||
}
|
||||
|
||||
@@ -33,6 +33,13 @@ import net.runelite.api.NPCDefinition;
|
||||
@Data
|
||||
public class NpcActionChanged
|
||||
{
|
||||
public static final NpcActionChanged INSTANCE = new NpcActionChanged();
|
||||
|
||||
private NpcActionChanged()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* The NPC composition that has been changed.
|
||||
*/
|
||||
|
||||
@@ -26,18 +26,25 @@ package net.runelite.api.events;
|
||||
|
||||
import net.runelite.api.Actor;
|
||||
import net.runelite.api.NPC;
|
||||
import lombok.Value;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* An event where an {@link NPC} has despawned.
|
||||
*/
|
||||
@Value
|
||||
@Data
|
||||
public class NpcDespawned
|
||||
{
|
||||
public static final NpcDespawned INSTANCE = new NpcDespawned();
|
||||
|
||||
private NpcDespawned()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* The despawned NPC.
|
||||
*/
|
||||
private final NPC npc;
|
||||
private NPC npc;
|
||||
|
||||
public Actor getActor()
|
||||
{
|
||||
|
||||
@@ -26,18 +26,25 @@ package net.runelite.api.events;
|
||||
|
||||
import net.runelite.api.Actor;
|
||||
import net.runelite.api.NPC;
|
||||
import lombok.Value;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* An event where an {@link NPC} has spawned.
|
||||
*/
|
||||
@Value
|
||||
@Data
|
||||
public class NpcSpawned
|
||||
{
|
||||
public static final NpcSpawned INSTANCE = new NpcSpawned();
|
||||
|
||||
private NpcSpawned()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* The spawned NPC.
|
||||
*/
|
||||
private final NPC npc;
|
||||
private NPC npc;
|
||||
|
||||
public Actor getActor()
|
||||
{
|
||||
|
||||
@@ -1,12 +1,19 @@
|
||||
package net.runelite.api.events;
|
||||
|
||||
import net.runelite.api.Actor;
|
||||
import lombok.Value;
|
||||
import lombok.Data;
|
||||
|
||||
@Value
|
||||
@Data
|
||||
public class OverheadTextChanged
|
||||
{
|
||||
private final Actor actor;
|
||||
public static final OverheadTextChanged INSTANCE = new OverheadTextChanged();
|
||||
|
||||
private final String overheadText;
|
||||
private OverheadTextChanged()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
private Actor actor;
|
||||
|
||||
private String overheadText;
|
||||
}
|
||||
@@ -26,20 +26,27 @@ package net.runelite.api.events;
|
||||
|
||||
import net.runelite.api.Actor;
|
||||
import net.runelite.api.Player;
|
||||
import lombok.Value;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* An event where a {@link Player} has despawned.
|
||||
* <p>
|
||||
* Note: This event does not get called for the local player.
|
||||
*/
|
||||
@Value
|
||||
@Data
|
||||
public class PlayerDespawned
|
||||
{
|
||||
public static final PlayerDespawned INSTANCE = new PlayerDespawned();
|
||||
|
||||
private PlayerDespawned()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* The despawned player.
|
||||
*/
|
||||
private final Player player;
|
||||
private Player player;
|
||||
|
||||
public Actor getActor()
|
||||
{
|
||||
|
||||
@@ -33,6 +33,13 @@ import lombok.Data;
|
||||
@Data
|
||||
public class PlayerMenuOptionClicked
|
||||
{
|
||||
public static final PlayerMenuOptionClicked INSTANCE = new PlayerMenuOptionClicked();
|
||||
|
||||
private PlayerMenuOptionClicked()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* The menu option clicked.
|
||||
*/
|
||||
|
||||
@@ -29,6 +29,13 @@ import lombok.Data;
|
||||
@Data
|
||||
public class PlayerMenuOptionsChanged
|
||||
{
|
||||
public static final PlayerMenuOptionsChanged INSTANCE = new PlayerMenuOptionsChanged();
|
||||
|
||||
private PlayerMenuOptionsChanged()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* Index in playerOptions which changed.
|
||||
*/
|
||||
|
||||
@@ -26,18 +26,25 @@ package net.runelite.api.events;
|
||||
|
||||
import net.runelite.api.Actor;
|
||||
import net.runelite.api.Player;
|
||||
import lombok.Value;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* An event where a {@link Player} has spawned.
|
||||
*/
|
||||
@Value
|
||||
@Data
|
||||
public class PlayerSpawned
|
||||
{
|
||||
public static final PlayerSpawned INSTANCE = new PlayerSpawned();
|
||||
|
||||
private PlayerSpawned()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* The spawned player.
|
||||
*/
|
||||
private final Player player;
|
||||
private Player player;
|
||||
|
||||
public Actor getActor()
|
||||
{
|
||||
|
||||
@@ -30,5 +30,12 @@ import lombok.Data;
|
||||
@Data
|
||||
public class PostHealthBar
|
||||
{
|
||||
public static final PostHealthBar INSTANCE = new PostHealthBar();
|
||||
|
||||
private PostHealthBar()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
private HealthBar healthBar;
|
||||
}
|
||||
|
||||
@@ -34,6 +34,13 @@ import net.runelite.api.ItemDefinition;
|
||||
@Data
|
||||
public class PostItemDefinition
|
||||
{
|
||||
public static final PostItemDefinition INSTANCE = new PostItemDefinition();
|
||||
|
||||
private PostItemDefinition()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* The newly created item.
|
||||
*/
|
||||
|
||||
@@ -37,6 +37,13 @@ import lombok.Data;
|
||||
@Data
|
||||
public class ProjectileMoved
|
||||
{
|
||||
public static final ProjectileMoved INSTANCE = new ProjectileMoved();
|
||||
|
||||
private ProjectileMoved()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* The projectile being moved.
|
||||
*/
|
||||
|
||||
@@ -34,6 +34,13 @@ import lombok.Data;
|
||||
@Data
|
||||
public class ProjectileSpawned
|
||||
{
|
||||
public static final ProjectileSpawned INSTANCE = new ProjectileSpawned();
|
||||
|
||||
private ProjectileSpawned()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* The spawned projectile.
|
||||
*/
|
||||
|
||||
@@ -24,16 +24,23 @@
|
||||
*/
|
||||
package net.runelite.api.events;
|
||||
|
||||
import lombok.Value;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* An event where a request to remove a friend is sent to the server.
|
||||
*/
|
||||
@Value
|
||||
@Data
|
||||
public class RemovedFriend
|
||||
{
|
||||
public static final RemovedFriend INSTANCE = new RemovedFriend();
|
||||
|
||||
private RemovedFriend()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* The name of the removed friend.
|
||||
*/
|
||||
private final String name;
|
||||
private String name;
|
||||
}
|
||||
|
||||
@@ -34,6 +34,13 @@ import lombok.Data;
|
||||
@Data
|
||||
public class ResizeableChanged
|
||||
{
|
||||
public static final ResizeableChanged INSTANCE = new ResizeableChanged();
|
||||
|
||||
private ResizeableChanged()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the game is in resizable mode.
|
||||
*/
|
||||
|
||||
@@ -33,6 +33,13 @@ import lombok.Data;
|
||||
@Data
|
||||
public class ScriptCallbackEvent
|
||||
{
|
||||
public static final ScriptCallbackEvent INSTANCE = new ScriptCallbackEvent();
|
||||
|
||||
private ScriptCallbackEvent()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* The script being called.
|
||||
*/
|
||||
|
||||
@@ -29,6 +29,13 @@ import lombok.Data;
|
||||
@Data
|
||||
public class SoundEffectPlayed
|
||||
{
|
||||
public static final SoundEffectPlayed INSTANCE = new SoundEffectPlayed();
|
||||
|
||||
private SoundEffectPlayed()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
private int soundId;
|
||||
private int delay;
|
||||
}
|
||||
|
||||
@@ -21,6 +21,13 @@ import net.runelite.api.Actor;
|
||||
@Data
|
||||
public class SpotAnimationChanged
|
||||
{
|
||||
public static final SpotAnimationChanged INSTANCE = new SpotAnimationChanged();
|
||||
|
||||
private SpotAnimationChanged()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* The actor that has had their graphic changed.
|
||||
*/
|
||||
|
||||
@@ -32,4 +32,10 @@ package net.runelite.api.events;
|
||||
*/
|
||||
public class UsernameChanged
|
||||
{
|
||||
public static final UsernameChanged INSTANCE = new UsernameChanged();
|
||||
|
||||
private UsernameChanged()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,13 +25,20 @@
|
||||
*/
|
||||
package net.runelite.api.events;
|
||||
|
||||
import lombok.Value;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* An event where a varbit integer has changed.
|
||||
*/
|
||||
@Value
|
||||
@Data
|
||||
public class VarClientIntChanged
|
||||
{
|
||||
public static final VarClientIntChanged INSTANCE = new VarClientIntChanged();
|
||||
|
||||
private VarClientIntChanged()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
private int index;
|
||||
}
|
||||
|
||||
@@ -25,13 +25,20 @@
|
||||
*/
|
||||
package net.runelite.api.events;
|
||||
|
||||
import lombok.Value;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* An event where a varbit string has changed.
|
||||
*/
|
||||
@Value
|
||||
@Data
|
||||
public class VarClientStrChanged
|
||||
{
|
||||
public static final VarClientStrChanged INSTANCE = new VarClientStrChanged();
|
||||
|
||||
private VarClientStrChanged()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
private int index;
|
||||
}
|
||||
|
||||
@@ -34,6 +34,13 @@ import lombok.Data;
|
||||
@Data
|
||||
public class VarbitChanged
|
||||
{
|
||||
public static final VarbitChanged INSTANCE = new VarbitChanged();
|
||||
|
||||
private VarbitChanged()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* Index in the varp array that was changed.
|
||||
* For varplayer, this is the varplayer id.
|
||||
|
||||
@@ -34,6 +34,13 @@ import lombok.Data;
|
||||
@Data
|
||||
public class WallObjectChanged
|
||||
{
|
||||
public static final WallObjectChanged INSTANCE = new WallObjectChanged();
|
||||
|
||||
private WallObjectChanged()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* The affected tile.
|
||||
*/
|
||||
|
||||
@@ -34,6 +34,13 @@ import lombok.Data;
|
||||
@Data
|
||||
public class WallObjectDespawned
|
||||
{
|
||||
public static final WallObjectDespawned INSTANCE = new WallObjectDespawned();
|
||||
|
||||
private WallObjectDespawned()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* The affected tile.
|
||||
*/
|
||||
|
||||
@@ -34,6 +34,13 @@ import lombok.Data;
|
||||
@Data
|
||||
public class WallObjectSpawned
|
||||
{
|
||||
public static final WallObjectSpawned INSTANCE = new WallObjectSpawned();
|
||||
|
||||
private WallObjectSpawned()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* The affected tile.
|
||||
*/
|
||||
|
||||
@@ -33,6 +33,13 @@ import lombok.Data;
|
||||
@Data
|
||||
public class WidgetHiddenChanged
|
||||
{
|
||||
public static final WidgetHiddenChanged INSTANCE = new WidgetHiddenChanged();
|
||||
|
||||
private WidgetHiddenChanged()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* The affected widget.
|
||||
*/
|
||||
|
||||
@@ -32,6 +32,13 @@ import lombok.Data;
|
||||
@Data
|
||||
public class WidgetLoaded
|
||||
{
|
||||
public static final WidgetLoaded INSTANCE = new WidgetLoaded();
|
||||
|
||||
private WidgetLoaded()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* The group ID of the loaded widget.
|
||||
*/
|
||||
|
||||
@@ -33,6 +33,13 @@ import lombok.Data;
|
||||
@Data
|
||||
public class WidgetMenuOptionClicked
|
||||
{
|
||||
public static final WidgetMenuOptionClicked INSTANCE = new WidgetMenuOptionClicked();
|
||||
|
||||
private WidgetMenuOptionClicked()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
/**
|
||||
* The clicked menu option.
|
||||
*/
|
||||
|
||||
@@ -24,13 +24,16 @@
|
||||
*/
|
||||
package net.runelite.api.events;
|
||||
|
||||
import lombok.Value;
|
||||
|
||||
/**
|
||||
* An event where the position of a {@link net.runelite.api.widgets.Widget}
|
||||
* relative to its parent has changed.
|
||||
*/
|
||||
@Value
|
||||
public class WidgetPositioned
|
||||
{
|
||||
public static final WidgetPositioned INSTANCE = new WidgetPositioned();
|
||||
|
||||
private WidgetPositioned()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,13 +25,20 @@
|
||||
package net.runelite.api.events;
|
||||
|
||||
import net.runelite.api.World;
|
||||
import lombok.Value;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* Event when the world list is loaded for the world switcher
|
||||
*/
|
||||
@Value
|
||||
@Data
|
||||
public class WorldListLoad
|
||||
{
|
||||
private final World[] worlds;
|
||||
public static final WorldListLoad INSTANCE = new WorldListLoad();
|
||||
|
||||
private WorldListLoad()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
private World[] worlds;
|
||||
}
|
||||
|
||||
@@ -87,9 +87,6 @@ public class Hooks implements Callbacks
|
||||
private static final OverlayRenderer renderer = injector.getInstance(OverlayRenderer.class);
|
||||
private static final OverlayManager overlayManager = injector.getInstance(OverlayManager.class);
|
||||
|
||||
private static final GameTick GAME_TICK = new GameTick();
|
||||
private static final BeforeRender BEFORE_RENDER = new BeforeRender();
|
||||
|
||||
@Inject
|
||||
private EventBus eventBus;
|
||||
|
||||
@@ -151,13 +148,13 @@ public class Hooks implements Callbacks
|
||||
|
||||
deferredEventBus.replay();
|
||||
|
||||
eventBus.post(GAME_TICK);
|
||||
eventBus.post(GameTick.INSTANCE);
|
||||
|
||||
int tick = client.getTickCount();
|
||||
client.setTickCount(tick + 1);
|
||||
}
|
||||
|
||||
eventBus.post(BEFORE_RENDER);
|
||||
eventBus.post(BeforeRender.INSTANCE);
|
||||
|
||||
clientThread.invoke();
|
||||
|
||||
@@ -511,7 +508,7 @@ public class Hooks implements Callbacks
|
||||
|
||||
public static boolean drawMenu()
|
||||
{
|
||||
BeforeMenuRender event = new BeforeMenuRender();
|
||||
BeforeMenuRender event = BeforeMenuRender.INSTANCE;
|
||||
client.getCallbacks().post(event);
|
||||
return event.isConsumed();
|
||||
}
|
||||
|
||||
@@ -114,7 +114,9 @@ public class CommandManager
|
||||
String command = split[0];
|
||||
String[] args = Arrays.copyOfRange(split, 1, split.length);
|
||||
|
||||
CommandExecuted commandExecuted = new CommandExecuted(command, args);
|
||||
CommandExecuted commandExecuted = CommandExecuted.INSTANCE;
|
||||
commandExecuted.setCommand(command);
|
||||
commandExecuted.setArguments(args);
|
||||
eventBus.post(commandExecuted);
|
||||
}
|
||||
|
||||
|
||||
@@ -429,7 +429,7 @@ public class MenuManager
|
||||
if (curMenuOption.getMenuTarget().equals(event.getTarget())
|
||||
&& curMenuOption.getMenuOption().equals(event.getOption()))
|
||||
{
|
||||
WidgetMenuOptionClicked customMenu = new WidgetMenuOptionClicked();
|
||||
WidgetMenuOptionClicked customMenu = WidgetMenuOptionClicked.INSTANCE;
|
||||
customMenu.setMenuOption(event.getOption());
|
||||
customMenu.setMenuTarget(event.getTarget());
|
||||
customMenu.setWidget(curMenuOption.getWidget());
|
||||
@@ -444,7 +444,7 @@ public class MenuManager
|
||||
// <col=ffffff>username<col=40ff00> (level-42) or <col=ffffff><img=2>username</col>
|
||||
String username = Text.removeTags(target).split("[(]")[0].trim();
|
||||
|
||||
PlayerMenuOptionClicked playerMenuOptionClicked = new PlayerMenuOptionClicked();
|
||||
PlayerMenuOptionClicked playerMenuOptionClicked = PlayerMenuOptionClicked.INSTANCE;
|
||||
playerMenuOptionClicked.setMenuOption(event.getOption());
|
||||
playerMenuOptionClicked.setMenuTarget(username);
|
||||
|
||||
|
||||
@@ -258,7 +258,7 @@ public class DevToolsPlugin extends Plugin
|
||||
int value = Integer.parseInt(args[1]);
|
||||
client.setVarpValue(client.getVarps(), varp, value);
|
||||
client.addChatMessage(ChatMessageType.GAMEMESSAGE, "", "Set VarPlayer " + varp + " to " + value, null);
|
||||
VarbitChanged varbitChanged = new VarbitChanged();
|
||||
VarbitChanged varbitChanged = VarbitChanged.INSTANCE;
|
||||
varbitChanged.setIndex(varp);
|
||||
eventBus.post(varbitChanged); // fake event
|
||||
break;
|
||||
@@ -276,7 +276,7 @@ public class DevToolsPlugin extends Plugin
|
||||
int value = Integer.parseInt(args[1]);
|
||||
client.setVarbitValue(client.getVarps(), varbit, value);
|
||||
client.addChatMessage(ChatMessageType.GAMEMESSAGE, "", "Set varbit " + varbit + " to " + value, null);
|
||||
eventBus.post(new VarbitChanged()); // fake event
|
||||
eventBus.post(VarbitChanged.INSTANCE); // fake event
|
||||
break;
|
||||
}
|
||||
case "addxp":
|
||||
@@ -293,7 +293,7 @@ public class DevToolsPlugin extends Plugin
|
||||
|
||||
client.queueChangedSkill(skill);
|
||||
|
||||
ExperienceChanged experienceChanged = new ExperienceChanged();
|
||||
ExperienceChanged experienceChanged = ExperienceChanged.INSTANCE;
|
||||
experienceChanged.setSkill(skill);
|
||||
eventBus.post(experienceChanged);
|
||||
break;
|
||||
@@ -312,11 +312,11 @@ public class DevToolsPlugin extends Plugin
|
||||
|
||||
client.queueChangedSkill(skill);
|
||||
|
||||
ExperienceChanged experienceChanged = new ExperienceChanged();
|
||||
ExperienceChanged experienceChanged = ExperienceChanged.INSTANCE;
|
||||
experienceChanged.setSkill(skill);
|
||||
eventBus.post(experienceChanged);
|
||||
|
||||
BoostedLevelChanged boostedLevelChanged = new BoostedLevelChanged();
|
||||
BoostedLevelChanged boostedLevelChanged = BoostedLevelChanged.INSTANCE;
|
||||
boostedLevelChanged.setSkill(skill);
|
||||
eventBus.post(boostedLevelChanged);
|
||||
break;
|
||||
|
||||
@@ -121,7 +121,7 @@ public class FreezeTimersPlugin extends Plugin
|
||||
{
|
||||
if (prayerTracker.getSpotanimLastTick(actor) != actor.getSpotAnimation())
|
||||
{
|
||||
SpotAnimationChanged callback = new SpotAnimationChanged();
|
||||
SpotAnimationChanged callback = SpotAnimationChanged.INSTANCE;
|
||||
callback.setActor(actor);
|
||||
client.getCallbacks().post(callback);
|
||||
}
|
||||
|
||||
@@ -118,7 +118,9 @@ public class GameEventManager
|
||||
|
||||
if (itemContainer != null)
|
||||
{
|
||||
eventBus.post(new ItemContainerChanged(itemContainer));
|
||||
ItemContainerChanged event = ItemContainerChanged.INSTANCE;
|
||||
event.setItemContainer(itemContainer);
|
||||
eventBus.post(event);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,7 +128,8 @@ public class GameEventManager
|
||||
{
|
||||
if (npc != null)
|
||||
{
|
||||
final NpcSpawned npcSpawned = new NpcSpawned(npc);
|
||||
final NpcSpawned npcSpawned = NpcSpawned.INSTANCE;
|
||||
npcSpawned.setNpc(npc);
|
||||
eventBus.post(npcSpawned);
|
||||
}
|
||||
}
|
||||
@@ -135,7 +138,8 @@ public class GameEventManager
|
||||
{
|
||||
if (player != null)
|
||||
{
|
||||
final PlayerSpawned playerSpawned = new PlayerSpawned(player);
|
||||
final PlayerSpawned playerSpawned = PlayerSpawned.INSTANCE;
|
||||
playerSpawned.setPlayer(player);
|
||||
eventBus.post(playerSpawned);
|
||||
}
|
||||
}
|
||||
@@ -144,7 +148,7 @@ public class GameEventManager
|
||||
{
|
||||
Optional.ofNullable(tile.getWallObject()).ifPresent(object ->
|
||||
{
|
||||
final WallObjectSpawned objectSpawned = new WallObjectSpawned();
|
||||
final WallObjectSpawned objectSpawned = WallObjectSpawned.INSTANCE;
|
||||
objectSpawned.setTile(tile);
|
||||
objectSpawned.setWallObject(object);
|
||||
eventBus.post(objectSpawned);
|
||||
@@ -152,7 +156,7 @@ public class GameEventManager
|
||||
|
||||
Optional.ofNullable(tile.getDecorativeObject()).ifPresent(object ->
|
||||
{
|
||||
final DecorativeObjectSpawned objectSpawned = new DecorativeObjectSpawned();
|
||||
final DecorativeObjectSpawned objectSpawned = DecorativeObjectSpawned.INSTANCE;
|
||||
objectSpawned.setTile(tile);
|
||||
objectSpawned.setDecorativeObject(object);
|
||||
eventBus.post(objectSpawned);
|
||||
@@ -160,7 +164,7 @@ public class GameEventManager
|
||||
|
||||
Optional.ofNullable(tile.getGroundObject()).ifPresent(object ->
|
||||
{
|
||||
final GroundObjectSpawned objectSpawned = new GroundObjectSpawned();
|
||||
final GroundObjectSpawned objectSpawned = GroundObjectSpawned.INSTANCE;
|
||||
objectSpawned.setTile(tile);
|
||||
objectSpawned.setGroundObject(object);
|
||||
eventBus.post(objectSpawned);
|
||||
@@ -170,7 +174,7 @@ public class GameEventManager
|
||||
.filter(Objects::nonNull)
|
||||
.forEach(object ->
|
||||
{
|
||||
final GameObjectSpawned objectSpawned = new GameObjectSpawned();
|
||||
final GameObjectSpawned objectSpawned = GameObjectSpawned.INSTANCE;
|
||||
objectSpawned.setTile(tile);
|
||||
objectSpawned.setGameObject(object);
|
||||
eventBus.post(objectSpawned);
|
||||
@@ -186,7 +190,9 @@ public class GameEventManager
|
||||
|
||||
current = current.getNext();
|
||||
|
||||
final ItemSpawned itemSpawned = new ItemSpawned(tile, item);
|
||||
final ItemSpawned itemSpawned = ItemSpawned.INSTANCE;
|
||||
itemSpawned.setItem(item);
|
||||
itemSpawned.setTile(tile);
|
||||
eventBus.post(itemSpawned);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -93,14 +93,14 @@ public class AttackStylesPluginTest
|
||||
when(client.getVar(VarPlayer.ATTACK_STYLE)).thenReturn(AttackStyle.ACCURATE.ordinal());
|
||||
|
||||
// verify that earning xp in a warned skill will display red text on the widget
|
||||
attackPlugin.onVarbitChanged(new VarbitChanged());
|
||||
attackPlugin.onVarbitChanged(VarbitChanged.INSTANCE);
|
||||
assertTrue(attackPlugin.isWarnedSkillSelected());
|
||||
|
||||
// Switch to attack style that doesn't give attack xp
|
||||
when(client.getVar(VarPlayer.ATTACK_STYLE)).thenReturn(AttackStyle.AGGRESSIVE.ordinal());
|
||||
|
||||
// Verify the widget will now display white text
|
||||
attackPlugin.onVarbitChanged(new VarbitChanged());
|
||||
attackPlugin.onVarbitChanged(VarbitChanged.INSTANCE);
|
||||
warnedSkills = attackPlugin.getWarnedSkills();
|
||||
assertTrue(warnedSkills.contains(Skill.ATTACK));
|
||||
assertFalse(attackPlugin.isWarnedSkillSelected());
|
||||
@@ -129,7 +129,7 @@ public class AttackStylesPluginTest
|
||||
|
||||
// equip type_4 weapon type on player
|
||||
when(client.getVar(Varbits.EQUIPPED_WEAPON_TYPE)).thenReturn(WeaponType.TYPE_4.ordinal());
|
||||
attackPlugin.onVarbitChanged(new VarbitChanged());
|
||||
attackPlugin.onVarbitChanged(VarbitChanged.INSTANCE);
|
||||
|
||||
// Verify there is a warned skill
|
||||
Set<Skill> warnedSkills = attackPlugin.getWarnedSkills();
|
||||
|
||||
@@ -71,7 +71,7 @@ public class CerberusPluginTest
|
||||
mockNpc(new LocalPoint(2, 5)),
|
||||
mockNpc(new LocalPoint(1, 5))
|
||||
));
|
||||
cerberusPlugin.onGameTick(new GameTick());
|
||||
cerberusPlugin.onGameTick(GameTick.INSTANCE);
|
||||
|
||||
// Expected sort is by lowest y first, then by lowest x
|
||||
assertEquals(ghosts.get(0).getLocalLocation(), new LocalPoint(0, 0));
|
||||
|
||||
@@ -83,7 +83,7 @@ public class ChatNotificationsPluginTest
|
||||
MessageNode messageNode = mock(MessageNode.class);
|
||||
when(messageNode.getValue()).thenReturn("Deathbeam, Deathbeam OSRS");
|
||||
|
||||
ChatMessage chatMessage = new ChatMessage();
|
||||
ChatMessage chatMessage = ChatMessage.INSTANCE;
|
||||
chatMessage.setType(ChatMessageType.PUBLICCHAT);
|
||||
chatMessage.setMessageNode(messageNode);
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ public class CookingPluginTest
|
||||
when(config.fermentTimer()).thenReturn(true);
|
||||
when(client.getLocalPlayer()).thenReturn(player);
|
||||
|
||||
SpotAnimationChanged graphicChanged = new SpotAnimationChanged();
|
||||
SpotAnimationChanged graphicChanged = SpotAnimationChanged.INSTANCE;
|
||||
graphicChanged.setActor(player);
|
||||
cookingPlugin.onSpotAnimationChanged(graphicChanged);
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ public class EmojiPluginTest
|
||||
when(client.createIndexedSprite()).thenReturn(mock(IndexedSprite.class));
|
||||
|
||||
// Trip emoji loading
|
||||
GameStateChanged gameStateChanged = new GameStateChanged();
|
||||
GameStateChanged gameStateChanged = GameStateChanged.INSTANCE;
|
||||
gameStateChanged.setGameState(GameState.LOGGED_IN);
|
||||
emojiPlugin.onGameStateChanged(gameStateChanged);
|
||||
|
||||
@@ -81,7 +81,7 @@ public class EmojiPluginTest
|
||||
// With chat recolor, message may be wrapped in col tags
|
||||
when(messageNode.getValue()).thenReturn("<col=ff0000>:) :) :)</col>");
|
||||
|
||||
ChatMessage chatMessage = new ChatMessage();
|
||||
ChatMessage chatMessage = ChatMessage.INSTANCE;
|
||||
chatMessage.setType(ChatMessageType.PUBLICCHAT);
|
||||
chatMessage.setMessageNode(messageNode);
|
||||
|
||||
@@ -98,14 +98,14 @@ public class EmojiPluginTest
|
||||
when(client.createIndexedSprite()).thenReturn(mock(IndexedSprite.class));
|
||||
|
||||
// Trip emoji loading
|
||||
GameStateChanged gameStateChanged = new GameStateChanged();
|
||||
GameStateChanged gameStateChanged = GameStateChanged.INSTANCE;
|
||||
gameStateChanged.setGameState(GameState.LOGGED_IN);
|
||||
emojiPlugin.onGameStateChanged(gameStateChanged);
|
||||
|
||||
MessageNode messageNode = mock(MessageNode.class);
|
||||
when(messageNode.getValue()).thenReturn("<gt>:D<lt>");
|
||||
|
||||
ChatMessage chatMessage = new ChatMessage();
|
||||
ChatMessage chatMessage = ChatMessage.INSTANCE;
|
||||
chatMessage.setType(ChatMessageType.PUBLICCHAT);
|
||||
chatMessage.setMessageNode(messageNode);
|
||||
|
||||
|
||||
@@ -132,13 +132,13 @@ public class IdleNotifierPluginTest
|
||||
public void checkAnimationIdle()
|
||||
{
|
||||
when(player.getAnimation()).thenReturn(AnimationID.WOODCUTTING_BRONZE);
|
||||
AnimationChanged animationChanged = new AnimationChanged();
|
||||
AnimationChanged animationChanged = AnimationChanged.INSTANCE;
|
||||
animationChanged.setActor(player);
|
||||
plugin.onAnimationChanged(animationChanged);
|
||||
plugin.onGameTick(new GameTick());
|
||||
plugin.onGameTick(GameTick.INSTANCE);
|
||||
when(player.getAnimation()).thenReturn(AnimationID.IDLE);
|
||||
plugin.onAnimationChanged(animationChanged);
|
||||
plugin.onGameTick(new GameTick());
|
||||
plugin.onGameTick(GameTick.INSTANCE);
|
||||
verify(notifier).notify("[" + PLAYER_NAME + "] is now idle!");
|
||||
}
|
||||
|
||||
@@ -146,16 +146,16 @@ public class IdleNotifierPluginTest
|
||||
public void checkAnimationReset()
|
||||
{
|
||||
when(player.getAnimation()).thenReturn(AnimationID.WOODCUTTING_BRONZE);
|
||||
AnimationChanged animationChanged = new AnimationChanged();
|
||||
AnimationChanged animationChanged = AnimationChanged.INSTANCE;
|
||||
animationChanged.setActor(player);
|
||||
plugin.onAnimationChanged(animationChanged);
|
||||
plugin.onGameTick(new GameTick());
|
||||
plugin.onGameTick(GameTick.INSTANCE);
|
||||
when(player.getAnimation()).thenReturn(AnimationID.LOOKING_INTO);
|
||||
plugin.onAnimationChanged(animationChanged);
|
||||
plugin.onGameTick(new GameTick());
|
||||
plugin.onGameTick(GameTick.INSTANCE);
|
||||
when(player.getAnimation()).thenReturn(AnimationID.IDLE);
|
||||
plugin.onAnimationChanged(animationChanged);
|
||||
plugin.onGameTick(new GameTick());
|
||||
plugin.onGameTick(GameTick.INSTANCE);
|
||||
verify(notifier, times(0)).notify(any());
|
||||
}
|
||||
|
||||
@@ -163,14 +163,14 @@ public class IdleNotifierPluginTest
|
||||
public void checkAnimationLogout()
|
||||
{
|
||||
when(player.getAnimation()).thenReturn(AnimationID.WOODCUTTING_BRONZE);
|
||||
AnimationChanged animationChanged = new AnimationChanged();
|
||||
AnimationChanged animationChanged = AnimationChanged.INSTANCE;
|
||||
animationChanged.setActor(player);
|
||||
plugin.onAnimationChanged(animationChanged);
|
||||
plugin.onGameTick(new GameTick());
|
||||
plugin.onGameTick(GameTick.INSTANCE);
|
||||
|
||||
// Logout
|
||||
when(client.getGameState()).thenReturn(GameState.LOGIN_SCREEN);
|
||||
GameStateChanged gameStateChanged = new GameStateChanged();
|
||||
GameStateChanged gameStateChanged = GameStateChanged.INSTANCE;
|
||||
gameStateChanged.setGameState(GameState.LOGIN_SCREEN);
|
||||
plugin.onGameStateChanged(gameStateChanged);
|
||||
|
||||
@@ -182,7 +182,7 @@ public class IdleNotifierPluginTest
|
||||
// Tick
|
||||
when(player.getAnimation()).thenReturn(AnimationID.IDLE);
|
||||
plugin.onAnimationChanged(animationChanged);
|
||||
plugin.onGameTick(new GameTick());
|
||||
plugin.onGameTick(GameTick.INSTANCE);
|
||||
verify(notifier, times(0)).notify(any());
|
||||
}
|
||||
|
||||
@@ -190,11 +190,16 @@ public class IdleNotifierPluginTest
|
||||
public void checkCombatIdle()
|
||||
{
|
||||
when(player.getInteracting()).thenReturn(monster);
|
||||
plugin.onInteractingChanged(new InteractingChanged(player, monster));
|
||||
plugin.onGameTick(new GameTick());
|
||||
InteractingChanged event = InteractingChanged.INSTANCE;
|
||||
event.setSource(player);
|
||||
event.setTarget(monster);
|
||||
plugin.onInteractingChanged(event);
|
||||
plugin.onGameTick(GameTick.INSTANCE);
|
||||
when(player.getInteracting()).thenReturn(null);
|
||||
plugin.onInteractingChanged(new InteractingChanged(player, null));
|
||||
plugin.onGameTick(new GameTick());
|
||||
event.setSource(player);
|
||||
event.setTarget(null);
|
||||
plugin.onInteractingChanged(event);
|
||||
plugin.onGameTick(GameTick.INSTANCE);
|
||||
verify(notifier).notify("[" + PLAYER_NAME + "] is now out of combat!");
|
||||
}
|
||||
|
||||
@@ -202,27 +207,37 @@ public class IdleNotifierPluginTest
|
||||
public void checkCombatReset()
|
||||
{
|
||||
when(player.getInteracting()).thenReturn(monster);
|
||||
plugin.onInteractingChanged(new InteractingChanged(player, monster));
|
||||
plugin.onGameTick(new GameTick());
|
||||
InteractingChanged event = InteractingChanged.INSTANCE;
|
||||
event.setSource(player);
|
||||
event.setTarget(monster);
|
||||
plugin.onInteractingChanged(event);
|
||||
plugin.onGameTick(GameTick.INSTANCE);
|
||||
when(player.getInteracting()).thenReturn(randomEvent);
|
||||
plugin.onInteractingChanged(new InteractingChanged(player, randomEvent));
|
||||
plugin.onGameTick(new GameTick());
|
||||
event.setSource(player);
|
||||
event.setTarget(randomEvent);
|
||||
plugin.onInteractingChanged(event);
|
||||
plugin.onGameTick(GameTick.INSTANCE);
|
||||
when(player.getInteracting()).thenReturn(null);
|
||||
plugin.onInteractingChanged(new InteractingChanged(player, null));
|
||||
plugin.onGameTick(new GameTick());
|
||||
event.setSource(player);
|
||||
event.setTarget(null);
|
||||
plugin.onInteractingChanged(event);
|
||||
plugin.onGameTick(GameTick.INSTANCE);
|
||||
verify(notifier, times(0)).notify(any());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkCombatLogout()
|
||||
{
|
||||
plugin.onInteractingChanged(new InteractingChanged(player, monster));
|
||||
InteractingChanged event = InteractingChanged.INSTANCE;
|
||||
event.setSource(player);
|
||||
event.setTarget(monster);
|
||||
plugin.onInteractingChanged(event);
|
||||
when(player.getInteracting()).thenReturn(monster);
|
||||
plugin.onGameTick(new GameTick());
|
||||
plugin.onGameTick(GameTick.INSTANCE);
|
||||
|
||||
// Logout
|
||||
when(client.getGameState()).thenReturn(GameState.LOGIN_SCREEN);
|
||||
GameStateChanged gameStateChanged = new GameStateChanged();
|
||||
GameStateChanged gameStateChanged = GameStateChanged.INSTANCE;
|
||||
gameStateChanged.setGameState(GameState.LOGIN_SCREEN);
|
||||
plugin.onGameStateChanged(gameStateChanged);
|
||||
|
||||
@@ -233,8 +248,10 @@ public class IdleNotifierPluginTest
|
||||
|
||||
// Tick
|
||||
when(player.getInteracting()).thenReturn(null);
|
||||
plugin.onInteractingChanged(new InteractingChanged(player, null));
|
||||
plugin.onGameTick(new GameTick());
|
||||
event.setSource(player);
|
||||
event.setTarget(null);
|
||||
plugin.onInteractingChanged(event);
|
||||
plugin.onGameTick(GameTick.INSTANCE);
|
||||
verify(notifier, times(0)).notify(any());
|
||||
}
|
||||
|
||||
@@ -245,11 +262,11 @@ public class IdleNotifierPluginTest
|
||||
when(client.getMouseIdleTicks()).thenReturn(80_000);
|
||||
|
||||
// But player is being damaged (is in combat)
|
||||
final HitsplatApplied hitsplatApplied = new HitsplatApplied();
|
||||
final HitsplatApplied hitsplatApplied = HitsplatApplied.INSTANCE;
|
||||
hitsplatApplied.setActor(player);
|
||||
hitsplatApplied.setHitsplat(new Hitsplat(Hitsplat.HitsplatType.DAMAGE, 0, 0));
|
||||
plugin.onHitsplatApplied(hitsplatApplied);
|
||||
plugin.onGameTick(new GameTick());
|
||||
plugin.onGameTick(GameTick.INSTANCE);
|
||||
verify(notifier, times(0)).notify(any());
|
||||
}
|
||||
|
||||
@@ -262,8 +279,8 @@ public class IdleNotifierPluginTest
|
||||
when(client.getKeyboardIdleTicks()).thenReturn(80_000);
|
||||
when(client.getMouseIdleTicks()).thenReturn(14_500);
|
||||
|
||||
plugin.onGameTick(new GameTick());
|
||||
plugin.onGameTick(new GameTick());
|
||||
plugin.onGameTick(GameTick.INSTANCE);
|
||||
plugin.onGameTick(GameTick.INSTANCE);
|
||||
verify(notifier, times(1)).notify(any());
|
||||
}
|
||||
|
||||
@@ -273,11 +290,11 @@ public class IdleNotifierPluginTest
|
||||
when(config.getSpecEnergyThreshold()).thenReturn(50);
|
||||
|
||||
when(client.getVar(Matchers.eq(VarPlayer.SPECIAL_ATTACK_PERCENT))).thenReturn(400); // 40%
|
||||
plugin.onGameTick(new GameTick()); // once to set lastSpecEnergy to 400
|
||||
plugin.onGameTick(GameTick.INSTANCE); // once to set lastSpecEnergy to 400
|
||||
verify(notifier, never()).notify(any());
|
||||
|
||||
when(client.getVar(Matchers.eq(VarPlayer.SPECIAL_ATTACK_PERCENT))).thenReturn(500); // 50%
|
||||
plugin.onGameTick(new GameTick());
|
||||
plugin.onGameTick(GameTick.INSTANCE);
|
||||
verify(notifier).notify(Matchers.eq("[" + PLAYER_NAME + "] has restored spec energy!"));
|
||||
}
|
||||
}
|
||||
@@ -115,13 +115,13 @@ public class MotherlodePluginTest
|
||||
public void testOreCounter()
|
||||
{
|
||||
// set inMlm
|
||||
GameStateChanged gameStateChanged = new GameStateChanged();
|
||||
GameStateChanged gameStateChanged = GameStateChanged.INSTANCE;
|
||||
gameStateChanged.setGameState(GameState.LOGGED_IN);
|
||||
motherlodePlugin.onGameStateChanged(gameStateChanged);
|
||||
|
||||
// Initial sack count
|
||||
when(client.getVar(Varbits.SACK_NUMBER)).thenReturn(42);
|
||||
motherlodePlugin.onVarbitChanged(new VarbitChanged());
|
||||
motherlodePlugin.onVarbitChanged(VarbitChanged.INSTANCE);
|
||||
|
||||
// Create before inventory
|
||||
ItemContainer inventory = mock(ItemContainer.class);
|
||||
@@ -140,7 +140,7 @@ public class MotherlodePluginTest
|
||||
|
||||
// Withdraw 20
|
||||
when(client.getVar(Varbits.SACK_NUMBER)).thenReturn(22);
|
||||
motherlodePlugin.onVarbitChanged(new VarbitChanged());
|
||||
motherlodePlugin.onVarbitChanged(VarbitChanged.INSTANCE);
|
||||
|
||||
inventory = mock(ItemContainer.class);
|
||||
// +1 rune, +4 nugget, +2 coal, +1 addy
|
||||
@@ -162,7 +162,9 @@ public class MotherlodePluginTest
|
||||
when(client.getItemContainer(InventoryID.INVENTORY)).thenReturn(inventory);
|
||||
|
||||
// Trigger comparison
|
||||
motherlodePlugin.onItemContainerChanged(new ItemContainerChanged(inventory));
|
||||
ItemContainerChanged event = ItemContainerChanged.INSTANCE;
|
||||
event.setItemContainer(inventory);
|
||||
motherlodePlugin.onItemContainerChanged(event);
|
||||
|
||||
verify(motherlodeSession).updateOreFound(ItemID.RUNITE_ORE, 1);
|
||||
verify(motherlodeSession).updateOreFound(ItemID.GOLDEN_NUGGET, 4);
|
||||
|
||||
@@ -175,11 +175,11 @@ public class ScreenshotPluginTest
|
||||
|
||||
assertEquals("Hitpoints(99)", screenshotPlugin.parseLevelUpWidget(LEVEL_UP_LEVEL));
|
||||
|
||||
WidgetLoaded event = new WidgetLoaded();
|
||||
WidgetLoaded event = WidgetLoaded.INSTANCE;
|
||||
event.setGroupId(LEVEL_UP_GROUP_ID);
|
||||
screenshotPlugin.onWidgetLoaded(event);
|
||||
|
||||
GameTick tick = new GameTick();
|
||||
GameTick tick = GameTick.INSTANCE;
|
||||
screenshotPlugin.onGameTick(tick);
|
||||
|
||||
verify(drawManager).requestNextFrameListener(Matchers.any(Consumer.class));
|
||||
@@ -198,11 +198,11 @@ public class ScreenshotPluginTest
|
||||
|
||||
assertEquals("Firemaking(9)", screenshotPlugin.parseLevelUpWidget(LEVEL_UP_LEVEL));
|
||||
|
||||
WidgetLoaded event = new WidgetLoaded();
|
||||
WidgetLoaded event = WidgetLoaded.INSTANCE;
|
||||
event.setGroupId(LEVEL_UP_GROUP_ID);
|
||||
screenshotPlugin.onWidgetLoaded(event);
|
||||
|
||||
GameTick tick = new GameTick();
|
||||
GameTick tick = GameTick.INSTANCE;
|
||||
screenshotPlugin.onGameTick(tick);
|
||||
|
||||
verify(drawManager).requestNextFrameListener(Matchers.any(Consumer.class));
|
||||
@@ -221,11 +221,11 @@ public class ScreenshotPluginTest
|
||||
|
||||
assertEquals("Attack(70)", screenshotPlugin.parseLevelUpWidget(LEVEL_UP_LEVEL));
|
||||
|
||||
WidgetLoaded event = new WidgetLoaded();
|
||||
WidgetLoaded event = WidgetLoaded.INSTANCE;
|
||||
event.setGroupId(LEVEL_UP_GROUP_ID);
|
||||
screenshotPlugin.onWidgetLoaded(event);
|
||||
|
||||
GameTick tick = new GameTick();
|
||||
GameTick tick = GameTick.INSTANCE;
|
||||
screenshotPlugin.onGameTick(tick);
|
||||
|
||||
verify(drawManager).requestNextFrameListener(Matchers.any(Consumer.class));
|
||||
@@ -244,11 +244,11 @@ public class ScreenshotPluginTest
|
||||
|
||||
assertEquals("Hunter(2)", screenshotPlugin.parseLevelUpWidget(DIALOG_SPRITE_TEXT));
|
||||
|
||||
WidgetLoaded event = new WidgetLoaded();
|
||||
WidgetLoaded event = WidgetLoaded.INSTANCE;
|
||||
event.setGroupId(DIALOG_SPRITE_GROUP_ID);
|
||||
screenshotPlugin.onWidgetLoaded(event);
|
||||
|
||||
GameTick tick = new GameTick();
|
||||
GameTick tick = GameTick.INSTANCE;
|
||||
screenshotPlugin.onGameTick(tick);
|
||||
|
||||
verify(drawManager).requestNextFrameListener(Matchers.any(Consumer.class));
|
||||
|
||||
@@ -155,7 +155,7 @@ public class SlayerPluginTest
|
||||
Widget npcDialog = mock(Widget.class);
|
||||
when(npcDialog.getText()).thenReturn(TASK_NEW);
|
||||
when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog);
|
||||
slayerPlugin.onGameTick(new GameTick());
|
||||
slayerPlugin.onGameTick(GameTick.INSTANCE);
|
||||
|
||||
assertEquals("Suqahs", slayerPlugin.getCurrentTask().getTaskName());
|
||||
assertEquals(231, slayerPlugin.getCurrentTask().getAmount());
|
||||
@@ -167,7 +167,7 @@ public class SlayerPluginTest
|
||||
Widget npcDialog = mock(Widget.class);
|
||||
when(npcDialog.getText()).thenReturn(TASK_NEW_KONAR);
|
||||
when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog);
|
||||
slayerPlugin.onGameTick(new GameTick());
|
||||
slayerPlugin.onGameTick(GameTick.INSTANCE);
|
||||
|
||||
assertEquals("Wyrms", slayerPlugin.getCurrentTask().getTaskName());
|
||||
assertEquals(147, slayerPlugin.getCurrentTask().getAmount());
|
||||
@@ -180,7 +180,7 @@ public class SlayerPluginTest
|
||||
Widget npcDialog = mock(Widget.class);
|
||||
when(npcDialog.getText()).thenReturn(TASK_NEW_KONAR_2);
|
||||
when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog);
|
||||
slayerPlugin.onGameTick(new GameTick());
|
||||
slayerPlugin.onGameTick(GameTick.INSTANCE);
|
||||
|
||||
assertEquals("Hellhounds", slayerPlugin.getCurrentTask().getTaskName());
|
||||
assertEquals(142, slayerPlugin.getCurrentTask().getAmount());
|
||||
@@ -193,7 +193,7 @@ public class SlayerPluginTest
|
||||
Widget npcDialog = mock(Widget.class);
|
||||
when(npcDialog.getText()).thenReturn(TASK_NEW_KONAR_3);
|
||||
when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog);
|
||||
slayerPlugin.onGameTick(new GameTick());
|
||||
slayerPlugin.onGameTick(GameTick.INSTANCE);
|
||||
|
||||
assertEquals("Trolls", slayerPlugin.getCurrentTask().getTaskName());
|
||||
assertEquals(135, slayerPlugin.getCurrentTask().getAmount());
|
||||
@@ -206,7 +206,7 @@ public class SlayerPluginTest
|
||||
Widget npcDialog = mock(Widget.class);
|
||||
when(npcDialog.getText()).thenReturn(TASK_NEW_FIRST);
|
||||
when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog);
|
||||
slayerPlugin.onGameTick(new GameTick());
|
||||
slayerPlugin.onGameTick(GameTick.INSTANCE);
|
||||
|
||||
assertEquals("goblins", slayerPlugin.getCurrentTask().getTaskName());
|
||||
assertEquals(17, slayerPlugin.getCurrentTask().getAmount());
|
||||
@@ -218,7 +218,7 @@ public class SlayerPluginTest
|
||||
Widget npcDialog = mock(Widget.class);
|
||||
when(npcDialog.getText()).thenReturn(TASK_NEW_NPC_CONTACT);
|
||||
when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog);
|
||||
slayerPlugin.onGameTick(new GameTick());
|
||||
slayerPlugin.onGameTick(GameTick.INSTANCE);
|
||||
|
||||
assertEquals("Suqahs", slayerPlugin.getCurrentTask().getTaskName());
|
||||
assertEquals(211, slayerPlugin.getCurrentTask().getAmount());
|
||||
@@ -230,7 +230,7 @@ public class SlayerPluginTest
|
||||
Widget npcDialog = mock(Widget.class);
|
||||
when(npcDialog.getText()).thenReturn(TASK_BOSS_NEW);
|
||||
when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog);
|
||||
slayerPlugin.onGameTick(new GameTick());
|
||||
slayerPlugin.onGameTick(GameTick.INSTANCE);
|
||||
|
||||
assertEquals("Vet'ion", slayerPlugin.getCurrentTask().getTaskName());
|
||||
assertEquals(3, slayerPlugin.getCurrentTask().getAmount());
|
||||
@@ -243,7 +243,7 @@ public class SlayerPluginTest
|
||||
Widget npcDialog = mock(Widget.class);
|
||||
when(npcDialog.getText()).thenReturn(TASK_BOSS_NEW_THE);
|
||||
when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog);
|
||||
slayerPlugin.onGameTick(new GameTick());
|
||||
slayerPlugin.onGameTick(GameTick.INSTANCE);
|
||||
|
||||
assertEquals("Chaos Elemental", slayerPlugin.getCurrentTask().getTaskName());
|
||||
assertEquals(3, slayerPlugin.getCurrentTask().getAmount());
|
||||
@@ -296,7 +296,7 @@ public class SlayerPluginTest
|
||||
Widget npcDialog = mock(Widget.class);
|
||||
when(npcDialog.getText()).thenReturn(TASK_EXISTING);
|
||||
when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog);
|
||||
slayerPlugin.onGameTick(new GameTick());
|
||||
slayerPlugin.onGameTick(GameTick.INSTANCE);
|
||||
|
||||
assertEquals("suqahs", slayerPlugin.getCurrentTask().getTaskName());
|
||||
assertEquals(222, slayerPlugin.getCurrentTask().getAmount());
|
||||
@@ -331,7 +331,7 @@ public class SlayerPluginTest
|
||||
|
||||
ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "Perterter", TASK_POINTS, null, 0);
|
||||
slayerPlugin.onChatMessage(chatMessageEvent);
|
||||
VarbitChanged varbitChanged = new VarbitChanged();
|
||||
VarbitChanged varbitChanged = VarbitChanged.INSTANCE;
|
||||
slayerPlugin.onVarbitChanged(varbitChanged);
|
||||
|
||||
assertEquals(9, slayerPlugin.getStreak());
|
||||
@@ -347,7 +347,7 @@ public class SlayerPluginTest
|
||||
|
||||
ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "Perterter", TASK_LARGE_STREAK, null, 0);
|
||||
slayerPlugin.onChatMessage(chatMessageEvent);
|
||||
VarbitChanged varbitChanged = new VarbitChanged();
|
||||
VarbitChanged varbitChanged = VarbitChanged.INSTANCE;
|
||||
slayerPlugin.onVarbitChanged(varbitChanged);
|
||||
|
||||
assertEquals(2465, slayerPlugin.getStreak());
|
||||
@@ -408,7 +408,7 @@ public class SlayerPluginTest
|
||||
when(slayerConfig.taskCommand()).thenReturn(true);
|
||||
when(chatClient.getTask(anyString())).thenReturn(task);
|
||||
|
||||
ChatMessage setMessage = new ChatMessage();
|
||||
ChatMessage setMessage = ChatMessage.INSTANCE;
|
||||
setMessage.setType(ChatMessageType.PUBLICCHAT);
|
||||
setMessage.setName("Adam");
|
||||
setMessage.setMessageNode(mock(MessageNode.class));
|
||||
@@ -430,7 +430,7 @@ public class SlayerPluginTest
|
||||
when(slayerConfig.taskCommand()).thenReturn(true);
|
||||
when(chatClient.getTask(anyString())).thenReturn(task);
|
||||
|
||||
ChatMessage chatMessage = new ChatMessage();
|
||||
ChatMessage chatMessage = ChatMessage.INSTANCE;
|
||||
chatMessage.setType(ChatMessageType.PUBLICCHAT);
|
||||
chatMessage.setName("Adam");
|
||||
chatMessage.setMessageNode(mock(MessageNode.class));
|
||||
|
||||
@@ -186,7 +186,7 @@ public abstract class RSActorMixin implements RSActor
|
||||
@Inject
|
||||
public void animationChanged(int idx)
|
||||
{
|
||||
AnimationChanged animationChange = new AnimationChanged();
|
||||
AnimationChanged animationChange = AnimationChanged.INSTANCE;
|
||||
animationChange.setActor(this);
|
||||
client.getCallbacks().post(animationChange);
|
||||
}
|
||||
@@ -195,7 +195,7 @@ public abstract class RSActorMixin implements RSActor
|
||||
@Inject
|
||||
public void spotAnimationChanged(int idx)
|
||||
{
|
||||
SpotAnimationChanged spotAnimationChanged = new SpotAnimationChanged();
|
||||
SpotAnimationChanged spotAnimationChanged = SpotAnimationChanged.INSTANCE;
|
||||
spotAnimationChanged.setActor(this);
|
||||
client.getCallbacks().post(spotAnimationChanged);
|
||||
}
|
||||
@@ -204,7 +204,9 @@ public abstract class RSActorMixin implements RSActor
|
||||
@Inject
|
||||
public void interactingChanged(int idx)
|
||||
{
|
||||
InteractingChanged interactingChanged = new InteractingChanged(this, getInteracting());
|
||||
InteractingChanged interactingChanged = InteractingChanged.INSTANCE;
|
||||
interactingChanged.setSource(this);
|
||||
interactingChanged.setTarget(getInteracting());
|
||||
client.getCallbacks().post(interactingChanged);
|
||||
}
|
||||
|
||||
@@ -215,7 +217,10 @@ public abstract class RSActorMixin implements RSActor
|
||||
String overheadText = getOverheadText();
|
||||
if (overheadText != null)
|
||||
{
|
||||
OverheadTextChanged overheadTextChanged = new OverheadTextChanged(this, overheadText);
|
||||
|
||||
OverheadTextChanged overheadTextChanged = OverheadTextChanged.INSTANCE;
|
||||
overheadTextChanged.setActor(this);
|
||||
overheadTextChanged.setOverheadText(overheadText);
|
||||
client.getCallbacks().post(overheadTextChanged);
|
||||
}
|
||||
}
|
||||
@@ -251,7 +256,7 @@ public abstract class RSActorMixin implements RSActor
|
||||
{
|
||||
client.getLogger().debug("You died!");
|
||||
|
||||
LocalPlayerDeath event = new LocalPlayerDeath();
|
||||
LocalPlayerDeath event = LocalPlayerDeath.INSTANCE;
|
||||
client.getCallbacks().post(event);
|
||||
}
|
||||
else if (this instanceof RSNPC)
|
||||
@@ -278,7 +283,7 @@ public abstract class RSActorMixin implements RSActor
|
||||
public void applyActorHitsplat(int type, int value, int var3, int var4, int gameCycle, int duration)
|
||||
{
|
||||
final Hitsplat hitsplat = new Hitsplat(Hitsplat.HitsplatType.fromInteger(type), value, gameCycle + duration);
|
||||
final HitsplatApplied event = new HitsplatApplied();
|
||||
final HitsplatApplied event = HitsplatApplied.INSTANCE;
|
||||
event.setActor(this);
|
||||
event.setHitsplat(hitsplat);
|
||||
client.getCallbacks().post(event);
|
||||
|
||||
@@ -27,7 +27,8 @@ public abstract class RSClanChatMixin implements RSClanChat
|
||||
return;
|
||||
}
|
||||
|
||||
ClanMemberJoined event = new ClanMemberJoined(member);
|
||||
ClanMemberJoined event = ClanMemberJoined.INSTANCE;
|
||||
event.setMember(member);
|
||||
client.getCallbacks().postDeferred(event);
|
||||
}
|
||||
|
||||
@@ -41,7 +42,8 @@ public abstract class RSClanChatMixin implements RSClanChat
|
||||
return;
|
||||
}
|
||||
|
||||
ClanMemberLeft event = new ClanMemberLeft(member);
|
||||
ClanMemberLeft event = ClanMemberLeft.INSTANCE;
|
||||
event.setMember(member);
|
||||
client.getCallbacks().postDeferred(event);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -867,7 +867,7 @@ public abstract class RSClientMixin implements RSClient
|
||||
@Inject
|
||||
public static void draggingWidgetChanged(int idx)
|
||||
{
|
||||
DraggingWidgetChanged draggingWidgetChanged = new DraggingWidgetChanged();
|
||||
DraggingWidgetChanged draggingWidgetChanged = DraggingWidgetChanged.INSTANCE;
|
||||
draggingWidgetChanged.setDraggingWidget(client.isDraggingWidget());
|
||||
client.getCallbacks().post(draggingWidgetChanged);
|
||||
}
|
||||
@@ -905,7 +905,7 @@ public abstract class RSClientMixin implements RSClient
|
||||
|
||||
if (loaded)
|
||||
{
|
||||
WidgetLoaded event = new WidgetLoaded();
|
||||
WidgetLoaded event = WidgetLoaded.INSTANCE;
|
||||
event.setGroupId(groupId);
|
||||
client.getCallbacks().post(event);
|
||||
}
|
||||
@@ -937,7 +937,7 @@ public abstract class RSClientMixin implements RSClient
|
||||
@Inject
|
||||
public static void experiencedChanged(int idx)
|
||||
{
|
||||
ExperienceChanged experienceChanged = new ExperienceChanged();
|
||||
ExperienceChanged experienceChanged = ExperienceChanged.INSTANCE;
|
||||
Skill[] possibleSkills = Skill.values();
|
||||
|
||||
// We subtract one here because 'Overall' isn't considered a skill that's updated.
|
||||
@@ -958,7 +958,7 @@ public abstract class RSClientMixin implements RSClient
|
||||
if (idx >= 0 && idx < skills.length - 1)
|
||||
{
|
||||
Skill updatedSkill = skills[idx];
|
||||
BoostedLevelChanged boostedLevelChanged = new BoostedLevelChanged();
|
||||
BoostedLevelChanged boostedLevelChanged = BoostedLevelChanged.INSTANCE;
|
||||
boostedLevelChanged.setSkill(updatedSkill);
|
||||
client.getCallbacks().post(boostedLevelChanged);
|
||||
}
|
||||
@@ -977,7 +977,7 @@ public abstract class RSClientMixin implements RSClient
|
||||
client.getPlayerMenuTypes()[idx] = playerAction.getId();
|
||||
}
|
||||
|
||||
PlayerMenuOptionsChanged optionsChanged = new PlayerMenuOptionsChanged();
|
||||
PlayerMenuOptionsChanged optionsChanged = PlayerMenuOptionsChanged.INSTANCE;
|
||||
optionsChanged.setIndex(idx);
|
||||
client.getCallbacks().post(optionsChanged);
|
||||
}
|
||||
@@ -986,7 +986,7 @@ public abstract class RSClientMixin implements RSClient
|
||||
@Inject
|
||||
public static void gameStateChanged(int idx)
|
||||
{
|
||||
GameStateChanged gameStateChange = new GameStateChanged();
|
||||
GameStateChanged gameStateChange = GameStateChanged.INSTANCE;
|
||||
gameStateChange.setGameState(client.getGameState());
|
||||
client.getCallbacks().post(gameStateChange);
|
||||
}
|
||||
@@ -1007,7 +1007,9 @@ public abstract class RSClientMixin implements RSClient
|
||||
{
|
||||
npc.setIndex(idx);
|
||||
|
||||
client.getCallbacks().postDeferred(new NpcSpawned(npc));
|
||||
NpcSpawned npcSpawned = NpcSpawned.INSTANCE;
|
||||
npcSpawned.setNpc(npc);
|
||||
client.getCallbacks().postDeferred(npcSpawned);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1027,11 +1029,15 @@ public abstract class RSClientMixin implements RSClient
|
||||
|
||||
if (oldPlayer != null)
|
||||
{
|
||||
client.getCallbacks().post(new PlayerDespawned(oldPlayer));
|
||||
PlayerDespawned playerDespawned = PlayerDespawned.INSTANCE;
|
||||
playerDespawned.setPlayer(oldPlayer);
|
||||
client.getCallbacks().post(playerDespawned);
|
||||
}
|
||||
if (player != null)
|
||||
{
|
||||
client.getCallbacks().postDeferred(new PlayerSpawned(player));
|
||||
PlayerSpawned playerSpawned = PlayerSpawned.INSTANCE;
|
||||
playerSpawned.setPlayer(player);
|
||||
client.getCallbacks().postDeferred(playerSpawned);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1051,7 +1057,7 @@ public abstract class RSClientMixin implements RSClient
|
||||
return;
|
||||
}
|
||||
|
||||
GrandExchangeOfferChanged offerChangedEvent = new GrandExchangeOfferChanged();
|
||||
GrandExchangeOfferChanged offerChangedEvent = GrandExchangeOfferChanged.INSTANCE;
|
||||
offerChangedEvent.setOffer(internalOffer);
|
||||
offerChangedEvent.setSlot(idx);
|
||||
client.getCallbacks().post(offerChangedEvent);
|
||||
@@ -1061,7 +1067,7 @@ public abstract class RSClientMixin implements RSClient
|
||||
@Inject
|
||||
public static void settingsChanged(int idx)
|
||||
{
|
||||
VarbitChanged varbitChanged = new VarbitChanged();
|
||||
VarbitChanged varbitChanged = VarbitChanged.INSTANCE;
|
||||
varbitChanged.setIndex(idx);
|
||||
client.getCallbacks().post(varbitChanged);
|
||||
}
|
||||
@@ -1075,7 +1081,7 @@ public abstract class RSClientMixin implements RSClient
|
||||
|
||||
if (oldIsResized != isResized)
|
||||
{
|
||||
ResizeableChanged resizeableChanged = new ResizeableChanged();
|
||||
ResizeableChanged resizeableChanged = ResizeableChanged.INSTANCE;
|
||||
resizeableChanged.setResized(isResized);
|
||||
client.getCallbacks().post(resizeableChanged);
|
||||
|
||||
@@ -1087,7 +1093,9 @@ public abstract class RSClientMixin implements RSClient
|
||||
@Inject
|
||||
public static void clanMemberManagerChanged(int idx)
|
||||
{
|
||||
client.getCallbacks().post(new ClanChanged(client.getClanMemberManager() != null));
|
||||
ClanChanged event = ClanChanged.INSTANCE;
|
||||
event.setJoined(client.getClanMemberManager() != null);
|
||||
client.getCallbacks().post(event);
|
||||
}
|
||||
|
||||
@FieldHook("canvasWidth")
|
||||
@@ -1271,7 +1279,7 @@ public abstract class RSClientMixin implements RSClient
|
||||
@Inject
|
||||
public static void onUsernameChanged(int idx)
|
||||
{
|
||||
client.getCallbacks().post(new UsernameChanged());
|
||||
client.getCallbacks().post(UsernameChanged.INSTANCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1300,7 +1308,7 @@ public abstract class RSClientMixin implements RSClient
|
||||
@MethodHook("openMenu")
|
||||
public void menuOpened(int var1, int var2)
|
||||
{
|
||||
final MenuOpened event = new MenuOpened();
|
||||
final MenuOpened event = MenuOpened.INSTANCE;
|
||||
event.setMenuEntries(getMenuEntries());
|
||||
callbacks.post(event);
|
||||
}
|
||||
@@ -1513,7 +1521,7 @@ public abstract class RSClientMixin implements RSClient
|
||||
@FieldHook("cycleCntr")
|
||||
public static void onCycleCntrChanged(int idx)
|
||||
{
|
||||
client.getCallbacks().post(new ClientTick());
|
||||
client.getCallbacks().post(ClientTick.INSTANCE);
|
||||
}
|
||||
|
||||
@Copy("shouldLeftClickOpenMenu")
|
||||
@@ -1530,7 +1538,7 @@ public abstract class RSClientMixin implements RSClient
|
||||
return true;
|
||||
}
|
||||
|
||||
MenuShouldLeftClick menuShouldLeftClick = new MenuShouldLeftClick();
|
||||
MenuShouldLeftClick menuShouldLeftClick = MenuShouldLeftClick.INSTANCE;
|
||||
client.getCallbacks().post(menuShouldLeftClick);
|
||||
|
||||
if (menuShouldLeftClick.isForceRightClick())
|
||||
|
||||
@@ -18,7 +18,8 @@ public abstract class RSFriendSystemMixin implements RSFriendSystem
|
||||
@Inject
|
||||
public void rl$removeFriend(String friendName)
|
||||
{
|
||||
RemovedFriend removedFriend = new RemovedFriend(friendName);
|
||||
RemovedFriend removedFriend = RemovedFriend.INSTANCE;
|
||||
removedFriend.setName(friendName);
|
||||
client.getCallbacks().post(removedFriend);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,8 @@ public abstract class RSGraphicsObjectMixin implements RSGraphicsObject
|
||||
@Inject
|
||||
RSGraphicsObjectMixin()
|
||||
{
|
||||
final GraphicsObjectCreated event = new GraphicsObjectCreated(this);
|
||||
final GraphicsObjectCreated event = GraphicsObjectCreated.INSTANCE;
|
||||
event.setGraphicsObject(this);
|
||||
client.getCallbacks().post(event);
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,12 @@ public abstract class RSGroundItemMixin implements RSGroundItem
|
||||
{
|
||||
client.getLogger().debug("Item quantity changed: {} ({} -> {})", getId(), getQuantity(), quantity);
|
||||
|
||||
ItemQuantityChanged itemQuantityChanged = new ItemQuantityChanged(this, getTile(), getQuantity(), quantity);
|
||||
ItemQuantityChanged itemQuantityChanged = ItemQuantityChanged.INSTANCE;
|
||||
itemQuantityChanged.setItem(this);
|
||||
itemQuantityChanged.setTile(getTile());
|
||||
itemQuantityChanged.setOldQuantity(getQuantity());
|
||||
itemQuantityChanged.setNewQuantity(quantity);
|
||||
|
||||
client.getCallbacks().post(itemQuantityChanged);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ public abstract class RSHealthBarDefinitionMixin implements RSHealthBarDefinitio
|
||||
@Inject
|
||||
public void onRead(RSBuffer buffer)
|
||||
{
|
||||
PostHealthBar postHealthBar = new PostHealthBar();
|
||||
PostHealthBar postHealthBar = PostHealthBar.INSTANCE;
|
||||
postHealthBar.setHealthBar(this);
|
||||
client.getCallbacks().post(postHealthBar);
|
||||
}
|
||||
|
||||
@@ -75,7 +75,8 @@ public abstract class RSItemContainerMixin implements RSItemContainer
|
||||
|
||||
rl$lastCycle = cycle;
|
||||
|
||||
ItemContainerChanged event = new ItemContainerChanged(this);
|
||||
ItemContainerChanged event = ItemContainerChanged.INSTANCE;
|
||||
event.setItemContainer(this);
|
||||
client.getCallbacks().postDeferred(event);
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ public abstract class RSItemDefinitionMixin implements RSItemDefinition
|
||||
@MethodHook(value = "post", end = true)
|
||||
public void post()
|
||||
{
|
||||
final PostItemDefinition event = new PostItemDefinition();
|
||||
final PostItemDefinition event = PostItemDefinition.INSTANCE;
|
||||
event.setItemDefinition(this);
|
||||
client.getCallbacks().post(event);
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ public abstract class RSNPCDefinitionMixin implements RSNPCDefinition
|
||||
@Inject
|
||||
public void actionsHook(int idx)
|
||||
{
|
||||
NpcActionChanged npcActionChanged = new NpcActionChanged();
|
||||
NpcActionChanged npcActionChanged = NpcActionChanged.INSTANCE;
|
||||
npcActionChanged.setNpcDefinition(this);
|
||||
npcActionChanged.setIdx(idx);
|
||||
client.getCallbacks().post(npcActionChanged);
|
||||
|
||||
@@ -109,7 +109,9 @@ public abstract class RSNPCMixin implements RSNPC
|
||||
{
|
||||
if (composition == null)
|
||||
{
|
||||
client.getCallbacks().post(new NpcDespawned(this));
|
||||
NpcDespawned event = NpcDespawned.INSTANCE;
|
||||
event.setNpc(this);
|
||||
client.getCallbacks().post(event);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ public abstract class RSProjectileMixin implements RSProjectile
|
||||
@Inject
|
||||
RSProjectileMixin()
|
||||
{
|
||||
final ProjectileSpawned projectileSpawned = new ProjectileSpawned();
|
||||
final ProjectileSpawned projectileSpawned = ProjectileSpawned.INSTANCE;
|
||||
projectileSpawned.setProjectile(this);
|
||||
client.getCallbacks().post(projectileSpawned);
|
||||
}
|
||||
@@ -105,7 +105,7 @@ public abstract class RSProjectileMixin implements RSProjectile
|
||||
public void projectileMoved(int targetX, int targetY, int targetZ, int cycle)
|
||||
{
|
||||
final LocalPoint position = new LocalPoint(targetX, targetY);
|
||||
final ProjectileMoved projectileMoved = new ProjectileMoved();
|
||||
final ProjectileMoved projectileMoved = ProjectileMoved.INSTANCE;
|
||||
projectileMoved.setProjectile(this);
|
||||
projectileMoved.setPosition(position);
|
||||
projectileMoved.setZ(targetZ);
|
||||
|
||||
@@ -126,21 +126,21 @@ public abstract class RSTileMixin implements RSTile
|
||||
|
||||
if (current == null && previous != null)
|
||||
{
|
||||
WallObjectDespawned wallObjectDespawned = new WallObjectDespawned();
|
||||
WallObjectDespawned wallObjectDespawned = WallObjectDespawned.INSTANCE;
|
||||
wallObjectDespawned.setTile(this);
|
||||
wallObjectDespawned.setWallObject(previous);
|
||||
client.getCallbacks().post(wallObjectDespawned);
|
||||
}
|
||||
else if (current != null && previous == null)
|
||||
{
|
||||
WallObjectSpawned wallObjectSpawned = new WallObjectSpawned();
|
||||
WallObjectSpawned wallObjectSpawned = WallObjectSpawned.INSTANCE;
|
||||
wallObjectSpawned.setTile(this);
|
||||
wallObjectSpawned.setWallObject(current);
|
||||
client.getCallbacks().post(wallObjectSpawned);
|
||||
}
|
||||
else if (current != null)
|
||||
{
|
||||
WallObjectChanged wallObjectChanged = new WallObjectChanged();
|
||||
WallObjectChanged wallObjectChanged = WallObjectChanged.INSTANCE;
|
||||
wallObjectChanged.setTile(this);
|
||||
wallObjectChanged.setPrevious(previous);
|
||||
wallObjectChanged.setWallObject(current);
|
||||
@@ -159,21 +159,21 @@ public abstract class RSTileMixin implements RSTile
|
||||
|
||||
if (current == null && previous != null)
|
||||
{
|
||||
DecorativeObjectDespawned decorativeObjectDespawned = new DecorativeObjectDespawned();
|
||||
DecorativeObjectDespawned decorativeObjectDespawned = DecorativeObjectDespawned.INSTANCE;
|
||||
decorativeObjectDespawned.setTile(this);
|
||||
decorativeObjectDespawned.setDecorativeObject(previous);
|
||||
client.getCallbacks().post(decorativeObjectDespawned);
|
||||
}
|
||||
else if (current != null && previous == null)
|
||||
{
|
||||
DecorativeObjectSpawned decorativeObjectSpawned = new DecorativeObjectSpawned();
|
||||
DecorativeObjectSpawned decorativeObjectSpawned = DecorativeObjectSpawned.INSTANCE;
|
||||
decorativeObjectSpawned.setTile(this);
|
||||
decorativeObjectSpawned.setDecorativeObject(current);
|
||||
client.getCallbacks().post(decorativeObjectSpawned);
|
||||
}
|
||||
else if (current != null)
|
||||
{
|
||||
DecorativeObjectChanged decorativeObjectChanged = new DecorativeObjectChanged();
|
||||
DecorativeObjectChanged decorativeObjectChanged = DecorativeObjectChanged.INSTANCE;
|
||||
decorativeObjectChanged.setTile(this);
|
||||
decorativeObjectChanged.setPrevious(previous);
|
||||
decorativeObjectChanged.setDecorativeObject(current);
|
||||
@@ -192,21 +192,21 @@ public abstract class RSTileMixin implements RSTile
|
||||
|
||||
if (current == null && previous != null)
|
||||
{
|
||||
GroundObjectDespawned groundObjectDespawned = new GroundObjectDespawned();
|
||||
GroundObjectDespawned groundObjectDespawned = GroundObjectDespawned.INSTANCE;
|
||||
groundObjectDespawned.setTile(this);
|
||||
groundObjectDespawned.setGroundObject(previous);
|
||||
client.getCallbacks().post(groundObjectDespawned);
|
||||
}
|
||||
else if (current != null && previous == null)
|
||||
{
|
||||
GroundObjectSpawned groundObjectSpawned = new GroundObjectSpawned();
|
||||
GroundObjectSpawned groundObjectSpawned = GroundObjectSpawned.INSTANCE;
|
||||
groundObjectSpawned.setTile(this);
|
||||
groundObjectSpawned.setGroundObject(current);
|
||||
client.getCallbacks().post(groundObjectSpawned);
|
||||
}
|
||||
else if (current != null)
|
||||
{
|
||||
GroundObjectChanged groundObjectChanged = new GroundObjectChanged();
|
||||
GroundObjectChanged groundObjectChanged = GroundObjectChanged.INSTANCE;
|
||||
groundObjectChanged.setTile(this);
|
||||
groundObjectChanged.setPrevious(previous);
|
||||
groundObjectChanged.setGroundObject(current);
|
||||
@@ -282,7 +282,7 @@ public abstract class RSTileMixin implements RSTile
|
||||
|
||||
logger.trace("Game object despawn: {}", previous.getId());
|
||||
|
||||
GameObjectDespawned gameObjectDespawned = new GameObjectDespawned();
|
||||
GameObjectDespawned gameObjectDespawned = GameObjectDespawned.INSTANCE;
|
||||
gameObjectDespawned.setTile(this);
|
||||
gameObjectDespawned.setGameObject(previous);
|
||||
client.getCallbacks().post(gameObjectDespawned);
|
||||
@@ -296,7 +296,7 @@ public abstract class RSTileMixin implements RSTile
|
||||
|
||||
logger.trace("Game object spawn: {}", current.getId());
|
||||
|
||||
GameObjectSpawned gameObjectSpawned = new GameObjectSpawned();
|
||||
GameObjectSpawned gameObjectSpawned = GameObjectSpawned.INSTANCE;
|
||||
gameObjectSpawned.setTile(this);
|
||||
gameObjectSpawned.setGameObject(current);
|
||||
client.getCallbacks().post(gameObjectSpawned);
|
||||
@@ -310,7 +310,7 @@ public abstract class RSTileMixin implements RSTile
|
||||
|
||||
logger.trace("Game object change: {} -> {}", previous.getId(), current.getId());
|
||||
|
||||
GameObjectChanged gameObjectsChanged = new GameObjectChanged();
|
||||
GameObjectChanged gameObjectsChanged = GameObjectChanged.INSTANCE;
|
||||
gameObjectsChanged.setTile(this);
|
||||
gameObjectsChanged.setPrevious(previous);
|
||||
gameObjectsChanged.setGameObject(current);
|
||||
@@ -339,7 +339,9 @@ public abstract class RSTileMixin implements RSTile
|
||||
for (RSNode cur = head.getNext(); cur != head; cur = cur.getNext())
|
||||
{
|
||||
RSGroundItem item = (RSGroundItem) cur;
|
||||
ItemDespawned itemDespawned = new ItemDespawned(this, item);
|
||||
ItemDespawned itemDespawned = ItemDespawned.INSTANCE;
|
||||
itemDespawned.setTile(this);
|
||||
itemDespawned.setItem(item);
|
||||
client.getCallbacks().post(itemDespawned);
|
||||
}
|
||||
}
|
||||
@@ -357,7 +359,9 @@ public abstract class RSTileMixin implements RSTile
|
||||
{
|
||||
if (lastUnlink != null)
|
||||
{
|
||||
ItemDespawned itemDespawned = new ItemDespawned(this, lastUnlink);
|
||||
ItemDespawned itemDespawned = ItemDespawned.INSTANCE;
|
||||
itemDespawned.setTile(this);
|
||||
itemDespawned.setItem(lastUnlink);
|
||||
client.getCallbacks().post(itemDespawned);
|
||||
}
|
||||
return;
|
||||
@@ -369,7 +373,9 @@ public abstract class RSTileMixin implements RSTile
|
||||
{
|
||||
if (lastUnlink != null)
|
||||
{
|
||||
ItemDespawned itemDespawned = new ItemDespawned(this, lastUnlink);
|
||||
ItemDespawned itemDespawned = ItemDespawned.INSTANCE;
|
||||
itemDespawned.setTile(this);
|
||||
itemDespawned.setItem(lastUnlink);
|
||||
client.getCallbacks().post(itemDespawned);
|
||||
}
|
||||
return;
|
||||
@@ -402,7 +408,9 @@ public abstract class RSTileMixin implements RSTile
|
||||
|
||||
if (lastUnlink != null && lastUnlink != previous && lastUnlink != next)
|
||||
{
|
||||
ItemDespawned itemDespawned = new ItemDespawned(this, lastUnlink);
|
||||
ItemDespawned itemDespawned = ItemDespawned.INSTANCE;
|
||||
itemDespawned.setTile(this);
|
||||
itemDespawned.setItem(lastUnlink);
|
||||
client.getCallbacks().post(itemDespawned);
|
||||
}
|
||||
|
||||
@@ -417,7 +425,9 @@ public abstract class RSTileMixin implements RSTile
|
||||
item.setX(x);
|
||||
item.setY(y);
|
||||
|
||||
ItemSpawned itemSpawned = new ItemSpawned(this, item);
|
||||
ItemSpawned itemSpawned = ItemSpawned.INSTANCE;
|
||||
itemSpawned.setTile(this);
|
||||
itemSpawned.setItem(item);
|
||||
client.getCallbacks().post(itemSpawned);
|
||||
|
||||
current = forward ? current.getNext() : current.getPrevious();
|
||||
|
||||
@@ -19,13 +19,17 @@ public abstract class RSVarcsMixin implements RSVarcs
|
||||
@Inject
|
||||
public void onVarCIntChanged(int id, int value)
|
||||
{
|
||||
client.getCallbacks().post(new VarClientIntChanged(id));
|
||||
VarClientIntChanged event = VarClientIntChanged.INSTANCE;
|
||||
event.setIndex(id);
|
||||
client.getCallbacks().post(event);
|
||||
}
|
||||
|
||||
@MethodHook(value = "setString", end = true)
|
||||
@Inject
|
||||
public void onVarCStrChanged(int id, String value)
|
||||
{
|
||||
client.getCallbacks().post(new VarClientStrChanged(id));
|
||||
VarClientStrChanged event = VarClientStrChanged.INSTANCE;
|
||||
event.setIndex(id);
|
||||
client.getCallbacks().post(event);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -408,7 +408,7 @@ public abstract class RSWidgetMixin implements RSWidget
|
||||
@Override
|
||||
public void broadcastHidden(boolean hidden)
|
||||
{
|
||||
WidgetHiddenChanged event = new WidgetHiddenChanged();
|
||||
WidgetHiddenChanged event = WidgetHiddenChanged.INSTANCE;
|
||||
event.setWidget(this);
|
||||
event.setHidden(hidden);
|
||||
|
||||
@@ -496,7 +496,7 @@ public abstract class RSWidgetMixin implements RSWidget
|
||||
|
||||
client.getLogger().trace("Posting widget position changed");
|
||||
|
||||
WidgetPositioned widgetPositioned = new WidgetPositioned();
|
||||
WidgetPositioned widgetPositioned = WidgetPositioned.INSTANCE;
|
||||
client.getCallbacks().postDeferred(widgetPositioned);
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,8 @@ public abstract class RSWorldMixin implements RSWorld
|
||||
if (worlds != null && worlds.length > 0 && worlds[worlds.length - 1] == this)
|
||||
{
|
||||
// this is the last world in the list.
|
||||
WorldListLoad worldLoad = new WorldListLoad(worlds);
|
||||
WorldListLoad worldLoad = WorldListLoad.INSTANCE;
|
||||
worldLoad.setWorlds(worlds);
|
||||
client.getCallbacks().post(worldLoad);
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user