Fix up client. (#815)

* Aoe Warnings Fix-Up

* Freeze Timers NPE Fix

* Slayer Chat Lookup NPE && Fixing up Access levels.

* Raids Thieving NPE Fix && Fixing up Access levels.

* Revert "Fix copy paste error"

This reverts commit 26c88101b682eb76b98a8a0d88fc8a47c9f104d3.

* Revert "Fix checkstyle"

This reverts commit abf7fec004148897585bc0389bb5e0420e3d03cb.

* Revert "Convert game thread events to singletons"

This reverts commit b33048d7ee0481b17c5849d2d862e75c91e5a36c.

* Various Fixes
This commit is contained in:
Ganom
2019-06-29 12:31:23 -04:00
committed by Kyleeld
parent d0591362d7
commit 701d809f78
120 changed files with 383 additions and 920 deletions

View File

@@ -51,9 +51,10 @@ public class GraphicID
public static final int IMBUED_HEART = 1316;
public static final int FLYING_FISH = 1387;
public static final int OLM_BURN = 1351;
public static final int OLM_LIGHTNING = 1356;
public static final int OLM_TELEPORT = 1359;
public static final int OLM_HEAL = 1363;
public static final int OLM_CRYSTAL = 1447;
public static final int XERIC_TELEPORT = 1612;
public static final int HYDRA_LIGHTNING = 1666;
}
}

View File

@@ -20,13 +20,6 @@ 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.
*/

View File

@@ -29,13 +29,6 @@ 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;

View File

