API for creating command sender which forwards feedback

This commit is contained in:
Jason Penilla
2022-02-01 15:51:55 -07:00
parent 0202f1788d
commit c0e7761df1
4 changed files with 124 additions and 1 deletions

View File

@@ -12,7 +12,7 @@ import org.bukkit.permissions.PermissionAttachmentInfo;
import org.bukkit.plugin.Plugin;
public abstract class ServerCommandSender implements CommandSender {
private final PermissibleBase perm;
public final PermissibleBase perm; // Paper
private net.kyori.adventure.pointer.Pointers adventure$pointers; // Paper - implement pointers
protected ServerCommandSender() {

View File

@@ -86,6 +86,11 @@ public final class VanillaCommandWrapper extends BukkitCommand {
if (sender instanceof ProxiedCommandSender) {
return ((ProxiedNativeCommandSender) sender).getHandle();
}
// Paper start
if (sender instanceof io.papermc.paper.commands.FeedbackForwardingSender feedback) {
return feedback.asVanilla();
}
// Paper end
throw new IllegalArgumentException("Cannot make " + sender + " a vanilla command listener");
}