endofzero / Minecraft-Sheller

Shell script designed to allow for automation of Minecraft Server Administration.
62 stars 18 forks source link

Tell player from command line or external script #21

Closed mattrl closed 13 years ago

mattrl commented 13 years ago

Something I use to get notification of the Overviewer script without spamming the server.

Exactly the same as 'say' as already exists in the script but allows you to tell a player directly from an external script or command line.

minecraft.sh tell "NAME content"

"tell") if [ $ONLINE -eq 1 ] then screen -S $SCREEN_NAME -p 0 -X stuff "printf "tell $2\r"";sleep 1 else echo "Server seems to be offline..." fi;;

Probably a better way to do this is to take the first word after tell and use this as the name, and all subsequent words and use this as the content to tell the player thus not requiring the use of quotes at all - but that is beyond my skill level.

I'm guessing that:

"tell") if [ $ONLINE -eq 1 ] then screen -S $SCREEN_NAME -p 0 -X stuff "printf "tell $2 $3\r"";sleep 1 else echo "Server seems to be offline..." fi;;

Would / should mean that the player name can go outside the quotation marks.

endofzero commented 13 years ago

Yeah, for the most part, commands that are thrown should be sent to everyone.

mattrl commented 13 years ago

Hey what? I'm guessing you mean that if something's worth telling it's worth telling to everyone.

Fair enough - I think it's useful as for myself as I like to get notification of each stage of Overviewer progress - Rsync begins, rsync complete, Number of chunks to render, Unlit render / night render complete, duration, etc.. anything really.

Where'as the players only need to know that Overviewer has started and finished.

endofzero commented 13 years ago

That makes sense, but I really try to stay on track to work best for the general admins that would first take in the script. Cron will capture the output from the jobs, so there is always a log of what is happening behind the scenes without the need to notify a user. As it seems I will really be heading the route of a 'mapper' directory that is synchronized, that is really almost a moot point as it negates the need for anyone inside of minecraft to need to worry about anything but the time it takes to synchronize the directories.

That's just with the general prompts. I don't see why we can't add a 'tell' clause to the say command to allow you to pipe it directly to a user. That way you could use it in shell script to send messages to yourself or whoever.

mattrl commented 13 years ago

Of course I don't meant to make the script send all the messages that I am sending myself.. those were simply ideas for the merit of it's inclusion. I only meant the addition of 'tell' to send a specific message to a specific user(s).. just as I wrote the code above - for whatever purpose the admin decides. As for making it some subset of 'say', 'tell' as it is above.. I thought was as about a simple as it can possibly be. Either way.. just putting ideas out there.

endofzero commented 13 years ago

Will be added in 2.1... already in active if you want to see it...