Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hologram lib integration for multiple lines #59

Closed
wants to merge 3 commits into from
Closed

Hologram lib integration for multiple lines #59

wants to merge 3 commits into from

Conversation

unldenis
Copy link

@unldenis unldenis commented Jan 6, 2022

Given the need to create npc with multiple name lines, #56 #48 I implemented my new Hologram-Lib library in this one.
(Already tried and everything seems to work.)
My library uses ProtocolLib to create holograms with different features
(You can also contribute in case).

In the integration I created a subclass of Hologram because the two show and hide methods in the library removed it from the list of seeing players.

The most essential thing was to create the teams to remove the npc nametag.

I don't think I need to comment on everything since my hologram library is also open source, but if you need to, I'll answer it.

A simple use:

public void appendNPC(Location location) {
        // building the NPC
        NPC npc = NPC.builder()
                .profile(this.createProfile())
                .location(location)
                .imitatePlayer(false)
                .lookAtPlayer(false)
                .addLine("Hello world")
                .addLine("Hello %%player%%")
                .addLine(new ItemStack(Material.EMERALD_BLOCK))
                .addPlaceholder("%%player%%", Player::getName)
                // appending it to the NPC pool
                .build(this.npcPool);

        npc.hologram().setAnimation(2, AnimationType.CIRCLE);
}

Preview:
2022-01-06_20 03 15

@derklaro derklaro added the enhancement New feature or request label Jan 10, 2022
Copy link
Collaborator

@derklaro derklaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, thanks for your contribution. Personally I don't like the idea of the HologramLib being included into this project as it adds another hard dependency to the project.

On the other hand, the code style is not even close to what we were using previously in the project and some changes were made that I don't see the reason for. For example, why is setting the name of a player profile deprecated? Which way should a user take if he wants to depend on this project without using the holograms (for example if they made them themselfes for a better integration into their system)?

Just a few thoughts, maybe @juliarn can bring his opinion in :)

@unldenis
Copy link
Author

unldenis commented Jan 10, 2022

The reason is that if you noticed to have the holograms I have to remove the nametag from the npc. Making the name editable could lead to problems in case it matches the names of some players for example.
Compared to the other question:

  1. the user is not obliged to add this text
  2. why add other Bukkit tasks if I can make the npc visible together with the text
  3. the user should remove the nametag himself
  4. the library is opensource and uses packets like this

Just knowing it's a dependency doesn't make it a problem, or at least in my opinion this functionality in my plugin is necessary and worth it.
I also look forward to

@Bloeckchengrafik
Copy link

Bloeckchengrafik commented Jan 11, 2022

I think this feature would be a great addition, but in my oppinion, the dependency should be optional and only be used if multiline nametags are needed, "normal" nametags should be possible either way.

@derklaro
Copy link
Collaborator

Yes i meant that, sorry if that was not so clear :). The main reason why this is currently not the best thing to integrate is because of the library design itself... There is currently no real way for extensions to be integrated (which we might address when doing a rewrite which is currently not a thing I nor juliarn have time for)

@mxuricerm
Copy link

Where can i get the libary with multiplie lines?

@derklaro
Copy link
Collaborator

It's linked in the initial description...

@mxuricerm
Copy link

Are there both libraries in one somewhere? Because I can only find both libraries individually

@unldenis
Copy link
Author

For those who need the integration, the fork is here!
https://github.com/unldenis/NPC-Lib/tree/hologramlib-integration

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants