Prompt player input

this is a paste from bukkit plugin suggestion forums, that now i think would be great if could be implemented on sponge !!


hi

i want to place a block (or click it, or whatever event) and it automatically opens the player chat interface (or a “prompt” input like “edit sign” or javascript ones) and waits the player input … so the player enter some string (like the name he wish to give to the block, the color or whatever) and it gets processed

how can i suddenly open the player chat window, wait for the user input and get processed?

Currently too early to say for sponge, however if it is anything like Bukkit then I’m sure you can not open chat, however there is a event that is triggered when someone sends a message. What you could do is record the people who have clicked this block then get the next message they send (you can stop the event if you don’t want the message to be global). The message they send will be the ‘command’ to do what ever action you like.

You could do something like this with protocol lib with signs, though it was kind of weird. To early to say how this will be handled with sponge.

1 Like

Technically its possible. Wether sponge will allow you to do it through its api, is another thing.

EDIT: I was mistaken, there is in fact no such packet. You can’t force a vanilla client to open chat.

i thought now that api is currently yet under development, could be good if it includes methods that be able to do this (maybe thought forge?)

it would make it possible to do very interactive plugins

I don’t think you will have much success in forcing open a players chat through a plugin. Metaphorically speaking, with inventories its one thing, the server just says “uh yeah you TOTALLY clicked on a chest with this inventory so you should open it now”, but with chat, well, there’s no server side event that could cause chat to open, so there’s nothing for the server to spoof and cause a client reaction with. At least, this is the impression I got from my time with bukkit and playing with custom inventories.

Edit: command blocks open up a big old text box when right clicked. A server could spoof that event and take the input text to do whatever.