@@ -29,13 +29,6 @@ import lombok.Data;
@Data
public class BeforeMenuRender
{
public static final BeforeMenuRender INSTANCE = new BeforeMenuRender();
private BeforeMenuRender()
{
// noop
}
private boolean consumed;
public void consume()

View File

@@ -29,10 +29,4 @@ package net.runelite.api.events;
*/
public class BeforeRender
{
public static final BeforeRender INSTANCE = new BeforeRender();
private BeforeRender()
{
// noop
}
}

View File

@@ -44,13 +44,6 @@ 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.
*/

View File

@@ -29,10 +29,4 @@ package net.runelite.api.events;
*/
public class CannonballFired
{
public static final CannonballFired INSTANCE = new CannonballFired();
private CannonballFired()
{
// noop
}
}

View File

@@ -28,6 +28,7 @@ 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.
@@ -39,15 +40,9 @@ import lombok.Data;
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ChatMessage
{
public static final ChatMessage INSTANCE = new ChatMessage();
private ChatMessage()
{
// noop
}
/**
* The underlying MessageNode for the message.
*/

View File

@@ -24,21 +24,14 @@
*/
package net.runelite.api.events;
import lombok.Data;
import lombok.Value;
/**
* An event where the client has joined or left a clan chat.
*/
@Data
@Value
public class ClanChanged
{
public static final ClanChanged INSTANCE = new ClanChanged();
private ClanChanged()
{
// noop
}
/**
* Whether or not the client is now in a clan chat.
*/

View File

@@ -25,18 +25,11 @@
package net.runelite.api.events;
import net.runelite.api.ClanMember;
import lombok.Data;
import lombok.Value;
@Data
@Value
public class ClanMemberJoined
{
public static final ClanMemberJoined INSTANCE = new ClanMemberJoined();
private ClanMemberJoined()
{
// noop
}
/**
* The ClanMember that joined
*/

View File

@@ -25,18 +25,11 @@
package net.runelite.api.events;
import net.runelite.api.ClanMember;
import lombok.Data;
import lombok.Value;
@Data
@Value
public class ClanMemberLeft
{
public static final ClanMemberLeft INSTANCE = new ClanMemberLeft();
private ClanMemberLeft()
{
// noop
}
/**
* The ClanMember that left
*/

View File

@@ -29,10 +29,4 @@ package net.runelite.api.events;
*/
public class ClientTick
{
public static final ClientTick INSTANCE = new ClientTick();
private ClientTick()
{
// noop
}
}

View File

@@ -24,7 +24,7 @@
*/
package net.runelite.api.events;
import lombok.Data;
import lombok.Value;
/**
* An event where a command has been used in the chat.
@@ -41,16 +41,9 @@ import lombok.Data;
* set the command field to an empty string. For example, the message ":: hello world!"
* will set command to "" and arguments to ["hello", "world!"].
*/
@Data
@Value
public class CommandExecuted
{
public static final CommandExecuted INSTANCE = new CommandExecuted();
private CommandExecuted()
{
// noop
}
/**
* The name of the command entered.
*/

View File

@@ -35,13 +35,6 @@ import lombok.Data;
@Data
public class DecorativeObjectChanged
{
public static final DecorativeObjectChanged INSTANCE = new DecorativeObjectChanged();
private DecorativeObjectChanged()
{
// noop
}
/**
* The affected tile.
*/

View File

@@ -35,13 +35,6 @@ import lombok.Data;
@Data
public class DecorativeObjectDespawned
{
public static final DecorativeObjectDespawned INSTANCE = new DecorativeObjectDespawned();
private DecorativeObjectDespawned()
{
// noop
}
/**
* The affected tile.
*/

View File

@@ -34,13 +34,6 @@ import lombok.Data;
@Data
public class DecorativeObjectSpawned
{
public static final DecorativeObjectSpawned INSTANCE = new DecorativeObjectSpawned();
private DecorativeObjectSpawned()
{
// noop
}
/**
* The affected tile.
*/

View File

@@ -33,13 +33,6 @@ import lombok.Data;
@Data
public class DraggingWidgetChanged
{
public static final DraggingWidgetChanged INSTANCE = new DraggingWidgetChanged();
private DraggingWidgetChanged()
{
// noop
}
/**
* Whether a widget is currently being dragged.
*/

View File

@@ -34,13 +34,6 @@ import lombok.Data;
@Data
public class ExperienceChanged
{
public static final ExperienceChanged INSTANCE = new ExperienceChanged();
private ExperienceChanged()
{
// noop
}
/**
* The modified skill.
*/

View File

@@ -34,13 +34,6 @@ import net.runelite.api.Tile;
@Data
public class GameObjectChanged
{
public static final GameObjectChanged INSTANCE = new GameObjectChanged();
private GameObjectChanged()
{
// noop
}
/**
* The affected tile.
*/

View File

@@ -34,13 +34,6 @@ import lombok.Data;
@Data
public class GameObjectDespawned
{
public static final GameObjectDespawned INSTANCE = new GameObjectDespawned();
private GameObjectDespawned()
{
// noop
}
/**
* The affected tile.
*/

View File

@@ -34,13 +34,6 @@ import lombok.Data;
@Data
public class GameObjectSpawned
{
public static final GameObjectSpawned INSTANCE = new GameObjectSpawned();
private GameObjectSpawned()
{
// noop
}
/**
* The affected tile.
*/

View File

@@ -33,13 +33,6 @@ import lombok.Data;
@Data
public class GameStateChanged
{
public static final GameStateChanged INSTANCE = new GameStateChanged();
private GameStateChanged()
{
// noop
}
/**
* The new game state.
*/

View File

@@ -24,6 +24,8 @@
*/
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.
@@ -41,12 +43,7 @@ package net.runelite.api.events;
* 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
}
}

View File

@@ -44,13 +44,6 @@ import lombok.Data;
@Data
public class GrandExchangeOfferChanged
{
public static final GrandExchangeOfferChanged INSTANCE = new GrandExchangeOfferChanged();
private GrandExchangeOfferChanged()
{
// noop
}
/**
* The offer that has been modified.
*/

View File

@@ -25,24 +25,16 @@
package net.runelite.api.events;
import net.runelite.api.GraphicsObject;
import lombok.Data;
import lombok.Value;
/**
* An event where a new {@link GraphicsObject} has been created.
*/
@Data
@Value
public class GraphicsObjectCreated
{
public static final GraphicsObjectCreated INSTANCE = new GraphicsObjectCreated();
private GraphicsObjectCreated()
{
// noop
}
/**
* The newly created graphics object.
*/
private GraphicsObject graphicsObject;
private final GraphicsObject graphicsObject;
}

View File

@@ -34,13 +34,6 @@ import lombok.Data;
@Data
public class GroundObjectChanged
{
public static final GroundObjectChanged INSTANCE = new GroundObjectChanged();
private GroundObjectChanged()
{
// noop
}
/**
* The affected tile.
*/

View File

@@ -34,13 +34,6 @@ import lombok.Data;
@Data
public class GroundObjectDespawned
{
public static final GroundObjectDespawned INSTANCE = new GroundObjectDespawned();
private GroundObjectDespawned()
{
// noop
}
/**
* The affected tile.
*/

View File

@@ -34,13 +34,6 @@ import lombok.Data;
@Data
public class GroundObjectSpawned
{
public static final GroundObjectSpawned INSTANCE = new GroundObjectSpawned();
private GroundObjectSpawned()
{
// noop
}
/**
* The affected tile.
*/

View File

@@ -38,13 +38,6 @@ import lombok.Data;
@Data
public class HitsplatApplied
{
public static final HitsplatApplied INSTANCE = new HitsplatApplied();
private HitsplatApplied()
{
// noop
}
/**
* The actor the hitsplat was applied to.
*/

View File

@@ -30,12 +30,5 @@ import lombok.Data;
@Data
public class InteractChanged
{
public static final InteractChanged INSTANCE = new InteractChanged();
private InteractChanged()
{
// noop
}
private Actor actor;
}

View File

@@ -1,26 +1,18 @@
package net.runelite.api.events;
import net.runelite.api.Actor;
import lombok.Data;
import lombok.Value;
/**
* An event called when the actor an actor is interacting with changes
*/
@Data
@Value
public class InteractingChanged
{
public static final InteractingChanged INSTANCE = new InteractingChanged();
private InteractingChanged()
{
// noop
}
private Actor source;
private final Actor source;
/**
* Target actor, may be null
*/
private Actor target;
private final Actor target;
}

View File

@@ -25,8 +25,7 @@
package net.runelite.api.events;
import net.runelite.api.ItemContainer;
import lombok.Data;
import lombok.Value;
/**
* An event called whenever the stack size of an {@link api.Item}
@@ -39,18 +38,11 @@ import lombok.Data;
* <li>Dropping an item</li>
* </ul>
*/
@Data
@Value
public class ItemContainerChanged
{
public static final ItemContainerChanged INSTANCE = new ItemContainerChanged();
private ItemContainerChanged()
{
// noop
}
/**
* The modified item container.
*/
private ItemContainer itemContainer;
private final ItemContainer itemContainer;
}

View File

@@ -26,23 +26,15 @@ package net.runelite.api.events;
import net.runelite.api.Item;
import net.runelite.api.Tile;
import lombok.Data;
import lombok.Value;
/**
* 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.
*/
@Data
@Value
public class ItemDespawned
{
public static final ItemDespawned INSTANCE = new ItemDespawned();
private ItemDespawned()
{
// noop
}
private Tile tile;
private Item item;
private final Tile tile;
private final Item item;
}

View File

@@ -26,23 +26,16 @@ package net.runelite.api.events;
import net.runelite.api.Item;
import net.runelite.api.Tile;
import lombok.Data;
import lombok.Value;
/**
* Called when the quantity of an item pile changes.
*/
@Data
@Value
public class ItemQuantityChanged
{
public static final ItemQuantityChanged INSTANCE = new ItemQuantityChanged();
private ItemQuantityChanged()
{
// noop
}
private Item item;
private Tile tile;
private int oldQuantity;
private int newQuantity;
private final Item item;
private final Tile tile;
private final int oldQuantity;
private final int newQuantity;
}

View File

@@ -26,22 +26,15 @@ package net.runelite.api.events;
import net.runelite.api.Item;
import net.runelite.api.Tile;
import lombok.Data;
import lombok.Value;
/**
* 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.
*/
@Data
@Value
public class ItemSpawned
{
public static final ItemSpawned INSTANCE = new ItemSpawned();
private ItemSpawned()
{
// noop
}
private Tile tile;
private Item item;
private final Tile tile;
private final Item item;
}

View File

@@ -29,10 +29,4 @@ package net.runelite.api.events;
*/
public class LocalPlayerDeath
{
public static final LocalPlayerDeath INSTANCE = new LocalPlayerDeath();
private LocalPlayerDeath()
{
// noop
}
}

View File

@@ -35,17 +35,10 @@ 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 MenuEntry menuEntry;
private final MenuEntry menuEntry;
public String getOption()
{

View File

@@ -33,13 +33,6 @@ 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>

View File

@@ -42,13 +42,6 @@ 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;

View File

@@ -33,13 +33,6 @@ 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.
*/

View File

@@ -25,23 +25,16 @@
package net.runelite.api.events;
import net.runelite.api.Nameable;
import lombok.Data;
import lombok.Value;
/**
* An event where a {@link Nameable} has had their name changed.
*/
@Data
@Value
public class NameableNameChanged
{
public static final NameableNameChanged INSTANCE = new NameableNameChanged();
private NameableNameChanged()
{
// noop
}
/**
* The nameable that changed names.
*/
private Nameable nameable;
private final Nameable nameable;
}

View File

@@ -33,13 +33,6 @@ 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.
*/

View File

@@ -26,25 +26,18 @@ package net.runelite.api.events;
import net.runelite.api.Actor;
import net.runelite.api.NPC;
import lombok.Data;
import lombok.Value;
/**
* An event where an {@link NPC} has despawned.
*/
@Data
@Value
public class NpcDespawned
{
public static final NpcDespawned INSTANCE = new NpcDespawned();
private NpcDespawned()
{
// noop
}
/**
* The despawned NPC.
*/
private NPC npc;
private final NPC npc;
public Actor getActor()
{

View File

@@ -26,25 +26,18 @@ package net.runelite.api.events;
import net.runelite.api.Actor;
import net.runelite.api.NPC;
import lombok.Data;
import lombok.Value;
/**
* An event where an {@link NPC} has spawned.
*/
@Data
@Value
public class NpcSpawned
{
public static final NpcSpawned INSTANCE = new NpcSpawned();
private NpcSpawned()
{
// noop
}
/**
* The spawned NPC.
*/
private NPC npc;
private final NPC npc;
public Actor getActor()
{

View File

@@ -1,19 +1,12 @@
package net.runelite.api.events;
import net.runelite.api.Actor;
import lombok.Data;
import lombok.Value;
@Data
@Value
public class OverheadTextChanged
{
public static final OverheadTextChanged INSTANCE = new OverheadTextChanged();
private final Actor actor;
private OverheadTextChanged()
{
// noop
}
private Actor actor;
private String overheadText;
private final String overheadText;
}

View File

@@ -26,27 +26,20 @@ package net.runelite.api.events;
import net.runelite.api.Actor;
import net.runelite.api.Player;
import lombok.Data;
import lombok.Value;
/**
* An event where a {@link Player} has despawned.
* <p>
* Note: This event does not get called for the local player.
*/
@Data
@Value
public class PlayerDespawned
{
public static final PlayerDespawned INSTANCE = new PlayerDespawned();
private PlayerDespawned()
{
// noop
}
/**
* The despawned player.
*/
private Player player;
private final Player player;
public Actor getActor()
{

View File

@@ -33,13 +33,6 @@ import lombok.Data;
@Data
public class PlayerMenuOptionClicked
{
public static final PlayerMenuOptionClicked INSTANCE = new PlayerMenuOptionClicked();
private PlayerMenuOptionClicked()
{
// noop
}
/**
* The menu option clicked.
*/

View File

@@ -29,13 +29,6 @@ import lombok.Data;
@Data
public class PlayerMenuOptionsChanged
{
public static final PlayerMenuOptionsChanged INSTANCE = new PlayerMenuOptionsChanged();
private PlayerMenuOptionsChanged()
{
// noop
}
/**
* Index in playerOptions which changed.
*/

View File

@@ -26,25 +26,18 @@ package net.runelite.api.events;
import net.runelite.api.Actor;
import net.runelite.api.Player;
import lombok.Data;
import lombok.Value;
/**
* An event where a {@link Player} has spawned.
*/
@Data
@Value
public class PlayerSpawned
{
public static final PlayerSpawned INSTANCE = new PlayerSpawned();
private PlayerSpawned()
{
// noop
}
/**
* The spawned player.
*/
private Player player;
private final Player player;
public Actor getActor()
{

View File

@@ -30,12 +30,5 @@ import lombok.Data;
@Data
public class PostHealthBar
{
public static final PostHealthBar INSTANCE = new PostHealthBar();
private PostHealthBar()
{
// noop
}
private HealthBar healthBar;
}

View File

@@ -34,13 +34,6 @@ import net.runelite.api.ItemDefinition;
@Data
public class PostItemDefinition
{
public static final PostItemDefinition INSTANCE = new PostItemDefinition();
private PostItemDefinition()
{
// noop
}
/**
* The newly created item.
*/

View File

@@ -37,13 +37,6 @@ import lombok.Data;
@Data
public class ProjectileMoved
{
public static final ProjectileMoved INSTANCE = new ProjectileMoved();
private ProjectileMoved()
{
// noop
}
/**
* The projectile being moved.
*/

View File

@@ -34,13 +34,6 @@ import lombok.Data;
@Data
public class ProjectileSpawned
{
public static final ProjectileSpawned INSTANCE = new ProjectileSpawned();
private ProjectileSpawned()
{
// noop
}
/**
* The spawned projectile.
*/

View File

@@ -24,23 +24,16 @@
*/
package net.runelite.api.events;
import lombok.Data;
import lombok.Value;
/**
* An event where a request to remove a friend is sent to the server.
*/
@Data
@Value
public class RemovedFriend
{
public static final RemovedFriend INSTANCE = new RemovedFriend();
private RemovedFriend()
{
// noop
}
/**
* The name of the removed friend.
*/
private String name;
private final String name;
}

View File

@@ -34,13 +34,6 @@ import lombok.Data;
@Data
public class ResizeableChanged
{
public static final ResizeableChanged INSTANCE = new ResizeableChanged();
private ResizeableChanged()
{
// noop
}
/**
* Whether the game is in resizable mode.
*/

View File

@@ -33,13 +33,6 @@ import lombok.Data;
@Data
public class ScriptCallbackEvent
{
public static final ScriptCallbackEvent INSTANCE = new ScriptCallbackEvent();
private ScriptCallbackEvent()
{
// noop
}
/**
* The script being called.
*/

View File

@@ -29,13 +29,6 @@ import lombok.Data;
@Data
public class SoundEffectPlayed
{
public static final SoundEffectPlayed INSTANCE = new SoundEffectPlayed();
private SoundEffectPlayed()
{
// noop
}
private int soundId;
private int delay;
}

View File

@@ -21,13 +21,6 @@ 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.
*/

View File

@@ -32,10 +32,4 @@ package net.runelite.api.events;
*/
public class UsernameChanged
{
public static final UsernameChanged INSTANCE = new UsernameChanged();
private UsernameChanged()
{
// noop
}
}

View File

@@ -25,20 +25,13 @@
*/
package net.runelite.api.events;
import lombok.Data;
import lombok.Value;
/**
* An event where a varbit integer has changed.
*/
@Data
@Value
public class VarClientIntChanged
{
public static final VarClientIntChanged INSTANCE = new VarClientIntChanged();
private VarClientIntChanged()
{
// noop
}
private int index;
}

View File

@@ -25,20 +25,13 @@
*/
package net.runelite.api.events;
import lombok.Data;
import lombok.Value;
/**
* An event where a varbit string has changed.
*/
@Data
@Value
public class VarClientStrChanged
{
public static final VarClientStrChanged INSTANCE = new VarClientStrChanged();
private VarClientStrChanged()
{
// noop
}
private int index;
}

View File

@@ -34,13 +34,6 @@ 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.

View File

@@ -34,13 +34,6 @@ import lombok.Data;
@Data
public class WallObjectChanged
{
public static final WallObjectChanged INSTANCE = new WallObjectChanged();
private WallObjectChanged()
{
// noop
}
/**
* The affected tile.
*/

View File

@@ -34,13 +34,6 @@ import lombok.Data;
@Data
public class WallObjectDespawned
{
public static final WallObjectDespawned INSTANCE = new WallObjectDespawned();
private WallObjectDespawned()
{
// noop
}
/**
* The affected tile.
*/

View File

@@ -34,13 +34,6 @@ import lombok.Data;
@Data
public class WallObjectSpawned
{
public static final WallObjectSpawned INSTANCE = new WallObjectSpawned();
private WallObjectSpawned()
{
// noop
}
/**
* The affected tile.
*/

View File

@@ -33,13 +33,6 @@ import lombok.Data;
@Data
public class WidgetHiddenChanged
{
public static final WidgetHiddenChanged INSTANCE = new WidgetHiddenChanged();
private WidgetHiddenChanged()
{
// noop
}
/**
* The affected widget.
*/

View File

@@ -32,13 +32,6 @@ import lombok.Data;
@Data
public class WidgetLoaded
{
public static final WidgetLoaded INSTANCE = new WidgetLoaded();
private WidgetLoaded()
{
// noop
}
/**
* The group ID of the loaded widget.
*/

View File

@@ -33,13 +33,6 @@ import lombok.Data;
@Data
public class WidgetMenuOptionClicked
{
public static final WidgetMenuOptionClicked INSTANCE = new WidgetMenuOptionClicked();
private WidgetMenuOptionClicked()
{
// noop
}
/**
* The clicked menu option.
*/

View File

@@ -24,16 +24,13 @@
*/
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
}
}

View File

@@ -25,20 +25,13 @@
package net.runelite.api.events;
import net.runelite.api.World;
import lombok.Data;
import lombok.Value;
/**
* Event when the world list is loaded for the world switcher
*/
@Data
@Value
public class WorldListLoad
{
public static final WorldListLoad INSTANCE = new WorldListLoad();
private WorldListLoad()
{
// noop
}
private World[] worlds;
private final World[] worlds;
}

View File

@@ -87,6 +87,9 @@ 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;
@@ -148,13 +151,13 @@ public class Hooks implements Callbacks
deferredEventBus.replay();
eventBus.post(GameTick.INSTANCE);
eventBus.post(GAME_TICK);
int tick = client.getTickCount();
client.setTickCount(tick + 1);
}
eventBus.post(BeforeRender.INSTANCE);
eventBus.post(BEFORE_RENDER);
clientThread.invoke();
@@ -508,7 +511,7 @@ public class Hooks implements Callbacks
public static boolean drawMenu()
{
BeforeMenuRender event = BeforeMenuRender.INSTANCE;
BeforeMenuRender event = new BeforeMenuRender();
client.getCallbacks().post(event);
return event.isConsumed();
}

View File

@@ -114,9 +114,7 @@ public class CommandManager
String command = split[0];
String[] args = Arrays.copyOfRange(split, 1, split.length);
CommandExecuted commandExecuted = CommandExecuted.INSTANCE;
commandExecuted.setCommand(command);
commandExecuted.setArguments(args);
CommandExecuted commandExecuted = new CommandExecuted(command, args);
eventBus.post(commandExecuted);
}

View File

@@ -429,7 +429,7 @@ public class MenuManager
if (curMenuOption.getMenuTarget().equals(event.getTarget())
&& curMenuOption.getMenuOption().equals(event.getOption()))
{
WidgetMenuOptionClicked customMenu = WidgetMenuOptionClicked.INSTANCE;
WidgetMenuOptionClicked customMenu = new WidgetMenuOptionClicked();
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 = PlayerMenuOptionClicked.INSTANCE;
PlayerMenuOptionClicked playerMenuOptionClicked = new PlayerMenuOptionClicked();
playerMenuOptionClicked.setMenuOption(event.getOption());
playerMenuOptionClicked.setMenuTarget(username);

View File

@@ -27,10 +27,8 @@
*/
package net.runelite.client.plugins.aoewarnings;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.Polygon;
import java.awt.Rectangle;
@@ -38,13 +36,11 @@ import java.time.Duration;
import java.time.Instant;
import java.util.Iterator;
import java.util.Map;
import javax.annotation.Nullable;
import javax.inject.Inject;
import net.runelite.api.Client;
import net.runelite.api.Perspective;
import net.runelite.api.Point;
import net.runelite.api.Projectile;
import net.runelite.api.coords.LocalPoint;
import net.runelite.api.coords.WorldPoint;
import net.runelite.client.ui.overlay.Overlay;
import net.runelite.client.ui.overlay.OverlayLayer;
@@ -62,7 +58,7 @@ public class AoeWarningOverlay extends Overlay
private final AoeWarningConfig config;
@Inject
public AoeWarningOverlay(@Nullable Client client, AoeWarningPlugin plugin, AoeWarningConfig config)
public AoeWarningOverlay(Client client, AoeWarningPlugin plugin, AoeWarningConfig config)
{
setPosition(OverlayPosition.DYNAMIC);
setLayer(OverlayLayer.UNDER_WIDGETS);
@@ -74,24 +70,25 @@ public class AoeWarningOverlay extends Overlay
@Override
public Dimension render(Graphics2D graphics)
{
WorldPoint lp = client.getLocalPlayer().getWorldLocation();
for (WorldPoint point : plugin.getLightningTrail())
{
drawTile(graphics, point, new Color(0, 150, 200), 2, 150, 50);
OverlayUtil.drawTile(graphics, client, point, lp, new Color(0, 150, 200), 2, 150, 50);
}
for (WorldPoint point : plugin.getAcidTrail())
{
drawTile(graphics, point, new Color(69, 241, 44), 2, 150, 50);
OverlayUtil.drawTile(graphics, client, point, lp, new Color(69, 241, 44), 2, 150, 50);
}
for (WorldPoint point : plugin.getCrystalSpike())
{
drawTile(graphics, point, new Color(255, 0, 84), 2, 150, 50);
OverlayUtil.drawTile(graphics, client, point, lp, new Color(255, 0, 84), 2, 150, 50);
}
for (WorldPoint point : plugin.getWintertodtSnowFall())
{
drawTile(graphics, point, new Color(255, 0, 84), 2, 150, 50);
OverlayUtil.drawTile(graphics, client, point, lp, new Color(255, 0, 84), 2, 150, 50);
}
Instant now = Instant.now();
@@ -164,7 +161,8 @@ public class AoeWarningOverlay extends Overlay
{
if (tickProgress >= 0)
{
renderTextLocation(graphics, Integer.toString(tickProgress), config.textSize(), config.fontStyle().getFont(), color, centerPoint(tilePoly.getBounds()));
OverlayUtil.renderTextLocation(graphics, Integer.toString(tickProgress), plugin.getTextSize(),
plugin.getFontStyle(), color, centerPoint(tilePoly.getBounds()), plugin.isShadows(), 0);
}
}
graphics.setColor(new Color(setAlphaComponent(config.overlayColor().getRGB(), fillAlpha), true));
@@ -173,50 +171,6 @@ public class AoeWarningOverlay extends Overlay
return null;
}
private void drawTile(Graphics2D graphics, WorldPoint point, Color color, int strokeWidth, int outlineAlpha, int fillAlpha)
{
WorldPoint playerLocation = client.getLocalPlayer().getWorldLocation();
if (point.distanceTo(playerLocation) >= 32)
{
return;
}
LocalPoint lp = LocalPoint.fromWorld(client, point);
if (lp == null)
{
return;
}
Polygon poly = Perspective.getCanvasTilePoly(client, lp);
if (poly == null)
{
return;
}
graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), outlineAlpha));
graphics.setStroke(new BasicStroke(strokeWidth));
graphics.draw(poly);
graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), fillAlpha));
graphics.fill(poly);
}
private void renderTextLocation(Graphics2D graphics, String txtString, int fontSize, int fontStyle, Color fontColor, Point canvasPoint)
{
graphics.setFont(new Font("Arial", fontStyle, fontSize));
if (canvasPoint != null)
{
final Point canvasCenterPoint = new Point(
canvasPoint.getX(),
canvasPoint.getY());
final Point canvasCenterPoint_shadow = new Point(
canvasPoint.getX() + 1,
canvasPoint.getY() + 1);
if (config.shadows())
{
OverlayUtil.renderTextLocation(graphics, canvasCenterPoint_shadow, txtString, Color.BLACK);
}
OverlayUtil.renderTextLocation(graphics, canvasCenterPoint, txtString, fontColor);
}
}
private Point centerPoint(Rectangle rect)
{
int x = (int) (rect.getX() + rect.getWidth() / 2);

View File

@@ -41,6 +41,7 @@ import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Client;
import net.runelite.api.GameObject;
import net.runelite.api.GameState;
import net.runelite.api.GraphicID;
import net.runelite.api.GraphicsObject;
import net.runelite.api.NullObjectID;
import net.runelite.api.ObjectID;
@@ -48,6 +49,7 @@ import net.runelite.api.Projectile;
import net.runelite.api.Tile;
import net.runelite.api.coords.LocalPoint;
import net.runelite.api.coords.WorldPoint;
import net.runelite.api.events.ConfigChanged;
import net.runelite.api.events.GameObjectDespawned;
import net.runelite.api.events.GameObjectSpawned;
import net.runelite.api.events.GameStateChanged;
@@ -72,40 +74,35 @@ import net.runelite.client.ui.overlay.OverlayManager;
@Slf4j
public class AoeWarningPlugin extends Plugin
{
@Getter
private final Map<WorldPoint, CrystalBomb> bombs = new HashMap<>();
private final Map<Projectile, AoeProjectile> projectiles = new HashMap<>();
@Inject
public AoeWarningConfig config;
@Inject
private Notifier notifier;
@Inject
private OverlayManager overlayManager;
@Inject
private AoeWarningOverlay coreOverlay;
@Inject
private BombOverlay bombOverlay;
@Inject
private Client client;
@Getter(AccessLevel.PACKAGE)
private List<WorldPoint> LightningTrail = new ArrayList<>();
@Getter(AccessLevel.PACKAGE)
private List<WorldPoint> AcidTrail = new ArrayList<>();
@Getter(AccessLevel.PACKAGE)
private List<WorldPoint> CrystalSpike = new ArrayList<>();
@Getter(AccessLevel.PACKAGE)
private List<WorldPoint> WintertodtSnowFall = new ArrayList<>();
@Getter(AccessLevel.PACKAGE)
private boolean shadows;
@Getter(AccessLevel.PACKAGE)
private int textSize;
@Getter(AccessLevel.PACKAGE)
private int fontStyle;
@Provides
AoeWarningConfig getConfig(ConfigManager configManager)
@@ -123,10 +120,7 @@ public class AoeWarningPlugin extends Plugin
{
overlayManager.add(coreOverlay);
overlayManager.add(bombOverlay);
LightningTrail.clear();
AcidTrail.clear();
CrystalSpike.clear();
WintertodtSnowFall.clear();
reset(true);
}
@Override
@@ -134,10 +128,29 @@ public class AoeWarningPlugin extends Plugin
{
overlayManager.remove(coreOverlay);
overlayManager.remove(bombOverlay);
LightningTrail.clear();
AcidTrail.clear();
CrystalSpike.clear();
WintertodtSnowFall.clear();
reset(false);
}
@Subscribe
public void onConfigChanged(ConfigChanged event)
{
if (!event.getGroup().equals("aoe"))
{
return;
}
switch (event.getKey())
{
case "fontStyle":
fontStyle = config.fontStyle().getFont();
break;
case "textSize":
textSize = config.textSize();
break;
case "shadows":
shadows = config.shadows();
break;
}
}
@Subscribe
@@ -172,12 +185,12 @@ public class AoeWarningPlugin extends Plugin
public void onGameObjectSpawned(GameObjectSpawned event)
{
final GameObject gameObject = event.getGameObject();
final WorldPoint bombLocation = gameObject.getWorldLocation();
final WorldPoint wp = gameObject.getWorldLocation();
switch (gameObject.getId())
{
case ObjectID.CRYSTAL_BOMB:
bombs.put(bombLocation, new CrystalBomb(gameObject, client.getTickCount()));
bombs.put(wp, new CrystalBomb(gameObject, client.getTickCount()));
if (config.aoeNotifyAll() || config.bombDisplayNotifyEnabled())
{
@@ -185,17 +198,16 @@ public class AoeWarningPlugin extends Plugin
}
break;
case ObjectID.ACID_POOL:
AcidTrail.add(bombLocation);
AcidTrail.add(wp);
break;
case ObjectID.SMALL_CRYSTALS:
//todo
CrystalSpike.add(bombLocation);
CrystalSpike.add(wp);
break;
case NullObjectID.NULL_26690:
//Wintertodt Snowfall
if (config.isWintertodtEnabled())
{
WintertodtSnowFall.add(bombLocation);
WintertodtSnowFall.add(wp);
if (config.aoeNotifyAll() || config.isWintertodtNotifyEnabled())
{
@@ -210,25 +222,23 @@ public class AoeWarningPlugin extends Plugin
public void onGameObjectDespawned(GameObjectDespawned event)
{
GameObject gameObject = event.getGameObject();
WorldPoint bombLocation = gameObject.getWorldLocation();
WorldPoint wp = gameObject.getWorldLocation();
switch (gameObject.getId())
{
case ObjectID.CRYSTAL_BOMB:
//might as well check the ObjectID to save some time.
purgeBombs(bombs);
break;
case ObjectID.ACID_POOL:
AcidTrail.remove(bombLocation);
AcidTrail.remove(wp);
break;
case ObjectID.SMALL_CRYSTALS:
//todo
CrystalSpike.remove(bombLocation);
CrystalSpike.remove(wp);
break;
case NullObjectID.NULL_26690:
//Wintertodt Snowfall
if (config.isWintertodtEnabled())
{
WintertodtSnowFall.remove(bombLocation);
WintertodtSnowFall.remove(wp);
}
break;
}
@@ -251,7 +261,7 @@ public class AoeWarningPlugin extends Plugin
LightningTrail.clear();
for (GraphicsObject o : client.getGraphicsObjects())
{
if (o.getId() == 1356)
if (o.getId() == GraphicID.OLM_LIGHTNING)
{
LightningTrail.add(WorldPoint.fromLocal(client, o.getLocation()));
@@ -281,6 +291,12 @@ public class AoeWarningPlugin extends Plugin
Map.Entry<WorldPoint, CrystalBomb> entry = it.next();
WorldPoint world = entry.getKey();
LocalPoint local = LocalPoint.fromWorld(client, world);
if (local == null)
{
return;
}
Tile tile = tiles[world.getPlane()][local.getSceneX()][local.getSceneY()];
GameObject[] objects = tile.getGameObjects();
boolean containsObjects = false;
@@ -391,4 +407,20 @@ public class AoeWarningPlugin extends Plugin
return false;
}
}
private void reset(boolean setConfig)
{
LightningTrail.clear();
AcidTrail.clear();
CrystalSpike.clear();
WintertodtSnowFall.clear();
bombs.clear();
projectiles.clear();
if (setConfig)
{
fontStyle = config.fontStyle().getFont();
textSize = config.textSize();
shadows = config.shadows();
}
}
}

View File

@@ -121,6 +121,10 @@ public class BombOverlay extends Overlay
{
final Player localPlayer = client.getLocalPlayer();
LocalPoint localLoc = LocalPoint.fromWorld(client, bomb.getWorldLocation());
if (localLoc == null)
{
return;
}
double distance_x = Math.abs(bomb.getWorldLocation().getX() - localPlayer.getWorldLocation().getX());
double distance_y = Math.abs(bomb.getWorldLocation().getY() - localPlayer.getWorldLocation().getY());
Color color_code = Color.decode(SAFE);
@@ -142,7 +146,7 @@ public class BombOverlay extends Overlay
{
color_code = Color.decode(CAUTION);
}
LocalPoint CenterPoint = new LocalPoint(localLoc.getX() + 0, localLoc.getY() + 0);
LocalPoint CenterPoint = new LocalPoint(localLoc.getX(), localLoc.getY());
Polygon poly = Perspective.getCanvasTileAreaPoly(client, CenterPoint, BOMB_AOE);
if (poly != null)

View File

@@ -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 = VarbitChanged.INSTANCE;
VarbitChanged varbitChanged = new VarbitChanged();
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(VarbitChanged.INSTANCE); // fake event
eventBus.post(new VarbitChanged()); // fake event
break;
}
case "addxp":
@@ -293,7 +293,7 @@ public class DevToolsPlugin extends Plugin
client.queueChangedSkill(skill);
ExperienceChanged experienceChanged = ExperienceChanged.INSTANCE;
ExperienceChanged experienceChanged = new ExperienceChanged();
experienceChanged.setSkill(skill);
eventBus.post(experienceChanged);
break;
@@ -312,11 +312,11 @@ public class DevToolsPlugin extends Plugin
client.queueChangedSkill(skill);
ExperienceChanged experienceChanged = ExperienceChanged.INSTANCE;
ExperienceChanged experienceChanged = new ExperienceChanged();
experienceChanged.setSkill(skill);
eventBus.post(experienceChanged);
BoostedLevelChanged boostedLevelChanged = BoostedLevelChanged.INSTANCE;
BoostedLevelChanged boostedLevelChanged = new BoostedLevelChanged();
boostedLevelChanged.setSkill(skill);
eventBus.post(boostedLevelChanged);
break;

View File

@@ -54,17 +54,17 @@ public class FreezeTimersOverlay extends Overlay
private final BufferedImage FREEZE_IMAGE = ImageUtil.getResourceStreamFromClass(getClass(), "freeze.png");
private final BufferedImage TB_IMAGE = ImageUtil.getResourceStreamFromClass(getClass(), "teleblock.png");
private final BufferedImage VENG_IMAGE = ImageUtil.getResourceStreamFromClass(getClass(), "veng.png");
@Inject
private Timers timers;
private boolean lock;
private long finishedAtTest;
@Inject
public FreezeTimersOverlay(FreezeTimersConfig config, Client client)
public FreezeTimersOverlay(FreezeTimersConfig config, Client client, Timers timers)
{
this.config = config;
this.client = client;
this.timers = timers;
setPriority(OverlayPriority.HIGHEST);
setPosition(OverlayPosition.DYNAMIC);
setLayer(OverlayLayer.UNDER_WIDGETS);
@@ -119,24 +119,23 @@ public class FreezeTimersOverlay extends Overlay
String text = processTickCounter(finishedAt);
int test = Integer.parseInt(text);
Point poi = actor.getCanvasTextLocation(g, text, 0);
if (poi == null)
{
return false;
}
int xpoi = poi.getX();
int ypoi = poi.getY();
Point FixedPoint = new Point(xpoi, ypoi);
Point FixedPoint = new Point(poi.getX(), poi.getY());
if (config.noImage())
{
if (test > 3)
{
renderTextLocation(g, text, config.textSize(), config.fontStyle().getFont(), Color.WHITE, FixedPoint);
OverlayUtil.renderTextLocation(g, text, config.textSize(), config.fontStyle().getFont(), Color.WHITE, FixedPoint, false, 0);
}
else
{
renderTextLocation(g, text, config.textSize(), config.fontStyle().getFont(), Color.YELLOW, FixedPoint);
OverlayUtil.renderTextLocation(g, text, config.textSize(), config.fontStyle().getFont(), Color.YELLOW, FixedPoint, false, 0);
}
}
else
@@ -161,23 +160,26 @@ public class FreezeTimersOverlay extends Overlay
String text = processTickCounter(finishedAt);
Point poi = actor.getCanvasTextLocation(g, text, 0);
int xpoi = poi.getX() + 20;
int ypoi = poi.getY();
Point FixedPoint = new Point(xpoi, ypoi);
if (poi == null)
{
return false;
}
Point FixedPoint = new Point(poi.getX() + 20, poi.getY());
if (config.noImage())
{
if (timers.getTimerEnd(actor, TimerType.FREEZE) <= currentTick)
{
renderTextLocation(g, text, config.textSize(), config.fontStyle().getFont(), Color.CYAN, poi);
OverlayUtil.renderTextLocation(g, text, config.textSize(), config.fontStyle().getFont(), Color.CYAN, poi, false, 0);
}
if (timers.getTimerEnd(actor, TimerType.FREEZE) >= currentTick)
{
renderTextLocation(g, " | " + text, config.textSize(), config.fontStyle().getFont(), Color.CYAN, FixedPoint);
OverlayUtil.renderTextLocation(g, " | " + text, config.textSize(), config.fontStyle().getFont(), Color.CYAN, FixedPoint, false, 0);
}
if (timers.getTimerEnd(actor, TimerType.VENG) >= currentTick)
{
renderTextLocation(g, " | " + text, config.textSize(), config.fontStyle().getFont(), Color.CYAN, FixedPoint);
OverlayUtil.renderTextLocation(g, " | " + text, config.textSize(), config.fontStyle().getFont(), Color.CYAN, FixedPoint, false, 0);
}
}
else
@@ -202,22 +204,26 @@ public class FreezeTimersOverlay extends Overlay
String text = processTickCounter(finishedAt);
Point poi = actor.getCanvasTextLocation(g, text, 0);
int xpoi = poi.getX() - 20;
int ypoi = poi.getY();
Point FixedPoint = new Point(xpoi, ypoi);
if (poi == null)
{
return false;
}
Point FixedPoint = new Point(poi.getX() - 20, poi.getY());
if (config.noImage())
{
if (timers.getTimerEnd(actor, TimerType.FREEZE) <= currentTick)
{
renderTextLocation(g, text, config.textSize(), config.fontStyle().getFont(), Color.RED, poi);
OverlayUtil.renderTextLocation(g, text, config.textSize(), config.fontStyle().getFont(), Color.RED, poi, false, 0);
}
if (timers.getTimerEnd(actor, TimerType.FREEZE) >= currentTick)
{
renderTextLocation(g, text + " | ", config.textSize(), config.fontStyle().getFont(), Color.RED, FixedPoint);
OverlayUtil.renderTextLocation(g, text + " | ", config.textSize(), config.fontStyle().getFont(), Color.RED, FixedPoint, false, 0);
}
if (timers.getTimerEnd(actor, TimerType.TELEBLOCK) >= currentTick)
{
renderTextLocation(g, text + " | ", config.textSize(), config.fontStyle().getFont(), Color.RED, FixedPoint);
OverlayUtil.renderTextLocation(g, text + " | ", config.textSize(), config.fontStyle().getFont(), Color.RED, FixedPoint, false, 0);
}
}
else
@@ -229,10 +235,13 @@ public class FreezeTimersOverlay extends Overlay
g.setColor(RED);
Polygon poly = actor.getCanvasTilePoly();
if (poly != null)
if (poly == null)
{
OverlayUtil.renderPolygon(g, poly, RED);
return false;
}
OverlayUtil.renderPolygon(g, poly, RED);
OverlayUtil.renderTextLocation(g, new Point((int) poly.getBounds2D().getCenterX(),
(int) poly.getBounds2D().getCenterY()), actor.getName(), RED);
}
@@ -249,22 +258,6 @@ public class FreezeTimersOverlay extends Overlay
xOffset);
}
private void renderTextLocation(Graphics2D graphics, String txtString, int fontSize, int fontStyle, Color fontColor, Point canvasPoint)
{
graphics.setFont(new Font("Arial", fontStyle, fontSize));
if (canvasPoint != null)
{
final Point canvasCenterPoint = new Point(
canvasPoint.getX(),
canvasPoint.getY());
final Point canvasCenterPoint_shadow = new Point(
canvasPoint.getX() + 1,
canvasPoint.getY() + 1);
OverlayUtil.renderTextLocation(graphics, canvasCenterPoint_shadow, txtString, Color.BLACK);
OverlayUtil.renderTextLocation(graphics, canvasCenterPoint, txtString, fontColor);
}
}
public void renderImageLocation(Graphics2D graphics, Point imgLoc, BufferedImage image)
{
int x = imgLoc.getX();
@@ -273,12 +266,9 @@ public class FreezeTimersOverlay extends Overlay
graphics.drawImage(image, x, y, null);
}
public void renderActorTextAndImage(Graphics2D graphics, Actor actor, String text, Color color,
BufferedImage image, int yOffset, int xOffset)
private void renderActorTextAndImage(Graphics2D graphics, Actor actor, String text, Color color, BufferedImage image, int yOffset, int xOffset)
{
Point textLocation = new Point(actor.getCanvasImageLocation(image, 0).getX() + xOffset,
actor.getCanvasImageLocation(image, 0).getY() + yOffset);
Point textLocation = new Point(actor.getCanvasImageLocation(image, 0).getX() + xOffset, actor.getCanvasImageLocation(image, 0).getY() + yOffset);
renderImageLocation(graphics, textLocation, image);
xOffset = image.getWidth() + 1;
yOffset = (image.getHeight() - (int) graphics.getFontMetrics().getStringBounds(text, graphics).getHeight());

View File

@@ -121,7 +121,7 @@ public class FreezeTimersPlugin extends Plugin
{
if (prayerTracker.getSpotanimLastTick(actor) != actor.getSpotAnimation())
{
SpotAnimationChanged callback = SpotAnimationChanged.INSTANCE;
SpotAnimationChanged callback = new SpotAnimationChanged();
callback.setActor(actor);
client.getCallbacks().post(callback);
}

View File

@@ -30,14 +30,13 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import javax.inject.Inject;
import lombok.AccessLevel;
import lombok.Getter;
import net.runelite.api.GameState;
import net.runelite.api.NPC;
import net.runelite.api.events.GameTick;
import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.GameTick;
import net.runelite.api.events.NpcDespawned;
import net.runelite.api.events.NpcSpawned;
import net.runelite.client.config.ConfigManager;
@@ -119,6 +118,11 @@ public class ImplingsPlugin extends Plugin
{
Impling impling = Impling.findImpling(npc.getId());
if (impling == null || impling.getImplingType() == null)
{
continue;
}
ImplingType type = impling.getImplingType();
if (implingCounterMap.containsKey(type))
{

View File

@@ -106,7 +106,7 @@ public class BatSolver
}
public void calculateChanceOfPoison()
private void calculateChanceOfPoison()
{
if (getType() == null)
{

View File

@@ -35,9 +35,9 @@ import lombok.Getter;
// e.g. if there is an empty chest in L room chest 1, the other empty chests could be 16, 17, 38, 54, 55
// See https://dikkenoob.github.io/ for more information
public class SolutionSet
class SolutionSet
{
public static final SolutionSet[] SOLUTION_SETS =
static final SolutionSet[] SOLUTION_SETS =
{
new SolutionSet(ThievingRoomType.LEFT_TURN, 1, 16, 17, 55),
new SolutionSet(ThievingRoomType.LEFT_TURN, 1, 17, 38, 54),
@@ -147,12 +147,12 @@ public class SolutionSet
this.emptyChests = new HashSet<>(Arrays.asList(emptyChests));
}
public void addEmptyChest(int chestId)
void addEmptyChest(int chestId)
{
emptyChests.add(chestId);
}
public boolean containsChest(int chestId)
boolean containsChest(int chestId)
{
return emptyChests.contains(chestId);
}

View File

@@ -15,7 +15,7 @@ public class InstancePoint
private static final int CHUNK_SIZE = 8;
private static final double CHUNK_OFFSET = 3.5;
public InstancePoint(int x, int y, int rot)
private InstancePoint(int x, int y, int rot)
{
this.x = x;
this.y = y;
@@ -29,7 +29,7 @@ public class InstancePoint
this.rot = 0;
}
public static InstancePoint buildFromPoint(WorldPoint worldPoint, Client client)
static InstancePoint buildFromPoint(WorldPoint worldPoint, Client client)
{
Point point = new Point(worldPoint.getX(), worldPoint.getY());
Point base = new Point(client.getBaseX(), client.getBaseY());
@@ -48,7 +48,7 @@ public class InstancePoint
return buildFromTile(base, point, rotation, new Point(x, y));
}
public static InstancePoint buildFromTile(Point base, Point tile, int rot, Point chunkOrigin)
private static InstancePoint buildFromTile(Point base, Point tile, int rot, Point chunkOrigin)
{
int deltaX = tile.getX() - base.getX();
int deltaY = tile.getY() - base.getY();

View File

@@ -26,10 +26,10 @@ package net.runelite.client.plugins.raidsthieving;
public class RaidsThievingConstants
{
public static final int CLOSED_CHEST_ID = 29742;
public static final int OPEN_EMPTY_CHEST = 29743;
public static final int OPEN_FULL_CHEST_1 = 29744;
public static final int OPEN_FULL_CHEST_2 = 29745;
public static final int EMPTY_TROUGH = 29746;
static final int CLOSED_CHEST_ID = 29742;
static final int OPEN_EMPTY_CHEST = 29743;
static final int OPEN_FULL_CHEST_1 = 29744;
static final int OPEN_FULL_CHEST_2 = 29745;
static final int EMPTY_TROUGH = 29746;
public static final int[] STORAGE = {29769, 29770, 29771, 29772};
}

View File

@@ -201,6 +201,12 @@ public class RaidsThievingPlugin extends Plugin
{
log.debug("Found poison splat");
WorldPoint loc = WorldPoint.fromLocal(client, obj.getLocation());
if (chests.get(loc) == null)
{
return;
}
chests.get(loc).setPoison(true);
}
}
@@ -235,7 +241,7 @@ public class RaidsThievingPlugin extends Plugin
mapper = null;
}
public int numberOfEmptyChestsFound()
int numberOfEmptyChestsFound()
{
int total = 0;
for (ThievingChest chest : chests.values())
@@ -248,7 +254,6 @@ public class RaidsThievingPlugin extends Plugin
return total;
}
private boolean checkForBats()
{
for (ThievingChest chest : chests.values())
@@ -266,7 +271,7 @@ public class RaidsThievingPlugin extends Plugin
return false;
}
public int getChestId(WorldPoint worldPoint)
int getChestId(WorldPoint worldPoint)
{
return chests.get(worldPoint).getChestId();
}

View File

@@ -27,7 +27,7 @@ package net.runelite.client.plugins.slayer;
import java.util.ArrayList;
import java.util.List;
public class KnapsackSolver
class KnapsackSolver
{
private List<Integer> reconstructItemsInSack(int[][] sackMatrix, List<Integer> items, int i, int w)
@@ -49,7 +49,7 @@ public class KnapsackSolver
}
}
public int howMuchFitsInSack(List<Integer> items, int maxWeight)
int howMuchFitsInSack(List<Integer> items, int maxWeight)
{
int itemCount = items.size();

View File

@@ -29,17 +29,17 @@ public class NPCPresence
return name + "[" + combatLevel + "]";
}
public boolean shouldExist()
boolean shouldExist()
{
return fadeTimer > 0;
}
public void tickExistence()
void tickExistence()
{
fadeTimer--;
}
public static NPCPresence buildPresence(NPC npc)
static NPCPresence buildPresence(NPC npc)
{
return new NPCPresence(npc.getName(), npc.getCombatLevel());
}

View File

@@ -390,7 +390,7 @@ public class SlayerPlugin extends Plugin
}
}
int estimateKillCount(List<NPCPresence> potentialKills, int gains)
private int estimateKillCount(List<NPCPresence> potentialKills, int gains)
{
// failsafe to avoid calculating kill count if there were no slayer monsters around that could be killed on task
// this failsafe *WILL FAIL* if someone decides to lamp their slayer in the middle of a task next to on task creatures
@@ -751,7 +751,7 @@ public class SlayerPlugin extends Plugin
}
@VisibleForTesting
void killedOne()
private void killedOne()
{
if (currentTask.getAmount() == 0)
{
@@ -788,7 +788,7 @@ public class SlayerPlugin extends Plugin
}
// checks if any contiguous subsequence of seq0 exactly matches the String toMatch
boolean contiguousSubsequenceMatches(String[] seq0, String toMatch)
private boolean contiguousSubsequenceMatches(String[] seq0, String toMatch)
{
for (int i = 0; i < seq0.length; i++)
{
@@ -962,7 +962,7 @@ public class SlayerPlugin extends Plugin
rebuildTargetList();
}
public AsyncBufferedImage getImageForTask(Task task)
AsyncBufferedImage getImageForTask(Task task)
{
int itemSpriteId = ItemID.ENCHANTED_GEM;
if (task != null)
@@ -1048,6 +1048,11 @@ public class SlayerPlugin extends Plugin
return;
}
if (task == null)
{
return;
}
if (TASK_STRING_VALIDATION.matcher(task.getTask()).find() || task.getTask().length() > TASK_STRING_MAX_LENGTH ||
TASK_STRING_VALIDATION.matcher(task.getLocation()).find() || task.getLocation().length() > TASK_STRING_MAX_LENGTH)
{

View File

@@ -343,7 +343,7 @@ public class SlayerTaskPanel extends PluginPanel
changePauseState(paused);
}
static String htmlLabel(String key, long timeMillis)
private static String htmlLabel(String key, long timeMillis)
{
if (timeMillis == Long.MAX_VALUE)
{
@@ -363,7 +363,7 @@ public class SlayerTaskPanel extends PluginPanel
}
}
static String htmlLabel(String key, int value)
private static String htmlLabel(String key, int value)
{
String valueStr = StackFormatter.quantityToRSDecimalStack(value);
return String.format(HTML_LABEL_TEMPLATE, ColorUtil.toHexColor(ColorScheme.LIGHT_GRAY_COLOR),

View File

@@ -31,14 +31,14 @@ import java.io.InputStreamReader;
import java.util.List;
import java.util.Map;
public class SlayerXpDropLookup
class SlayerXpDropLookup
{
private Map<String, List<Double>> xpMap;
// floating point math equality
private static final double EPSILON = 1e-6;
void loadXpJson()
private void loadXpJson()
{
final InputStream xpFile = getClass().getResourceAsStream("/slayer_xp.json");
Gson gson = new Gson();
@@ -76,7 +76,7 @@ public class SlayerXpDropLookup
* @param npc the npc we are estimating slayer xp for
* @return our best guess for the slayer xp for this npc
*/
public double findXpForNpc(NPCPresence npc)
double findXpForNpc(NPCPresence npc)
{
List<Double> xpCombatLevel = xpMap.get(npc.getName());
if (xpCombatLevel == null)
@@ -127,7 +127,7 @@ public class SlayerXpDropLookup
return -1;
}
public SlayerXpDropLookup()
SlayerXpDropLookup()
{
loadXpJson();
}

View File

@@ -39,6 +39,7 @@ import net.runelite.client.ui.overlay.OverlayMenuEntry;
import net.runelite.client.ui.overlay.OverlayPosition;
import net.runelite.client.ui.overlay.OverlayPriority;
import net.runelite.client.ui.overlay.components.PanelComponent;
import net.runelite.client.ui.overlay.components.table.TableAlignment;
import net.runelite.client.ui.overlay.components.table.TableComponent;
import net.runelite.client.util.ColorUtil;
@@ -102,6 +103,7 @@ class NyloOverlay extends Overlay
panelComponent.getChildren().clear();
TableComponent tableComponent = new TableComponent();
tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT);
int nyloCount = (hagios + toxobolos + ischyros);
if (nylohandler.getWave() < 21)

View File

@@ -13,6 +13,7 @@ import net.runelite.client.ui.overlay.OverlayMenuEntry;
import net.runelite.client.ui.overlay.OverlayPosition;
import net.runelite.client.ui.overlay.components.PanelComponent;
import net.runelite.client.ui.overlay.components.TitleComponent;
import net.runelite.client.ui.overlay.components.table.TableAlignment;
import net.runelite.client.ui.overlay.components.table.TableComponent;
public class XarpusCounter extends Overlay
@@ -60,6 +61,7 @@ public class XarpusCounter extends Overlay
));
TableComponent tableComponent = new TableComponent();
tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT);
tableComponent.addRow("Exhumes", String.valueOf(xarpusHandler.getExhumesCount()));
panelComponent.getChildren().add(tableComponent);

View File

@@ -118,9 +118,7 @@ public class GameEventManager
if (itemContainer != null)
{
ItemContainerChanged event = ItemContainerChanged.INSTANCE;
event.setItemContainer(itemContainer);
eventBus.post(event);
eventBus.post(new ItemContainerChanged(itemContainer));
}
}
@@ -128,8 +126,7 @@ public class GameEventManager
{
if (npc != null)
{
final NpcSpawned npcSpawned = NpcSpawned.INSTANCE;
npcSpawned.setNpc(npc);
final NpcSpawned npcSpawned = new NpcSpawned(npc);
eventBus.post(npcSpawned);
}
}
@@ -138,8 +135,7 @@ public class GameEventManager
{
if (player != null)
{
final PlayerSpawned playerSpawned = PlayerSpawned.INSTANCE;
playerSpawned.setPlayer(player);
final PlayerSpawned playerSpawned = new PlayerSpawned(player);
eventBus.post(playerSpawned);
}
}
@@ -148,7 +144,7 @@ public class GameEventManager
{
Optional.ofNullable(tile.getWallObject()).ifPresent(object ->
{
final WallObjectSpawned objectSpawned = WallObjectSpawned.INSTANCE;
final WallObjectSpawned objectSpawned = new WallObjectSpawned();
objectSpawned.setTile(tile);
objectSpawned.setWallObject(object);
eventBus.post(objectSpawned);
@@ -156,7 +152,7 @@ public class GameEventManager
Optional.ofNullable(tile.getDecorativeObject()).ifPresent(object ->
{
final DecorativeObjectSpawned objectSpawned = DecorativeObjectSpawned.INSTANCE;
final DecorativeObjectSpawned objectSpawned = new DecorativeObjectSpawned();
objectSpawned.setTile(tile);
objectSpawned.setDecorativeObject(object);
eventBus.post(objectSpawned);
@@ -164,7 +160,7 @@ public class GameEventManager
Optional.ofNullable(tile.getGroundObject()).ifPresent(object ->
{
final GroundObjectSpawned objectSpawned = GroundObjectSpawned.INSTANCE;
final GroundObjectSpawned objectSpawned = new GroundObjectSpawned();
objectSpawned.setTile(tile);
objectSpawned.setGroundObject(object);
eventBus.post(objectSpawned);
@@ -174,7 +170,7 @@ public class GameEventManager
.filter(Objects::nonNull)
.forEach(object ->
{
final GameObjectSpawned objectSpawned = GameObjectSpawned.INSTANCE;
final GameObjectSpawned objectSpawned = new GameObjectSpawned();
objectSpawned.setTile(tile);
objectSpawned.setGameObject(object);
eventBus.post(objectSpawned);
@@ -190,9 +186,7 @@ public class GameEventManager
current = current.getNext();
final ItemSpawned itemSpawned = ItemSpawned.INSTANCE;
itemSpawned.setItem(item);
itemSpawned.setTile(tile);
final ItemSpawned itemSpawned = new ItemSpawned(tile, item);
eventBus.post(itemSpawned);
}
});

View File

@@ -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(VarbitChanged.INSTANCE);
attackPlugin.onVarbitChanged(new VarbitChanged());
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(VarbitChanged.INSTANCE);
attackPlugin.onVarbitChanged(new VarbitChanged());
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(VarbitChanged.INSTANCE);
attackPlugin.onVarbitChanged(new VarbitChanged());
// Verify there is a warned skill
Set<Skill> warnedSkills = attackPlugin.getWarnedSkills();

View File

@@ -71,7 +71,7 @@ public class CerberusPluginTest
mockNpc(new LocalPoint(2, 5)),
mockNpc(new LocalPoint(1, 5))
));
cerberusPlugin.onGameTick(GameTick.INSTANCE);
cerberusPlugin.onGameTick(new GameTick());
// Expected sort is by lowest y first, then by lowest x
assertEquals(ghosts.get(0).getLocalLocation(), new LocalPoint(0, 0));

View File

@@ -83,7 +83,7 @@ public class ChatNotificationsPluginTest
MessageNode messageNode = mock(MessageNode.class);
when(messageNode.getValue()).thenReturn("Deathbeam, Deathbeam OSRS");
ChatMessage chatMessage = ChatMessage.INSTANCE;
ChatMessage chatMessage = new ChatMessage();
chatMessage.setType(ChatMessageType.PUBLICCHAT);
chatMessage.setMessageNode(messageNode);

View File

@@ -118,7 +118,7 @@ public class CookingPluginTest
when(config.fermentTimer()).thenReturn(true);
when(client.getLocalPlayer()).thenReturn(player);
SpotAnimationChanged graphicChanged = SpotAnimationChanged.INSTANCE;
SpotAnimationChanged graphicChanged = new SpotAnimationChanged();
graphicChanged.setActor(player);
cookingPlugin.onSpotAnimationChanged(graphicChanged);

View File

@@ -73,7 +73,7 @@ public class EmojiPluginTest
when(client.createIndexedSprite()).thenReturn(mock(IndexedSprite.class));
// Trip emoji loading
GameStateChanged gameStateChanged = GameStateChanged.INSTANCE;
GameStateChanged gameStateChanged = new GameStateChanged();
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 = ChatMessage.INSTANCE;
ChatMessage chatMessage = new ChatMessage();
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 = GameStateChanged.INSTANCE;
GameStateChanged gameStateChanged = new GameStateChanged();
gameStateChanged.setGameState(GameState.LOGGED_IN);
emojiPlugin.onGameStateChanged(gameStateChanged);
MessageNode messageNode = mock(MessageNode.class);
when(messageNode.getValue()).thenReturn("<gt>:D<lt>");
ChatMessage chatMessage = ChatMessage.INSTANCE;
ChatMessage chatMessage = new ChatMessage();
chatMessage.setType(ChatMessageType.PUBLICCHAT);
chatMessage.setMessageNode(messageNode);

View File

@@ -132,13 +132,13 @@ public class IdleNotifierPluginTest
public void checkAnimationIdle()
{
when(player.getAnimation()).thenReturn(AnimationID.WOODCUTTING_BRONZE);
AnimationChanged animationChanged = AnimationChanged.INSTANCE;
AnimationChanged animationChanged = new AnimationChanged();
animationChanged.setActor(player);
plugin.onAnimationChanged(animationChanged);
plugin.onGameTick(GameTick.INSTANCE);
plugin.onGameTick(new GameTick());
when(player.getAnimation()).thenReturn(AnimationID.IDLE);
plugin.onAnimationChanged(animationChanged);
plugin.onGameTick(GameTick.INSTANCE);
plugin.onGameTick(new GameTick());
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 = AnimationChanged.INSTANCE;
AnimationChanged animationChanged = new AnimationChanged();
animationChanged.setActor(player);
plugin.onAnimationChanged(animationChanged);
plugin.onGameTick(GameTick.INSTANCE);
plugin.onGameTick(new GameTick());
when(player.getAnimation()).thenReturn(AnimationID.LOOKING_INTO);
plugin.onAnimationChanged(animationChanged);
plugin.onGameTick(GameTick.INSTANCE);
plugin.onGameTick(new GameTick());
when(player.getAnimation()).thenReturn(AnimationID.IDLE);
plugin.onAnimationChanged(animationChanged);
plugin.onGameTick(GameTick.INSTANCE);
plugin.onGameTick(new GameTick());
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 = AnimationChanged.INSTANCE;
AnimationChanged animationChanged = new AnimationChanged();
animationChanged.setActor(player);
plugin.onAnimationChanged(animationChanged);
plugin.onGameTick(GameTick.INSTANCE);
plugin.onGameTick(new GameTick());
// Logout
when(client.getGameState()).thenReturn(GameState.LOGIN_SCREEN);
GameStateChanged gameStateChanged = GameStateChanged.INSTANCE;
GameStateChanged gameStateChanged = new GameStateChanged();
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(GameTick.INSTANCE);
plugin.onGameTick(new GameTick());
verify(notifier, times(0)).notify(any());
}
@@ -190,16 +190,11 @@ public class IdleNotifierPluginTest
public void checkCombatIdle()
{
when(player.getInteracting()).thenReturn(monster);
InteractingChanged event = InteractingChanged.INSTANCE;
event.setSource(player);
event.setTarget(monster);
plugin.onInteractingChanged(event);
plugin.onGameTick(GameTick.INSTANCE);
plugin.onInteractingChanged(new InteractingChanged(player, monster));
plugin.onGameTick(new GameTick());
when(player.getInteracting()).thenReturn(null);
event.setSource(player);
event.setTarget(null);
plugin.onInteractingChanged(event);
plugin.onGameTick(GameTick.INSTANCE);
plugin.onInteractingChanged(new InteractingChanged(player, null));
plugin.onGameTick(new GameTick());
verify(notifier).notify("[" + PLAYER_NAME + "] is now out of combat!");
}
@@ -207,37 +202,27 @@ public class IdleNotifierPluginTest
public void checkCombatReset()
{
when(player.getInteracting()).thenReturn(monster);
InteractingChanged event = InteractingChanged.INSTANCE;
event.setSource(player);
event.setTarget(monster);
plugin.onInteractingChanged(event);
plugin.onGameTick(GameTick.INSTANCE);
plugin.onInteractingChanged(new InteractingChanged(player, monster));
plugin.onGameTick(new GameTick());
when(player.getInteracting()).thenReturn(randomEvent);
event.setSource(player);
event.setTarget(randomEvent);
plugin.onInteractingChanged(event);
plugin.onGameTick(GameTick.INSTANCE);
plugin.onInteractingChanged(new InteractingChanged(player, randomEvent));
plugin.onGameTick(new GameTick());
when(player.getInteracting()).thenReturn(null);
event.setSource(player);
event.setTarget(null);
plugin.onInteractingChanged(event);
plugin.onGameTick(GameTick.INSTANCE);
plugin.onInteractingChanged(new InteractingChanged(player, null));
plugin.onGameTick(new GameTick());
verify(notifier, times(0)).notify(any());
}
@Test
public void checkCombatLogout()
{
InteractingChanged event = InteractingChanged.INSTANCE;
event.setSource(player);
event.setTarget(monster);
plugin.onInteractingChanged(event);
plugin.onInteractingChanged(new InteractingChanged(player, monster));
when(player.getInteracting()).thenReturn(monster);
plugin.onGameTick(GameTick.INSTANCE);
plugin.onGameTick(new GameTick());
// Logout
when(client.getGameState()).thenReturn(GameState.LOGIN_SCREEN);
GameStateChanged gameStateChanged = GameStateChanged.INSTANCE;
GameStateChanged gameStateChanged = new GameStateChanged();
gameStateChanged.setGameState(GameState.LOGIN_SCREEN);
plugin.onGameStateChanged(gameStateChanged);
@@ -248,10 +233,8 @@ public class IdleNotifierPluginTest
// Tick
when(player.getInteracting()).thenReturn(null);
event.setSource(player);
event.setTarget(null);
plugin.onInteractingChanged(event);
plugin.onGameTick(GameTick.INSTANCE);
plugin.onInteractingChanged(new InteractingChanged(player, null));
plugin.onGameTick(new GameTick());
verify(notifier, times(0)).notify(any());
}
@@ -262,11 +245,11 @@ public class IdleNotifierPluginTest
when(client.getMouseIdleTicks()).thenReturn(80_000);
// But player is being damaged (is in combat)
final HitsplatApplied hitsplatApplied = HitsplatApplied.INSTANCE;
final HitsplatApplied hitsplatApplied = new HitsplatApplied();
hitsplatApplied.setActor(player);
hitsplatApplied.setHitsplat(new Hitsplat(Hitsplat.HitsplatType.DAMAGE, 0, 0));
plugin.onHitsplatApplied(hitsplatApplied);
plugin.onGameTick(GameTick.INSTANCE);
plugin.onGameTick(new GameTick());
verify(notifier, times(0)).notify(any());
}
@@ -279,8 +262,8 @@ public class IdleNotifierPluginTest
when(client.getKeyboardIdleTicks()).thenReturn(80_000);
when(client.getMouseIdleTicks()).thenReturn(14_500);
plugin.onGameTick(GameTick.INSTANCE);
plugin.onGameTick(GameTick.INSTANCE);
plugin.onGameTick(new GameTick());
plugin.onGameTick(new GameTick());
verify(notifier, times(1)).notify(any());
}
@@ -290,11 +273,11 @@ public class IdleNotifierPluginTest
when(config.getSpecEnergyThreshold()).thenReturn(50);
when(client.getVar(Matchers.eq(VarPlayer.SPECIAL_ATTACK_PERCENT))).thenReturn(400); // 40%
plugin.onGameTick(GameTick.INSTANCE); // once to set lastSpecEnergy to 400
plugin.onGameTick(new GameTick()); // 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(GameTick.INSTANCE);
plugin.onGameTick(new GameTick());
verify(notifier).notify(Matchers.eq("[" + PLAYER_NAME + "] has restored spec energy!"));
}
}

View File

@@ -115,13 +115,13 @@ public class MotherlodePluginTest
public void testOreCounter()
{
// set inMlm
GameStateChanged gameStateChanged = GameStateChanged.INSTANCE;
GameStateChanged gameStateChanged = new GameStateChanged();
gameStateChanged.setGameState(GameState.LOGGED_IN);
motherlodePlugin.onGameStateChanged(gameStateChanged);
// Initial sack count
when(client.getVar(Varbits.SACK_NUMBER)).thenReturn(42);
motherlodePlugin.onVarbitChanged(VarbitChanged.INSTANCE);
motherlodePlugin.onVarbitChanged(new VarbitChanged());
// 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(VarbitChanged.INSTANCE);
motherlodePlugin.onVarbitChanged(new VarbitChanged());
inventory = mock(ItemContainer.class);
// +1 rune, +4 nugget, +2 coal, +1 addy
@@ -162,9 +162,7 @@ public class MotherlodePluginTest
when(client.getItemContainer(InventoryID.INVENTORY)).thenReturn(inventory);
// Trigger comparison
ItemContainerChanged event = ItemContainerChanged.INSTANCE;
event.setItemContainer(inventory);
motherlodePlugin.onItemContainerChanged(event);
motherlodePlugin.onItemContainerChanged(new ItemContainerChanged(inventory));
verify(motherlodeSession).updateOreFound(ItemID.RUNITE_ORE, 1);
verify(motherlodeSession).updateOreFound(ItemID.GOLDEN_NUGGET, 4);

Some files were not shown because too many files have changed in this diff Show More