Skip to content

Commit 93a2c94

Browse files
authored
Merge pull request #50 from Dominilk01/canSpawnFor
Fix canSpawnFor to use allMatch insted of anyMatch
2 parents befebbf + 9b192e7 commit 93a2c94

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

api/src/main/java/me/tofaa/entitylib/ve/ViewerEngine.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ public void clearTracked() {
121121
* @return true if the user passed and did not fail any rules, false otherwise
122122
*/
123123
public boolean canSpawnFor(User user, WrapperEntity entity) {
124-
if (entity.getViewerRules().stream().anyMatch(rule -> rule.shouldSee(user))) return true;
125-
return globalRules.stream().anyMatch(rule -> rule.shouldSee(user));
124+
if (!entity.getViewerRules().isEmpty() && entity.getViewerRules().stream().allMatch(rule -> rule.shouldSee(user))) return true;
125+
return globalRules.stream().allMatch(rule -> rule.shouldSee(user));
126126
}
127127

128128
/**

0 commit comments

Comments
 (0)