GetTargetBlock problem, can anybody help?

Discussion in 'Plugin Development' started by Yuluuu, Feb 23, 2016.

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

    Yuluuu

    Hi, so i'm having a problem with the method getTargetBlock. I'm currently making a grappling hook based on this tutorial:

    And when i'm paste the code into eclipse, it have an error:
    [​IMG]
    I'm google for a while and then I change into the getTargetBlock method and the error still there:
    [​IMG]
    Can anybody help me? This is the code:

    Code:
    for (Block block : p.getTargetBlock(null, 100) {
                        if (!block.getType().equals(Material.AIR)) {
                                target = block.getLocation();
                                break;
                        }
                }
    I'm using the bukkit download from getspigot.com, thks :D
     
  2. Offline

    MaTaMoR_

    p.getTargetBlock((HashSet<Byte>) null);
     
  3. Offline

    mcdorli

    Maybe explain it

    @Yuluuu The player class has 2 methods with the same name (getTargetBlock), but one requires a hashset, the other one I can't remember. If ypu pass it a null, it can't choose befween the two.

    Try fo google next time, this was andwered millions of times so far
     
  4. Offline

    MaTaMoR_

    Damn the good guy, don't tag me for that thing.
     
  5. Offline

    mcdorli

    Didn't tagged you, I replyied :p
     
  6. Offline

    Yuluuu

    Damn you guys it good :'( I feel bad about my self :'(
    Thks evẻybody :3
    Edit:
    What happen now? :v I really don't understand[​IMG]
     
    Last edited: Feb 23, 2016
  7. Offline

    mcdorli

    Targetblock returns one block, not a list of blocks, the block the player is currebtly looking at.

    Please, learn java before doing bukkit.
     
Thread Status:
Not open for further replies.

Share This Page