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

How to work with visiable by default is false throught API? #99

Open
BigTows opened this issue May 23, 2024 · 2 comments
Open

How to work with visiable by default is false throught API? #99

BigTows opened this issue May 23, 2024 · 2 comments

Comments

@BigTows
Copy link
Contributor

BigTows commented May 23, 2024

I have next case:

        final var id = UUID.randomUUID();

        final var displayData = DisplayHologramData.getDefault(location);
        displayData.setBillboard(Display.Billboard.CENTER);
        displayData.setVisibleByDefault(false);

        final var textData = TextHologramData.getDefault(id.toString());
        
        de.oliver.fancyholograms.api.Hologram hologram = FancyHologramsPlugin.get().getHologramManager().create(
             new de.oliver.fancyholograms.api.data.HologramData(id.toString(), displayData, HologramType.TEXT, textData)      
        );
        FancyHologramsPlugin.get().getHologramManager().addHologram(hologram);

        hologram.createHologram();
        hologram.hideHologram(Bukkit.getOnlinePlayers());

So I generted VisibleByDefault holo and what do i want to do? I want to show that holo for some player, i am trying like this:

 hologramManager.getHologram(ID).ifPresent(hologram -> {
                  hologram.showHologram(player);
                  hologram.checkAndUpdateShownStateForPlayer(player);
              })

But holo displayed for some ticks and hidded again. What am i doing wrong?

@BigTows BigTows changed the title How does work with visiable by default? How does work with visiable by default false? May 23, 2024
@BigTows BigTows changed the title How does work with visiable by default false? How does work with visiable by default is false? May 23, 2024
@BigTows BigTows changed the title How does work with visiable by default is false? How does work with visiable by default is false throught API? May 23, 2024
@BigTows BigTows changed the title How does work with visiable by default is false throught API? How to work with visiable by default is false throught API? May 23, 2024
@BigTows
Copy link
Contributor Author

BigTows commented May 23, 2024

I found the reason:

if (!getData().getDisplayData().isVisibleByDefault() && !player.hasPermission("fancyholograms.viewhologram." + data.getName())) {

Could you add API-Path without permissions?

BigTows added a commit to BigTows/FancyHolograms that referenced this issue May 23, 2024
BigTows added a commit to BigTows/FancyHolograms that referenced this issue May 23, 2024
OliverSchlueter pushed a commit that referenced this issue May 25, 2024
* Added new property `Viewer` for hologram. #99

* Revert "Added new property `Viewer` for hologram. #99"

This reverts commit 63b95c9.

* Added predicate for visibility

* Pr fixes.

* Added migration for visibility to visible_by_default

* Pr fixes.

* Added old API and improve javadocs.

* Added list for Manual visibility.

* Revert "Added list for Manual visibility."

This reverts commit 9d2a711.
@OliverSchlueter
Copy link
Member

You can set the visibility to MANUAL and control it via the Visibility.ManualVisibility class

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants