Merge pull request #6431 from Hydrox6/friends-custom-entry
friendnotes: Use new chatbox input dialogue
This commit is contained in:
@@ -46,7 +46,7 @@ import net.runelite.api.events.NameableNameChanged;
|
|||||||
import net.runelite.api.events.RemovedFriend;
|
import net.runelite.api.events.RemovedFriend;
|
||||||
import net.runelite.api.widgets.WidgetInfo;
|
import net.runelite.api.widgets.WidgetInfo;
|
||||||
import net.runelite.client.config.ConfigManager;
|
import net.runelite.client.config.ConfigManager;
|
||||||
import net.runelite.client.game.ChatboxInputManager;
|
import net.runelite.client.game.chatbox.ChatboxPanelManager;
|
||||||
import net.runelite.client.plugins.Plugin;
|
import net.runelite.client.plugins.Plugin;
|
||||||
import net.runelite.client.plugins.PluginDescriptor;
|
import net.runelite.client.plugins.PluginDescriptor;
|
||||||
import net.runelite.client.ui.overlay.OverlayManager;
|
import net.runelite.client.ui.overlay.OverlayManager;
|
||||||
@@ -81,7 +81,7 @@ public class FriendNotesPlugin extends Plugin
|
|||||||
private FriendNoteOverlay overlay;
|
private FriendNoteOverlay overlay;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private ChatboxInputManager chatboxInputManager;
|
private ChatboxPanelManager chatboxPanelManager;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private HoveredFriend hoveredFriend = null;
|
private HoveredFriend hoveredFriend = null;
|
||||||
@@ -204,22 +204,22 @@ public class FriendNotesPlugin extends Plugin
|
|||||||
if (event.getMenuOption().equals(ADD_NOTE) || event.getMenuOption().equals(EDIT_NOTE))
|
if (event.getMenuOption().equals(ADD_NOTE) || event.getMenuOption().equals(EDIT_NOTE))
|
||||||
{
|
{
|
||||||
event.consume();
|
event.consume();
|
||||||
|
|
||||||
final String note = getFriendNote(sanitizedTarget);
|
final String note = getFriendNote(sanitizedTarget);
|
||||||
|
|
||||||
// Open the chatbox input dialog
|
// Open the new chatbox input dialog
|
||||||
chatboxInputManager.openInputWindow(String.format(NOTE_PROMPT_FORMAT, sanitizedTarget,
|
chatboxPanelManager.openTextInput(String.format(NOTE_PROMPT_FORMAT, sanitizedTarget, CHARACTER_LIMIT))
|
||||||
CHARACTER_LIMIT), Strings.nullToEmpty(note), CHARACTER_LIMIT, (content) ->
|
.value(Strings.nullToEmpty(note))
|
||||||
{
|
.onDone((content) ->
|
||||||
if (content == null)
|
|
||||||
{
|
{
|
||||||
return;
|
if (content == null)
|
||||||
}
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
content = Text.removeTags(content).trim();
|
content = Text.removeTags(content).trim();
|
||||||
log.debug("Set note for '{}': '{}'", sanitizedTarget, content);
|
log.debug("Set note for '{}': '{}'", sanitizedTarget, content);
|
||||||
setFriendNote(sanitizedTarget, content);
|
setFriendNote(sanitizedTarget, content);
|
||||||
});
|
}).build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user