Comments (10)
Hello, this depends on the way you create the hologram. If you use DHAPI then yes, the hologram will be shown to everyone. But you can also create it with Hologram constructor and then use Hologram#enable() and Hologram#show(Player...) with the players that you want the hologram to be shown to.
from decentholograms.
Interesting. I'll give it a try and report back. A little workaround I was using to produce the same effect is below
Hologram holo = DHAPI.createHologram(UUID.randomUUID().toString(),
location.clone(), false, List.of(""));
holo.hideAll();
holo.addPage();
DHAPI.setHologramLines(holo, 1, List.of(StringExtensionsKt.chatColorize(text)));
holo.show(player, 1);
Using page management to make the default holo empty, and the content on page 1, then display 1 to the relevant users worked well enough, but using the constructor sounds simpler haha.
from decentholograms.
So I tried it out, and it turns out... This is false
create it with Hologram constructor and then use Hologram#enable() and Hologram#show(Player...)
The Holorgram#enable method actually does this, which is what tripped me up.
public void enable() {
super.enable();
this.showAll();
this.register();
}
It shows it to all by default. Additionally...
Hologram holo = new Hologram(UUID.randomUUID().toString(), location.clone(), false);
DHAPI.setHologramLines(holo, List.of(StringExtensionsKt.chatColorize(text)));
holo.setEnabled(true);
holo.register();
holo.show(player, 0);
The above should bypass the fact that enable() includes showAll(), however, in testing, other people can still see the holograms (included quick gif below). Sadly, the only way I've found to show a short-term created hologram to only one person via the API seems to be my hacky page solution.
from decentholograms.
Hi, I meant Hologram#setEnabled(true), my bad. Strange that it doesn't work as intended though. Anyway, I will look into it.
from decentholograms.
I just checked the code and i think that the following should work for you.
Hologram holo = new Hologram(UUID.randomUUID().toString(), location.clone(), false);
DHAPI.setHologramLines(holo, List.of(StringExtensionsKt.chatColorize(text)));
holo.show(player, 0);
You actually don't have to enable it as it is enabled by default, neither you need to call the Hologram#register() method because that's being called by the constructor. Also, holograms can process color codes so if you don't do anything special in the StringExtensionsKt.chatColorize(text)
method, you can also remove it.
from decentholograms.
Hrm... That's actually what I did for my first attempt, or close to it. It'll try that right now and report back.
EDIT: Nope. That way of doing it still leaks some numbers, surprisingly . But at least it's fewer numbers? You gotta look close at the right side, about 10% of holos are visible when they shouldn't be.
from decentholograms.
Any news regarding this? It's not this complicated to introduce a "defaultVisibility" parameter.
from decentholograms.
Still have this issue :v
from decentholograms.
We are starting a project to support DecentHolograms with pHD, which should solve this issue (and others). You can follow along at SlimeDog/pHD#4.
from decentholograms.
Visibility is not handled very well in the current version of the plugin. It basically updates the visibility for all players automatically and the only way to avoid this is to set a view permission to the hologram. Anyway, this is all going to be solved in upcoming 3.0 rewrite of the plugin which is gonna provide a proper visibility management in the API. I will close this issue now as there is nothing else to discuss.
from decentholograms.
Related Issues (20)
- Sub Permissions for Commands HOT 1
- DHAPI creates empty files HOT 3
- Custom replacemente on API HOT 2
- decent holograms error HOT 11
- Holograms turned into ton of armor stands randomly HOT 13
- Incorrect method call HOT 1
- Upon using the API to set a hologram item, this works fine but the minute the chunk is unloaded and the player returns, the item no longer displays. HOT 2
- Loop support for hologram lines HOT 3
- Updating holograms (flickering) HOT 3
- Allays always generate +1 hp holograms HOT 1
- 1.20.6 support HOT 7
- #HEAD items uncentered? HOT 6
- Add entity type (besides mobs) "PLAYER" too, with all its attributes HOT 2
- HoloPlots to errors because of DecentHolograms HOT 4
- DH throwing error with Holograms used in BetonQuest HOT 2
- Hello, can you update it to support creating holograms using Chinese? I am a user from China. HOT 2
- Item-NBT-API crash the maven api HOT 2
- Failed to modify player's pipeline. (NoSuchElementException/packet_handler)
- Dependency not found HOT 2
- transparent HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from decentholograms.