2 problems, making a player stay on the ground + doing something when a player shoots an arrow.

Discussion in 'Plugin Development' started by Relentless_x, Apr 13, 2011.

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


    Is there anyway to see if a player fires and arrow and then if they do, run something?

    also i have this code which i want to make the guys just move faster, but it also makes you lfy in any direction you look, how can i make them stay on the ground?

            if (player.isSneaking())
                if (playerHandler.getRace(player).equalsIgnoreCase("elf")) {
                    Vector dir = player.getLocation().getDirection().multiply(2);
  2. Offline



    Your first question (the bow firing) you would listen for right-click events and check to see if the player was wielding a bow.

    For the second problem, the first thing that came to mind was to check under the player for the first non-AIR block and set the player's y-value one above that. Don't know how this would work in practice though.
  3. Offline


    ok thanks i'll try them both out!

    how can i check if there is air underneath the player been searching the javadocs since i posted last message, ive found nothing :S

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: May 13, 2016
  4. Offline


    Try :

    Location l = player.getLocation();
    World w = player.getWorld();
    Block b = w.getBlockAt(l.getX(),l.getY() - 1, l.getZ());
    if(b.getType == Materil.AIR){
    //DO somthing
  5. Offline


    ok thanks ill look into it :) (Y)
  6. Offline


    This works too:
  7. Offline


    thank you kindly :)
Thread Status:
Not open for further replies.

Share This Page