command.unregister() returns false because Command.allowChangesFrom() returns false. As old code shows, a commandMap passed as parameter should NOT be null (which is passes fine), and it should NOT be equal to command's known command map (this.commandMap), this sounds as complete nonsense because command SHOULD allow changes from a commandMap that is equal to this.commandMap and vice-versa. (Vanilla commands are all registered using same SimpleCommandMap instance so it should always return true when comparing this.commandMap to Server.getInstance().getCommandMap(), right?
Currently, it is impossible to unregister a command using this method:
command.unregister()
returnsfalse
becauseCommand.allowChangesFrom()
returnsfalse
. As old code shows, acommandMap
passed as parameter should NOT be null (which is passes fine), and it should NOT be equal to command's known command map (this.commandMap
), this sounds as complete nonsense because command SHOULD allow changes from acommandMap
that is equal tothis.commandMap
and vice-versa. (Vanilla commands are all registered using sameSimpleCommandMap
instance so it should always returntrue
when comparingthis.commandMap
toServer.getInstance().getCommandMap()
, right?P.S. Also, this should prove my point.
https://github.com/pmmp/PocketMine-MP/blob/stable/src/command/Command.php#L176
(referred issue: https://github.com/CloudburstMC/Nukkit/issues/2145)