![ServerSync](https://media.forgecdn.net/avatars/thumbnails/254/696/256/256/637199290945083080.png)
Silent run as client
TomberWolf opened this issue ยท 57 comments
It would be nice if we could run the client in a silent mode.
So we can use it for a mod pack and run it before Minecraft starts and all of the needed files would be synced without the need of updating them manually.
I like the sound of that. Let me just confirm we are on the same page.
from some action (eg. user presses play in their client) serversync runs its client update and closes without building it's GUI, or perhaps better it builds a specific progress GUI that just closes when complete.
Minecraft is triggered to run on completion of the update.
To make it more clear:
We're providing our mod pack with a batch file that runs the Minecraft jar.
So it would be easy to run the serversync client at first with "-silent" for example.
It checks if updates are available and if not it closes and the batch file runs Minecraft.
If there are new updates it could show a progress bar with informations that it's updating or something like that, does the updates, closes and Minecraft runs.
Smooth, easy to manage and always up to date.
Sweet, yeah should be able to fairly easily get that functionality going.
I'll add it to the priority updates
Added a pre-release of 'headless' client sync. This has had minimal testing but it should work as expected, note that the progress-only option currently just uses ServerSyncs normal GUI.
E:\>java -jar serversync-2.6.13.jar silent
finished loading config
Loading language file: de_de
No language file available for: de_de, defaulting to en_US
finished loading config
Exception in thread "Thread-3" java.lang.NullPointerException
at com.superzanti.serversync.ClientWorker.run(ClientWorker.java:86)
at java.lang.Thread.run(Unknown Source)
New version in the releases should sort the GUI calls when in silent, gave it a breif test run on both silent and progress-only. Both seem to be working as intended.
"(user presses play in their client) serversync runs its client update and closes without building it's GUI, or perhaps better it builds a specific progress GUI that just closes when complete.
Minecraft is triggered to run on completion of the update."
I like this idea; my players don't seem to understand the concept of updating and its hindering my ability to get people to connect. Since I have pokecube ... I get a younger crowd. It would really assist me in growing my player base if there was a way to check for updates automatically on launch without bats of any kind.
Although instead of a gui it could use a progress bar. @superzanti
In some cases, ServerSync doesn't remove files which are not longer present on the server.
The error tells that the file is currently in use.
java.nio.file.FileSystemException: mods\NotEnoughItems-1.10.2-2.1.3.207-universal.jar: Der Prozess kann nicht auf die Datei zugreifen, da sie von einem anderen Prozess verwendet wird.
at sun.nio.fs.WindowsException.translateToIOException(Unknown Source)
at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
at sun.nio.fs.WindowsFileSystemProvider.implDelete(Unknown Source)
at sun.nio.fs.AbstractFileSystemProvider.delete(Unknown Source)
at java.nio.file.Files.delete(Unknown Source)
at com.superzanti.serversync.util.SyncFile$1.run(SyncFile.java:262)
Looks like it must be an issue with serversync, nothing out of the ordinary in the batch.
Does it output the ____________ part before starting Minecraft?
Interesting, could you post the batch file you are using, removing any sensitive info of course (IP addresses etc)
I get the feeling we have an async process running here with a bit of a race condition
Sure.
Strange: The same thing happened when I opened the ServerSync client jar itself with it's GUI.
And today I've updated some other mod files without any problems.
Don't ask me how it happened but it did.
Please don't wonder if you take a look at my launcher batch. We're using a different folder structure than MC does. And it's a really simple batch file, nothing special.
Minecraft Launcher.zip
Might have to add some more specialised error handling around deletion. Any particular file it fails to delete or just random?
For now it was just NotEnoughItems-1.10.2-2.1.3.207-universal.jar. Several updates after that issue worked like a charm without any problems.
@TomberWolf
This could potentially happen if serversync was opened twice, or if it had not finished before being opened again.
I thought in the same way, so I've checked the processes to make sure that there were no other java processes.
Dunno. It never happened again.
@rheimus any updates on a test release for an update at start release? I cannot tell you the number of people who ask me the same question ... it is very much a pain in the ass to try and re-explain the same thing every damn time.
PS thank you very much for all your efforts by the way.
It works.
You just need to run Minecraft in a batch file witch the serversync silent before.
So your saying @TomberWolf that all my clients have to do is launch the game - not a bat - and it will automatically update their clients?
If not then its not enough because not everyone understand to run a 3rd party app. Most people are stupid lets face it. Also the younger the player base the deeper the naivety.
Also I am not a coder just a moderator so making bats and hooks are very difficult for me.
@P3rf3ctXZer0 Using a batch file would essentially be like creating a shortcut to the minecraft launcher, could even tell windows / linux / whatever to give it a nice icon :)
It lets you intercept the users request to run something, in this case the minecraft launcher, and run whatever commands you like before that happens.
Your program flow from a users perspective would be:
- Run minecraft.bat
- minecraft launcher opens and is magically synced with the configured server
All you really need to know to create a batch file is where the minecraft launcher & serversync are located on your target machines, which is the hard part as by default it's not always in the same place.
You could even bypass the launcher entirely and just directly launch minecraft.
I'm happy to make a custom batch file for you if it works with your target audience.
http://minecraft.gamepedia.com/Minecraft_launcher has some useful material on directly launching minecraft and connecting to a server
I have made very little progress in the research front for hooking into the native minecraft launcher. It's probably next up on my agenda though.
Would it not be much easier to just add a command within the updating process that runs the launcher after finishing the sync directly from the serversync.jar?
So players just need to run serversync.jar that handles the rest. Done.
@TomberWolf
Probably yeah, just requires me to either have some sort of auto discovery of where the minecraft launcher is or to have the user set the location manually.
Would be interesting to see if you can set up a profile in the launcher to point to serversync instead of minecraft, then I just need to pass the args along to minecraft after running serversyncs update.
@rheimus Thank you for all your effort. I would love a custom bat file. Its got to be technic pack ready though because everyone appears to be pretty stupid ... I don't see whats so hard about just launching a jar file.
@rheimus I very much appreciate that. At any rate I believe people are so used to auto updating that they think that games just code themselves at this point.
@P3rf3ctXZer0 I'll grab a copy of technic over the weekend and see how they are structuring themselves, should be able to throw something together.
had a brief look at technics layout, its not quite standard mc. shall investigate further
Okay, crazy!! The process in use issue seems to be mod related. Today I've updated Not Enough Items and ServerSync has the same issue again. But just and only with this special mod. How strange is that?
Nothing terribly out of the ordinary in NEI.
Its .info file is named neimod.info, could possibly be stumbling SS, but I'm pretty sure SS just falls back to hash comparison if it cant find mcmod.info
@rheimus how is the status of making a useable auto updater ... unfortunately even a tutorial as good as this still leaves people stupid.
https://docs.google.com/document/d/1nsZZSRFc_7ci2TgOOl_4g8hylX_0NRB8teEx2zZ4abs/edit?usp=sharing
That's a pretty thorough guide! Its actually useful to have that as I can follow the guide to determine a common setup. Am attempting to build a 'catch all' batch for you that should work in most cases.
Unfortunately its not really something I can test at work, IT would not be happy to see minecraft & game launchers on my system ๐
Havent had much luck with hooking into standard Minecraft workflow.
Today there was an update for Optifine (client side only).
http://adf.ly/404181/optifine.net/adloadx?f=OptiFine_1.10.2_HD_U_D8.jar
Same issue as with Not Enough Items.
So: The new one is copied like a charm, the older versions stuck.
java.nio.file.FileSystemException: mods\OptiFine_1.10.2_HD_U_D7.jar: Der Prozess kann nicht auf die Datei zugreifen, da sie von einem anderen Prozess verwendet wird.
at sun.nio.fs.WindowsException.translateToIOException(Unknown Source)
at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
at sun.nio.fs.WindowsFileSystemProvider.implDelete(Unknown Source)
at sun.nio.fs.AbstractFileSystemProvider.delete(Unknown Source)
at java.nio.file.Files.delete(Unknown Source)
at com.superzanti.serversync.util.SyncFile$1.run(SyncFile.java:262)
java.nio.file.FileSystemException: mods\NotEnoughItems-1.10.2-2.1.3.219-universal.jar: Der Prozess kann nicht auf die Datei zugreifen, da sie von einem anderen Prozess verwendet wird.
at sun.nio.fs.WindowsException.translateToIOException(Unknown Source)
at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
at sun.nio.fs.WindowsFileSystemProvider.implDelete(Unknown Source)
at sun.nio.fs.AbstractFileSystemProvider.delete(Unknown Source)
at java.nio.file.Files.delete(Unknown Source)
at com.superzanti.serversync.util.SyncFile$1.run(SyncFile.java:262)
Useful information indeed. Sounds like SS might be holding leftover file access from the update phase.
Good find thank you ๐
@P3rf3ctXZer0
Start_NeverEndingInstability.zip
Haven't exactly done thorough testing on it but that batch file should be runnable from anywhere on a windows machine, at the moment I have left it as running any serversync that it finds in the Instances folder.
If you want it to specifically run your modpacks serversync only then theres a commented out line in the batch file that you can implement to make it only run serversync on your pack.
The file is also fairly heavily commented if you are interested in what it is doing.
Basically it just searches for serversync (assuming that people have followed your guide and are using curse) and runs it in progress mode then runs the curse client as your users will still need to log in etc.
@P3rf3ctXZer0 So we need something that searches for your modpack regardless of the launcher being used?
To clarify, as long as the user is using curse that batch should work regardless of what settings they have used. We could always make several batches for each launcher that basically just do the same thing.
Thank you that is awesome :) - just one problem ... I have idiots ignoring the guide completely - I need it to auto run without them knowing - or caring in most cases as I am sad to say but I will use that bat I like shortcuts XD
I am sorry I am asking this of you.
@P3rf3ctXZer0 That was the original way SS ran, though you did need to mess around with customGUI.
There is nothing really wrong with that design, however minecraft/modloader is what really kills it. Would probably be ok if you had 2-3 small mods but even adding one larger mod drastically increases the load time.
It ends up being:
- load minecraft (2-10min)
- connect to server and sync (20seconds - 1min)
- close minecraft (0-20seconds)
- load minecraft (2-10min)
Low time to run: 4min 20sec
High time to run: 21min 20sec
The high time is the extreme case of course and you wont need to update every time you connect depending on the server administration.
I could look into adding this as a client option, but I would rather do some more research to see if I can trigger forge to reload its mod environment so that as far as the user is concerned its just extra load time overhead (they don't need to manually interact with the process).
It needs to be code that launches the moment someone launches the modpack like pre-modpack launch. Do you play smite or league legends? If so think of the way their clients update or think of the way world of warcraft updates. If need be you can only make changes for the vanilla minecraft launcher. ... what about a launcher in a launcher like League? Basically a user launches league - they sign in - then it loads client and checks for updates and restarts as needed and player launches client again and they get in game and can play because no updates are detected.
We need a way to force players to update on launch without them clicking anything.
The hook is the problem, launchers lock you down to only being able to run minecraft specifically.
Short of writing a hijack virus we cant really use any part of the launcher process, writing a custom launcher has the same problem that your clients would need to download and use the custom version (virus has the same problem too for that matter).
We only really have access to these events:
- Users first point of access (what they run to start with)
- Forge pre-init (too late to be running SS)
Hmmm ... see if you can talk to a dev who made a completely custom client. https://discord.gg/HNKTMNh ask for "Peterix" He knows a great deal about client code who knows maybe he can hook your mod right into his client.
Here is the launcher he and his team created https://multimc.org/.
I'm not sure that SS would work as an integrated part of a launcher on further thought:
- User launches modpack A
- SS synchronizes with server A running modpack A v1.1
- User tries to connect to server B running modpack A v1.0
- User is kicked as mods are incompatable
To get an ideal setup we either have to use explicit user interaction (i.e. the batch file) as this is the user saying I want to specifically connect to this server, or we need to shift the sync process to post connection request.
Post connection request as far as I know at the moment does not play well with forge as its really designed around pre-loading everything.
Though if the 'launcher' was more of a server browser then it would work. Would probably require adding an API for getting which modpack the server is running / info / description etc.
post process might be the best bet
Maybe make a shadow folder that overwrites everything after shutting down client?
So basically client loads
Client attempts to connect to server
Client running update 1 does not match update 2
Server Sync States - Client does not match server patch number and attempts to get update
Serversync creates a sub folder in the client called "pending updates" at gets all the files from server
Server sync finishes getting updates from server and askes user to close minecraft before contuing.
Client closes Minecraft
Clicks Continue box on popup
server sync overwrites files.
User reopens minecraft
Profit.
If they are too stupid beyond this it is hopeless rheimus.