Skip to content
This repository has been archived by the owner on Feb 2, 2024. It is now read-only.

Commit

Permalink
auto lazymc.toml update
Browse files Browse the repository at this point in the history
  • Loading branch information
Okazakee committed Jan 22, 2023
1 parent e07b2d2 commit ba3da44
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ This is a Linux Docker image for creating Minecraft servers with `lazymc`.
This image provides a basic PaperMC (or alternatives) server. All customizations are left to the user.

# To do:
- [x] Automatically insert server variables inside lazymc.toml
- [ ] Add support for more server providers, please let me know in issues if you want to add new ones.
- [ ] Better logging, remove useless console outputs and give the user clear and clean messages of what is going on.
- [ ] Add Docker Compose section in this README.
- [ ] Build a stati webpage for the project.
- [ ] Do not trgger github actions when README or actions yml get pushed.
- [ ] Automatically insert server variables inside lazymc.toml

# Usage
It is assumed that the user has already acquired a working Docker installation. If that is not the case, go do that and come back here when you're done.
Expand Down
29 changes: 19 additions & 10 deletions mcserver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,6 @@ fi
wget -O lazymc ${LAZYMC_URL}
chmod +x lazymc

# Generate lazymc.tom if necessary
if [ ! -e lazymc.toml ]
then
./lazymc config generate
if [ $? -ne 0 ]; then
echo "Error: Could not generate lazymc config"
exit 1
fi
fi

# Get version information and build download URL and jar name
case "$SERVER_PROVIDER" in
"paper")
Expand Down Expand Up @@ -143,8 +133,27 @@ fi
if [ ! -z "${MC_RAM}" ]
then
JAVA_OPTS="-Xms512M -Xmx${MC_RAM} ${JAVA_OPTS}"
else
JAVA_OPTS="-Xms512M ${JAVA_OPTS}"
fi

# Generate lazymc.toml if necessary
if [ ! -e lazymc.toml ]
then
./lazymc config generate
if [ $? -ne 0 ]; then
echo "Error: Could not generate lazymc config"
exit 1
fi
else
# Add new values to lazymc.toml
echo "Updating lazymc.toml with latest details"
sed -i '/Command to start the server/i # Managed by mcserver-lazymc-docker, please do not edit this!' lazymc.toml
sed -i "s~command = .*~command = \"java $JAVA_OPTS -jar $JAR_NAME nogui\"~" lazymc.toml
fi



# Start the server
./lazymc start
if [ $? -ne 0 ]; then
Expand Down

0 comments on commit ba3da44

Please sign in to comment.