Sign in to follow this  
Arduin

[RELEASED] InactivePlayersMod

Recommended Posts

Hello everyone!

 

Recently we had the need to query our database for inactive players and the corresponding deeds.

To make this task easily accessible without the need of database knowledge, I wrote this small handy mod to help with that.

 

You can configure the minimum days of inactivity in the properties file.

You can also disable the mod in the properties file by setting the "active" property to false instead of the default true.

 

What this mod does is essentially a lookup in the database for which players are inactive for the minimum amount of days configured and then dumping the information

into a formatted textfile in the server root folder. If the mod is set to inactive, it will clean up after itself and delete the textfile from the server root folder if it exists.

 

It will never, at any point, write anything to the database. It just performs a safe lookup through the wurmplayers.db and wurmzones.db

 

The collected informations are:

  • Name of the player
  • Total days played (if 0 the player has just played less than 24 hours)
  • Total days inactive
  • Name of the deed the player is the mayor of

 

Download from Github: https://github.com/Jhary/InactivePlayerMod/releases

 

Usage:

  1. Download the mod
  2. Unzip the contents of the zip file into your server mods folder
  3. Make sure its active in the properties file and set the inactiveDays property to a value of your liking
  4. Run the server
  5. ....
  6. Profit :P (you will find the output file in the server root folder)

 

The mod does collect the data on serverstart.

 

Please report any bugs you may encounter.

 

I hope it helps some of you people :)

 

Source code can be found on its Github Repository

 

Known problems:

  • fixed As long as the mod is active, its currently not possible to login. Your database will not be harmed by this. I am investigating the issue currently. 
Edited by Arduin

Share this post


Link to post
Share on other sites

I am pretty sure this corrupted my player database. Can't imagine what else would have done it.

Scratch that. I removed it and I was finally able to log in. No character loss.

Edited by Crustyfoot

Share this post


Link to post
Share on other sites

 

17 hours ago, Crustyfoot said:

I am pretty sure this corrupted my player database. Can't imagine what else would have done it.

Scratch that. I removed it and I was finally able to log in. No character loss.

 

So is this a working mod or not?

Share this post


Link to post
Share on other sites

I have not retried it. When I did try it I could not log in. Results may vary for other people.

Share this post


Link to post
Share on other sites

I will have a deeper look at it. It seems weird, since I am just performing a simple lookup. Literally just two "select statements" and thats it. Also closing all database connections afterwards. 

 

Ok thats really wonky. I updated the post to state that you should stop the server and deactivate the mod again after you got the datadump. I am currently investigating why you can't login as long as the mod is active. Thanks for pointing that out. Your database will not be harmed by this in any way. 

 

I pushed a new version to the github that does not delete the output file anymore if the mod is set to inactive in the config file.

 

Found the error. Its fixed now. I closed the database connections. Thats normal practice, but the server seems to never check if the connection is open, it just opens it on startup. Soo yeah I shut the server out of its own database.. lol ^^. All is fine now and works as intended

 

New release

Edited by Arduin

Share this post


Link to post
Share on other sites

This game is almost entirely "in memory", nothing is saved to disk on a regular or real-time basis.  The game dumps everything to disk on shutdown, so any changes (database or otherwise) have to be applied or queried after shutting down the server.

Share this post


Link to post
Share on other sites
6 minutes ago, Ricowan said:

This game is almost entirely "in memory", nothing is saved to disk on a regular or real-time basis.  The game dumps everything to disk on shutdown, so any changes (database or otherwise) have to be applied or queried after shutting down the server.

Thats known, because this the mod is creating the textfile with the server(re)start.

 

Eject

Share this post


Link to post
Share on other sites

Nice mod! I enjoy sharing as much info as I can with players

Share this post


Link to post
Share on other sites

If you got other ideas that involve analyzing data from all the wurm databases, let me know. I am currently considering to rewrite the mod so it is an action category on the ebony wand. And you can then choose between different things. The only issue I got currently is if I add more than one entry to that "category" it is shown at the "root" of the ebony wand. 

 

For example I then got :

ebony wand

- ... different actions

- DBTools //my category

- - inactive players

- economy statistics //another action I am working on

 

If someone with more knowledge on action "categories" reads that and wants to help out, please send me a PM :)

 

As far as I know Wurm does not only save all the data to the databases on server shutdown. There is different "batch jobs" that write stuff to the db at runtime. So it should be usable with somewhat more up to date data. The "worst" case would be its a state from the last shutdown.

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