scripts: use ScriptPostFired event for scripts that callback at the end of the script
Uses the ScriptPostFired event that was added with the script inspector dev tool, removing the scripts that can be done with it.
This commit is contained in:
@@ -64,6 +64,7 @@ import net.runelite.api.events.GameTick;
|
||||
import net.runelite.api.events.PlayerDespawned;
|
||||
import net.runelite.api.events.PlayerSpawned;
|
||||
import net.runelite.api.events.ScriptCallbackEvent;
|
||||
import net.runelite.api.events.ScriptPostFired;
|
||||
import net.runelite.api.events.VarClientStrChanged;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
@@ -554,12 +555,15 @@ public class ClanChatPlugin extends Plugin
|
||||
clientThread.invokeLater(() -> confirmKickPlayer(kickPlayerName));
|
||||
break;
|
||||
}
|
||||
case "clanChatChannelRebuild":
|
||||
if (config.showIgnores())
|
||||
{
|
||||
clientThread.invoke(() -> colorIgnoredPlayers(config.showIgnoresColor()));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onScriptPostFired(ScriptPostFired event)
|
||||
{
|
||||
if (event.getScriptId() == ScriptID.CLAN_CHAT_CHANNEL_BUILD && config.showIgnores())
|
||||
{
|
||||
colorIgnoredPlayers(config.showIgnoresColor());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -48,12 +48,14 @@ import net.runelite.api.GrandExchangeOfferState;
|
||||
import net.runelite.api.ItemComposition;
|
||||
import net.runelite.api.MenuAction;
|
||||
import net.runelite.api.MenuEntry;
|
||||
import net.runelite.api.ScriptID;
|
||||
import net.runelite.api.events.ChatMessage;
|
||||
import net.runelite.api.events.FocusChanged;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.api.events.GrandExchangeOfferChanged;
|
||||
import net.runelite.api.events.MenuEntryAdded;
|
||||
import net.runelite.api.events.ScriptCallbackEvent;
|
||||
import net.runelite.api.events.ScriptPostFired;
|
||||
import net.runelite.api.events.WidgetLoaded;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetID;
|
||||
@@ -435,14 +437,20 @@ public class GrandExchangePlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onScriptPostFired(ScriptPostFired event)
|
||||
{
|
||||
// GE offers setup init
|
||||
if (event.getScriptId() != ScriptID.GE_OFFERS_SETUP_BUILD)
|
||||
{
|
||||
return;
|
||||
}
|
||||
rebuildGeText();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onScriptCallbackEvent(ScriptCallbackEvent event)
|
||||
{
|
||||
if (event.getEventName().equals("geBuilt"))
|
||||
{
|
||||
rebuildGeText();
|
||||
}
|
||||
|
||||
if (!event.getEventName().equals("setGETitle") || !config.showTotal())
|
||||
{
|
||||
return;
|
||||
|
||||
@@ -51,7 +51,7 @@ import net.runelite.api.SkullIcon;
|
||||
import net.runelite.api.SpriteID;
|
||||
import net.runelite.api.Varbits;
|
||||
import net.runelite.api.WorldType;
|
||||
import net.runelite.api.events.ScriptCallbackEvent;
|
||||
import net.runelite.api.events.ScriptPostFired;
|
||||
import net.runelite.api.vars.AccountType;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
@@ -72,6 +72,7 @@ import net.runelite.client.util.QuantityFormatter;
|
||||
public class ItemsKeptOnDeathPlugin extends Plugin
|
||||
{
|
||||
private static final int DEEP_WILDY = 20;
|
||||
|
||||
private static final Pattern WILDERNESS_LEVEL_PATTERN = Pattern.compile("^Level: (\\d+).*");
|
||||
|
||||
@AllArgsConstructor
|
||||
@@ -121,9 +122,9 @@ public class ItemsKeptOnDeathPlugin extends Plugin
|
||||
int wildyLevel;
|
||||
|
||||
@Subscribe
|
||||
public void onScriptCallbackEvent(ScriptCallbackEvent event)
|
||||
public void onScriptPostFired(ScriptPostFired event)
|
||||
{
|
||||
if (event.getEventName().equals("itemsKeptOnDeath"))
|
||||
if (event.getScriptId() == ScriptID.DEATH_KEEP_BUILD)
|
||||
{
|
||||
// The script in charge of building the Items Kept on Death interface has finished running.
|
||||
// Make all necessary changes now.
|
||||
|
||||
@@ -41,12 +41,13 @@ import net.runelite.api.InventoryID;
|
||||
import net.runelite.api.Item;
|
||||
import net.runelite.api.ItemContainer;
|
||||
import net.runelite.api.ItemID;
|
||||
import net.runelite.api.ScriptID;
|
||||
import net.runelite.api.SpriteID;
|
||||
import net.runelite.api.VarPlayer;
|
||||
import net.runelite.api.Varbits;
|
||||
import net.runelite.client.events.ConfigChanged;
|
||||
import net.runelite.api.events.GameTick;
|
||||
import net.runelite.api.events.ScriptCallbackEvent;
|
||||
import net.runelite.api.events.ScriptPostFired;
|
||||
import net.runelite.api.events.VarbitChanged;
|
||||
import net.runelite.api.widgets.JavaScriptCallback;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
@@ -152,9 +153,9 @@ public class ItemStatPlugin extends Plugin
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onScriptCallbackEvent(ScriptCallbackEvent event)
|
||||
public void onScriptPostFired(ScriptPostFired event)
|
||||
{
|
||||
if (event.getEventName().equals("geBuilt") && config.geStats())
|
||||
if (event.getScriptId() == ScriptID.GE_OFFERS_SETUP_BUILD && config.geStats())
|
||||
{
|
||||
int currentGeItem = client.getVar(VarPlayer.CURRENT_GE_ITEM);
|
||||
if (currentGeItem != -1 && client.getVar(Varbits.GE_OFFER_CREATION_TYPE) == 0)
|
||||
|
||||
@@ -43,7 +43,7 @@ import net.runelite.api.SpriteID;
|
||||
import net.runelite.api.VarClientInt;
|
||||
import net.runelite.api.Varbits;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.api.events.ScriptCallbackEvent;
|
||||
import net.runelite.api.events.ScriptPostFired;
|
||||
import net.runelite.api.events.VarClientIntChanged;
|
||||
import net.runelite.api.events.VarbitChanged;
|
||||
import net.runelite.api.widgets.JavaScriptCallback;
|
||||
@@ -119,13 +119,12 @@ public class QuestListPlugin extends Plugin
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onScriptCallbackEvent(ScriptCallbackEvent event)
|
||||
public void onScriptPostFired(ScriptPostFired event)
|
||||
{
|
||||
if (!event.getEventName().equals("questProgressUpdated"))
|
||||
if (event.getScriptId() != ScriptID.QUESTLIST_PROGRESS_LIST_SHOW)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
addQuestButtons();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user