Skip to content

Commit 80b6aaa

Browse files
committed
add empty check for ActionApplier & RequirementApplier
1 parent f6818fc commit 80b6aaa

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/main/java/me/hsgamer/bettergui/action/ActionApplier.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,15 @@ public ActionApplier(Menu menu, Object value) {
4040
this(ActionBuilder.INSTANCE.build(menu, value));
4141
}
4242

43+
/**
44+
* Check if the applier is empty
45+
*
46+
* @return true if it is empty
47+
*/
48+
public boolean isEmpty() {
49+
return actions.isEmpty();
50+
}
51+
4352
/**
4453
* Apply the action to the process without the next action
4554
*

src/main/java/me/hsgamer/bettergui/requirement/RequirementApplier.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,15 @@ public static Map<BukkitClickType, RequirementApplier> convertClickRequirementAp
108108
return clickRequirements;
109109
}
110110

111+
/**
112+
* Check if the applier is empty
113+
*
114+
* @return true if it is empty
115+
*/
116+
public boolean isEmpty() {
117+
return requirementSets.isEmpty() && failActionApplier.isEmpty();
118+
}
119+
111120
/**
112121
* Get the result of the requirement
113122
*

0 commit comments

Comments
 (0)