Skip to content

Commit

Permalink
Add isEmpty method to CompoundTag class
Browse files Browse the repository at this point in the history
This new method checks if the compound tag contains any entries. It enhances the usability of the CompoundTag class by providing a straightforward way to determine if a tag is empty.
  • Loading branch information
NonSwag committed Nov 2, 2024
1 parent 3ab5aa4 commit 148a62f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion nbt/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
}

group = "net.thenextlvl.core"
version = "2.2.13"
version = "2.2.14"

java {
toolchain.languageVersion = JavaLanguageVersion.of(21)
Expand Down
9 changes: 9 additions & 0 deletions nbt/src/main/java/core/nbt/tag/CompoundTag.java
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,15 @@ public Set<String> keySet() {
return getValue().keySet();
}

/**
* Checks if the compound tag is empty.
*
* @return true if the compound tag has no entries, false otherwise
*/
public boolean isEmpty() {
return getValue().isEmpty();
}

/**
* Returns the number of tags contained in this compound tag.
*
Expand Down

0 comments on commit 148a62f

Please sign in to comment.