隐藏来自实体的玩家
这可以通过使用事件 EntityTargetEvent 来完成
如果你取消活动,实体将不会定位到玩家:
@EventHandler
public void onEntityTarget(EntityTargetEvent e) {
Entity target = e.getEntity();
if(target instanceof Player) {
Player playerTargetted = (Player) target;
if (shouldBeInvisible(playerTargetted) {
e.setCancelled(true); //Cancel the target event
}
}
}