getTargetBlock error

Discussion in 'Spigot Plugin Development' started by Pointless2Play, Apr 24, 2017.

  1. Simply gives an error: 'The method getTargetBlock(HashSet<Byte>, int) is ambiguous for the type Player'

    package me.kingdom.wand;

    import java.util.Set;

    import org.bukkit.Location;
    import org.bukkit.Material;
    import org.bukkit.entity.Player;
    import org.bukkit.event.Listener;

    public class Spark implements Listener{

    private Main plugin;

    public Spark(Main instance) {
    this.plugin = instance;

    public void onCast(Player p) {
    Location loc = p.getTargetBlock((Set<Material>) null, 50).getLocation();


  2. For goodness sake please put your code in
    Code (Java):
    blocks, thank you.
    But, what version are you using? Doesn't happen to me, copy-pasted that exact code with no errors.
  3. I'm using 1.11.2 Spigot and Craftbukkit, tested it with both.
  4. Well, as I said, that exact code works perfectly for me; and by the looks of it it shouldn't give the error. Did you save after it gave that error, did you try if it works in-game, is that the same exact code you have in your IDE?
  5. Thank you, it's fixed. One of my friends fucked with my code when I went to the bathroom, great friends uh?

    Anyway, thanks.
    • Funny Funny x 1
  6. Pff, that sure sounds like the truth ;) Anyhow, glad it's fixed!