Hey guys. I am making plugin, where you play as mob (only move event and tp mob). I have set player's mode spectator, because you can't collide with that mob (mob is pushing player and tp to player again so it is infinite loop. I have tried "setCollidable" but didnt work anytime). I wanted to hit player with left click while you are in spectator mode. So question is- How to stop setting targeted player as spectator target? Or is there some event that is checking spectator targeting? Thanks for your time guys
@skales65 There is a change I understand what you are trying to accomplish. I never tested this out by I have worked with it. Code: Player player = //player Entity target = //target EntityPlayer ep =((CraftPlayer)player).getHandle(); /* Bukkit-1.12 */ ep.setSpectatorTarget(target) I hope this is what you are looking for. If you have any further questions, I'm willing to help
@DanielTheDev I want to hit player (or mob) while I am in spectator mode. I have made it threw interact event but it check only click on block or in air(idk if I can do it threw it), not on mob. When you left click mob, you start spectating him. I want to hit him, not start spectating him.
@skales65 Check PlayerInteractEntityEvent and check if the gamemode is spectator if so cancel the event and give the player or mob damage, that could work
@Blackwing_Forged I see that in PlayerInteractEntityEvent you can only check right click. It is no problem, but still if player clicks on entity with left button he will start to spectate him. Any ideas how to stop it?