Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide player name tab complete #6

Open
vaporvee opened this issue Jan 17, 2022 · 51 comments
Open

Hide player name tab complete #6

vaporvee opened this issue Jan 17, 2022 · 51 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed question Further information is requested

Comments

@vaporvee
Copy link

Is it possible to hide the suggestion for player names?
Would be cool because the plugin is mainly about disabling tab complete and commands

@BlueTree242
Copy link
Owner

yes, spectific players, or hide all except

@BlueTree242 BlueTree242 added good first issue Good for newcomers help wanted Extra attention is needed question Further information is requested labels Jan 17, 2022
@vaporvee
Copy link
Author

for me its enough when i can just hide all players

@BlueTree242
Copy link
Owner

actually note that you can only do that for spectific commands

@vaporvee
Copy link
Author

which specific commands? you mean normal in player chat theres still auto complete?

@BlueTree242
Copy link
Owner

yes, also i see a good feature request in your message

@masmc05
Copy link

masmc05 commented Jan 17, 2022

won't it work on every command even if you hook into com.destroystokyo.paper.event.brigadier.AsyncPlayerSendSuggestionsEvent ? in the server code it is called right before sending the suggestions, with the final sugestions from the event

@masmc05
Copy link

masmc05 commented Jan 17, 2022

didn't worked with the brigadier so it's a bit confusing why we can't control it XD

@masmc05
Copy link

masmc05 commented Jan 17, 2022

from my testing, even vanilla commands don't use this request on basic arguments (like for /gamemode [client completes this by himselve] ), but request players, (like for /gamemode survival [will request completions from server] ), so you could filter a player from it

@BlueTree242
Copy link
Owner

The plugin uses packets, not paper's event as it isnt complete. That's the plugin implementation i can easily get it to work on every command

@BlueTree242
Copy link
Owner

Please wait for me i got a few features to be added soon

@BlueTree242
Copy link
Owner

Yea! Vanilla commands dont use tab complete, it is only modified from packets or just that commands event

@masmc05
Copy link

masmc05 commented Jan 17, 2022

then how

@EventHandler
    public void onComplete(AsyncPlayerSendSuggestionsEvent event) {
        event.getSuggestions().getList().forEach(suggestion -> event.getPlayer().sendMessage(suggestion.getText()));
    }

was working with vanilla commands? if paper was able to implement the event, then it somehow should work behind the scenes, i'm using 1.18.1 btw

@BlueTree242
Copy link
Owner

try it with non vanilla commands

@masmc05
Copy link

masmc05 commented Jan 17, 2022

works too

@BlueTree242
Copy link
Owner

what command did you try

@masmc05
Copy link

masmc05 commented Jan 17, 2022

from advancedban

@BlueTree242
Copy link
Owner

try calling getSuggestions

@masmc05
Copy link

masmc05 commented Jan 17, 2022

@EventHandler
    public void onComplete(AsyncPlayerSendSuggestionsEvent event) {
        event.getSuggestions().getList().clear();
    }

succesfully removed all existing suggestions from all the plugin's commands

@masmc05
Copy link

masmc05 commented Jan 17, 2022

try calling getSuggestions

what do you mean?

@BlueTree242
Copy link
Owner

nvm

@BlueTree242
Copy link
Owner

i would take a closer look then

@masmc05
Copy link

masmc05 commented Jan 17, 2022

@EventHandler
    public void onComplete(AsyncPlayerSendSuggestionsEvent event) {
        event.getSuggestions().getList().clear();
    }

succesfully removed all existing suggestions from all the plugin's commands

it didn't removed static suggestions like survival... from gamemode, but removed suggestions that may be different sometimes (like players on /gamemode survival)

@BlueTree242
Copy link
Owner

that's what im trying to say

@masmc05
Copy link

masmc05 commented Jan 17, 2022

well, to filter players it is good, because he asks for players every time

@masmc05
Copy link

masmc05 commented Jan 17, 2022

and the event gives the opportunity to removes all the players from the suggestions even from vanilla commands

@BlueTree242
Copy link
Owner

i don't see the purpose, remember this is a paper event, im trying to make it work on spigot too so i use packets

@masmc05
Copy link

masmc05 commented Jan 17, 2022

Yea! Vanilla commands dont use tab complete, it is only modified from packets or just that commands event

to say that he use tab completions when completing players, if the event is fired, then it means that he worked on these suggestions

@BlueTree242
Copy link
Owner

ye not surprised, not tab completion event, its brigadier, its even in the package

@masmc05
Copy link

masmc05 commented Jan 17, 2022

well yes, vanilla uses brigardier from 1.13

@BlueTree242
Copy link
Owner

lol dinnerbone added this in 1.13 so yes

@masmc05
Copy link

masmc05 commented Jan 17, 2022

