Want a better Minecraft server? Read about SpigotMC here!
Separate names with a comma.
Discussion in 'Spigot Plugin Development' started by IllegalSloth, Jun 1, 2017.
How do I make my title appear for longer?
Edit: Misunderstood. Use fade and stay for this.
You can set the fade in, stay and out.
There is a way: PacketPlayOutTitle. http://wiki.vg/Protocol#Title
It would be useful if you put some code explaining how
It would be good if you could show us your solution and then we can help.
Which version of Minecraft are you using? For recent versions there is a method for that (Player#sendTitle). For lower version, you'll need to use packets since the spigot api method does not include fade in and out
It would be useful if you show some code....
Yep, as these folks have already said, you need to use either the 1.9+ #sendTitle method, or packets, depending on which version you're writing for.
Could you show me an example for 1.8?
It would make your life a whole lot easier if you were to use Spigot 1.11.2. API methods exist for a reason, and you can't get access to those methods without updating. Show us what you've tried and we'll help you from there. We don't often spoonfeed here because it won't ever help teach you how to do it for yourself in the future.
Tip, take a look at the PacketPlayOutTitle class as well as EntityPlayer's "playerConnection" field which provides a #sendPacket() method. You can find plenty of resources regarding this topic if you take a nice little search through Google
@IllegalSloth here is some code (not mine) with some comments to understand the code when using it. This code is multi-version
Not to mention we don't actually support 1.8 here. /shrug
The method is Player#sendTitle(String title, String subtitle, int fadeIn, int stay, int fadeOut)
This method exists since 1.11 AFAIK and this is what it does (works in 1.8 as well)
If you still need help, Rayzr created an API for this, and you set fade out and fade in, also how long it says up.
This might help you.