Question Tabcomplete

Voyqed

New member
Jun 17, 2022
2
0
1
Hello, everyone,
I have the following problem. I want to write a command that not everyone can execute. So far that's no problem. However, the command is suggested to every player (TabComplete) even if they don't have the permission.
Example:

Command: /Teamchat
Permission: server.teamchat
If you then "/" tab "Teamchat" will be displayed to each player.

I was able to fix the problem by overwriting the "hasPermission(Invocation invocation)" method. Then only players who didn't have the permission could tab "/Teamchat".

But then there is the problem that for players who do not have permission for the command, the default message from Minecraft comes that the command does not exist ("Unknown command. Type "/help" for help"). For these players, the message should come that they dont have permission for this command.
Also, typing "/Teamchat <something>" gives the error message "Incorrect argument for command at position 9: teamchat <--[HERE]"

Information:
Velocity version: newest
Paper version: 1.18.2 newest
Command used: SimpleCommand

I hope someone can help me.
 
Version Output
Velocity 3.1.2-SNAPSHOT (git-74edac96-b153)

electronicboy

Administrator
Staff member
Dec 11, 2021
83
6
18
8
I think that if you wanna properly hide a command, you need to implement the command using the brigadier command stuff so that you can put a requirement on the command node itself; It's saying invalid args because it's not able to find any applicable argument structure to send to the client is what I think is happening
 
  • Like
Reactions: Voyqed

Voyqed

New member
Jun 17, 2022
2
0
1
I think that if you wanna properly hide a command, you need to implement the command using the brigadier command stuff so that you can put a requirement on the command node itself; It's saying invalid args because it's not able to find any applicable argument structure to send to the client is what I think is happening
Okay with the Brigadier the message "Incorrect argument for command at position 9: teamchat <--[HERE]" no longer comes. But for these players the message "Unknown command. Type "/help" for help" still comes. Is there a way that the client know that the command exist so the message "You dont have permission" comes?