diff --git a/README.md b/README.md index b25c771..9a8673f 100644 --- a/README.md +++ b/README.md @@ -54,9 +54,15 @@ -- Follow the instructions below to set the Java version you want for your server: - - If you want your server version to be Minecraft 1.16.x or below, do not change anything. - - If you want your server version to be Minecraft 1.17.x or above, make sure to change `pkgs.openjdk8-bootstrap` to `pkgs.openjdk17-bootstrap` +- Choose the Java version you want to use from below and replace the default Java version with the one you want to use: + + > _The default Java version is `pkgs.openjdk8-bootstrap`_ + + | Minecraft Version | Java Version | + | ----------------- | -------------------------- | + | `1.21+` | `pkgs.jdk21_headless` | + | `1.17 - 1.20` | `pkgs.openjdk17-bootstrap` | + | `1.16-` | `pkgs.openjdk8-bootstrap` | ## Creating Enviornment Variables @@ -68,30 +74,17 @@ -- Create a new secret called `ngrok_region` and input one of the regional codes from the list below as the value: - - > _Choose the closest region for better network connectivity._ - - | Region | Code | - | ------------------------- | ---- | - | United States (Ohio) | `us` | - | Europe (Frankfurt) | `eu` | - | Asia/Pacific (Singapore) | `ap` | - | Australia (Sydney) | `au` | - | South America (Sao Paulo) | `sa` | - | Japan (Tokyo) | `jp` | - | India (Mumbai) | `in` | +- Create a new secret with the key named `ngrok_token` and the value as your [authtoken](https://dashboard.ngrok.com/get-started/your-authtoken) - + > _Note: You need to create an ngrok account to get an authtoken_ - Do the same for the variables in the list below: - | Key | Value | - | ------------- | ---------------------------------------------------------------------------------------------------------------------------------- | - | `ngrok_token` | Your [authtoken](https://dashboard.ngrok.com/get-started/your-authtoken) for ngrok. _You need to create an ngrok account for this_ | - | `SERVER` | The server software in all lowercase. e.g `purpur` | - | `VERSION` | Version of Minecraft your server is running on. e.g `1.19.4` | - | `BUILD` | The build number of your server software. _Only use this if you have `paper` as the server software_ | + | Key | Value | + | --------- | ---------------------------------------------------------------------------------------------------- | + | `SERVER` | The server software in all lowercase. e.g `purpur` | + | `VERSION` | Version of Minecraft your server is running on. e.g `1.19.4` | + | `BUILD` | The build number of your server software. _Only use this if you have `paper` as the server software_ | - List of server software supported: diff --git a/projectInfo/ngrokRegion.png b/projectInfo/ngrokRegion.png deleted file mode 100644 index f63549e..0000000 Binary files a/projectInfo/ngrokRegion.png and /dev/null differ diff --git a/start.sh b/start.sh index 665f132..186c090 100644 --- a/start.sh +++ b/start.sh @@ -103,23 +103,27 @@ while true; do requireFile "server.jar" requireExec "ngrok" requireEnv "ngrok_token" - requireEnv "ngrok_region" mkdir -p ./logs touch ./logs/temp rm ./logs/* - echo -e "${GREEN}Starting ngrok tunnel in region: $ngrok_region" - ./ngrok authtoken $ngrok_token >/dev/null 2>&1 - ./ngrok tcp -region $ngrok_region --log=stdout 25565 >$root/status.log & + if ! pgrep -x "ngrok" >/dev/null; then + echo -e "${GREEN}Starting ngrok tunnel...${NC}" + ./ngrok authtoken $ngrok_token >/dev/null 2>&1 + ./ngrok tcp --log=stdout 25565 >$root/status.log & + fi echo "" echo -e "${CYAN}Minecraft server starting, please wait...${NC}" echo "" echo -e "${GREEN}=====================================================================${NC}" echo "" COMMON_JVM_FLAGS="-Xms128M -Xmx512M -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+UnlockDiagnosticVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -XX:+UseStringDeduplication -XX:+UseAES -XX:+UseAESIntrinsics -XX:UseSSE=4 -XX:AllocatePrefetchStyle=1 -XX:+UseLoopPredicate -XX:+RangeCheckElimination -XX:+EliminateLocks -XX:+DoEscapeAnalysis -XX:+UseCodeCacheFlushing -XX:+OptimizeStringConcat -XX:+UseCompressedOops -XX:+UseThreadPriorities -XX:+TrustFinalNonStaticFields -XX:+UseInlineCaches -XX:+RewriteBytecodes -XX:+RewriteFrequentPairs -XX:+UseNUMA -XX:-DontCompileHugeMethods -XX:+UseFPUForSpilling -XX:+UseNewLongLShift -XX:+UseXMMForArrayCopy -XX:+UseXmmI2D -XX:+UseXmmI2F -XX:+UseXmmLoadAndClearUpper -XX:+UseXmmRegToRegMoveAll -Dfile.encoding=UTF-8 -Djava.security.egd=file:/dev/urandom" + JAVA_CMD="java $COMMON_JVM_FLAGS -jar server.jar nogui" - if [[ "$VERSION" =~ ^1\.(17|18|19|20)\. ]]; then - java $COMMON_JVM_FLAGS --add-modules jdk.incubator.vector -XX:UseAVX=2 -Xlog:async -jar server.jar nogui - elif [[ "$VERSION" =~ ^1\.(8|9|10|11|12|13|14|15|16)\. ]]; then - java $COMMON_JVM_FLAGS -XX:-UseBiasedLocking -XX:UseAVX=3 -jar server.jar nogui + if [[ "$VERSION" =~ ^1\.(17|18|19|20|21)(\.|$) ]]; then + JAVA_CMD="java $COMMON_JVM_FLAGS --add-modules jdk.incubator.vector -XX:UseAVX=2 -Xlog:async -jar server.jar nogui" + elif [[ "$VERSION" =~ ^1\.(8|9|10|11|12|13|14|15|16)(\.|$) ]]; then + JAVA_CMD="java $COMMON_JVM_FLAGS -XX:-UseBiasedLocking -XX:UseAVX=3 -jar server.jar nogui" fi + + $JAVA_CMD done