Ejemplo n.º 1
0
 @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());
   }
 }
Ejemplo 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;
    }
  }
Ejemplo n.º 3
0
 public KeyType(String keyString, boolean h) {
   Keyboard key = null;
   if (keyString.equalsIgnoreCase("left")) key = Keyboard.MOUSE_LEFT;
   else if (keyString.equalsIgnoreCase("right")) key = Keyboard.MOUSE_RIGHT;
   else if (keyString.equalsIgnoreCase("middle")) key = Keyboard.MOUSE_MIDDLE;
   else key = Keyboard.valueOf("KEY_" + keyString.toUpperCase());
   this.key = key;
   this.hold = h;
 }
  public SMSSpoutKeyMap(String definition) {
    keys = new HashSet<Keyboard>();

    if (definition == null || definition.isEmpty()) {
      return;
    }
    String[] wanted = definition.split("\\+");
    for (String w : wanted) {
      w = w.toUpperCase();
      if (!w.startsWith("KEY_")) w = "KEY_" + w;
      keys.add(Keyboard.valueOf(w));
    }
  }