lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hello, 

Some months back I started running a Minecraft server (Java) on FreeBSD. There are two issues that I've run into:
1) The Minecraft client (game) automatically updates and will not run against servers of prior revisions without changing client settings.  
2) The Minecraft 'server' jar uses stdin and stdout. That means (in my understanding) that the process must be kept in the foreground for interaction. The current solution I've found (on the Minecraft wiki) requires screen/tmux to allow one to run a server instance from ssh. 

The solution I now envision is to use lua-http and cqueues to create a 'controller' that updates the server.jar file and runs the application without the need for the process to be in the foreground. The parts I see needing are:
- A routine that checks for updates and downloads the jar files
- A 'thread' for running the minecraft server.jar file in java. This 'thread' would re-direct stdin and stdout. This 'thread' should also be able to stop and start the running jar file. 
- A websocket server to funnel the captured IO to a webpage for interactivity.

So far, I have roughed in the server.jar checks and download, and the websocket server for communications. The code can be found here: https://github.com/RussellHaley/minecraft-runner/mc-runner.lua

What I don't know/understand yet if it's possible to run/control a process from Lua so that I can grab stdin/stdout? I am hoping there is something in cqueues to do this, but once again thought I'd send out a general request for ideas. 

Any input would be grand. 

Thanks!
Russ