Closed FerusGrim closed 4 years ago
Currently, setClickCallback doesn't work (at least for BukkitHologramFactory.BukkitHologram).
I'm going to be making a PR soon which will fix this, but for now, this is part of my hotfix, as I needed something quicker than I could implement the fix.
private static final Field SPAWNED_ENTITIES_FIELD; static { Field spawnedEntitiesField = null; try { Class<?> clazz = Class.forName("me.lucko.helper.hologram.BukkitHologramFactory$BukkitHologram"); spawnedEntitiesField = clazz.getDeclaredField("spawnedEntities"); spawnedEntitiesField.setAccessible(true); } catch (Throwable e) { e.printStackTrace(); } SPAWNED_ENTITIES_FIELD = spawnedEntitiesField; } private List<UUID> getHologramEntityIds(Hologram hologram) { try { return ((List<ArmorStand>) SPAWNED_ENTITIES_FIELD.get(hologram)).stream() .map(Entity::getUniqueId) .collect(Collectors.toList()); } catch (IllegalAccessException e) { e.printStackTrace(); return Lists.newArrayList(); } }
private List<UUID> getHologramEntityIds(Hologram hologram) { return hologram.getArmorStands().stream() .map(Entity::getUniqueId) .collect(Collectors.toList()); }
Currently, setClickCallback doesn't work (at least for BukkitHologramFactory.BukkitHologram).
I'm going to be making a PR soon which will fix this, but for now, this is part of my hotfix, as I needed something quicker than I could implement the fix.
Before
After