pdinklag / MinecraftStats

A Minecraft player statistics browser for the web - supports 1.13 and later!
https://discord.gg/brH5PGG8By
Other
227 stars 53 forks source link

Minecraft and WebServer on Different Machines #25

Closed Valentinez closed 5 years ago

Valentinez commented 6 years ago

To start: Minecraft Version is 1.12.2 MinecraftStats 1.0

So, My Minecraft is hosted on one server, and my webserver is a completely different host. My Minecraft Server Allows FTP, so...

I managed to pull the files via CRON PHP FTP, however, I noticed you're getting the Last Online time from the modified times from the Files in the Raw Directory.

Which, since it write via FTP, updates it to the time FTP pulled it...

Found a solution for all of this, so I decided to post it here, incase this can be used as a second option in case Minecraft and MinecraftStats are not hosted on same machine. Named it ftp.php, placed in root directory and run it as a CRON

I'd suggest visiting http://yourwebsite.com/path.to/MinecraftStats/ftp.php to make sure running correctly

ftp.txt

pdinklag commented 5 years ago

I picked this solution because the file is written whenever a stat is updated for a player or he logs out, so it's pretty accurate for "last played". As far as I know, there is no other way to get this info.

Copying the files properly is not part of this project, but it's good that you mention this and I'll include a note in the readme that the file modification timestamps are crucial and needs to be considered.