mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-04 23:47:59 +01:00
Add EventNode#getParent
This commit is contained in:
parent
94e315e3b2
commit
f1ddedfb44
@ -123,6 +123,7 @@ public class EventNode<T extends Event> {
|
||||
|
||||
public EventNode<T> addChild(@NotNull EventNode<? extends T> child) {
|
||||
synchronized (GLOBAL_CHILD_LOCK) {
|
||||
Check.stateCondition(child.parent != null, "Node already has a parent");
|
||||
Check.stateCondition(Objects.equals(parent, child), "Cannot have a child as parent");
|
||||
final boolean result = this.children.add((EventNode<T>) child);
|
||||
if (result) {
|
||||
@ -209,6 +210,10 @@ public class EventNode<T extends Event> {
|
||||
return this;
|
||||
}
|
||||
|
||||
public @Nullable EventNode<? super T> getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
public @NotNull Set<@NotNull EventNode<T>> getChildren() {
|
||||
return Collections.unmodifiableSet(children);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user