- 全息显示 API- 如何移除玩家附近的全息图

-Holographic Displays API- How to remove holograms near a player

我正在制作一个插件。当输入命令时。它删除了最接近 sender/player 的全息图。现在,我尝试过的是移除 10 个方块半径内的隐形盔甲架。我也试过看看是否有办法获得最近的全息图,但我没有运气。如果有什么方法可以指出我需要做什么,那将会很有帮助。我不是要代码,只是为了我需要查看的内容,比如特定的 class 等

谢谢,seb。

正在尝试移除盔甲架:

for(Entity en : player.getNearbyEntities(10, 10, 10)) {
            if(en instanceof ArmorStand) {
                en.remove();
            }
}

我的问题:我应该去哪里寻找移除玩家附近全息影像的方法?如果你能提供代码,虽然不需要。

//Loop through all existing holograms registered to your plugin
for (Hologram hologram : HologramsAPI.getHolograms(plugin)) {
    Location playerLoc   = player.getLocation();
    Location hologramLoc = hologram.getLocation();

    //Check if the distance between the locations are less than 10
    //and deletes the hologram if true
    if (playerLoc.distance(hologramLoc) < 10) {
        hologram.delete();
    }
}

这个全息显示器 API 有一个 hologram delete method

https://github.com/filoghost/HolographicDisplays/wiki