@Override
 public void keyPressed(KeyBindingEvent keyBindingEvent) {
   Keyboard key = keyBindingEvent.getBinding().getDefaultKey();
   switch (key) {
     case KEY_1:
     case KEY_2:
     case KEY_3:
     case KEY_4:
     case KEY_5:
     case KEY_6:
     case KEY_7:
     case KEY_8:
     case KEY_9:
       SpoutPlayer p = keyBindingEvent.getPlayer();
       if (holdingCtrl.contains(p)) {
         int numKey = (int) key.toString().charAt(4) - 49;
         p.sendMessage(numKey + " pressed");
         // p.setItemInHand( lastWep.get( p ) ); // This is wrong. This puts the pressed keys
         // item in the current hand. It doesn't change the #slot that's active..
         SkillsPlayer mmoPlayer = MMOSkillTree.mmoPlayerManager.get(p);
         mmoPlayer.activateSkill(numKey);
       }
       break;
   }
   if (key == Keyboard.KEY_LCONTROL) {
     SpoutPlayer p = keyBindingEvent.getPlayer();
     holdingCtrl.add(p);
     lastWep.put(p, p.getItemInHand());
   }
 }
Esempio n. 2
0
  public static void setupSpoutConfigs() {
    String temp = LoadProperties.readString("Spout.Menu.Key", "KEY_M");

    for (Keyboard x : Keyboard.values()) {
      if (x.toString().equalsIgnoreCase(temp)) {
        keypress = x;
      }
    }

    if (keypress == null) {
      System.out.println("Invalid KEY for Spout.Menu.Key, using KEY_M");
      keypress = Keyboard.KEY_M;
    }
  }