隱藏來自實體的玩家

這可以通過使用事件 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
        }
    }
}