diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..a7f73e9 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +src/logs diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml new file mode 100644 index 0000000..04b167f --- /dev/null +++ b/.github/workflows/build-docker.yml @@ -0,0 +1,46 @@ +--- + +on: + push: + branches: + - main + - develop + +jobs: + build-docker: + runs-on: ubuntu-latest + env: + registry: gitea.cuqmbr.xyz + steps: + - name: Login to Docker Container Registry + uses: docker/login-action@v3 + with: + registry: ${{env.registry}} + username: ${{vars.DOCKER_USER}} + password: ${{secrets.DOCKER_TOKEN}} + - name: Checkout repository + uses: actions/checkout@v4 + # https://github.com/actions/checkout/issues/1830 + # https://gitea.com/gitea/act_runner/issues/164 + - name: Checkout lfs + run: | + git lfs install --local + AUTH=$(git config --local http.${{ github.server_url }}/.extraheader) + git config --local --unset http.${{ github.server_url }}/.extraheader + git config --local http.${{ github.server_url }}/${{ github.repository }}.git/info/lfs/objects/batch.extraheader "$AUTH" + git lfs pull + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: . + file: ./Dockerfile + platforms: linux/arm64,linux/amd64 + push: true + # TODO: split tag names into multiple lines + tags: | + ${{env.registry}}/${{github.repository_owner}}/${{github.event.repository.name}}/${{github.ref_name}}:${{github.sha}} + ${{env.registry}}/${{github.repository_owner}}/${{github.event.repository.name}}/${{github.ref_name}}:latest diff --git a/.gitignore b/.gitignore index 1d76db5..a7f73e9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,17 +1 @@ -*/cache -*/libraries -*/logs -*/versions -*/plugins/.paper-remapped - -*/world -*/world_nether -*/world_the_end - -*/.console_history - -*/banned-ips.json -*/banned-players.json -*/ops.json -*/whitelist.json -*/usercache.json +src/logs diff --git a/Dockerfile b/Dockerfile index e523c0e..1ef47de 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,19 +11,40 @@ RUN mkdir ${DATA_PATH} RUN mkdir ${DATA_PATH}/logs && \ ln -sf ${DATA_PATH}/logs ${CONFIG_PATH} -RUN touch ${DATA_PATH}/whitelist.json && \ - ln -sf ${DATA_PATH}/whitelist.json ${CONFIG_PATH} + +# Generate unicode locale so that cyrillic characters display properly +RUN apt-get update -y && apt-get install -y locales && \ + echo en_US.UTF-8 UTF-8 > /etc/locale.gen && \ + dpkg-reconfigure --frontend=noninteractive locales && \ + rm -Rf var/lib/apt/lists/* +ENV LANG en_US.UTF-8 + VOLUME ${DATA_PATH} +EXPOSE 25565/tcp + + ENV MEMORY=1G ENV PROXY_SECRET=change_me + WORKDIR ${WORKDIR_PATH}/config -EXPOSE 25565/tcp - CMD \ - sed -i "s/_PROXY_SECRET_/${PROXY_SECRET}/g" server.properties && \ - java -Xms${MEMORY} -Xmx${MEMORY} -jar *.jar --nogui + # Create and switch to user with desired UID and GID. + # All processes that create/change files in ${DATA_PATH} + # must be run under this user. + groupadd -g ${GID} worker && \ + useradd -M -g ${GID} -u ${UID} worker && \ + chmod -R o-rwx ${WORKDIR_PATH} && \ + + # Add proxy secret + sed -i "s/_PROXY_SECRET_/${PROXY_SECRET}/g" settings.yml && \ + + # Change UID and GID of used files to desired values. + chown -R worker:worker ${WORKDIR_PATH} && \ + + # Launch + su worker -c "java -Xms${MEMORY} -Xmx${MEMORY} -jar *.jar --nogui" diff --git a/src/Limbo-0.7.10-ALPHA-1.21.1.jar b/src/Limbo-0.7.10-ALPHA-1.21.1.jar deleted file mode 100644 index 803602b..0000000 --- a/src/Limbo-0.7.10-ALPHA-1.21.1.jar +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:dc528599c08df1766c29a15da646df5d586b791d5c52255170746fc51563c120 -size 8493423 diff --git a/src/NanoLimbo-1.9.7-all.jar b/src/NanoLimbo-1.9.7-all.jar new file mode 100644 index 0000000..b98f13a --- /dev/null +++ b/src/NanoLimbo-1.9.7-all.jar @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6046e8346858bfbbd14e9b39d8d8535bf25b7d18408b623842e4c24238f2f687 +size 3971634 diff --git a/src/permission.yml b/src/permission.yml deleted file mode 100644 index 0f5a839..0000000 --- a/src/permission.yml +++ /dev/null @@ -1,14 +0,0 @@ -groups: - # admin: - # - limboserver.stop - # - limboserver.kick - # - limboserver.say - # - limboserver.gamemode - default: - - limboserver.spawn - - limboserver.chat - # - limboserver.version - -players: - # LOOHP: - # - admin diff --git a/src/plugins/bStats/config.yml b/src/plugins/bStats/config.yml deleted file mode 100644 index 23e317e..0000000 --- a/src/plugins/bStats/config.yml +++ /dev/null @@ -1,7 +0,0 @@ -#bStats collects some data for plugin authors like how many servers are using their plugins. -#To honor their work, you should not disable it. -#This has nearly no effect on the server performance! -#Check out https://bStats.org/ to learn more :) -enabled: false -serverUuid: f7c31857-e3e6-4807-856c-4fe187149590 -logFailedRequests: false diff --git a/src/run.bat b/src/run.bat index 6324766..20ef6e9 100755 --- a/src/run.bat +++ b/src/run.bat @@ -1,3 +1,3 @@ @echo off -java -Xms1G -Xmx1G -jar *.jar --nogui +java -Xms1G -Xmx1G -jar NanoLimbo-1.9.7-all.jar --nogui pause diff --git a/src/run.sh b/src/run.sh index 41dad80..482b2fa 100755 --- a/src/run.sh +++ b/src/run.sh @@ -1,3 +1,3 @@ #!/bin/sh -java -Xms1G -Xmx1G -jar *.jar --nogui +java -Xms1G -Xmx1G -jar NanoLimbo-1.9.7-all.jar --nogui diff --git a/src/server.properties b/src/server.properties deleted file mode 100644 index acbf67f..0000000 --- a/src/server.properties +++ /dev/null @@ -1,30 +0,0 @@ -#For explaination of what each of the options does, please visit: -#https://github.com/LOOHP/Limbo/blob/master/src/main/resources/server.properties -#Sun Jun 08 11:50:59 EEST 2025 -allow-chat=true -allow-flight=false -bungee-guard=false -bungeecord=false -default-gamemode=adventure -enforce-whitelist=false -forwarding-secrets=_PROXY_SECRET_ -handshake-verbose=true -level-dimension=minecraft\:overworld -level-name=world;spawn.schem -log-player-ip-addresses=true -max-players=-1 -motd={"text"\:"","extra"\:[{"text"\:"Limbo Server\!","color"\:"yellow"}]} -reduced-debug-info=true -required-resource-pack=false -resource-pack= -resource-pack-prompt={"text"\:"","extra"\:[{"text"\:"Install server resource pack\!","color"\:"yellow"}]} -resource-pack-sha1= -server-ip=0.0.0.0 -server-port=25565 -tab-footer= -tab-header= -ticks-per-second=5 -velocity-modern=true -version=Limbo\! -view-distance=6 -world-spawn=world;20.5;17;22.5;-90;0 diff --git a/src/settings.yml b/src/settings.yml new file mode 100644 index 0000000..976bb8d --- /dev/null +++ b/src/settings.yml @@ -0,0 +1,137 @@ +# +# NanoLimbo configuration +# + +# Server's host address and port. Set ip empty to use public address +bind: + ip: '0.0.0.0' + port: 25565 + +# Max number of players can join to server +# Set -1 to make it infinite +maxPlayers: 100 + +# Server's data in servers list +ping: + description: '{"text": "&9NanoLimbo"}' + version: 'NanoLimbo' + # Return static protocol version number in ping result + # By default, its -1 to return the client version if it supported + # https://wiki.vg/Protocol_version_numbers + protocol: -1 + +# Available dimensions: OVERWORLD, NETHER, THE_END +dimension: THE_END + +# Whether to display the player in the player list +# For 1.16.5 clients, the player list will be sent even if disabled, to avoid crash +playerList: + enable: false + username: 'NanoLimbo' + +# Whether to display header and footer in player list +# For 1.8+ clients +headerAndFooter: + enable: false + header: '{"text": "&eWelcome!"}' + footer: '{"text": "&9NanoLimbo"}' + +# Setup player's game mode +# 0 - Survival +# 1 - Creative (hide HP and food bar) +# 2 - Adventure +# 3 - Spectator (hide all UI bars) +# Spectator works on 1.8+ clients +gameMode: 3 + +# Remove secure-chat toast +# For 1.20.5+ clients +secureProfile: false + +# Server name which is shown under F3 +# For 1.13+ clients +brandName: + enable: false + content: 'NanoLimbo' + +# Message sends when player joins to the server +joinMessage: + enable: false + text: '{"text": "&eWelcome to the Limbo!"}' + +# BossBar displays when player joins to the server +# For 1.9+ clients +bossBar: + enable: false + text: '{"text": "Welcome to the Limbo!"}' + health: 1.0 + # Available colors: PINK, BLUE, RED, GREEN, YELLOW, PURPLE, WHITE + color: PINK + # Available divisions: SOLID, DASHES_6, DASHES_10, DASHES_12, DASHES_20 + division: SOLID + +# Display title and subtitle +# For 1.8+ clients +title: + enable: false + # Set title text value empty, if you need only subtitle + title: '{"text": "&9&lWelcome!"}' + # Set subtitle text value empty, if you need only title + subtitle: '{"text": "&6NanoLimbo"}' + # Fade in time in ticks (1 sec = 20 ticks) + fadeIn: 10 + # Stay time in ticks + stay: 200 + # Fade out time in ticks + fadeOut: 10 + +# Player info forwarding support. +# Available types: +# - NONE +# - LEGACY +# - MODERN +# - BUNGEE_GUARD +# Don't use secret if you do not use MODERN type +infoForwarding: + type: MODERN + secret: '_PROXY_SECRET_' + tokens: + - '' + +# Read timeout for connections in milliseconds +readTimeout: 30000 + +# Define log level. For production, I'd recommend to use level 2 +# Log levels: +# 0 - Display only errors +# 1 - Display errors, warnings +# 2 - Display errors, warnings, info +# 3 - Display errors, warnings, info, debug +debugLevel: 2 + +# Warning! Do not touch params of this block if you are not completely sure what is this! +netty: + # Use a Linux native transport type, if it possible + useEpoll: true + # EventLoopGroup threads count + threads: + bossGroup: 1 + workerGroup: 4 + +# Options to check incoming traffic and kick potentially malicious connections. +# Take into account that player can send many small packets, for example, just moving mouse. +traffic: + # If true, then additional handler will be added to the channel pipeline + enable: true + # Max packet size in bytes + # Unlimited if -1 + maxPacketSize: 8192 + # The interval to measure packets over + # Lowering this value will limit peak packets from players which would target people with bad connections + # Raising this value will allow higher peak packet rates, which will help with people who have poor connections + # Ignored if -1.0 + interval: 7.0 + # The maximum packets per second for players + # It is measured over the configured interval + # Ignored if -1.0 + maxPacketRate: 500.0 diff --git a/src/spawn.schem b/src/spawn.schem deleted file mode 100644 index 4c431de..0000000 --- a/src/spawn.schem +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:dde72add1e579739a8f816708d1f2efae9198bc9d6ca99a236972f53b712f6e6 -size 6609