Want a better Minecraft server? Read about SpigotMC here!
Separate names with a comma.
Discussion in 'Spigot Plugin Development' started by SledgeR6, Dec 8, 2018 at 5:54 PM.
Of course it is.
Player.getTargetBlock() will help you
And how do I set the command for that specific block, which can only be done by looking at the specific block?
Can you give me some advice?
Try do this in the onCommand method.
The method getTargetBlock(HashSet<Byte>, int) is ambiguous for the type Player
player.getTargetBlock((Set<Material>) null, 3)
player cannot be resolved
Don't just copy and paste the code. Do you have a player object in your code? If so, use that.
Ok, but where can I post the message to verify that the block it is watching is right, and if it is not right to send it another warning message.
Another error: The method getTargetBlock(HashSet<Byte>, int) in the type LivingEntity is not applicable for the arguments (Set<Material>, int)
player.getTargetBlock((Set<Material>) null, 3) -> returns a block object.
Use Block#getType to get the block's material and then add an if statement comparing it to whatever material type (block) you want.