Add mod state in console

This commit is contained in:
Darto KLoning
2026-09-06 14:28:45 +07:00
parent 7c747f9036
commit ecc67d99ae
10 changed files with 689 additions and 329 deletions
+38 -4
View File
@@ -21,13 +21,14 @@ Double-click `compile.bat` atau jalankan:
.\compile.bat
```
Atau langsung:
Linux/macOS:
```powershell
.\compile.ps1
```bash
chmod +x compile.sh release.sh
./compile.sh
```
Kedua script membaca `mod_version` dan `minecraft_version` langsung dari `gradle.properties`. Header build akan menampilkan versi yang sedang di-compile, misalnya:
`compile.bat` dan `compile.sh` membaca `mod_version` dan `minecraft_version` langsung dari `gradle.properties`. Setelah `BUILD SUCCESS`, script akan menanyakan apakah source ingin di-commit dan di-push ke Git/Gitea. Header build akan menampilkan versi yang sedang di-compile, misalnya:
```text
============================================
@@ -46,6 +47,39 @@ build/libs/lobby-systems-1.2.0.jar
`*-sources.jar` hanya source archive dan tidak perlu dipasang ke server.
## Membuat Gitea Release
Gunakan `release.bat` di Windows atau `./release.sh` di Linux/macOS. Release script akan:
1. menjalankan build melalui mode `--build-only`;
2. memastikan source sudah di-commit/push;
3. membuat/push tag `v<mod_version>`;
4. membuat Gitea Release melalui API;
5. mengupload `build/libs/lobby-systems-<version>.jar` sebagai release asset.
Default repository release:
```text
https://git.darto.id/dartokloning/lobby-systems
```
API release membutuhkan Gitea Personal Access Token. Jangan simpan token di repository. Anda dapat memasukkan token ketika script meminta, atau menyediakan environment variable `GITEA_TOKEN`.
## Console state logging
State penting Lobby Systems memakai separator agar mudah terlihat di server console, antara lain startup, config load, player-position store ready, portal load, reload, player join/disconnect, portal create/delete, dan teleport. Contoh:
```text
============================================
Lobby Systems - READY
Version: 1.2.0
Minecraft: 26.2
Config directory: config/lobby
WorldEdit: available
============================================
```
## Struktur konfigurasi v1.2.0
```text
+15 -113
View File
@@ -4,17 +4,13 @@ setlocal EnableExtensions EnableDelayedExpansion
REM ============================================================
REM Lobby Systems - Fabric Build Script
REM Windows
REM
REM Features:
REM - Read version from gradle.properties
REM - Check Java 25
REM - Download Gradle 9.5.1 automatically if needed
REM - Clean build
REM - Ask for Git commit + push ONLY after BUILD SUCCESS
REM ============================================================
cd /d "%~dp0"
set "BUILD_ONLY=0"
if /I "%~1"=="--build-only" set "BUILD_ONLY=1"
set "GRADLE_PROPERTIES=%CD%\gradle.properties"
set "LOCAL_GRADLE_DIR=%CD%\.gradle-local"
set "GRADLE_VERSION=9.5.1"
@@ -25,10 +21,6 @@ set "MOD_VERSION="
set "MINECRAFT_VERSION="
set "MAVEN_GROUP="
REM ============================================================
REM Read gradle.properties
REM ============================================================
if not exist "%GRADLE_PROPERTIES%" (
echo [ERROR] gradle.properties tidak ditemukan.
goto :failed
@@ -51,12 +43,7 @@ echo Namespace: id.dartokloning.lobbysystems
echo Mod ID: dartokloning
echo ============================================
REM ============================================================
REM Check Java
REM ============================================================
where java.exe >nul 2>&1
if errorlevel 1 (
echo [ERROR] Java tidak ditemukan di PATH.
echo Install JDK 25, buka terminal baru, lalu jalankan script lagi.
@@ -69,11 +56,9 @@ for /f "delims=" %%J in ('where java.exe 2^>nul') do (
)
:java_path_found
echo [INFO] Java executable: %JAVA_PATH%
set "JAVA_VERSION="
for /f "tokens=2" %%V in ('java --version 2^>^&1 ^| findstr /R /C:"^openjdk " /C:"^java "') do (
if not defined JAVA_VERSION set "JAVA_VERSION=%%V"
)
@@ -83,9 +68,7 @@ if not defined JAVA_VERSION (
goto :failed
)
for /f "tokens=1 delims=." %%M in ("%JAVA_VERSION%") do (
set "JAVA_MAJOR=%%M"
)
for /f "tokens=1 delims=." %%M in ("%JAVA_VERSION%") do set "JAVA_MAJOR=%%M"
if not "%JAVA_MAJOR%"=="25" (
echo [ERROR] Java 25 diperlukan.
@@ -95,42 +78,30 @@ if not "%JAVA_MAJOR%"=="25" (
echo [OK] Java 25 terdeteksi.
REM ============================================================
REM Prepare Gradle
REM ============================================================
if exist "%GRADLE_BIN%" goto :gradle_ready
echo [INFO] Gradle %GRADLE_VERSION% belum tersedia.
echo [INFO] Mengunduh distribusi resmi...
if not exist "%LOCAL_GRADLE_DIR%" (
mkdir "%LOCAL_GRADLE_DIR%"
)
if not exist "%LOCAL_GRADLE_DIR%" mkdir "%LOCAL_GRADLE_DIR%"
set "GRADLE_ZIP=%LOCAL_GRADLE_DIR%\gradle-%GRADLE_VERSION%-bin.zip"
set "GRADLE_URL=https://services.gradle.org/distributions/gradle-%GRADLE_VERSION%-bin.zip"
where curl.exe >nul 2>&1
if errorlevel 1 (
echo [ERROR] curl.exe tidak ditemukan.
echo Windows 10/11 biasanya sudah menyediakan curl.
goto :failed
)
curl.exe -L --fail --progress-bar "%GRADLE_URL%" -o "%GRADLE_ZIP%"
if errorlevel 1 (
echo [ERROR] Gagal mengunduh Gradle %GRADLE_VERSION%.
goto :failed
)
echo [INFO] Mengekstrak Gradle %GRADLE_VERSION%...
powershell.exe -NoProfile -ExecutionPolicy Bypass -Command ^
"Expand-Archive -LiteralPath '%GRADLE_ZIP%' -DestinationPath '%LOCAL_GRADLE_DIR%' -Force"
powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "Expand-Archive -LiteralPath '%GRADLE_ZIP%' -DestinationPath '%LOCAL_GRADLE_DIR%' -Force"
if errorlevel 1 (
echo [ERROR] Gagal mengekstrak Gradle.
goto :failed
@@ -144,31 +115,19 @@ if not exist "%GRADLE_BIN%" (
)
:gradle_ready
echo [OK] Gradle %GRADLE_VERSION% tersedia.
REM ============================================================
REM Build
REM ============================================================
echo [INFO] Menjalankan clean build Lobby Systems v%MOD_VERSION%...
echo.
call "%GRADLE_BIN%" clean build --no-daemon
if errorlevel 1 goto :build_failed
REM ============================================================
REM BUILD SUCCESS
REM ============================================================
echo.
echo ============================================
echo BUILD SUCCESS
echo ============================================
set "JAR_PATH=%CD%\build\libs\lobby-systems-%MOD_VERSION%.jar"
if exist "%JAR_PATH%" (
echo JAR:
echo %JAR_PATH%
@@ -177,26 +136,21 @@ if exist "%JAR_PATH%" (
echo %JAR_PATH%
)
REM release.bat memakai mode ini supaya prompt Git tidak muncul dua kali.
if "%BUILD_ONLY%"=="1" exit /b 0
echo.
REM ============================================================
REM Ask whether to continue to Git
REM ============================================================
choice /C YN /N /M "Commit dan push perubahan ke Git/Gitea? [Y/N]: "
if errorlevel 2 goto :skip_git
if errorlevel 1 goto :git_integration
:git_integration
echo.
echo ============================================
echo Git Integration
echo ============================================
where git.exe >nul 2>&1
if errorlevel 1 (
echo [ERROR] Git tidak ditemukan di PATH.
echo Build tetap berhasil, tetapi Git tidak dapat dijalankan.
@@ -204,7 +158,6 @@ if errorlevel 1 (
)
git rev-parse --is-inside-work-tree >nul 2>&1
if errorlevel 1 (
echo [ERROR] Folder ini belum menjadi Git repository.
echo.
@@ -217,12 +170,8 @@ if errorlevel 1 (
)
echo [INFO] Memeriksa perubahan...
set "HAS_CHANGES="
for /f "delims=" %%G in ('git status --porcelain') do (
set "HAS_CHANGES=1"
)
for /f "delims=" %%G in ('git status --porcelain') do set "HAS_CHANGES=1"
if defined HAS_CHANGES (
echo.
@@ -231,76 +180,45 @@ if defined HAS_CHANGES (
echo.
set "COMMIT_MESSAGE="
set /p "COMMIT_MESSAGE=Commit message [Lobby Systems v%MOD_VERSION% build]: "
if not defined COMMIT_MESSAGE (
for /f "tokens=1-3 delims=/ " %%A in ("%date%") do (
set "DATESTAMP=%date%"
)
set "COMMIT_MESSAGE=Lobby Systems v%MOD_VERSION% build"
)
if not defined COMMIT_MESSAGE set "COMMIT_MESSAGE=Lobby Systems v%MOD_VERSION% build"
echo.
echo [INFO] Menambahkan perubahan ke staging...
git add -A
if errorlevel 1 (
echo [ERROR] git add gagal.
goto :git_failed
)
echo [INFO] Membuat commit...
git commit -m "!COMMIT_MESSAGE!"
if errorlevel 1 (
echo [ERROR] git commit gagal.
goto :git_failed
)
) else (
echo [INFO] Tidak ada perubahan source yang perlu di-commit.
echo [INFO] Akan mencoba push commit yang sudah ada.
)
REM ============================================================
REM Determine current branch
REM ============================================================
set "CURRENT_BRANCH="
for /f "delims=" %%B in ('git branch --show-current') do (
set "CURRENT_BRANCH=%%B"
)
for /f "delims=" %%B in ('git branch --show-current') do set "CURRENT_BRANCH=%%B"
if not defined CURRENT_BRANCH (
echo [ERROR] Tidak dapat menentukan branch Git aktif.
goto :git_failed
)
REM ============================================================
REM Check origin
REM ============================================================
git remote get-url origin >nul 2>&1
if errorlevel 1 (
echo [ERROR] Remote Git 'origin' belum dikonfigurasi.
echo.
echo Tambahkan Gitea dengan:
echo git remote add origin ^<URL-GITEA^>
echo.
echo Commit lokal tetap tersimpan.
goto :git_failed
)
echo [INFO] Push ke origin/!CURRENT_BRANCH!...
git push origin "!CURRENT_BRANCH!"
if errorlevel 1 (
echo [ERROR] Git push gagal.
echo [INFO] Commit lokal tetap tersimpan.
@@ -311,22 +229,12 @@ echo.
echo [SUCCESS] Push ke Git/Gitea berhasil.
goto :success
REM ============================================================
REM Skip Git
REM ============================================================
:skip_git
echo.
echo [INFO] Git commit/push dilewati.
goto :success
REM ============================================================
REM Success
REM ============================================================
:success
echo.
echo ============================================
echo Lobby Systems v%MOD_VERSION% selesai.
@@ -335,13 +243,7 @@ echo.
pause
exit /b 0
REM ============================================================
REM Build failed
REM Git section is NEVER reached
REM ============================================================
:build_failed
echo.
echo ============================================
echo BUILD FAILED
@@ -350,11 +252,11 @@ echo.
echo [ERROR] Build gagal.
echo [INFO] Git Integration tidak dijalankan.
echo.
if "%BUILD_ONLY%"=="1" exit /b 1
pause
exit /b 1
:git_failed
echo.
echo ============================================
echo GIT FAILED
@@ -367,9 +269,9 @@ pause
exit /b 2
:failed
echo.
echo Build gagal.
echo.
if "%BUILD_ONLY%"=="1" exit /b 1
pause
exit /b 1
exit /b 1
+24 -199
View File
@@ -3,63 +3,33 @@
# ============================================================
# Lobby Systems - Fabric Build Script
# Linux / macOS
#
# Features:
# - Read version from gradle.properties
# - Check Java 25
# - Download Gradle 9.5.1 automatically if needed
# - Clean build
# - Ask for Git commit + push ONLY after BUILD SUCCESS
# ============================================================
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR" || exit 1
BUILD_ONLY=0
if [[ "${1:-}" == "--build-only" ]]; then
BUILD_ONLY=1
fi
GRADLE_PROPERTIES="$SCRIPT_DIR/gradle.properties"
LOCAL_GRADLE_DIR="$SCRIPT_DIR/.gradle-local"
GRADLE_VERSION="9.5.1"
GRADLE_HOME="$LOCAL_GRADLE_DIR/gradle-$GRADLE_VERSION"
GRADLE_BIN="$GRADLE_HOME/bin/gradle"
# ============================================================
# Helper functions
# ============================================================
info() {
echo "[INFO] $1"
}
ok() {
echo "[OK] $1"
}
warn() {
echo "[WARN] $1"
}
error() {
echo "[ERROR] $1"
}
separator() {
echo "============================================"
}
info() { echo "[INFO] $1"; }
ok() { echo "[OK] $1"; }
warn() { echo "[WARN] $1"; }
error() { echo "[ERROR] $1"; }
separator() { echo "============================================"; }
read_property() {
local key="$1"
grep -E "^${key}=" "$GRADLE_PROPERTIES" \
| head -n 1 \
| cut -d'=' -f2- \
| tr -d '\r'
grep -E "^${key}=" "$GRADLE_PROPERTIES" | head -n 1 | cut -d'=' -f2- | tr -d '\r'
}
# ============================================================
# Read gradle.properties
# ============================================================
if [[ ! -f "$GRADLE_PROPERTIES" ]]; then
error "gradle.properties tidak ditemukan."
exit 1
@@ -69,17 +39,9 @@ MOD_VERSION="$(read_property "mod_version")"
MINECRAFT_VERSION="$(read_property "minecraft_version")"
MAVEN_GROUP="$(read_property "maven_group")"
if [[ -z "$MOD_VERSION" ]]; then
MOD_VERSION="unknown"
fi
if [[ -z "$MINECRAFT_VERSION" ]]; then
MINECRAFT_VERSION="26.2"
fi
if [[ -z "$MAVEN_GROUP" ]]; then
MAVEN_GROUP="id.dartokloning"
fi
[[ -z "$MOD_VERSION" ]] && MOD_VERSION="unknown"
[[ -z "$MINECRAFT_VERSION" ]] && MINECRAFT_VERSION="26.2"
[[ -z "$MAVEN_GROUP" ]] && MAVEN_GROUP="id.dartokloning"
separator
echo " Lobby Systems - Fabric $MINECRAFT_VERSION Build"
@@ -88,10 +50,6 @@ echo " Namespace: id.dartokloning.lobbysystems"
echo " Mod ID: dartokloning"
separator
# ============================================================
# Check Java
# ============================================================
if ! command -v java >/dev/null 2>&1; then
error "Java tidak ditemukan di PATH."
echo "Install JDK 25 lalu jalankan script lagi."
@@ -99,13 +57,10 @@ if ! command -v java >/dev/null 2>&1; then
fi
JAVA_PATH="$(command -v java)"
info "Java executable: $JAVA_PATH"
JAVA_VERSION_OUTPUT="$(java --version 2>&1 | head -n 1)"
JAVA_VERSION="$(echo "$JAVA_VERSION_OUTPUT" | awk '{print $2}')"
JAVA_MAJOR="$(echo "$JAVA_VERSION" | cut -d'.' -f1)"
if [[ "$JAVA_MAJOR" != "25" ]]; then
@@ -117,45 +72,24 @@ fi
ok "Java 25 terdeteksi."
# ============================================================
# Prepare Gradle
# ============================================================
if [[ ! -x "$GRADLE_BIN" ]]; then
info "Gradle $GRADLE_VERSION belum tersedia."
info "Mengunduh distribusi resmi..."
mkdir -p "$LOCAL_GRADLE_DIR"
GRADLE_ZIP="$LOCAL_GRADLE_DIR/gradle-$GRADLE_VERSION-bin.zip"
GRADLE_URL="https://services.gradle.org/distributions/gradle-$GRADLE_VERSION-bin.zip"
if command -v curl >/dev/null 2>&1; then
curl \
-L \
--fail \
--progress-bar \
"$GRADLE_URL" \
-o "$GRADLE_ZIP"
curl -L --fail --progress-bar "$GRADLE_URL" -o "$GRADLE_ZIP"
DOWNLOAD_RESULT=$?
elif command -v wget >/dev/null 2>&1; then
wget \
"$GRADLE_URL" \
-O "$GRADLE_ZIP"
wget "$GRADLE_URL" -O "$GRADLE_ZIP"
DOWNLOAD_RESULT=$?
else
error "curl atau wget tidak ditemukan."
exit 1
fi
if [[ $DOWNLOAD_RESULT -ne 0 ]]; then
@@ -170,12 +104,7 @@ if [[ ! -x "$GRADLE_BIN" ]]; then
exit 1
fi
unzip \
-q \
-o \
"$GRADLE_ZIP" \
-d "$LOCAL_GRADLE_DIR"
unzip -q -o "$GRADLE_ZIP" -d "$LOCAL_GRADLE_DIR"
EXTRACT_RESULT=$?
if [[ $EXTRACT_RESULT -ne 0 ]]; then
@@ -194,40 +123,23 @@ fi
ok "Gradle $GRADLE_VERSION tersedia."
# ============================================================
# Build
# ============================================================
info "Menjalankan clean build Lobby Systems v$MOD_VERSION..."
echo
"$GRADLE_BIN" clean build --no-daemon
BUILD_RESULT=$?
# ============================================================
# BUILD FAILED
# ============================================================
if [[ $BUILD_RESULT -ne 0 ]]; then
echo
separator
echo " BUILD FAILED"
separator
echo
error "Build gagal dengan exit code $BUILD_RESULT."
info "Git Integration tidak dijalankan."
exit "$BUILD_RESULT"
fi
# ============================================================
# BUILD SUCCESS
# ============================================================
echo
separator
echo " BUILD SUCCESS"
@@ -236,210 +148,123 @@ separator
JAR_PATH="$SCRIPT_DIR/build/libs/lobby-systems-$MOD_VERSION.jar"
if [[ -f "$JAR_PATH" ]]; then
echo "JAR:"
echo "$JAR_PATH"
else
warn "Build berhasil, tetapi JAR utama tidak ditemukan pada:"
echo "$JAR_PATH"
fi
# ============================================================
# Ask whether to use Git
# ============================================================
# release.sh memakai mode ini supaya build tidak menampilkan prompt Git dua kali.
if [[ $BUILD_ONLY -eq 1 ]]; then
exit 0
fi
echo
read -r -p "Commit dan push perubahan ke Git/Gitea? [Y/N]: " GIT_CONFIRM
case "$GIT_CONFIRM" in
y|Y|yes|YES|Yes)
;;
y|Y|yes|YES|Yes) ;;
*)
echo
info "Git commit/push dilewati."
echo
separator
echo " Lobby Systems v$MOD_VERSION selesai."
separator
exit 0
;;
esac
# ============================================================
# Git Integration
# ============================================================
echo
separator
echo " Git Integration"
separator
# ------------------------------------------------------------
# Check Git
# ------------------------------------------------------------
if ! command -v git >/dev/null 2>&1; then
error "Git tidak ditemukan di PATH."
info "Build tetap berhasil."
exit 0
fi
# ------------------------------------------------------------
# Check repository
# ------------------------------------------------------------
if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
error "Folder ini belum menjadi Git repository."
echo
echo "Jalankan terlebih dahulu:"
echo
echo " git init"
echo " git branch -M main"
echo " git remote add origin <URL-GITEA>"
echo
exit 0
fi
# ------------------------------------------------------------
# Check source changes
# ------------------------------------------------------------
info "Memeriksa perubahan Git..."
CHANGES="$(git status --porcelain)"
if [[ -n "$CHANGES" ]]; then
echo
echo "Perubahan ditemukan:"
echo
git status --short
echo
read -r -p \
"Commit message [Lobby Systems v$MOD_VERSION build]: " \
COMMIT_MESSAGE
read -r -p "Commit message [Lobby Systems v$MOD_VERSION build]: " COMMIT_MESSAGE
if [[ -z "$COMMIT_MESSAGE" ]]; then
TIMESTAMP="$(date '+%Y-%m-%d %H:%M:%S')"
COMMIT_MESSAGE="Lobby Systems v$MOD_VERSION build - $TIMESTAMP"
fi
# --------------------------------------------------------
# Git Add
# --------------------------------------------------------
info "Menambahkan perubahan ke staging..."
if ! git add -A; then
error "git add gagal."
exit 2
fi
# --------------------------------------------------------
# Git Commit
# --------------------------------------------------------
info "Membuat commit..."
if ! git commit -m "$COMMIT_MESSAGE"; then
error "git commit gagal."
exit 2
fi
else
info "Tidak ada perubahan source yang perlu di-commit."
info "Akan mencoba push commit yang sudah ada."
fi
# ============================================================
# Determine current branch
# ============================================================
CURRENT_BRANCH="$(git branch --show-current)"
if [[ -z "$CURRENT_BRANCH" ]]; then
error "Tidak dapat menentukan branch Git aktif."
exit 2
fi
info "Branch aktif: $CURRENT_BRANCH"
# ============================================================
# Check origin
# ============================================================
if ! git remote get-url origin >/dev/null 2>&1; then
error "Remote Git 'origin' belum dikonfigurasi."
echo
echo "Tambahkan remote Gitea dengan:"
echo
echo " git remote add origin <URL-GITEA>"
echo
info "Commit lokal tetap tersimpan."
exit 2
fi
REMOTE_URL="$(git remote get-url origin)"
info "Remote origin: $REMOTE_URL"
# ============================================================
# Git Push
# ============================================================
info "Push ke origin/$CURRENT_BRANCH..."
if ! git push origin "$CURRENT_BRANCH"; then
echo
error "Git push gagal."
info "Commit lokal tetap tersimpan."
exit 2
fi
# ============================================================
# Complete
# ============================================================
echo
ok "Push ke Git/Gitea berhasil."
echo
separator
echo " Lobby Systems v$MOD_VERSION selesai."
separator
exit 0
exit 0
+1 -1
View File
@@ -5,6 +5,6 @@ minecraft_version=26.2
loader_version=0.19.3
loom_version=1.17-SNAPSHOT
fabric_api_version=0.156.0+26.2
mod_version=1.2.0
mod_version=1.2.1
maven_group=id.dartokloning
archives_base_name=lobby-systems
+242
View File
@@ -0,0 +1,242 @@
@echo off
setlocal EnableExtensions EnableDelayedExpansion
REM ============================================================
REM Lobby Systems - Gitea Release Script
REM Windows
REM ============================================================
cd /d "%~dp0"
if not defined GITEA_BASE_URL set "GITEA_BASE_URL=https://git.darto.id"
if not defined GITEA_OWNER set "GITEA_OWNER=dartokloning"
if not defined GITEA_REPO set "GITEA_REPO=lobby-systems"
set "MOD_VERSION="
set "MINECRAFT_VERSION="
for /f "usebackq tokens=1,* delims==" %%A in ("gradle.properties") do (
if "%%A"=="mod_version" set "MOD_VERSION=%%B"
if "%%A"=="minecraft_version" set "MINECRAFT_VERSION=%%B"
)
if not defined MOD_VERSION (
echo [ERROR] mod_version tidak ditemukan di gradle.properties.
exit /b 1
)
set "TAG=v%MOD_VERSION%"
set "JAR_NAME=lobby-systems-%MOD_VERSION%.jar"
set "JAR_PATH=%CD%\build\libs\%JAR_NAME%"
echo ============================================
echo Lobby Systems - Release %TAG%
echo Minecraft: %MINECRAFT_VERSION%
echo Gitea: %GITEA_BASE_URL%/%GITEA_OWNER%/%GITEA_REPO%
echo ============================================
echo.
echo [INFO] Menjalankan build terlebih dahulu...
call "%CD%\compile.bat" --build-only
if errorlevel 1 (
echo [ERROR] Release dibatalkan karena build gagal.
exit /b 1
)
if not exist "%JAR_PATH%" (
echo [ERROR] JAR release tidak ditemukan:
echo %JAR_PATH%
exit /b 1
)
where git.exe >nul 2>&1
if errorlevel 1 (
echo [ERROR] Git tidak ditemukan di PATH.
exit /b 1
)
where curl.exe >nul 2>&1
if errorlevel 1 (
echo [ERROR] curl.exe tidak ditemukan di PATH.
exit /b 1
)
git rev-parse --is-inside-work-tree >nul 2>&1
if errorlevel 1 (
echo [ERROR] Folder ini bukan Git repository.
exit /b 1
)
set "CURRENT_BRANCH="
for /f "delims=" %%B in ('git branch --show-current') do set "CURRENT_BRANCH=%%B"
if not defined CURRENT_BRANCH (
echo [ERROR] Tidak dapat menentukan branch Git aktif.
exit /b 1
)
git remote get-url origin >nul 2>&1
if errorlevel 1 (
echo [ERROR] Remote 'origin' belum dikonfigurasi.
exit /b 1
)
echo.
echo ============================================
echo Git Release Preparation
echo ============================================
set "HAS_CHANGES="
for /f "delims=" %%G in ('git status --porcelain') do set "HAS_CHANGES=1"
if defined HAS_CHANGES (
echo.
echo Perubahan source belum di-commit:
git status --short
echo.
choice /C YN /N /M "Commit dan push perubahan sebelum membuat release? [Y/N]: "
if errorlevel 2 (
echo [WARN] Release dibatalkan. Source harus bersih agar tag sesuai dengan build.
exit /b 0
)
set "COMMIT_MESSAGE="
set /p "COMMIT_MESSAGE=Commit message [Prepare Lobby Systems %TAG% release]: "
if not defined COMMIT_MESSAGE set "COMMIT_MESSAGE=Prepare Lobby Systems %TAG% release"
git add -A
if errorlevel 1 exit /b 2
git commit -m "!COMMIT_MESSAGE!"
if errorlevel 1 exit /b 2
)
echo [INFO] Push branch !CURRENT_BRANCH! ke origin...
git push origin "!CURRENT_BRANCH!"
if errorlevel 1 (
echo [ERROR] Push branch gagal. Release dibatalkan.
exit /b 2
)
set "HEAD_COMMIT="
for /f "delims=" %%H in ('git rev-parse HEAD') do set "HEAD_COMMIT=%%H"
set "TAG_COMMIT="
for /f "delims=" %%T in ('git rev-list -n 1 "%TAG%" 2^>nul') do set "TAG_COMMIT=%%T"
if defined TAG_COMMIT (
if /I not "!TAG_COMMIT!"=="!HEAD_COMMIT!" (
echo [ERROR] Tag %TAG% sudah ada tetapi menunjuk commit lain.
echo Tag : !TAG_COMMIT!
echo HEAD: !HEAD_COMMIT!
echo Naikkan mod_version sebelum membuat release baru.
exit /b 2
)
echo [INFO] Tag lokal %TAG% sudah ada pada commit saat ini.
) else (
echo [INFO] Membuat tag %TAG%...
git tag -a "%TAG%" -m "Lobby Systems %TAG%"
if errorlevel 1 exit /b 2
)
git ls-remote --exit-code --tags origin "refs/tags/%TAG%" >nul 2>&1
if errorlevel 1 (
echo [INFO] Push tag %TAG% ke origin...
git push origin "%TAG%"
if errorlevel 1 exit /b 2
) else (
echo [INFO] Tag %TAG% sudah ada di origin.
)
echo.
echo ============================================
echo Gitea Release
echo ============================================
choice /C YN /N /M "Buat Release %TAG% dan upload %JAR_NAME%? [Y/N]: "
if errorlevel 2 (
echo [INFO] Pembuatan Gitea Release dilewati. Tag %TAG% tetap sudah tersimpan.
exit /b 0
)
if not defined GITEA_TOKEN (
echo.
set /p "GITEA_TOKEN=Gitea Personal Access Token: "
)
if not defined GITEA_TOKEN (
echo [ERROR] Token Gitea kosong.
exit /b 2
)
set "API_BASE=%GITEA_BASE_URL%/api/v1/repos/%GITEA_OWNER%/%GITEA_REPO%"
set "RELEASE_JSON=%TEMP%\lobby-release-%RANDOM%.json"
set "CREATE_JSON=%TEMP%\lobby-create-%RANDOM%.json"
set "ASSET_JSON=%TEMP%\lobby-asset-%RANDOM%.json"
set "HTTP_CODE="
for /f "delims=" %%H in ('curl.exe -sS -o "!RELEASE_JSON!" -w "%%{http_code}" -H "Authorization: token !GITEA_TOKEN!" "!API_BASE!/releases/tags/%TAG%"') do set "HTTP_CODE=%%H"
if "!HTTP_CODE!"=="200" (
echo [INFO] Release %TAG% sudah ada. Akan menggunakan release tersebut.
) else if "!HTTP_CODE!"=="404" (
>"!CREATE_JSON!" echo {
>>"!CREATE_JSON!" echo "tag_name": "%TAG%",
>>"!CREATE_JSON!" echo "target_commitish": "!CURRENT_BRANCH!",
>>"!CREATE_JSON!" echo "name": "Lobby Systems %TAG%",
>>"!CREATE_JSON!" echo "body": "Lobby Systems %TAG% untuk Minecraft %MINECRAFT_VERSION%.",
>>"!CREATE_JSON!" echo "draft": false,
>>"!CREATE_JSON!" echo "prerelease": false
>>"!CREATE_JSON!" echo }
echo [INFO] Membuat Release %TAG% di Gitea...
set "HTTP_CODE="
for /f "delims=" %%H in ('curl.exe -sS -o "!RELEASE_JSON!" -w "%%{http_code}" -X POST -H "Authorization: token !GITEA_TOKEN!" -H "Content-Type: application/json" --data-binary "@!CREATE_JSON!" "!API_BASE!/releases"') do set "HTTP_CODE=%%H"
if not "!HTTP_CODE!"=="201" (
echo [ERROR] Gitea gagal membuat release. HTTP !HTTP_CODE!
type "!RELEASE_JSON!"
del /q "!RELEASE_JSON!" "!CREATE_JSON!" "!ASSET_JSON!" >nul 2>&1
exit /b 2
)
) else (
echo [ERROR] Gagal memeriksa release. HTTP !HTTP_CODE!
type "!RELEASE_JSON!"
del /q "!RELEASE_JSON!" "!CREATE_JSON!" "!ASSET_JSON!" >nul 2>&1
exit /b 2
)
set "RELEASE_ID="
for /f "delims=" %%I in ('powershell.exe -NoProfile -Command "$r=Get-Content -Raw -LiteralPath '!RELEASE_JSON!' ^| ConvertFrom-Json; $r.id"') do set "RELEASE_ID=%%I"
if not defined RELEASE_ID (
echo [ERROR] Tidak dapat membaca release ID dari response Gitea.
type "!RELEASE_JSON!"
exit /b 2
)
echo [INFO] Release ID: !RELEASE_ID!
echo [INFO] Mengupload %JAR_NAME%...
set "ASSET_CODE="
for /f "delims=" %%H in ('curl.exe -sS -o "!ASSET_JSON!" -w "%%{http_code}" -X POST -H "Authorization: token !GITEA_TOKEN!" -F "attachment=@%JAR_PATH%" "!API_BASE!/releases/!RELEASE_ID!/assets?name=%JAR_NAME%"') do set "ASSET_CODE=%%H"
if "!ASSET_CODE!"=="201" (
echo.
echo [SUCCESS] Release %TAG% berhasil dibuat dan JAR berhasil diupload.
) else if "!ASSET_CODE!"=="409" (
echo.
echo [WARN] Release sudah ada dan asset %JAR_NAME% tampaknya sudah terupload.
) else (
echo [ERROR] Upload JAR gagal. HTTP !ASSET_CODE!
type "!ASSET_JSON!"
exit /b 2
)
del /q "!RELEASE_JSON!" "!CREATE_JSON!" "!ASSET_JSON!" >nul 2>&1
echo.
echo ============================================
echo RELEASE SUCCESS
echo Tag: %TAG%
echo Asset: %JAR_NAME%
echo ============================================
exit /b 0
+237
View File
@@ -0,0 +1,237 @@
#!/usr/bin/env bash
# ============================================================
# Lobby Systems - Gitea Release Script
# Linux / macOS
# ============================================================
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR" || exit 1
GITEA_BASE_URL="${GITEA_BASE_URL:-https://git.darto.id}"
GITEA_OWNER="${GITEA_OWNER:-dartokloning}"
GITEA_REPO="${GITEA_REPO:-lobby-systems}"
GRADLE_PROPERTIES="$SCRIPT_DIR/gradle.properties"
info() { echo "[INFO] $1"; }
ok() { echo "[OK] $1"; }
warn() { echo "[WARN] $1"; }
error() { echo "[ERROR] $1"; }
separator() { echo "============================================"; }
read_property() { grep -E "^${1}=" "$GRADLE_PROPERTIES" | head -n 1 | cut -d'=' -f2- | tr -d '\r'; }
MOD_VERSION="$(read_property mod_version)"
MINECRAFT_VERSION="$(read_property minecraft_version)"
TAG="v$MOD_VERSION"
JAR_PATH="$SCRIPT_DIR/build/libs/lobby-systems-$MOD_VERSION.jar"
JAR_NAME="lobby-systems-$MOD_VERSION.jar"
separator
echo " Lobby Systems - Release $TAG"
echo " Minecraft: $MINECRAFT_VERSION"
echo " Gitea: $GITEA_BASE_URL/$GITEA_OWNER/$GITEA_REPO"
separator
echo
info "Menjalankan build terlebih dahulu..."
"$SCRIPT_DIR/compile.sh" --build-only
BUILD_RESULT=$?
if [[ $BUILD_RESULT -ne 0 ]]; then
error "Release dibatalkan karena build gagal."
exit "$BUILD_RESULT"
fi
if [[ ! -f "$JAR_PATH" ]]; then
error "JAR release tidak ditemukan: $JAR_PATH"
exit 1
fi
if ! command -v git >/dev/null 2>&1; then
error "Git tidak ditemukan di PATH."
exit 1
fi
if ! command -v curl >/dev/null 2>&1; then
error "curl tidak ditemukan di PATH."
exit 1
fi
if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
error "Folder ini bukan Git repository."
exit 1
fi
CURRENT_BRANCH="$(git branch --show-current)"
if [[ -z "$CURRENT_BRANCH" ]]; then
error "Tidak dapat menentukan branch Git aktif."
exit 1
fi
if ! git remote get-url origin >/dev/null 2>&1; then
error "Remote 'origin' belum dikonfigurasi."
exit 1
fi
echo
separator
echo " Git Release Preparation"
separator
CHANGES="$(git status --porcelain)"
if [[ -n "$CHANGES" ]]; then
echo
echo "Perubahan source belum di-commit:"
git status --short
echo
read -r -p "Commit dan push perubahan sebelum membuat release? [Y/N]: " SYNC_CONFIRM
case "$SYNC_CONFIRM" in
y|Y|yes|YES|Yes) ;;
*)
warn "Release dibatalkan. Source harus bersih agar tag sesuai dengan build."
exit 0
;;
esac
read -r -p "Commit message [Prepare Lobby Systems $TAG release]: " COMMIT_MESSAGE
[[ -z "$COMMIT_MESSAGE" ]] && COMMIT_MESSAGE="Prepare Lobby Systems $TAG release"
git add -A || exit 2
git commit -m "$COMMIT_MESSAGE" || exit 2
fi
info "Push branch $CURRENT_BRANCH ke origin..."
if ! git push origin "$CURRENT_BRANCH"; then
error "Push branch gagal. Release dibatalkan."
exit 2
fi
HEAD_COMMIT="$(git rev-parse HEAD)"
if git rev-parse "$TAG" >/dev/null 2>&1; then
TAG_COMMIT="$(git rev-list -n 1 "$TAG")"
if [[ "$TAG_COMMIT" != "$HEAD_COMMIT" ]]; then
error "Tag $TAG sudah ada tetapi menunjuk commit lain."
echo "Tag : $TAG_COMMIT"
echo "HEAD: $HEAD_COMMIT"
echo "Naikkan mod_version sebelum membuat release baru."
exit 2
fi
info "Tag lokal $TAG sudah ada pada commit saat ini."
else
info "Membuat tag $TAG..."
git tag -a "$TAG" -m "Lobby Systems $TAG" || exit 2
fi
if git ls-remote --exit-code --tags origin "refs/tags/$TAG" >/dev/null 2>&1; then
info "Tag $TAG sudah ada di origin."
else
info "Push tag $TAG ke origin..."
git push origin "$TAG" || exit 2
fi
echo
separator
echo " Gitea Release"
separator
read -r -p "Buat Release $TAG dan upload $JAR_NAME? [Y/N]: " RELEASE_CONFIRM
case "$RELEASE_CONFIRM" in
y|Y|yes|YES|Yes) ;;
*)
info "Pembuatan Gitea Release dilewati. Tag $TAG tetap sudah tersimpan."
exit 0
;;
esac
if [[ -z "${GITEA_TOKEN:-}" ]]; then
echo
read -r -s -p "Gitea Personal Access Token: " GITEA_TOKEN
echo
fi
if [[ -z "$GITEA_TOKEN" ]]; then
error "Token Gitea kosong."
exit 2
fi
API_BASE="$GITEA_BASE_URL/api/v1/repos/$GITEA_OWNER/$GITEA_REPO"
TMP_DIR="$(mktemp -d)"
trap 'rm -rf "$TMP_DIR"' EXIT
RELEASE_JSON="$TMP_DIR/release.json"
CREATE_JSON="$TMP_DIR/create.json"
ASSET_JSON="$TMP_DIR/asset.json"
info "Memeriksa apakah Release $TAG sudah ada..."
HTTP_CODE="$(curl -sS -o "$RELEASE_JSON" -w '%{http_code}' \
-H "Authorization: token $GITEA_TOKEN" \
"$API_BASE/releases/tags/$TAG")"
if [[ "$HTTP_CODE" == "200" ]]; then
info "Release $TAG sudah ada. Akan menggunakan release tersebut."
elif [[ "$HTTP_CODE" == "404" ]]; then
cat > "$CREATE_JSON" <<JSON
{
"tag_name": "$TAG",
"target_commitish": "$CURRENT_BRANCH",
"name": "Lobby Systems $TAG",
"body": "Lobby Systems $TAG untuk Minecraft $MINECRAFT_VERSION.",
"draft": false,
"prerelease": false
}
JSON
info "Membuat Release $TAG di Gitea..."
HTTP_CODE="$(curl -sS -o "$RELEASE_JSON" -w '%{http_code}' \
-X POST \
-H "Authorization: token $GITEA_TOKEN" \
-H "Content-Type: application/json" \
--data-binary "@$CREATE_JSON" \
"$API_BASE/releases")"
if [[ "$HTTP_CODE" != "201" ]]; then
error "Gitea gagal membuat release. HTTP $HTTP_CODE"
cat "$RELEASE_JSON"
exit 2
fi
else
error "Gagal memeriksa release. HTTP $HTTP_CODE"
cat "$RELEASE_JSON"
exit 2
fi
RELEASE_ID="$(grep -oE '"id"[[:space:]]*:[[:space:]]*[0-9]+' "$RELEASE_JSON" | head -n 1 | grep -oE '[0-9]+')"
if [[ -z "$RELEASE_ID" ]]; then
error "Tidak dapat membaca release ID dari response Gitea."
cat "$RELEASE_JSON"
exit 2
fi
info "Release ID: $RELEASE_ID"
info "Mengupload $JAR_NAME..."
ASSET_CODE="$(curl -sS -o "$ASSET_JSON" -w '%{http_code}' \
-X POST \
-H "Authorization: token $GITEA_TOKEN" \
-F "attachment=@$JAR_PATH" \
"$API_BASE/releases/$RELEASE_ID/assets?name=$JAR_NAME")"
if [[ "$ASSET_CODE" == "201" ]]; then
echo
ok "Release $TAG berhasil dibuat dan JAR berhasil diupload."
elif [[ "$ASSET_CODE" == "409" ]]; then
echo
warn "Release sudah ada dan asset $JAR_NAME tampaknya sudah terupload."
else
error "Upload JAR gagal. HTTP $ASSET_CODE"
cat "$ASSET_JSON"
exit 2
fi
echo
separator
echo " RELEASE SUCCESS"
echo " Tag: $TAG"
echo " Asset: $JAR_NAME"
separator
@@ -27,12 +27,15 @@ public final class LegacyConfigMigrator {
Files.createDirectories(target.getParent());
Files.move(source, target, StandardCopyOption.REPLACE_EXISTING);
LobbySystemsMod.LOGGER.info("Migrated legacy {}: {} -> {}", label, source, target);
LobbyLog.state("LEGACY CONFIG MIGRATED", "Type: " + label, "From: " + source, "To: " + target);
} catch (Exception moveError) {
try {
Files.copy(source, target, StandardCopyOption.REPLACE_EXISTING);
LobbySystemsMod.LOGGER.info("Copied legacy {}: {} -> {}", label, source, target);
LobbyLog.state("LEGACY CONFIG COPIED", "Type: " + label, "From: " + source, "To: " + target);
} catch (Exception copyError) {
LobbySystemsMod.LOGGER.error("Failed to migrate legacy {} from {} to {}", label, source, target, copyError);
LobbyLog.state("LEGACY MIGRATION FAILED", "Type: " + label, "From: " + source, "To: " + target);
}
}
}
@@ -0,0 +1,46 @@
package id.dartokloning.lobbysystems;
import net.fabricmc.loader.api.FabricLoader;
/**
* Logger visual untuk state penting Lobby Systems.
* Separator sengaja dipakai agar state mod mudah terlihat di console server.
*/
public final class LobbyLog {
private static final String SEPARATOR = "============================================";
private LobbyLog() {}
public static String modVersion() {
return FabricLoader.getInstance()
.getModContainer(LobbySystemsMod.MOD_ID)
.map(container -> container.getMetadata().getVersion().getFriendlyString())
.orElse("unknown");
}
public static String minecraftVersion() {
return FabricLoader.getInstance()
.getModContainer("minecraft")
.map(container -> container.getMetadata().getVersion().getFriendlyString())
.orElse("unknown");
}
public static void state(String title, String... details) {
LobbySystemsMod.LOGGER.info(SEPARATOR);
LobbySystemsMod.LOGGER.info(" Lobby Systems - {}", title);
for (String detail : details) {
LobbySystemsMod.LOGGER.info(" {}", detail);
}
LobbySystemsMod.LOGGER.info(SEPARATOR);
}
public static void startup() {
state(
"STARTING",
"Version: " + modVersion(),
"Minecraft: " + minecraftVersion(),
"Namespace: id.dartokloning.lobbysystems",
"Mod ID: " + LobbySystemsMod.MOD_ID
);
}
}
@@ -1,7 +1,6 @@
package id.dartokloning.lobbysystems;
import com.mojang.brigadier.arguments.StringArgumentType;
import com.mojang.logging.LogUtils;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
@@ -19,10 +18,11 @@ import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.level.Level;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public final class LobbySystemsMod implements ModInitializer {
public static final String MOD_ID = "dartokloning";
public static final Logger LOGGER = LogUtils.getLogger();
public static final Logger LOGGER = LoggerFactory.getLogger("Lobby Systems");
private static final ConfigManager CONFIG = new ConfigManager();
private static final SessionTracker SESSIONS = new SessionTracker();
@@ -33,18 +33,43 @@ public final class LobbySystemsMod implements ModInitializer {
@Override
public void onInitialize() {
LobbyLog.startup();
LegacyConfigMigrator.migrate();
CONFIG.load();
boolean configLoaded = CONFIG.load();
LobbyLog.state(
configLoaded ? "CONFIG LOADED" : "CONFIG LOAD FAILED",
"File: " + CONFIG.path(),
"Lobby dimension: " + CONFIG.get().lobbyDimension
);
POSITIONS.load();
POSITIONS.setExcludedDimension(lobbyKey());
PORTALS.load();
LobbyLog.state(
"PLAYER POSITIONS READY",
"File: " + ConfigPaths.PLAYER_POSITIONS,
"Lobby persistence: excluded"
);
boolean portalsLoaded = PORTALS.load();
LobbyLog.state(
portalsLoaded ? "PORTALS LOADED" : "PORTAL LOAD FAILED",
"File: " + ConfigPaths.PORTALS,
"Portals: " + PORTALS.size()
);
ServerPlayConnectionEvents.JOIN.register((listener, sender, server) -> {
ServerPlayer player = listener.getPlayer();
server.execute(() -> {
POSITIONS.captureCurrent(player);
TELEPORTS.scheduleJoinToLobby(player);
LOGGER.info("Scheduled lobby login teleport for {} ({})", player.getName().getString(), player.getUUID());
LobbyLog.state(
"PLAYER JOIN",
"Player: " + player.getName().getString(),
"UUID: " + player.getUUID(),
"Lobby teleport: scheduled"
);
});
});
@@ -54,6 +79,12 @@ public final class LobbySystemsMod implements ModInitializer {
SESSIONS.onDisconnect(player.getUUID());
TELEPORTS.onDisconnect(player.getUUID());
PORTALS.onDisconnect(player.getUUID());
LobbyLog.state(
"PLAYER DISCONNECT",
"Player: " + player.getName().getString(),
"UUID: " + player.getUUID(),
"Session state: saved/cleared"
);
});
ServerTickEvents.END_SERVER_TICK.register(server -> {
@@ -128,8 +159,15 @@ public final class LobbySystemsMod implements ModInitializer {
);
});
LOGGER.info("Lobby Systems v1.2.0 initialized for Minecraft 26.2. Config directory: {}", ConfigPaths.DIRECTORY);
LOGGER.info("WorldEdit integration: {}", WorldEditSelectionBridge.isAvailable() ? "available" : "not installed (saved portals still work)");
LobbyLog.state(
"READY",
"Version: " + LobbyLog.modVersion(),
"Minecraft: " + LobbyLog.minecraftVersion(),
"Config directory: " + ConfigPaths.DIRECTORY,
"WorldEdit: " + (WorldEditSelectionBridge.isAvailable()
? "available"
: "not installed (saved portals still work)")
);
}
private static int handleLobbyCommand(ServerPlayer player, MinecraftServer server) {
@@ -154,7 +192,14 @@ public final class LobbySystemsMod implements ModInitializer {
}
private static int reloadAll(MinecraftServer server, CommandSourceStack source) {
LobbyLog.state(
"RELOAD START",
"Config: " + ConfigPaths.CONFIG,
"Portals: " + ConfigPaths.PORTALS
);
if (!CONFIG.load()) {
LobbyLog.state("RELOAD FAILED", "Reason: config.json gagal dibaca");
source.sendFailure(Component.literal("§cLobby Systems: reload config gagal. Cek console untuk detail JSON."));
return 0;
}
@@ -164,10 +209,12 @@ public final class LobbySystemsMod implements ModInitializer {
key = lobbyKey();
if (server.getLevel(key) == null) {
source.sendFailure(Component.literal("§eConfig terbaca, tetapi lobbyDimension '" + CONFIG.get().lobbyDimension + "' tidak sedang ter-load."));
LobbyLog.state("RELOAD FAILED", "Reason: lobby dimension tidak ter-load", "Lobby: " + CONFIG.get().lobbyDimension);
return 0;
}
} catch (Exception e) {
source.sendFailure(Component.literal("§cConfig terbaca, tetapi lobbyDimension tidak valid: " + CONFIG.get().lobbyDimension));
LobbyLog.state("RELOAD FAILED", "Reason: lobbyDimension tidak valid", "Lobby: " + CONFIG.get().lobbyDimension);
return 0;
}
@@ -175,6 +222,7 @@ public final class LobbySystemsMod implements ModInitializer {
boolean portalOk = PORTALS.load();
if (!portalOk) {
source.sendFailure(Component.literal("§eConfig utama direload, tetapi portals.json bermasalah. Cek console."));
LobbyLog.state("RELOAD FAILED", "Reason: portals.json gagal dibaca");
return 0;
}
@@ -182,6 +230,13 @@ public final class LobbySystemsMod implements ModInitializer {
"§aLobby Systems direload. §7Lobby: §f" + CONFIG.get().lobbyDimension
+ " §7| Minimum play: §f" + CONFIG.get().minimumPlaySeconds + "s"
+ " §7| Portals: §f" + PORTALS.size()), false);
LobbyLog.state(
"RELOAD COMPLETE",
"Lobby: " + CONFIG.get().lobbyDimension,
"Minimum play: " + CONFIG.get().minimumPlaySeconds + "s",
"Portals: " + PORTALS.size(),
"Player positions lobby exclusion: active"
);
return 1;
}
@@ -218,6 +273,12 @@ public final class LobbySystemsMod implements ModInitializer {
PORTALS.suppress(player.getUUID(), Math.max(CONFIG.get().portalCooldownTicks, 100));
player.sendSystemMessage(Component.literal(
"§aPortal §f" + name + "§a dibuat. §7" + portal.sourceDimension + " §8→ §f" + targetId));
LobbyLog.state(
"PORTAL CREATED",
"Name: " + name,
"Source: " + portal.sourceDimension,
"Target: " + targetId
);
return 1;
} catch (Exception e) {
LOGGER.warn("Failed to read WorldEdit selection for {}", player.getUUID(), e);
@@ -233,6 +294,7 @@ public final class LobbySystemsMod implements ModInitializer {
return 0;
}
source.sendSuccess(() -> Component.literal("§aPortal §f" + key + "§a dihapus."), false);
LobbyLog.state("PORTAL DELETED", "Name: " + key);
return 1;
}
@@ -83,17 +83,26 @@ public final class TeleportCoordinator {
TeleportTransition.DO_NOTHING
);
LobbySystemsMod.LOGGER.info(
"Teleporting {} ({}): {} -> {} @ [{}, {}, {}]",
player.getName().getString(), player.getUUID(),
from.identifier(), to.identifier(),
String.format("%.2f", x), String.format("%.2f", y), String.format("%.2f", z)
LobbyLog.state(
"TELEPORT",
"Player: " + player.getName().getString() + " (" + player.getUUID() + ")",
"From: " + from.identifier(),
"To: " + to.identifier(),
"Position: [" + String.format("%.2f", x) + ", "
+ String.format("%.2f", y) + ", "
+ String.format("%.2f", z) + "]"
);
ServerPlayer result = player.teleport(transition);
if (result == null) {
lockedUntilTick.remove(player.getUUID());
LobbySystemsMod.LOGGER.warn("Teleport failed for {}: {} -> {}", player.getUUID(), from.identifier(), to.identifier());
LobbyLog.state(
"TELEPORT FAILED",
"Player: " + player.getName().getString() + " (" + player.getUUID() + ")",
"From: " + from.identifier(),
"To: " + to.identifier()
);
return false;
}