MCPcopy Create free account
hub / github.com/demoth/jake2 / Key_Bind_f

Method Key_Bind_f

client/src/main/java/jake2/client/Key.java:897–927  ·  view source on GitHub ↗
(List<String> args)

Source from the content-addressed store, hash-verified

895 }
896
897 private static void Key_Bind_f(List<String> args) {
898
899 if (args.size() < 2) {
900 Com.Printf("bind <key> [command] : attach a command to a key\n");
901 return;
902 }
903 int key = StringToKeynum(args.get(1));
904 if (key == -1) {
905 Com.Printf("\"" + args.get(1) + "\" isn't a valid key\n");
906 return;
907 }
908
909 // show current binding
910 if (args.size() == 2) {
911 if (ClientGlobals.keybindings[key] != null)
912 Com.Printf("\"" + args.get(1) + "\" = \"" + ClientGlobals.keybindings[key] + "\"\n");
913 else
914 Com.Printf("\"" + args.get(1) + "\" is not bound\n");
915 return;
916 }
917
918 // copy the rest of the command line
919 String cmd = ""; // start out with a null string
920 for (int i = 2; i < args.size(); i++) {
921 cmd += args.get(i);
922 if (i != (args.size() - 1))
923 cmd += " ";
924 }
925
926 SetBinding(key, cmd);
927 }
928
929 static void SetBinding(int keynum, String binding) {
930 if (keynum == -1)

Callers

nothing calls this directly

Calls 5

PrintfMethod · 0.95
StringToKeynumMethod · 0.95
SetBindingMethod · 0.95
sizeMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected