@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());
   }
 }
예제 #2
0
 public static String getCrossbow(SpoutPlayer player) {
   ItemStack inHand = player.getItemInHand();
   /*for(GenericCustomTool crossbow :MaterialManager.customcrossbows){
   	if(inHand.getDurability() == crossbow.getCustomId()){
   		return crossbow.getName();
   	}
   }*/
   return null;
 }