Open vaporvee opened 2 years ago
yes, spectific players, or hide all except
for me its enough when i can just hide all players
actually note that you can only do that for spectific commands
which specific commands? you mean normal in player chat theres still auto complete?
yes, also i see a good feature request in your message
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
didn't worked with the brigadier so it's a bit confusing why we can't control it XD
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
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
Please wait for me i got a few features to be added soon
Yea! Vanilla commands dont use tab complete, it is only modified from packets or just that commands event
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
try it with non vanilla commands
works too
what command did you try
from advancedban
try calling getSuggestions
@EventHandler
public void onComplete(AsyncPlayerSendSuggestionsEvent event) {
event.getSuggestions().getList().clear();
}
succesfully removed all existing suggestions from all the plugin's commands
try calling getSuggestions
what do you mean?
nvm
i would take a closer look then
@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)
that's what im trying to say
well, to filter players it is good, because he asks for players every time
and the event gives the opportunity to removes all the players from the suggestions even from vanilla commands
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
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
i have a question, what do you mean by "he" it confuses me, do you mean player client?
yes
and vanilla also
ye not surprised, not tab completion event, its brigadier, its even in the package
well yes, vanilla uses brigardier from 1.13
lol dinnerbone added this in 1.13 so yes
brigardier is even open source, but as i know it don't have events, that's why paper-brigardier exists
Ye this plugin modifies it before being sent to client, no paper used
Currently didn't implement modifications on most parts of brigardier
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
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
What intellij plugin is that
Also i use that packet lol, but i dont think it can remove players but other stuff it can
that is it's debug menu, i don't use any plugins related to plugin development
like no changes to it
Oh ye ur in the packet class lol
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
Only way is doing modifications that may break sometimes
I guess the event should be modified
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
the suggestions class is from brigardier (https://github.com/Mojang/brigadier) that is from vanilla
the suggestions class is from brigardier (https://github.com/Mojang/brigadier) that is from vanilla
Yeah we use that
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
Is it possible to hide the suggestion for player names? Would be cool because the plugin is mainly about disabling tab complete and commands