Coder Social home page Coder Social logo

Comments (10)

d0by1 avatar d0by1 commented on July 30, 2024

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.

UltraFaceguy avatar UltraFaceguy commented on July 30, 2024

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.

UltraFaceguy avatar UltraFaceguy commented on July 30, 2024

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.

holobug

from decentholograms.

d0by1 avatar d0by1 commented on July 30, 2024

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.

d0by1 avatar d0by1 commented on July 30, 2024

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.

UltraFaceguy avatar UltraFaceguy commented on July 30, 2024

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.
leakinnn2

from decentholograms.

SkytAsul avatar SkytAsul commented on July 30, 2024

Any news regarding this? It's not this complicated to introduce a "defaultVisibility" parameter.

from decentholograms.

UltraFaceguy avatar UltraFaceguy commented on July 30, 2024

Still have this issue :v

from decentholograms.

SlimeDog avatar SlimeDog commented on July 30, 2024

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.

d0by1 avatar d0by1 commented on July 30, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.