Easy way to check for sword parrying?

Discussion in 'Plugin Development' started by Codex Arcanum, Nov 5, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    Codex Arcanum

    Title says it all. Is there any easy way to check if someone is currently parrying with a sword?
     
  2. Offline

    thescreem

    I would say to use a PlayerInteractEvent and check for right-click actions. Then check if the player is holding a sword in their hand.
     
  3. Offline

    ArcheCane

    You could either use PlayerInteractEvent or PlayerAnimationEvent and check, if you're using interact event you should check for right click, if animation event you should check for arm swing. also check if player is holding a sword.
     
  4. Offline

    thescreem

    Using a PlayerAnimationEvent isn't going to work, as the animation event is essentially a left-click event while you right-click to parry.
     
  5. Offline

    ArcheCane

    Good point.
     
  6. Offline

    undeadmach1ne

    can anyone verify if parrying even works? i made a testing plugin that basically reads out the damage you deal and receive as it happens. it shows critical hits working fine, but it shows no change in damage taken between parrying and just standing there.

    more on topic: couldnt you just check if item inhand is a sword and rightclicking? something like :

    Code:
        public void onPlayerInteract(PlayerInteractEvent event)
          {
            if (event.hasItem())
            {
              if (event.getItem().getType() == Material.whatever_sword_material)
              {
                if ((event.getAction() == Action.RIGHT_CLICK_AIR)
                {
                  do whatever
                }
              }
                else return;
            }
        }
    cool first plugin btw. ill probably try that out at some point soon (dowsing rods)
     
  7. Offline

    DrAgonmoray

    I think parrying works in 1.9
     
    undeadmach1ne likes this.
  8. Offline

    undeadmach1ne

    nice :) thanks for confirming.
     
  9. Offline

    Codex Arcanum

    Thanks. Right now I'm working on a vaguely related plugin. Basically I am adding new weapons groups (probably with UltraItems) with special perks. The one I'm working on now is hammers with knockback, and I just wanted to make it so they have less knockback if you parry.
     
  10. Offline

    undeadmach1ne

    did that code snippet work for you or did you already have it sorted out?
     
  11. Offline

    Codex Arcanum

    Nope, haven't gotten around to doing anything with it yet. Had other stuff to do today.
     
Thread Status:
Not open for further replies.

Share This Page