File tree Expand file tree Collapse file tree
src/main/java/net/wurstclient Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1616import net .wurstclient .events .ChatOutputListener ;
1717import net .wurstclient .hack .Hack ;
1818import net .wurstclient .hacks .TooManyHaxHack ;
19+ import net .wurstclient .other_feature .OtherFeature ;
1920import net .wurstclient .util .ChatUtils ;
2021
2122public final class CmdProcessor implements ChatOutputListener
@@ -48,6 +49,9 @@ public void process(String input)
4849 if (runHackShortcut (input ))
4950 return ;
5051
52+ if (runOtherFeatureShortcut (input ))
53+ return ;
54+
5155 try
5256 {
5357 Command cmd = parseCmd (input );
@@ -151,6 +155,24 @@ private boolean runHackShortcut(String input)
151155 return true ;
152156 }
153157
158+ private boolean runOtherFeatureShortcut (String input )
159+ {
160+ String [] args = input .trim ().split ("\\ s+" );
161+ if (args .length != 1 || args [0 ].isEmpty ())
162+ return false ;
163+
164+ // If a real command shares this name, let the command parser handle it.
165+ if (cmds .getCmdByName (args [0 ]) != null )
166+ return false ;
167+
168+ OtherFeature otf = WurstClient .INSTANCE .getOtfs ().getOtfByName (args [0 ]);
169+ if (otf == null )
170+ return false ;
171+
172+ otf .doPrimaryAction ();
173+ return true ;
174+ }
175+
154176 private void setHackEnabled (Hack hack , boolean enabled )
155177 {
156178 TooManyHaxHack tooManyHax =
Original file line number Diff line number Diff line change 2727import net .wurstclient .command .Command ;
2828import net .wurstclient .hack .Hack ;
2929import net .wurstclient .hacks .AutoCompleteHack ;
30+ import net .wurstclient .other_feature .OtherFeature ;
3031
3132@ Mixin (CommandSuggestions .class )
3233public abstract class CommandSuggestionsMixin
@@ -79,6 +80,8 @@ private void onRefresh(CallbackInfo ci)
7980 Collection <Command > commands =
8081 WurstClient .INSTANCE .getCmds ().getAllCmds ();
8182 Collection <Hack > hacks = WurstClient .INSTANCE .getHax ().getAllHax ();
83+ Collection <OtherFeature > otfs =
84+ WurstClient .INSTANCE .getOtfs ().getAllOtfs ();
8285 SuggestionsBuilder builder = new SuggestionsBuilder (draftMessage , 0 );
8386 LinkedHashSet <String > candidates = new LinkedHashSet <>();
8487 String inlineSuggestion = "" ;
@@ -103,6 +106,14 @@ private void onRefresh(CallbackInfo ci)
103106 candidates .add (prefix + hack .getName ());
104107 }
105108
109+ for (OtherFeature otf : otfs )
110+ {
111+ if (otf == null || otf .getName () == null )
112+ continue ;
113+
114+ candidates .add (prefix + otf .getName ());
115+ }
116+
106117 for (String candidate : candidates )
107118 {
108119 if (!candidate .toLowerCase (Locale .ROOT ).startsWith (lowerDraft ))
You can’t perform that action at this time.
0 commit comments