diff --git a/paper-api/src/main/java/org/bukkit/Bukkit.java b/paper-api/src/main/java/org/bukkit/Bukkit.java index df6930fb5b..557d97bb3d 100644 --- a/paper-api/src/main/java/org/bukkit/Bukkit.java +++ b/paper-api/src/main/java/org/bukkit/Bukkit.java @@ -1384,6 +1384,32 @@ public final class Bukkit { return server.getLootTable(key); } + /** + * Selects entities using the given Vanilla selector. + *
+ * No guarantees are made about the selector format, other than they match + * the Vanilla format for the active Minecraft version. + *
+ * Usually a selector will start with '@', unless selecting a Player in + * which case it may simply be the Player's name or UUID. + *
+ * Note that in Vanilla, elevated permissions are usually required to use + * '@' selectors, but this method should not check such permissions from the + * sender. + * + * @param sender the sender to execute as, must be provided + * @param selector the selection string + * @return a list of the selected entities. The list will not be null, but + * no further guarantees are made. + * @throws IllegalArgumentException if the selector is malformed in any way + * or a parameter is null + * @deprecated draft API + */ + @Deprecated + public static List selectEntities(CommandSender sender, String selector) throws IllegalArgumentException { + return server.selectEntities(sender, selector); + } + /** * @see UnsafeValues * @return the unsafe values instance diff --git a/paper-api/src/main/java/org/bukkit/Server.java b/paper-api/src/main/java/org/bukkit/Server.java index f94f2958f1..5fb5e4ff18 100644 --- a/paper-api/src/main/java/org/bukkit/Server.java +++ b/paper-api/src/main/java/org/bukkit/Server.java @@ -1153,6 +1153,30 @@ public interface Server extends PluginMessageRecipient { */ LootTable getLootTable(NamespacedKey key); + /** + * Selects entities using the given Vanilla selector. + *
+ * No guarantees are made about the selector format, other than they match + * the Vanilla format for the active Minecraft version. + *
+ * Usually a selector will start with '@', unless selecting a Player in + * which case it may simply be the Player's name or UUID. + *
+ * Note that in Vanilla, elevated permissions are usually required to use + * '@' selectors, but this method should not check such permissions from the + * sender. + * + * @param sender the sender to execute as, must be provided + * @param selector the selection string + * @return a list of the selected entities. The list will not be null, but + * no further guarantees are made. + * @throws IllegalArgumentException if the selector is malformed in any way + * or a parameter is null + * @deprecated draft API + */ + @Deprecated + List selectEntities(CommandSender sender, String selector) throws IllegalArgumentException; + /** * @see UnsafeValues * @return the unsafe values instance