garrettjoecox / scriptserver

A Minecraft server wrapper, allows for simple plugins in vanilla
GNU General Public License v3.0
68 stars 10 forks source link

server.send not functioning #12

Closed roobscoob closed 6 years ago

roobscoob commented 6 years ago

Server.send('command') not functioning.

there's no more to say here, it just isn't doing anything.

eethe0 commented 6 years ago

Same issue here, this seems to be a problem with Rcon.

While waiting for a fix, another way to send commands is to send them directly to the input stream of the server process :

// Instead of 
server.send("say hi");
// Use this
server.spawn.stdin.write("say hi\n");

Notice the newline character that is needed for the server to register and process the input.

eethe0 commented 6 years ago

I found what was at fault for me. Make sure that the server is setup correctly to allow RCON. For example, if you were to create your server object like so

const server = new ScriptServer({
    core: {
        jar: "server.jar",
        args: [
            "-Xmx2G"
        ],
        rcon: {
            port: "25575",
            password: "0000"
        }
    }
});

Then the server's server.properties file needs to have these lines

enable-rcon=true
rcon.port=25575
rcon.password=0000

It seems that newer versions of the server jar (in my case snapshot 18w19a) don't automatically generate those lines.

roobscoob commented 6 years ago

Thanks!

On Tue, May 8, 2018 at 9:33 PM, Etienne Orlhac notifications@github.com wrote:

I found what was at fault for me. Make sure that the server is setup correctly to allow RCON. For example, if you were to create your server object like so

const server = new ScriptServer({ core: { jar: "server.jar", args: [ "-Xmx2G" ], rcon: { port: "25575", password: "0000" } } });

Then the server's server.properties file needs to have these lines

enable-rcon=truercon.port=25575rcon.password=0000

It seems that newer versions of the server jar (in my case the latest snapshot) don't automatically generate those lines.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/garrettjoecox/scriptserver/issues/12#issuecomment-387592525, or mute the thread https://github.com/notifications/unsubscribe-auth/AG_p70A4x69El6KOhZRyxUJct9YybPw_ks5twkdZgaJpZM4Tr785 .

garrettjoecox commented 6 years ago

Sorry for the trouble! I seem to have completely forgot to document the requirement to enable RCON in your server.properties. I will leave this ticket open until I am able to do so.