Sign in to follow this  
bdew

[RELEASED] RMITool - simple tool to send commands to server

Recommended Posts

This is a small tool to send commands to WU servers using their Java RMI interface, intended for use from scripts, cronjobs, etc.

 

RMI must be enabled in server config, and you need to know the IntraServer password.

 

Currently available commands:

 

  • Shut down server: java -jar rmitool.jar <Server IP> <RMI port> <IntraServer Password> shutdown <Name> <Seconds> "<Message>"
    • Name is purely for logging, users will not see it
    • Seconds - Time until shutdown, in seconds
    • Message - Reason that the users will see, if it has spaces it needs to be quoted
  • Broadcast message:  java -jar rmitool.jar <Server IP> <RMI port> <IntraServer Password> broadcast "<Message>"
    • Message - Message to broadcast, if it has spaces it needs to be quoted
  • Check if server is running: java -jar rmitool.jar <Server IP> <RMI port> <IntraServer Password> isrunning
    • Exit code will be 0 if the server is running and can be cotacted by RMI, otherwise it will be 1. 
  • Check number of players on server: java -jar rmitool.jar <Server IP> <RMI port> <IntraServer Password> playercount
    • The number of players will be printed to STDOUT (everything else goes to STDERR)
  • Add money to player bank: java -jar rmitool.jar <Server IP> <RMI port> <IntraServer Password> addmoney <Name> <Amount> [Reason]

    • Name is player name

    • Amount is how much money to add, in irons
    • Reason is optional, and does nothing with current WU implementation :P
    • On success exit code is 0 and a summary will be printed to stdout ("An amount of 1 silver has been added to the account. Current balance is 31 silver, 85 copper and 76 iron.")

    • On failure exit code is 1 and an error will be printed to stderr

       

On success the exit code will be 0 otherwise it will be 1 and a human readable (YMMV) error message will be written to stderr.

 

More stuff will be added in the future. If you have any specific ideas - post them here. See here for what can be done in theory with the RMI interface.

 

Downloads and source code: https://github.com/bdew-wurm/rmitool/releases

Edited by bdew
  • Like 2

Share this post


Link to post
Share on other sites

Added 2 new commands:

 

  • Check if server is running: java -jar rmitool.jar <Server IP> <RMI port> <IntraServer Password> isrunning
    • Exit code will be 0 if the server is running and can be cotacted by RMI, otherwise it will be 1. 
  • Check number of players on server: java -jar rmitool.jar <Server IP> <RMI port> <IntraServer Password> playercount
    • The number of players will be printed to STDOUT (everything else goes to STDERR)

Share this post


Link to post
Share on other sites

Hey Bdew awesome work. Have you looked at the web tool that coolboy made to see if you could get any ideas from it?

  • Like 1

Share this post


Link to post
Share on other sites

Added new command:

 

  • Add money to player bank: java -jar rmitool.jar <Server IP> <RMI port> <IntraServer Password> addmoney <Name> <Amount> [Reason]

    • Name is player name

    • Amount is how much money to add, in irons
    • Reason is optional, and does nothing with current WU implementation :P
    • On success exit code is 0 and a summary will be printed to stdout ("An amount of 1 silver has been added to the account. Current balance is 31 silver, 85 copper and 76 iron.")

    • On failure exit code is 1 and an error will be printed to stderr

 

Thanks to Parsiuk for initial implementation.

Edited by bdew
  • Like 1

Share this post


Link to post
Share on other sites

i believe its a command line (ie the DOS type box started via the Start/Run CMD).

not actually a Program/App.

It will not work on a citadel hosted server as they block the RMI ports from the outside.

Share this post


Link to post
Share on other sites

Has anyone implemented the getPlayersForDeed?  I've tried to get it to work, but not sure the final int p1 parameter.

 

    Map<String, Long> getPlayersForDeed(final String p0, final int p1) throws RemoteException;  

 

It seems like all players get returned under p1 = 1 regardless of their actual deed membership in game.

Share this post


Link to post
Share on other sites
On 2017-01-17 at 2:44 PM, bigsteve said:

i believe its a command line (ie the DOS type box started via the Start/Run CMD).

not actually a Program/App.

It will not work on a citadel hosted server as they block the RMI ports from the outside.

Ooh i see. 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this