Skip to content

Commit

Permalink
Merge pull request #227 from Dominilk01/main
Browse files Browse the repository at this point in the history
Add mentions to DHAPI
  • Loading branch information
d0by1 authored Aug 7, 2024
2 parents 3f9aa60 + 3b61d92 commit d69deb5
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ public class Hologram extends UpdatingHologramObject implements ITicked {
CACHED_HOLOGRAMS = new ConcurrentHashMap<>();
}

/**
* @see eu.decentsoftware.holograms.api.DHAPI#getHologram(String)
*/
public static Hologram getCachedHologram(@NonNull String name) {
return CACHED_HOLOGRAMS.get(name);
}
Expand Down Expand Up @@ -248,6 +251,7 @@ public static Hologram fromFile(final @NotNull String filePath) throws LocationP
*
* @param name The name of the hologram.
* @param location The location of the hologram.
* @see eu.decentsoftware.holograms.api.DHAPI#createHologram(String, Location)
*/
public Hologram(@NonNull String name, @NonNull Location location) {
this(name, location, true);
Expand All @@ -259,6 +263,7 @@ public Hologram(@NonNull String name, @NonNull Location location) {
* @param name The name of the hologram.
* @param location The location of the hologram.
* @param saveToFile Whether the hologram should be saved to a file.
* @see eu.decentsoftware.holograms.api.DHAPI#createHologram(String, Location, boolean)
*/
public Hologram(@NonNull String name, @NonNull Location location, boolean saveToFile) {
this(name, location, saveToFile ? new FileConfig(DECENT_HOLOGRAMS.getPlugin(), String.format("holograms/%s.yml", name)) : null);
Expand Down Expand Up @@ -335,6 +340,8 @@ public String toString() {

/**
* This method calls {@link #destroy()} before deleting the hologram file.
*
* @see eu.decentsoftware.holograms.api.DHAPI#removeHologram(String)
*/
@Override
public void delete() {
Expand Down Expand Up @@ -406,6 +413,7 @@ public void setFacing(float facing) {
* for the players, you have to call {@link #realignLines()} for that.
*
* @param location The new location of this hologram.
* @see eu.decentsoftware.holograms.api.DHAPI#moveHologram(Hologram, Location)
*/
@Override
public void setLocation(@NonNull Location location) {
Expand Down Expand Up @@ -533,15 +541,6 @@ public void onQuit(@NonNull Player player) {
* Visibility Methods
*/

/**
* Set default display state
*
* @param state state
*/
public void setDefaultVisibleState(boolean state) {
this.defaultVisibleState = state;
}

/**
* @return Default display state
*/
Expand Down Expand Up @@ -680,6 +679,10 @@ public void updateAll() {
updateAll(false);
}

/**
* @param force If true, the line will be updated even if it does not need to be.
* @see eu.decentsoftware.holograms.api.DHAPI#updateHologram(String)
*/
public void updateAll(boolean force) {
synchronized (visibilityMutex) {
if (isEnabled() && !hasFlag(EnumFlag.DISABLE_UPDATING)) {
Expand Down Expand Up @@ -896,12 +899,18 @@ public void realignLines() {
}
}

/**
* @see eu.decentsoftware.holograms.api.DHAPI#addHologramPage(Hologram)
*/
public HologramPage addPage() {
HologramPage page = new HologramPage(this, pages.size());
pages.add(page);
return page;
}

/**
* @see eu.decentsoftware.holograms.api.DHAPI#insertHologramPage(Hologram, int)
*/
public HologramPage insertPage(int index) {
if (index < 0 || index > size()) return null;
HologramPage page = new HologramPage(this, index);
Expand All @@ -919,6 +928,9 @@ public HologramPage insertPage(int index) {
return page;
}

/**
* @see eu.decentsoftware.holograms.api.DHAPI#getHologramPage(Hologram, int)
*/
public HologramPage getPage(int index) {
if (index < 0 || index >= size()) return null;
return pages.get(index);
Expand All @@ -931,6 +943,9 @@ public HologramPage getPage(@NonNull Player player) {
return null;
}

/**
* @see eu.decentsoftware.holograms.api.DHAPI#removeHologramPage(Hologram, int)
*/
public HologramPage removePage(int index) {
if (index < 0 || index >= size()) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ public static HologramLine fromMap(@NonNull Map<String, Object> map, @Nullable H
* Constructors
*/

/**
* @see eu.decentsoftware.holograms.api.DHAPI#createHologramLine(HologramPage, Location, String)
*/
public HologramLine(@Nullable HologramPage parent, @NonNull Location location, @NotNull String content) {
super(location);
this.parent = parent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ public void realignLines() {
*
* @param line New line.
* @return Boolean whether the operation was successful.
* @see eu.decentsoftware.holograms.api.DHAPI#addHologramLine(HologramPage, String)
*/
public boolean addLine(@NonNull HologramLine line) {
lines.add(line);
Expand All @@ -169,6 +170,7 @@ public boolean addLine(@NonNull HologramLine line) {
* @param index Index of the new line.
* @param line New line.
* @return Boolean whether the operation was successful.
* @see eu.decentsoftware.holograms.api.DHAPI#insertHologramLine(Hologram, int, String)
*/
public boolean insertLine(int index, @NonNull HologramLine line) {
if (index < 0 || index >= size()) {
Expand All @@ -186,6 +188,7 @@ public boolean insertLine(int index, @NonNull HologramLine line) {
* @param index Index of the line.
* @param content Line's new content.
* @return Boolean whether the operation was successful.
* @see eu.decentsoftware.holograms.api.DHAPI#setHologramLine(HologramPage, int, String)
*/
public boolean setLine(int index, @NonNull String content) {
HologramLine line = getLine(index);
Expand All @@ -210,6 +213,7 @@ public boolean setLine(int index, @NonNull String content) {
*
* @param index Index of the line.
* @return The HologramLine or null if it wasn't found.
* @see eu.decentsoftware.holograms.api.DHAPI#getHologramLine(HologramPage, int)
*/
public HologramLine getLine(int index) {
if (index < 0 || index >= size()) {
Expand All @@ -223,6 +227,7 @@ public HologramLine getLine(int index) {
*
* @param index Index of the line.
* @return The removed line or null if it wasn't found.
* @see eu.decentsoftware.holograms.api.DHAPI#removeHologramLine(HologramPage, int)
*/
public HologramLine removeLine(int index) {
if (index < 0 || index >= size()) {
Expand Down

0 comments on commit d69deb5

Please sign in to comment.