diff --git a/api/src/main/java/me/filoghost/holographicdisplays/api/hologram/Hologram.java b/api/src/main/java/me/filoghost/holographicdisplays/api/hologram/Hologram.java index 77805ef3..ff1db08b 100644 --- a/api/src/main/java/me/filoghost/holographicdisplays/api/hologram/Hologram.java +++ b/api/src/main/java/me/filoghost/holographicdisplays/api/hologram/Hologram.java @@ -81,22 +81,14 @@ public interface Hologram { void setPosition(@NotNull Location location); /** - * Checks if the hologram will track and replace placeholders. - * This is false by default. - * - * @return if the hologram allows placeholders * @since 1 */ - boolean isAllowPlaceholders(); + @NotNull ResolvePlaceholders getResolvePlaceholders(); /** - * Sets if the hologram should track and replace placeholders. - * By default, it will not track them. - * - * @param allowPlaceholders if the hologram should track placeholders * @since 1 */ - void setAllowPlaceholders(boolean allowPlaceholders); + void setResolvePlaceholders(@NotNull ResolvePlaceholders resolvePlaceholders); /** * Deletes this hologram. Editing or teleporting the hologram when deleted diff --git a/api/src/main/java/me/filoghost/holographicdisplays/api/hologram/ResolvePlaceholders.java b/api/src/main/java/me/filoghost/holographicdisplays/api/hologram/ResolvePlaceholders.java new file mode 100644 index 00000000..f5c1c6b6 --- /dev/null +++ b/api/src/main/java/me/filoghost/holographicdisplays/api/hologram/ResolvePlaceholders.java @@ -0,0 +1,14 @@ +/* + * Copyright (C) filoghost and contributors + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ +package me.filoghost.holographicdisplays.api.hologram; + +public enum ResolvePlaceholders { + + DEFAULT, + ALL, + NONE + +} diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/api/current/APIHologram.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/api/current/APIHologram.java index a3e33372..b0404790 100644 --- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/api/current/APIHologram.java +++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/api/current/APIHologram.java @@ -8,6 +8,7 @@ package me.filoghost.holographicdisplays.plugin.api.current; import me.filoghost.fcommons.Preconditions; import me.filoghost.holographicdisplays.api.Position; import me.filoghost.holographicdisplays.api.hologram.Hologram; +import me.filoghost.holographicdisplays.api.hologram.ResolvePlaceholders; import me.filoghost.holographicdisplays.plugin.hologram.base.BaseHologram; import me.filoghost.holographicdisplays.plugin.hologram.base.ImmutablePosition; import me.filoghost.holographicdisplays.plugin.hologram.tracking.LineTrackerManager; @@ -22,7 +23,7 @@ public class APIHologram extends BaseHologram implements Hologram { private final APIHologramManager hologramManager; private final DefaultVisibilitySettings visibilitySettings; - private boolean allowPlaceholders; + private @NotNull ResolvePlaceholders resolvePlaceholders; protected APIHologram( ImmutablePosition position, @@ -35,6 +36,7 @@ public class APIHologram extends BaseHologram implements Hologram { this.plugin = plugin; this.hologramManager = hologramManager; this.visibilitySettings = new DefaultVisibilitySettings(); + this.resolvePlaceholders = ResolvePlaceholders.DEFAULT; } @Override @@ -53,19 +55,20 @@ public class APIHologram extends BaseHologram implements Hologram { } @Override - public boolean isAllowPlaceholders() { - return allowPlaceholders; + public @NotNull ResolvePlaceholders getResolvePlaceholders() { + return resolvePlaceholders; } @Override - public void setAllowPlaceholders(boolean allowPlaceholders) { + public void setResolvePlaceholders(@NotNull ResolvePlaceholders resolvePlaceholders) { + Preconditions.notNull(resolvePlaceholders, "resolvePlaceholders"); checkNotDeleted(); - if (this.allowPlaceholders == allowPlaceholders) { + if (this.resolvePlaceholders == resolvePlaceholders) { return; } - this.allowPlaceholders = allowPlaceholders; + this.resolvePlaceholders = resolvePlaceholders; for (APIHologramLine line : lines) { line.setChanged(); } diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/api/current/APITextHologramLine.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/api/current/APITextHologramLine.java index 34a7df92..afffdc40 100644 --- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/api/current/APITextHologramLine.java +++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/api/current/APITextHologramLine.java @@ -5,6 +5,7 @@ */ package me.filoghost.holographicdisplays.plugin.api.current; +import me.filoghost.holographicdisplays.api.hologram.ResolvePlaceholders; import me.filoghost.holographicdisplays.api.hologram.line.ClickListener; import me.filoghost.holographicdisplays.api.hologram.line.TextHologramLine; import me.filoghost.holographicdisplays.plugin.hologram.base.BaseTextHologramLine; @@ -23,7 +24,7 @@ public class APITextHologramLine extends BaseTextHologramLine implements TextHol @Override public boolean isAllowPlaceholders() { - return hologram.isAllowPlaceholders(); + return hologram.getResolvePlaceholders() == ResolvePlaceholders.ALL; } @Override