Tutorial by Examples

Player playerToHide; Player playerToNotSee; playerToNotSee.hide(playerToHide); //playerToHide will no longer be seen by playerToNotSee. If player is already hidden, nothing happens
Player toUnhide; Player toSeeAgain toSeeAgain.show(toUnhide); //Player toSeeAgain will now see Player toUnhide again. If player is already visible, nothing happens.
Player playerToCheck; Player playerSeeing; boolean isVisible = playerSeeing.canSee(playerToCheck); //isVisible returns true if playerSeeing can see playerToCheck and false otherwhise
This can be done by using the event EntityTargetEvent Entities won't target the player if you cancel the event: @EventHandler public void onEntityTarget(EntityTargetEvent e) { Entity target = e.getEntity(); if(target instanceof Player) { Player playerTargetted = (Player) target...

Page 1 of 1