File tree 1 file changed +18
-3
lines changed
src/main/java/org/spongepowered/api/adventure
1 file changed +18
-3
lines changed Original file line number Diff line number Diff line change 27
27
import net .kyori .adventure .audience .Audience ;
28
28
import org .spongepowered .api .Sponge ;
29
29
30
+ import java .util .Objects ;
31
+
30
32
/**
31
33
* {@link Audience}s.
32
34
*/
@@ -47,7 +49,19 @@ public static Audience server() {
47
49
* @return An audience
48
50
*/
49
51
public static Audience onlinePlayers () {
50
- return factory ().onlinePlayers ();
52
+ return Sponge .getRegistry ().getFactoryRegistry ().provideFactory (Factory .class ).onlinePlayers ();
53
+ }
54
+
55
+ /**
56
+ * Gets an {@link Audience} that targets all online players
57
+ * with the specified permission.
58
+ *
59
+ * @param permission The permission
60
+ * @return An audience
61
+ */
62
+ public static Audience withPermission (final String permission ) {
63
+ Objects .requireNonNull (permission );
64
+ return Sponge .getRegistry ().getFactoryRegistry ().provideFactory (Factory .class ).withPermission (permission );
51
65
}
52
66
53
67
/**
@@ -59,13 +73,14 @@ public static Audience system() {
59
73
return Sponge .getGame ().getSystemSubject ();
60
74
}
61
75
62
- // TODO: withPermission
63
-
64
76
private static Factory factory () {
65
77
return Sponge .getRegistry ().getFactoryRegistry ().provideFactory (Factory .class );
66
78
}
67
79
68
80
public interface Factory {
81
+
69
82
Audience onlinePlayers ();
83
+
84
+ Audience withPermission (String permission );
70
85
}
71
86
}
You can’t perform that action at this time.
0 commit comments