project: wrap up loose ends in api, upstream to fix the broken things
This commit is contained in:
@@ -2071,4 +2071,6 @@ public interface Client extends GameShell
|
||||
Widget getWidget(int param1);
|
||||
|
||||
Widget getScriptActiveWidget();
|
||||
|
||||
ScriptEvent createScriptEvent(Object[] args);
|
||||
}
|
||||
|
||||
@@ -40,13 +40,19 @@ public interface ScriptEvent
|
||||
String NAME = "event_opbase";
|
||||
|
||||
/**
|
||||
* Gets the widget of the event.
|
||||
*
|
||||
* @return the widget
|
||||
* @see Widget
|
||||
* Gets the widget the {@link #WIDGET_ID} and {@link #WIDGET_INDEX} args
|
||||
* are substituted with
|
||||
*/
|
||||
Widget getSource();
|
||||
|
||||
/**
|
||||
* Sets the widget the {@link #WIDGET_ID} and {@link #WIDGET_INDEX} args
|
||||
* are substituted with. This is useful for running widget listeners
|
||||
*
|
||||
* @see Widget#getOnLoadListener()
|
||||
*/
|
||||
ScriptEvent setSource(Widget widget);
|
||||
|
||||
/**
|
||||
* Gets the menu index of the event
|
||||
*
|
||||
@@ -80,4 +86,11 @@ public interface ScriptEvent
|
||||
* @return
|
||||
*/
|
||||
int getTypedKeyChar();
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes a cs2 script specified by this event
|
||||
*
|
||||
* This method must be ran on the client thread and is not reentrant
|
||||
*/
|
||||
void run();
|
||||
}
|
||||
@@ -25,15 +25,16 @@
|
||||
package net.runelite.api.events;
|
||||
|
||||
import lombok.Value;
|
||||
import net.runelite.api.Nameable;
|
||||
|
||||
/**
|
||||
* An event where a request to remove a friend is sent to the server.
|
||||
* An event trigger when a player is removed from the friend or ignore list.
|
||||
*/
|
||||
@Value
|
||||
public class RemovedFriend implements Event
|
||||
public class RemovedFriend
|
||||
{
|
||||
/**
|
||||
* The name of the removed friend.
|
||||
* The removed friend or ignore entry
|
||||
*/
|
||||
String name;
|
||||
}
|
||||
private final Nameable nameable;
|
||||
}
|
||||
@@ -85,6 +85,7 @@ import net.runelite.api.Player;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
import net.runelite.api.events.PlayerChanged;
|
||||
import net.runelite.api.events.UsernameChanged;
|
||||
import net.runelite.api.events.WorldChanged;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.account.AccountSession;
|
||||
import net.runelite.client.eventbus.EventBus;
|
||||
@@ -1041,7 +1042,13 @@ public class ConfigManager
|
||||
{
|
||||
updateRSProfile();
|
||||
}
|
||||
|
||||
|
||||
@Subscribe
|
||||
private void onWorldChanged(WorldChanged ev)
|
||||
{
|
||||
updateRSProfile();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onPlayerChanged(PlayerChanged ev)
|
||||
{
|
||||
|
||||
@@ -69,7 +69,6 @@ public class ExternalPluginClient
|
||||
.newBuilder()
|
||||
.addPathSegments("manifest.js")
|
||||
.build();
|
||||
System.out.println(manifest.uri());
|
||||
try (Response res = okHttpClient.newCall(new Request.Builder().url(manifest).build()).execute())
|
||||
{
|
||||
if (res.code() != 200)
|
||||
|
||||
@@ -132,6 +132,14 @@ public class CameraPlugin extends Plugin implements KeyListener, MouseListener
|
||||
{
|
||||
addZoomTooltip(sideSlider);
|
||||
}
|
||||
|
||||
Widget settingsInit = client.getWidget(WidgetInfo.SETTINGS_INIT);
|
||||
if (settingsInit != null)
|
||||
{
|
||||
client.createScriptEvent(settingsInit.getOnLoadListener())
|
||||
.setSource(settingsInit)
|
||||
.run();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -152,6 +160,14 @@ public class CameraPlugin extends Plugin implements KeyListener, MouseListener
|
||||
{
|
||||
sideSlider.setOnMouseRepeatListener((Object[]) null);
|
||||
}
|
||||
|
||||
Widget settingsInit = client.getWidget(WidgetInfo.SETTINGS_INIT);
|
||||
if (settingsInit != null)
|
||||
{
|
||||
client.createScriptEvent(settingsInit.getOnLoadListener())
|
||||
.setSource(settingsInit)
|
||||
.run();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -327,7 +327,7 @@ public class FriendNotesPlugin extends Plugin
|
||||
public void onRemovedFriend(RemovedFriend event)
|
||||
{
|
||||
// Delete a friend's note if they are removed
|
||||
final String displayName = Text.toJagexName(event.getName());
|
||||
final String displayName = Text.toJagexName(event.getNameable().getName());
|
||||
log.debug("Remove friend: '{}'", displayName);
|
||||
setFriendNote(displayName, null);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ public abstract class RSFriendSystemMixin implements RSFriendSystem
|
||||
@Inject
|
||||
public void rl$removeFriend(String friendName)
|
||||
{
|
||||
RemovedFriend removedFriend = new RemovedFriend(friendName);
|
||||
RemovedFriend removedFriend = new RemovedFriend(client.getFriendManager().getFriendContainer().findByName(friendName));
|
||||
client.getCallbacks().post(removedFriend);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user