Пример #1
0
public class Keybinds {

  public static int keybindFly = Keyboard.getKeyIndex("R");
  public static int keybindWallhack = Keyboard.getKeyIndex("X");
  public static int keybindSneak = Keyboard.getKeyIndex("Z");
  public static int keybindNofall = Keyboard.getKeyIndex("N");
  public static int keybindTracer = Keyboard.getKeyIndex("G");
  public static int keybindKillaura = Keyboard.getKeyIndex("F");
  public static int keybindBright = Keyboard.getKeyIndex("B");
  public static int keybindSpeedmine = Keyboard.getKeyIndex("V");
  public static int keybindSprint = Keyboard.getKeyIndex("C");
  public static int keybindGUI = Keyboard.getKeyIndex("GRAVE");

  public Keybinds() {}
}
Пример #2
0
  private void loadConfig() throws FileNotFoundException, IOException {

    properties = new Properties();

    if (configFile.exists()) {
      properties.load(new FileInputStream(configFile));

      toggleKey = Keyboard.getKeyIndex(properties.getProperty("ToggleKey", DEFAULT_KEY));
    } else {
      configFile.createNewFile();
      properties.load(new FileInputStream(configFile));

      properties.setProperty("ToggleKey", DEFAULT_KEY);
      toggleKey = Keyboard.getKeyIndex(DEFAULT_KEY);

      properties.store(new FileOutputStream(configFile), "SpeedMiner Config File - by phlip9");
    }
  }
Пример #3
0
  private void keyConfigSequence() {

    while (loop) {

      GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);

      try {
        menuTheme
            .getFont()
            .glDrawText(
                "\\c#FFFFFFKey Bindings",
                (Main.SCREEN_WIDTH - menuTheme.getFont().getStringWidth("Key Bindings")) / 2 + 2,
                50);

      } catch (InvalidEscapeSequenceException e) {
        e.printStackTrace();
      }

      Input.poll();
      mouseEvents = Input.getMouseEvents();
      keyEvents = Input.getKeyEvents();

      try {
        drawKeyConfigText(margin, 75, 30);
      } catch (InvalidEscapeSequenceException e) {

      }

      for (GLUIComponent t : keyConfigTextField) {

        t.processKeyEvents(keyEvents);
        t.processMouseEvents(mouseEvents);
        t.update(0);
        t.renderGL();
      }

      Display.update();

      if (Display.isCloseRequested()) {
        Game.GAME_STATE = Game.GAME_STATE_QUIT;
        menu = false;
        loop = false;
      } else if (Keyboard.isKeyDown(Keyboard.KEY_ESCAPE)) {
        loop = false;
      }
    }

    for (GLUIComponent t : keyConfigTextField) {

      if (t instanceof GLTextField) {
        ((GLTextField) t).setText(((GLTextField) t).getText().toUpperCase());
        KeyBindings.valueOf(t.getContext().toString())
            .setUserKey(Keyboard.getKeyIndex(((GLTextField) t).getText()));
      }
    }
  }
Пример #4
0
 @Override
 public void loadSkillKeyBindings() {
   skillGuiKeyBinding =
       new KeyBinding(
           "key.skillGui",
           Keyboard.getKeyIndex(Character.toString(keys[0])),
           "key.categories.gui");
   SkillAPIKeyHandler.INSTANCE.addKeyBinding(skillGuiKeyBinding, false);
   for (int i = 1; i < keys.length; i++) {
     skillKeyBindings[i - 1] =
         new KeyBinding(
             "key.skill" + i,
             Keyboard.getKeyIndex(Character.toString(keys[i])),
             "key.categories.gameplay");
   }
   for (KeyBinding binding : skillKeyBindings) {
     SkillAPIKeyHandler.INSTANCE.addKeyBinding(binding, false);
   }
   for (KeyBinding key : SkillAPIKeyHandler.INSTANCE.keyBindings) {
     ClientRegistry.registerKeyBinding(key);
   }
   updateKeyBindingTypes(Minecraft.getMinecraft().thePlayer);
 }
  @Override
  public void processCommand(ICommandSender icommandsender, String[] astring) {
    boolean successful = false;
    if (astring[0].equalsIgnoreCase("add")) {
      for (AbstractModule m : ModuleManager.instance().avModules) {
        if (astring[1].equalsIgnoreCase(m.getModuleName().replaceAll(" ", ""))) {
          int i = Keyboard.getKeyIndex(astring[2].toUpperCase());
          if (i != Keyboard.KEY_NONE) {
            successful = true;
            m.setKeybinding(i);
            icommandsender.sendChatToPlayer(
                ChatMessageComponent.createFromText(
                    "Setted key: "
                        + m.getKeybind()
                        + "("
                        + astring[2]
                        + ")"
                        + " for module: "
                        + m.getModuleName()));
            KeybindConfiguration.instance().writeKeybindConfig();
            break;
          }
        }
      }
    }

    if (astring[0].equalsIgnoreCase("delete")) {
      for (AbstractModule m : ModuleManager.instance().avModules) {
        if (astring[1].equalsIgnoreCase(m.getModuleName().replaceAll(" ", ""))) {
          successful = true;
          m.setKeybinding(0);
          icommandsender.sendChatToPlayer(
              ChatMessageComponent.createFromText("Removed key for module: " + m.getModuleName()));
          KeybindConfiguration.instance().writeKeybindConfig();
          break;
        }
      }
    }
    if (!successful) {
      icommandsender.sendChatToPlayer(
          ChatMessageComponent.createFromText(
              "Can't recognize module: " + astring[1] + " or subcommand: " + astring[0]));
    }
  }