mattmalec / Pterodactyl4J

Java wrapper for the API of Pterodactyl
Apache License 2.0
117 stars 30 forks source link

Update container startup commands with the wrapper #66

Closed PedroMPagani closed 1 year ago

PedroMPagani commented 1 year ago

Is there a way to update a specific container startup commands with this wrapper? I am looking for some helper class but I can't seem to find.

mattmalec commented 1 year ago

You can use ApplicationServer#getStartupManager, and then from the StartupManager, you can use ServerStartupManager#setStartupCommand. This is a PteroAction, so it will need to be executed.

PedroMPagani commented 1 year ago

Hey matt, it worked good, thanks for the help!

If you could take a look at this. I run a Minecraft Network and we currently have about 25 instances of game that need to be synced, is there anyway the pterodactyl allows through the api to update files?

I found Directory, now I wonder if i can listen to a startup action so that I sync what i want before it starts.

mattmalec commented 1 year ago

Yeah! In Directory, it provides a bunch of methods that you can use to upload files and stuff like that. https://ci.mattmalec.com/job/Pterodactyl4J/javadoc/com/mattmalec/pterodactyl4j/client/entities/Directory.html

mattmalec commented 1 year ago

You could then listen to the StatusUpdateEvent to perform actions depending on the UtilizationState.

PedroMPagani commented 1 year ago

You could then listen to the StatusUpdateEvent to perform actions depending on the UtilizationState.

I guess if i wanted to sync every time the instance starts i would need to stop it when it starts and sync my stuff, and then start it back up again but making sure the event doesnt endup in loop?