Add gamerule per dimension

This commit is contained in:
Darto KLoning
2026-09-06 19:31:59 +07:00
parent e037fadfc9
commit ba4fc88538
11 changed files with 598 additions and 40 deletions
+59 -13
View File
@@ -30,6 +30,54 @@ read_property() {
grep -E "^${key}=" "$GRADLE_PROPERTIES" | head -n 1 | cut -d'=' -f2- | tr -d '\r'
}
suggest_commit_message() {
local status
status="$(git status --porcelain)"
SUGGESTED_COMMIT="Update Lobby Systems v$MOD_VERSION"
if grep -qiE '(^|[[:space:]])src/' <<<"$status"; then
SUGGESTED_COMMIT="Update Lobby Systems v$MOD_VERSION"
elif grep -qiE 'compile\.(bat|sh)|release\.(bat|sh)' <<<"$status"; then
SUGGESTED_COMMIT="Improve build and Git workflow"
elif grep -qiE 'README\.md|LICENSE' <<<"$status"; then
SUGGESTED_COMMIT="Update Lobby Systems documentation"
fi
}
push_branch_with_retry() {
local round=1
local attempt
while true; do
attempt=1
while [[ $attempt -le 3 ]]; do
echo
info "Push attempt $attempt/3 (round $round) ke origin/$CURRENT_BRANCH..."
if git push origin "$CURRENT_BRANCH"; then
return 0
fi
warn "Push attempt $attempt/3 gagal."
if [[ $attempt -lt 3 ]]; then
info "Mencoba lagi dalam 2 detik..."
sleep 2
fi
attempt=$((attempt + 1))
done
echo
separator
echo " GIT PUSH FAILED - 3 ATTEMPTS"
separator
info "Commit lokal tetap aman dan tidak perlu compile ulang."
read -r -p "Coba push 3x lagi? [Y/N]: " RETRY_CONFIRM
case "$RETRY_CONFIRM" in
y|Y|yes|YES|Yes) round=$((round + 1)) ;;
*) return 1 ;;
esac
done
}
if [[ ! -f "$GRADLE_PROPERTIES" ]]; then
error "gradle.properties tidak ditemukan."
exit 1
@@ -122,7 +170,6 @@ if [[ ! -x "$GRADLE_BIN" ]]; then
fi
ok "Gradle $GRADLE_VERSION tersedia."
info "Menjalankan clean build Lobby Systems v$MOD_VERSION..."
echo
@@ -155,14 +202,12 @@ else
echo "$JAR_PATH"
fi
# 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) ;;
*)
@@ -208,12 +253,11 @@ if [[ -n "$CHANGES" ]]; then
git status --short
echo
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
suggest_commit_message
echo "[SUGGEST] Commit message: $SUGGESTED_COMMIT"
info "Tekan Enter untuk memakai saran tersebut, atau ketik pesan sendiri."
read -r -p "Commit message [$SUGGESTED_COMMIT]: " COMMIT_MESSAGE
[[ -z "$COMMIT_MESSAGE" ]] && COMMIT_MESSAGE="$SUGGESTED_COMMIT"
info "Menambahkan perubahan ke staging..."
if ! git add -A; then
@@ -232,7 +276,6 @@ else
fi
CURRENT_BRANCH="$(git branch --show-current)"
if [[ -z "$CURRENT_BRANCH" ]]; then
error "Tidak dapat menentukan branch Git aktif."
exit 2
@@ -252,12 +295,15 @@ fi
REMOTE_URL="$(git remote get-url origin)"
info "Remote origin: $REMOTE_URL"
info "Push ke origin/$CURRENT_BRANCH..."
if ! git push origin "$CURRENT_BRANCH"; then
if ! push_branch_with_retry; then
echo
error "Git push gagal."
separator
echo " GIT FAILED"
separator
info "Build Lobby Systems tetap berhasil."
info "Commit lokal tetap tersimpan."
info "Jalankan compile.sh lagi dan pilih Y; bila tidak ada perubahan, script langsung mencoba push commit yang tertunda."
exit 2
fi