Betonquest: Hiding NPCs for individual players

Created on 18 May 2017  路  21Comments  路  Source: BetonQuest/BetonQuest

Hey guys, I just wanted to make an official request for a feature that would give events/conditions that make some specific Citizen NPC's, by ID, only visible to players with the correct tag. This would allow for a lot of dynamic storylines. The one I'm thinking of in particular, someone comes back to life in their own tomb, and becomes a questgiver. I only want them visible to players who have done the quest to resurrect them, but I also want players in either part of the quest to be able to see each other in that area, so I can't just make a copy of the tomb.

Thanks everyone! I hope to see this in the plugin at some point. :)

Feature Request Support Question

Most helpful comment

Okay, so I made a thing!
Maven messed up BQs dependencies for me so I couldn't integrate it into BQ and make a PR, but I figured you'd still want to see the result. Crammed into one class, here it is: https://gist.github.com/Namnodorel/fbf72c7ae871115d78c9a6aa76c693b6
I put usage and stuff as a comment under the gist. Feel free to make me change stuff so it can be used in BQ :)

All 21 comments

I was thinking about this some time ago. You could even spawn per-player NPCs and move them individually. Sadly, there's no existing plugin which has an API for hiding NPCs, I won't include version-dependent code in BQ and I don't feel like writing that kind of plugin (and maintaining it afterwards) myself.

However, if you can find something like that I'll be more than happy to write an integration :D

I had a similar idea some time ago, so-called Layers. Which basically mean that every world has seperate Layers which contain the blocks and entities. You could then assign a player to one (or more) Layer and that player would be able to see and interact only with stuff in that layer (it overrides the usual world). But I've never found a clean way to implement such a thing into Bukkit... For example, we'd have to make Bukkit understand that, for example a Zombie in a different layer can't target a player which is not in that layer. And we'd have to get other plugins to work with that, too...

I think the changes required for that would need to be at the engine level. Bukkit API is too limited and it won't improve in the future.

Exactly. Terasology would be much better suited, but...well, it's a different game.

If that plugin's at all possible in Spigot (which is what I personally use, but I'll also have it written for Bukkit), I'll pay a developer to write it myself. XD BetonQuest is so powerful, it's pretty much 50% of my server at this point.

Thanks for humoring me and responding, guys. I really appreciate it. :) I'll keep you updated, especially if I can find a developer!

Well, I got a little off-topic there. Just hiding the NPCs shouldn't be too hard - just using a mentioned PacketListener could hide an NPC from a player. But that would be very limited and potentially buggy, because the client is the only one who thinks there's nothing there. Like, any explosion damage, mob targeting etc. would act as if the NPC was there for everyone. Without looking anything up, I think players could also damage damagable NPCs even without seeing them by hitting the air.

That wouldn't be a problem in my case, at the very least. None of my NPC's are targetable, and mobs are always spawned far away. So shrug :P

Well, would you want a Blacklist- or Whitelistbased system? I could try to code something, just a single-purpose-plugin.

My server has neither a blacklist or a whitelist, but if you mean if I'd like a system where I choose the NPC's that are visible to everyone (and the rest are invisible by default), vs. a system where I choose the NPC's that require a command to be run or a permission of some sort (and the rest are visible to everyone by default), then I'd go with the latter. Definitely going to have more non-hidden NPC's than normal ones.

Just so everyone's aware, I've been able to find a developer willing to program this sort of thing. If all goes well, I'll request that he make the plugin free for download on Spigot :) If you guys would like to add integration at that point, more power to you!

Alright, he just needs to post the source code somewhere. I hate working with closed source libraries :P

This is a very good suggestion and I'm sure many others would benefit from having a blacklist/whitelist of visibility.

Have a look at this: https://stackoverflow.com/questions/36246091/hide-entity-for-some-players-spigot-bukkit-java

When you use it together with the BQ API, everything you need to code yourself is some glue code to make both things stick together and work on specific NPCs. I intended to do that in the next days, but when you've already found someone who codes it, that's even better ^^

Looks promising! great discovery! ^^

Is there any progress or should I add this to my own TODO list? By the way, it's only ProtocolLib, no NMS code, so we can include it in the plugin as ProtocolLib integration.

No mentionable progress, but as I mentioned I need this feature as well so I'll at least try to implement it. So far I wanted to do that in my own plugin, but if you want I can do it in BQ, probably similar to #586

I'm very sorry that I failed to update you guys; the developer in question unfortunately decided not to finish the project. If anyone does decide to make this change, I'd love to hear about it; I could still use this feature.

Okay, so I made a thing!
Maven messed up BQs dependencies for me so I couldn't integrate it into BQ and make a PR, but I figured you'd still want to see the result. Crammed into one class, here it is: https://gist.github.com/Namnodorel/fbf72c7ae871115d78c9a6aa76c693b6
I put usage and stuff as a comment under the gist. Feel free to make me change stuff so it can be used in BQ :)

I'll update the documentation tomorrow.

Awesome, thanks so much everyone. Really looking forward to using this.

The build is broken, so it's not on the dev builds page yet. I need to investigate what went wrong on Travis. I guess it couldn't pull ProtocolLib dependency for some reason.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MWFIAE picture MWFIAE  路  5Comments

survetman picture survetman  路  6Comments

HollishKid picture HollishKid  路  3Comments

HollishKid picture HollishKid  路  6Comments

SirMittens picture SirMittens  路  4Comments