Skip to content

Commit 67ee0ad

Browse files
committed
Add right-click predict to in-game report option
1 parent f87b7b8 commit 67ee0ad

File tree

2 files changed

+30
-9
lines changed

2 files changed

+30
-9
lines changed

src/main/java/com/botdetector/BotDetectorConfig.java

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,17 @@ default boolean addPredictOption()
9999

100100
@ConfigItem(
101101
position = 5,
102+
keyName = "predictOnReport",
103+
name = "'Predict' on Right-click 'Report'",
104+
description = "Makes the in-game right-click 'Report' option also open the prediction panel."
105+
)
106+
default boolean predictOnReport()
107+
{
108+
return false;
109+
}
110+
111+
@ConfigItem(
112+
position = 6,
102113
keyName = "predictOptionCopyName",
103114
name = "'Predict' Copy Name to Clipboard",
104115
description = "Copies the player's name to the clipboard when right-click predicting a player."
@@ -109,7 +120,7 @@ default boolean predictOptionCopyName()
109120
}
110121

111122
@ConfigItem(
112-
position = 6,
123+
position = 7,
113124
keyName = HIGHLIGHT_PREDICT_KEY,
114125
name = "Highlight 'Predict' Option",
115126
description = "When right-clicking on a player, the predict option will be highlighted to be easier to identify."
@@ -120,7 +131,7 @@ default PredictHighlightMode highlightPredictOption()
120131
}
121132

122133
@ConfigItem(
123-
position = 7,
134+
position = 8,
124135
keyName = "autocomplete",
125136
name = "Prediction Autocomplete",
126137
description = "Autocomplete names when typing a name to predict"
@@ -131,7 +142,7 @@ default boolean panelAutocomplete()
131142
}
132143

133144
@ConfigItem(
134-
position = 8,
145+
position = 9,
135146
keyName = SHOW_FEEDBACK_TEXTBOX,
136147
name = "Show Feedback Textbox",
137148
description = "Show a textbox on the prediction feedback panel where you can explain your feedback to us."
@@ -142,7 +153,7 @@ default boolean showFeedbackTextbox()
142153
}
143154

144155
@ConfigItem(
145-
position = 9,
156+
position = 10,
146157
keyName = "panelDefaultStatsType",
147158
name = "Panel Default Stats Tab",
148159
description = "Sets the initial player statistics tab in the prediction panel for when the plugin is launched."
@@ -153,7 +164,7 @@ default PlayerStatsType panelDefaultStatsType()
153164
}
154165

155166
@ConfigItem(
156-
position = 10,
167+
position = 11,
157168
keyName = PANEL_FONT_TYPE_KEY,
158169
name = "Panel Font Size",
159170
description = "Sets the size of the label fields in the prediction panel."
@@ -164,7 +175,7 @@ default PanelFontType panelFontType()
164175
}
165176

166177
@ConfigItem(
167-
position = 11,
178+
position = 12,
168179
keyName = ANONYMOUS_UPLOADING_KEY,
169180
name = "Anonymous Uploading",
170181
description = "Your name will not be included with your name uploads.<br>Disable if you'd like to track your contributions."

src/main/java/com/botdetector/BotDetectorPlugin.java

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,18 @@ public class BotDetectorPlugin extends Plugin
130130

131131
private static final String PREDICT_OPTION = "Predict";
132132
private static final String HIGHLIGHTED_PREDICT_OPTION = ColorUtil.prependColorTag(PREDICT_OPTION, Color.RED);
133+
private static final String REPORT_OPTION = "Report";
133134
private static final String KICK_OPTION = "Kick";
134135
private static final String DELETE_OPTION = "Delete";
135136
private static final ImmutableSet<String> AFTER_OPTIONS =
136137
ImmutableSet.of("Message", "Add ignore", "Remove friend", DELETE_OPTION, KICK_OPTION);
137138

139+
private static final ImmutableSet<MenuAction> PLAYER_MENU_ACTIONS = ImmutableSet.of(
140+
MenuAction.PLAYER_FIRST_OPTION, MenuAction.PLAYER_SECOND_OPTION, MenuAction.PLAYER_THIRD_OPTION, MenuAction.PLAYER_FOURTH_OPTION,
141+
MenuAction.PLAYER_FIFTH_OPTION, MenuAction.PLAYER_SIXTH_OPTION, MenuAction.PLAYER_SEVENTH_OPTION, MenuAction.PLAYER_EIGTH_OPTION
142+
);
143+
144+
138145
private static final String VERIFY_DISCORD_COMMAND = "!code";
139146
private static final Pattern VERIFY_DISCORD_CODE_PATTERN = Pattern.compile("\\d{4}");
140147

@@ -757,11 +764,14 @@ private void onMenuOpened(MenuOpened event)
757764
@Subscribe
758765
private void onMenuOptionClicked(MenuOptionClicked event)
759766
{
760-
if ((event.getMenuAction() == MenuAction.RUNELITE || event.getMenuAction() == MenuAction.RUNELITE_PLAYER)
761-
&& event.getMenuOption().endsWith(PREDICT_OPTION))
767+
if (((event.getMenuAction() == MenuAction.RUNELITE || event.getMenuAction() == MenuAction.RUNELITE_PLAYER)
768+
&& event.getMenuOption().endsWith(PREDICT_OPTION))
769+
|| (config.predictOnReport() && (PLAYER_MENU_ACTIONS.contains(event.getMenuAction()) || event.getMenuAction() == MenuAction.CC_OP_LOW_PRIORITY)
770+
&& event.getMenuOption().equals(REPORT_OPTION)))
762771
{
763772
String name;
764-
if (event.getMenuAction() == MenuAction.RUNELITE_PLAYER)
773+
if (event.getMenuAction() == MenuAction.RUNELITE_PLAYER
774+
|| PLAYER_MENU_ACTIONS.contains(event.getMenuAction()))
765775
{
766776
Player player = client.getCachedPlayers()[event.getId()];
767777

0 commit comments

Comments
 (0)