[SPIGOT-742] Vanilla Commands are not executable by custom CommandSenders Created: 26/Mar/15  Updated: 13/Apr/15  Resolved: 13/Apr/15

Status: Closed
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Trojaner Assignee: Thinkofname
Resolution: Fixed Votes: 1
Labels: Craftbukkit, command, spigot, vanilla
Environment:

Linux (Debian), Java 8



 Description   

The VanillaCommandWrapper#getListener(CommandSender) method will return null when the "sender" argument is a custom CommandSender. This will cause an NPE when calling Bukkit#dispatchCommand(CommandSender, String) with that CommandSender.

E.g:

public class CustomCommandSender implements CommandSender() {
...
}

CommandSender sender = new CustomCommandSender();

Bukkit.dispatchCommand(sender, "save-all");
// NPE at VanillaCommandWrapper#execute(CommandSender, String, String[]) (Line 42)



 Comments   
Comment by Trojaner [ 26/Mar/15 ]

At least there could be an IllegalArgumentException thrown at VanillaCommandWrapper#getListener instead of just returning null...Or give CommandListeners the abilitiy to define their own ICommandListener

Comment by Thinkofname [ 26/Mar/15 ]

Custom CommandSenders were never officially supported by the api, furthermore there isn't a way for it to be supported due to the fact vanilla uses a different command system

Comment by SpigotMC [ 26/Mar/15 ]

Your build is not the latest and therefore may be the reason you are having this issue. Spigot is 13 version(s) behind. CraftBukkit is 26 version(s) behind. This message was automatically generated and is not guaranteed to be a solution to your issue.

Generated at Sat Apr 05 07:14:57 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.