brigardier is even open source, but as i know it don't have events, that's why paper-brigardier exists

@BlueTree242
Copy link
Owner

Ye this plugin modifies it before being sent to client, no paper used

@BlueTree242
Copy link
Owner

Currently didn't implement modifications on most parts of brigardier

@BlueTree242
Copy link
Owner

This is also because of something i read before but not sure, that there is a argument type for players that the client automatically knows this is for players, probably asks server for player list so this is probably why there is no event on simply stuff like /gamemode creative because for the client its fixed values

@masmc05
Copy link

masmc05 commented Jan 17, 2022

image
maybe it will help you, this is the packet with completions that is going to be sent to player when pressed tab with "/gamemode survival" in chat, idk how to use protocol lib so wish luck with blocking the players even in vanilla commands

@BlueTree242
Copy link
Owner

What intellij plugin is that

@BlueTree242
Copy link
Owner

Also i use that packet lol, but i dont think it can remove players but other stuff it can

@masmc05
Copy link

masmc05 commented Jan 17, 2022

that is it's debug menu, i don't use any plugins related to plugin development

@masmc05
Copy link

masmc05 commented Jan 17, 2022

image
like no changes to it

@BlueTree242
Copy link
Owner

Oh ye ur in the packet class lol

@masmc05
Copy link

masmc05 commented Jan 17, 2022

Also i use that packet lol, but i dont think it can remove players but other stuff it can

idk, in code it's arraylist, on protocol lib it's 1 value (or i'm just sleepy), but if you can't remove it, hide it (with "" at least), or create and send a new packet

@BlueTree242
Copy link
Owner

Only way is doing modifications that may break sometimes

@BlueTree242
Copy link
Owner

I guess the event should be modified

@masmc05
Copy link

masmc05 commented Jan 17, 2022

image
image

ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(this, ListenerPriority.LOW, PacketType.Play.Server.TAB_COMPLETE) {
            @Override
            public void onPacketSending(PacketEvent event) {
                var suggestions  = event.getPacket().getSpecificModifier(Suggestions.class);
                suggestions.getValues().get(0).getList().add(new Suggestion(suggestions.getValues().get(0).getRange(),"This is the biggest test ever"));
                suggestions.getValues().get(0).getList().add(new Suggestion(suggestions.getValues().get(0).getRange(),"No jokes"));
                suggestions.getValues().forEach(suggestions1 -> {
                    var temp = new ArrayList<>(suggestions1.getList());
                    temp.forEach(suggestion -> {
                        if (suggestion.getText().equals("mastermc05")){
                            suggestions1.getList().remove(suggestion);
                        }
                    });
                });
            }
        });

managed to remove my name from every suggestion and add "this is the bigest test ever" to them, without touching other suggestions

@masmc05
Copy link

masmc05 commented Jan 17, 2022

the suggestions class is from brigardier (https://github.com/Mojang/brigadier) that is from vanilla

@BlueTree242
Copy link
Owner

the suggestions class is from brigardier (https://github.com/Mojang/brigadier) that is from vanilla

Yeah we use that

@BlueTree242
Copy link
Owner

image image

ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(this, ListenerPriority.LOW, PacketType.Play.Server.TAB_COMPLETE) {
            @Override
            public void onPacketSending(PacketEvent event) {
                var suggestions  = event.getPacket().getSpecificModifier(Suggestions.class);
                suggestions.getValues().get(0).getList().add(new Suggestion(suggestions.getValues().get(0).getRange(),"This is the biggest test ever"));
                suggestions.getValues().get(0).getList().add(new Suggestion(suggestions.getValues().get(0).getRange(),"No jokes"));
                suggestions.getValues().forEach(suggestions1 -> {
                    var temp = new ArrayList<>(suggestions1.getList());
                    temp.forEach(suggestion -> {
                        if (suggestion.getText().equals("mastermc05")){
                            suggestions1.getList().remove(suggestion);
                        }
                    });
                });
            }
        });

managed to remove my name from every suggestion and add "this is the bigest test ever" to them, without touching other suggestions

This one is also being listened to, but cant add new values, but can remove

@BlueTree242
Copy link
Owner

With the plugin config it is actually possible to remove all of them

gamemode * *

Repository owner deleted a comment from Creeperz653 Feb 3, 2022
Repository owner deleted a comment from Creeperz653 Feb 3, 2022
Repository owner deleted a comment from Creeperz653 Feb 3, 2022
Repository owner deleted a comment from Creeperz653 Feb 3, 2022
Repository owner deleted a comment from BlueBruh Feb 3, 2022
Repository owner deleted a comment from BlueBruh Feb 3, 2022
Repository owner deleted a comment from BlueBruh Feb 3, 2022
Repository owner locked as spam and limited conversation to collaborators Feb 3, 2022
Repository owner unlocked this conversation Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants