FancyMcPlugins / FancyHolograms

FancyHolograms is a simple, lightweight and fast hologram plugin using display entities
https://modrinth.com/plugin/fancyholograms
MIT License
93 stars 29 forks source link

Feature request: API #3

Open SlimeDog opened 1 year ago

SlimeDog commented 1 year ago

Please implement a public API so pHD can consider adding support.

OliverSchlueter commented 1 year ago

I will do that in the comming days and keep you updated here.

SlimeDog commented 1 year ago

The most important API access points are hologram name (ie., the list) and visibility. pHD utilizes a variety of factors to determine if a hologram should be visible to a particular player, so it needs to be able to set/unset visibility.

OliverSchlueter commented 1 year ago

To get a hologram by name:

Hologram holo = FancyHolograms.getInstance().getHologramManager().getHologram("name");

To get a list of all holograms:

Collection<Hologram> holograms = FancyHolograms.getInstance().getHologramManager().getAllHolograms();

To show/spawn to a player

hologram.spawn(serverPlayer); // requires a ServerPlayer
HologramSpigotAdapter.fromHologram(hologram).spawn(player); // requires a normal Bukkit Player

To hide/remove to a player

hologram.remove(serverPlayer);
HologramSpigotAdapter.fromHologram(hologram).remove(player); // requires a normal Bukkit Player

There is no information stored which players see which holograms, but I'll make a HologramSpawnEvent and a HologramRemoveEvent, then you can in theory easily track that.

SlimeDog commented 1 year ago

There is no information stored which players see which holograms, but I'll make a HologramSpawnEvent and a HologramRemoveEvent, then you can in theory easily track that.

pHD controls visibility for a player, based on these factors.

OliverSchlueter commented 1 year ago

@SlimeDog do you need any more information or can this be closed?

SlimeDog commented 1 year ago

Has FancyHolograms API covered all the listed items?

SlimeDog commented 1 year ago

We're also waiting for more hologram features, like heads and items and blocks, but those are in addition to the pHD control features.

keehl254 commented 1 year ago

Would it be possible to adjust the build settings to include the API as a compile, or to combine the API project and the plugin project together?

The developer gradle repo is only allowing me to see the classes inside of the plugin branch; I can do FancyHologramsPlugin.get().getHologramsManager() But I cannot see any of the events, the Hologram class, nor the HologramData class. As a result, I really can't use the API if I am not just manually adding the API package into my project.

image

The above image should have shown me a list of possible methods and fields inside the Hologram class, but as it cannot be found, it is blank.

OliverSchlueter commented 1 year ago

Would it be possible to adjust the build settings to include the API as a compile, or to combine the API project and the plugin project together?

The developer gradle repo is only allowing me to see the classes inside of the plugin branch; I can do FancyHologramsPlugin.get().getHologramsManager() But I cannot see any of the events, the Hologram class, nor the HologramData class. As a result, I really can't use the API if I am not just manually adding the API package into my project.

image

The above image should have shown me a list of possible methods and fields inside the Hologram class, but as it cannot be found, it is blank.

Yes I'll see what I can do (I'm not the best with maven repos and gradle), thank you for telling

OliverSchlueter commented 11 months ago

We're also waiting for more hologram features, like heads and items and blocks, but those are in addition to the pHD control features.

I just released the feature to have item & block holograms (https://github.com/FancyMcPlugins/FancyHolograms/releases/tag/v2.0.3)

Do you need anything else?

SlimeDog commented 11 months ago

Do you need anything else?

I will test it over the next week or so. Thanks.

SlimeDog commented 11 months ago

Do you need anything else?

Command(s) to convert from HolographicDisplays and DecentHolograms would be a big plus.

SlimeDog commented 11 months ago

OK, I've done some testing (more to follow).

In what follows, HD=HolographicDisplays, DH=DecentHolograms, FH=FancyHolograms.

SlimeDog commented 11 months ago

A hologram should be a collection of (one or more) related display entities of various types. For me, a typical hologram consists of a block in the middle (vertically) of several text lines.

SlimeDog commented 10 months ago

I would like to add FancyHolograms support to pHD. It would be helpful if the issues noted above

could be addressed. Thanks for your consideration.

OliverSchlueter commented 10 months ago

I would like to add FancyHolograms support to pHD. It would be helpful if the issues noted above

* combined holographic elements in a single hologram

* bouncing/rotating block elements

* centered location specification

could be addressed. Thanks for your consideration.

Combined hologram elements in one single holograms is not planned for now. You would need to position multiple holograms by yourself.

I'll think about bouncing & rotating item/block holograms. That could be pretty cool.

You can center the hologram on block with the moveTo command (x.5 y z.5)?

SlimeDog commented 10 months ago

You can center the hologram on block with the moveTo command (x.5 y z.5)?

Yep. Works great. Thanks.

I'll think about bouncing & rotating item/block holograms. That could be pretty cool.

That would be great.

Combined hologram elements in one single holograms is not planned for now. You would need to position multiple holograms by yourself.

OK. Will do.