Skip to content

Commit 8ceeae3

Browse files
Merge pull request #118 from Cyborger1/report-predict
Add right-click predict to in-game report option
2 parents a2b4a21 + 67ee0ad commit 8ceeae3

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
@@ -131,11 +131,18 @@ public class BotDetectorPlugin extends Plugin
131131

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

140+
private static final ImmutableSet<MenuAction> PLAYER_MENU_ACTIONS = ImmutableSet.of(
141+
MenuAction.PLAYER_FIRST_OPTION, MenuAction.PLAYER_SECOND_OPTION, MenuAction.PLAYER_THIRD_OPTION, MenuAction.PLAYER_FOURTH_OPTION,
142+
MenuAction.PLAYER_FIFTH_OPTION, MenuAction.PLAYER_SIXTH_OPTION, MenuAction.PLAYER_SEVENTH_OPTION, MenuAction.PLAYER_EIGTH_OPTION
143+
);
144+
145+
139146
private static final String VERIFY_DISCORD_COMMAND = "!code";
140147
private static final int VERIFY_DISCORD_CODE_SIZE = 4;
141148
private static final Pattern VERIFY_DISCORD_CODE_PATTERN = Pattern.compile("\\d{1," + VERIFY_DISCORD_CODE_SIZE + "}");
@@ -762,11 +769,14 @@ private void onMenuOpened(MenuOpened event)
762769
@Subscribe
763770
private void onMenuOptionClicked(MenuOptionClicked event)
764771
{
765-
if ((event.getMenuAction() == MenuAction.RUNELITE || event.getMenuAction() == MenuAction.RUNELITE_PLAYER)
766-
&& event.getMenuOption().endsWith(PREDICT_OPTION))
772+
if (((event.getMenuAction() == MenuAction.RUNELITE || event.getMenuAction() == MenuAction.RUNELITE_PLAYER)
773+
&& event.getMenuOption().endsWith(PREDICT_OPTION))
774+
|| (config.predictOnReport() && (PLAYER_MENU_ACTIONS.contains(event.getMenuAction()) || event.getMenuAction() == MenuAction.CC_OP_LOW_PRIORITY)
775+
&& event.getMenuOption().equals(REPORT_OPTION)))
767776
{
768777
String name;
769-
if (event.getMenuAction() == MenuAction.RUNELITE_PLAYER)
778+
if (event.getMenuAction() == MenuAction.RUNELITE_PLAYER
779+
|| PLAYER_MENU_ACTIONS.contains(event.getMenuAction()))
770780
{
771781
Player player = client.getCachedPlayers()[event.getId()];
772782

0 commit comments

Comments
 (0)