Compare commits

..

37 Commits

Author SHA1 Message Date
Chaoscaot 83eb621b0f Merge pull request 'Test Backporting' (#344) from test/backporting into main
Deploy / Build (push) Successful in 1m30s
Deploy / Deploy (push) Successful in 7s
Reviewed-on: #344
2026-05-15 13:58:00 +02:00
Chaoscaot 65aaf4857d Test Backporting
Pull Request Build / Build (pull_request) Successful in 2m8s
Pull Request Build / Merge backport (pull_request) Has been skipped
Backport CommonCore / Backport CommonCore changes (pull_request) Failing after 8s
Signed-off-by: Chaoscaot <max@maxsp.de>
2026-05-15 13:55:12 +02:00
Chaoscaot 7d52447b00 Merge pull request 'Test Backporting' (#343) from test/backporting into main
Deploy / Build (push) Successful in 3m20s
Deploy / Deploy (push) Successful in 9s
Reviewed-on: #343
2026-05-15 13:54:00 +02:00
Chaoscaot 046ab8d1a8 Merge branch 'main' into test/backporting
Backport CommonCore / Backport CommonCore changes (pull_request) Failing after 12s
Pull Request Build / Build (pull_request) Successful in 2m49s
Pull Request Build / Merge backport (pull_request) Has been skipped
2026-05-15 13:53:53 +02:00
Chaoscaot 33c032092d Test Backporting
Pull Request Build / Build (pull_request) Successful in 2m7s
Pull Request Build / Merge backport (pull_request) Has been skipped
Signed-off-by: Chaoscaot <max@maxsp.de>
2026-05-15 13:53:09 +02:00
Chaoscaot b8eeb93a8f Merge pull request 'Test Backporting' (#342) from test/backporting into main
Deploy / Build (push) Successful in 2m26s
Deploy / Deploy (push) Successful in 7s
Reviewed-on: #342
2026-05-15 13:44:41 +02:00
Chaoscaot e95f68406f Test Backporting
Backport CommonCore / Backport CommonCore changes (pull_request) Failing after 16s
Pull Request Build / Build (pull_request) Successful in 2m14s
Pull Request Build / Merge backport (pull_request) Has been skipped
Signed-off-by: Chaoscaot <max@maxsp.de>
2026-05-15 13:44:23 +02:00
Chaoscaot c6f432a5c4 Test Backporting
Deploy / Deploy (push) Has been cancelled
Deploy / Build (push) Has been cancelled
Signed-off-by: Chaoscaot <max@maxsp.de>
2026-05-15 13:43:56 +02:00
Chaoscaot 9ca7446dba .gitea/workflows/backport-commoncore.yml aktualisiert
Deploy / Build (push) Has started running
Deploy / Deploy (push) Has been cancelled
2026-05-15 13:42:26 +02:00
Chaoscaot 773a1adf64 Merge pull request 'Test Backporting' (#341) from test/backporting into main
Deploy / Build (push) Successful in 1m32s
Deploy / Deploy (push) Successful in 8s
Reviewed-on: #341
2026-05-15 13:38:23 +02:00
Chaoscaot 6afe5d4c0d Test Backporting
Pull Request Build / Build (pull_request) Successful in 1m11s
Pull Request Build / Merge backport (pull_request) Has been skipped
Backport CommonCore / Backport CommonCore changes (pull_request) Failing after 13s
Signed-off-by: Chaoscaot <max@maxsp.de>
2026-05-15 13:31:49 +02:00
Chaoscaot 755a05fe34 Add merge-backport workflow to automate PR backports after successful builds
Deploy / Build (push) Successful in 1m28s
Deploy / Deploy (push) Successful in 7s
Signed-off-by: Chaoscaot <max@maxsp.de>
2026-05-15 13:31:11 +02:00
Chaoscaot 202da658ee Refactor workflows: split pull request build, rename deploy, and remove unused steps
Deploy / Build (push) Successful in 1m31s
Deploy / Deploy (push) Successful in 7s
Signed-off-by: Chaoscaot <max@maxsp.de>
2026-05-15 12:47:00 +02:00
Chaoscaot a5856cf240 Merge pull request 'Test Autobackporting' (#340) from test/backporting into main
Build / Build (push) Successful in 1m37s
Build / Deploy (push) Successful in 7s
Build / Merge backport (push) Has been skipped
Reviewed-on: #340
2026-05-15 12:31:37 +02:00
Chaoscaot 38099e6167 Test Autobackporting
Build / Build (push) Successful in 1m12s
Build / Build (pull_request) Successful in 1m12s
Build / Deploy (push) Has been skipped
Build / Merge backport (push) Has been skipped
Build / Deploy (pull_request) Has been skipped
Build / Merge backport (pull_request) Has been skipped
Backport CommonCore / Backport CommonCore changes (pull_request) Failing after 7s
Signed-off-by: Chaoscaot <max@maxsp.de>
2026-05-15 12:28:10 +02:00
Chaoscaot d307038e5e Use non basic caching
Build / Build (push) Successful in 3m21s
Build / Deploy (push) Successful in 7s
Build / Merge backport (push) Has been skipped
Signed-off-by: Chaoscaot <max@maxsp.de>
2026-05-15 12:07:41 +02:00
Chaoscaot d5aeeaf5e3 Add backport workflow for CommonCore changes and update build.yml
Build / Deploy (push) Has been cancelled
Build / Merge backport (push) Has been cancelled
Build / Build (push) Has been cancelled
Signed-off-by: Chaoscaot <max@maxsp.de>
2026-05-15 12:04:02 +02:00
Chaoscaot 134a05ea23 Add build.yml
Build / Build (push) Successful in 3m8s
Build / Deploy (push) Successful in 9s
Signed-off-by: Chaoscaot <max@maxsp.de>
2026-05-15 11:37:16 +02:00
Chaoscaot db63f2a67c Add build.yml
Build / Build (push) Failing after 3m45s
Signed-off-by: Chaoscaot <max@maxsp.de>
2026-05-15 11:29:08 +02:00
Chaoscaot 97a3c3ef35 .gitea/workflows/build.yml aktualisiert
/ Build (push) Successful in 3m54s
2026-05-15 11:09:37 +02:00
Chaoscaot a40e904ab3 .gitea/workflows/build.yml aktualisiert
/ Build (push) Failing after 2m0s
2026-05-15 11:06:54 +02:00
Chaoscaot a8a89b0809 .gitea/workflows/build.yml aktualisiert
/ Build (push) Failing after 5m8s
2026-05-15 10:30:13 +02:00
Chaoscaot 480efd1f8b Add build.yml
/ Build (push) Has been cancelled
Signed-off-by: Chaoscaot <max@maxsp.de>
2026-05-15 10:11:29 +02:00
YoyoNow 26baccf3c4 Test push 2026-05-15 10:09:02 +02:00
Chaoscaot 916f9b2557 Merge pull request 'SteamWar CLI merge' (#330) from feature/steamwar-cli into main
SteamWarCI Build successful
Reviewed-on: #330
Reviewed-by: YoyoNow <yoyonow@noreply.localhost>
2026-05-13 22:42:59 +02:00
YoyoNow 34992344b2 Fix CheckCommand.accept
SteamWarCI Build successful
2026-05-12 16:47:30 +02:00
YoyoNow 1ea8dea381 Fix WhoisCommand.whois
SteamWarCI Build successful
2026-05-11 21:03:51 +02:00
Chaoscaot 15aa0572f3 Merge pull request 'Implement old bau behavior for WGS' (#332) from old-bau-behavior into main
SteamWarCI Build successful
Reviewed-on: #332
Reviewed-by: D4rkr34lm <dark@steamwar.de>
2026-05-10 18:55:25 +02:00
Chaoscaot 6a843f4a71 Implement old bau behavior for WGS
SteamWarCI Build successful
Signed-off-by: Chaoscaot <max@maxsp.de>
2026-05-10 11:29:26 +02:00
Chaoscaot a63c1a94ca Fix TNT explosion logic to handle non-TNT entities correctly
SteamWarCI Build successful
Signed-off-by: Chaoscaot <max@maxsp.de>
2026-05-09 21:10:43 +02:00
Chaoscaot 43263035d9 Merge pull request 'Add DB Indexes for future local Development deployments' (#262) from add-db-indexes into main
SteamWarCI Build successful
Reviewed-on: #262
Reviewed-by: YoyoNow <yoyonow@noreply.localhost>
2026-05-09 20:23:56 +02:00
Chaoscaot 42ab55d0f8 Merge branch 'main' into add-db-indexes
SteamWarCI Build successful
# Conflicts:
#	CommonCore/SQL/src/de/steamwar/sql/BannedUserIPs.kt
2026-05-09 20:22:15 +02:00
Chaoscaot 44846cce57 Unpack CLI distribution in release
SteamWarCI Build successful
- Remove CLI installDist from build step
- Copy the packaged sw.zip into /jars during release
- Use `rm -rf` for the existing `/jars/sw` cleanup
2026-05-09 16:51:04 +02:00
Chaoscaot 1451750bcb Add SteamWar CLI module
SteamWarCI Build successful
- add Clikt-based `sw` entrypoint and subcommands
- include database, user, dev, and profiler commands
- wire CLI build and CI install/release steps
2026-05-09 16:46:59 +02:00
YoyoNow 8ade5180cb Fix FightSystem
SteamWarCI Build successful
2026-05-08 20:55:17 +02:00
Chaoscaot 73f903fc23 Merge branch 'main' into add-db-indexes
SteamWarCI Build successful
2026-01-23 23:04:11 +01:00
Chaoscaot 22ed7e23da Add DB Indexes for future local Development deployments
SteamWarCI Build successful
Signed-off-by: Chaoscaot <max@maxsp.de>
2025-12-25 20:51:57 +01:00
55 changed files with 1101 additions and 80 deletions
+201
View File
@@ -0,0 +1,201 @@
name: Backport CommonCore
on:
pull_request:
types: [closed]
branches:
- main
permissions:
contents: write
issues: write
pull-requests: write
jobs:
backport:
name: Backport CommonCore changes
runs-on: ubuntu-latest
if: ${{ github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main' }}
steps:
- name: Checkout sources
uses: actions/checkout@v6
with:
ref: main
fetch-depth: 0
token: ${{ secrets.GITEA_TOKEN }}
- name: Create version branch backports
shell: bash
env:
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
run: |
set -euo pipefail
api() {
local method="$1"
local path="$2"
local body="${3:-}"
if [[ -n "$body" ]]; then
curl --fail --silent --show-error \
-X "$method" \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
--data "$body" \
"${GITHUB_API_URL}${path}"
else
curl --fail --silent --show-error \
-X "$method" \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "Accept: application/json" \
"${GITHUB_API_URL}${path}"
fi
}
repo_path="/repos/${GITHUB_REPOSITORY}"
pr_number="$(jq -r '.number' "$GITHUB_EVENT_PATH")"
pr_title="$(jq -r '.pull_request.title // ""' "$GITHUB_EVENT_PATH")"
event_commit="$(jq -r '.pull_request.merge_commit_sha // .pull_request.merged_commit_id // .commit_id // env.GITHUB_SHA' "$GITHUB_EVENT_PATH")"
commoncore_files=()
page=1
while true; do
response="$(api GET "${repo_path}/pulls/${pr_number}/files?page=${page}&limit=50")"
count="$(jq 'length' <<< "$response")"
while IFS= read -r file; do
[[ -n "$file" ]] && commoncore_files+=("$file")
done < <(jq -r '.[] | (.filename // .path // .name // "") | select(startswith("CommonCore/"))' <<< "$response")
[[ "$count" -lt 50 ]] && break
page=$((page + 1))
done
if [[ "${#commoncore_files[@]}" -eq 0 ]]; then
echo "PR #${pr_number} did not change CommonCore/; nothing to backport."
exit 0
fi
echo "PR #${pr_number} changed CommonCore files:"
printf ' - %s\n' "${commoncore_files[@]}"
pr_commits=()
page=1
while true; do
response="$(api GET "${repo_path}/pulls/${pr_number}/commits?page=${page}&limit=50")"
count="$(jq 'length' <<< "$response")"
while IFS= read -r commit; do
[[ -n "$commit" ]] && pr_commits+=("$commit")
done < <(jq -r '.[] | .sha // .id // empty' <<< "$response")
[[ "$count" -lt 50 ]] && break
page=$((page + 1))
done
source_commits=("$event_commit")
if [[ "${#pr_commits[@]}" -gt 1 ]]; then
for commit in "${pr_commits[@]}"; do
if [[ "$commit" == "$event_commit" ]]; then
source_commits=("${pr_commits[@]}")
break
fi
done
fi
echo "Using source commit plan:"
printf ' - %s\n' "${source_commits[@]}"
git config --global user.name "SteamWar Backport Bot"
git config --global user.email "backport-bot@steamwar.de"
git fetch origin '+refs/heads/*:refs/remotes/origin/*'
for commit in "${source_commits[@]}"; do
git cat-file -e "${commit}^{commit}"
done
mapfile -t version_branches < <(
git for-each-ref --format='%(refname:short)' refs/remotes/origin/version |
sed 's#^origin/##' |
sort -u
)
if [[ "${#version_branches[@]}" -eq 0 ]]; then
echo "No origin/version/* branches found; nothing to backport."
exit 0
fi
failures=()
for target_branch in "${version_branches[@]}"; do
safe_target="$(sed -E 's#[^A-Za-z0-9._-]+#-#g; s#^-+##; s#-+$##' <<< "$target_branch")"
head_branch="backport/pr-${pr_number}-to-${safe_target}"
existing_pr="$(api GET "${repo_path}/pulls?state=open&base_branch=$(jq -rn --arg value "$target_branch" '$value|@uri')&limit=50" |
jq -r --arg head "$head_branch" '.[] | select(.head.ref == $head) | .number' |
head -n 1)"
if [[ -n "$existing_pr" ]]; then
echo "Backport PR #${existing_pr} already exists for ${target_branch}; leaving it unchanged."
continue
fi
echo "Creating ${head_branch} from ${target_branch}"
git checkout -B "$head_branch" "origin/${target_branch}"
for commit in "${source_commits[@]}"; do
cherry_pick_args=(-x)
if [[ "$(git rev-list --parents -n 1 "$commit" | wc -w)" -gt 2 ]]; then
cherry_pick_args=(-x -m 1)
fi
if git cherry-pick "${cherry_pick_args[@]}" "$commit"; then
continue
fi
if [[ -z "$(git status --porcelain)" ]]; then
echo "Cherry-pick of ${commit} produced no changes; skipping it."
git cherry-pick --skip || true
continue
fi
git cherry-pick --abort || true
failures+=("${target_branch}: cherry-pick of ${commit} failed")
break
done
if [[ "${failures[*]:-}" == *"${target_branch}:"* ]]; then
git checkout main
continue
fi
if git diff --quiet "origin/${target_branch}" HEAD; then
echo "${target_branch} already contains the change; no PR needed."
git checkout main
continue
fi
if [[ "${#source_commits[@]}" -eq 1 ]]; then
source_text="Source commit: \`${source_commits[0]}\`"
else
source_text="Source commits:"
for commit in "${source_commits[@]}"; do
source_text="${source_text} \`${commit}\`"
done
fi
description="Automated backport of #${pr_number} to ${target_branch} because the source PR changed CommonCore/. Source PR: ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/pulls/${pr_number}. ${source_text}. This PR will be merged automatically by the Pull Request Build workflow after a successful build."
git push \
-o "topic=${head_branch}" \
-o "title=Backport #${pr_number} to ${target_branch}: ${pr_title}" \
-o "description=${description}" \
-o "force-push" \
origin "HEAD:refs/for/${target_branch}"
echo "Created backport PR from ${head_branch} to ${target_branch}."
git checkout main
done
if [[ "${#failures[@]}" -gt 0 ]]; then
echo "Backport failures:"
printf ' - %s\n' "${failures[@]}"
exit 1
fi
+132
View File
@@ -0,0 +1,132 @@
name: Deploy
on:
push:
branches:
- main
- version/*
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v6
- name: Setup Java 8
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: 8
- name: Setup Java 11
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: 11
- name: Setup Java 17
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: 17
- name: Setup Java
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: 21
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v6
- name: Setup Maven Repository
env:
SW_MAVEN_CREDENTIALS: ${{ secrets.SW_MAVEN_CREDENTIALS }}
run: |
echo "$SW_MAVEN_CREDENTIALS" > steamwar.properties
- name: Build with Gradle
run: ./gradlew build --no-daemon
- name: Stage deploy artifacts
shell: bash
run: |
set -euo pipefail
rm -rf deploy
mkdir -p deploy
cp "BauSystem/build/libs/BauSystem-all.jar" "deploy/BauSystem.jar"
cp "LegacyBauSystem/build/libs/LegacyBauSystem.jar" "deploy/BauSystem-1.12.jar"
cp "FightSystem/build/libs/FightSystem-all.jar" "deploy/FightSystem.jar"
cp "KotlinCore/build/libs/KotlinCore-all.jar" "deploy/KotlinCore.jar"
cp "TNTLeague/build/libs/TNTLeague.jar" "deploy/TNTLeague.jar"
cp "LobbySystem/build/libs/LobbySystem.jar" "deploy/LobbySystem.jar"
cp "MissileWars/build/libs/MissileWars.jar" "deploy/MissileWars.jar"
cp "Realtime/build/libs/Realtime.jar" "deploy/RealTime.jar"
cp "SchematicSystem/build/libs/SchematicSystem-all.jar" "deploy/SchematicSystem.jar"
cp "SpigotCore/build/libs/SpigotCore-all.jar" "deploy/SpigotCore.jar"
cp "Teamserver/build/libs/Teamserver.jar" "deploy/Builder.jar"
cp "TowerRun/build/libs/TowerRun.jar" "deploy/TowerRun.jar"
cp "VelocityCore/Persistent/build/libs/Persistent.jar" "deploy/PersistentVelocityCore.jar"
cp "VelocityCore/Dependencies/build/libs/Dependencies-all.jar" "deploy/DependenciesVelocityCore.jar"
cp "VelocityCore/build/libs/VelocityCore-all.jar" "deploy/VelocityCore.jar"
cp "WebsiteBackend/build/libs/WebsiteBackend-all.jar" "deploy/website-api.jar"
- name: Upload deploy artifacts
uses: actions/upload-artifact@v3
with:
name: steamwar-jars
path: deploy/
deploy:
name: Deploy
runs-on: ubuntu-latest
needs: build
steps:
- name: Download deploy artifacts
uses: actions/download-artifact@v3
with:
name: steamwar-jars
path: deploy
- name: Resolve deploy target
id: target
shell: bash
run: |
set -euo pipefail
if [[ "${GITHUB_REF_NAME}" == "main" ]]; then
echo "path=/jars/current" >> "$GITHUB_OUTPUT"
elif [[ "${GITHUB_REF_NAME}" == version/* ]]; then
version="${GITHUB_REF_NAME#version/}"
if [[ ! "$version" =~ ^[A-Za-z0-9._-]+$ ]]; then
echo "Unsupported version branch name: ${GITHUB_REF_NAME}" >&2
exit 1
fi
echo "path=/jars/${version}" >> "$GITHUB_OUTPUT"
else
echo "Unsupported deployment branch: ${GITHUB_REF_NAME}" >&2
exit 1
fi
- name: Upload jars with scp
shell: bash
env:
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
DEPLOY_PORT: ${{ secrets.DEPLOY_PORT }}
DEPLOY_SSH_KEY: ${{ secrets.DEPLOY_SSH_KEY }}
DEPLOY_PATH: ${{ steps.target.outputs.path }}
run: |
set -euo pipefail
: "${DEPLOY_HOST:?Missing DEPLOY_HOST secret}"
: "${DEPLOY_USER:?Missing DEPLOY_USER secret}"
: "${DEPLOY_SSH_KEY:?Missing DEPLOY_SSH_KEY secret}"
port="${DEPLOY_PORT:-22}"
mkdir -p ~/.ssh
chmod 700 ~/.ssh
echo "$DEPLOY_SSH_KEY" > ~/.ssh/deploy_key
chmod 600 ~/.ssh/deploy_key
ssh-keyscan -p "$port" "$DEPLOY_HOST" >> ~/.ssh/known_hosts
ssh -i ~/.ssh/deploy_key -p "$port" "${DEPLOY_USER}@${DEPLOY_HOST}" "mkdir -p '$DEPLOY_PATH'"
scp -i ~/.ssh/deploy_key -P "$port" deploy/* "${DEPLOY_USER}@${DEPLOY_HOST}:$DEPLOY_PATH/"
+72
View File
@@ -0,0 +1,72 @@
name: Pull Request Build
on:
pull_request:
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v6
- name: Setup Java 8
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: 8
- name: Setup Java 11
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: 11
- name: Setup Java 17
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: 17
- name: Setup Java
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: 21
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v6
- name: Setup Maven Repository
env:
SW_MAVEN_CREDENTIALS: ${{ secrets.SW_MAVEN_CREDENTIALS }}
run: |
echo "$SW_MAVEN_CREDENTIALS" > steamwar.properties
- name: Build with Gradle
run: ./gradlew build --no-daemon
merge-backport:
name: Merge backport
runs-on: ubuntu-latest
needs: build
if: ${{ startsWith(github.event.pull_request.base.ref, 'version/') && startsWith(github.event.pull_request.head.ref, 'backport/pr-') }}
permissions:
contents: write
issues: write
pull-requests: write
steps:
- name: Merge successful backport PR
shell: bash
env:
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
run: |
set -euo pipefail
pr_number="$(jq -r '.number' "$GITHUB_EVENT_PATH")"
target_branch="$(jq -r '.pull_request.base.ref' "$GITHUB_EVENT_PATH")"
payload="$(jq -n \
--arg title "Merge backport #${pr_number} into ${target_branch}" \
'{Do: "merge", MergeTitleField: $title, MergeMessageField: "Automatic CommonCore backport after successful build.", delete_branch_after_merge: true}')"
curl --fail --silent --show-error \
-X POST \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
--data "$payload" \
"${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/pulls/${pr_number}/merge"
+1 -1
View File
@@ -21,4 +21,4 @@ lib
/WebsiteBackend/logs /WebsiteBackend/logs
/WebsiteBackend/skins /WebsiteBackend/skins
/WebsiteBackend/config.json /WebsiteBackend/config.json
/WebsiteBackend/sessions /WebsiteBackend/sessions
@@ -67,11 +67,7 @@ public class TNTListener implements Listener, ScoreboardElement {
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onExplode(EntityExplodeEvent event) { public void onExplode(EntityExplodeEvent event) {
if (!(event.getEntity() instanceof TNTPrimed)) { explode(event.blockList(), event.getEntity() instanceof TNTPrimed);
event.blockList().clear();
return;
}
explode(event.blockList(), true);
} }
@Override @Override
+32
View File
@@ -0,0 +1,32 @@
plugins {
steamwar.kotlin
application
}
kotlin {
jvmToolchain(21)
}
java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
application {
mainClass.set("de.steamwar.MainKt")
applicationName = "sw"
}
dependencies {
implementation(project(":CommonCore:SQL"))
implementation("com.github.ajalt.clikt:clikt:5.0.3")
implementation("com.github.ajalt.mordant:mordant:3.0.2")
implementation(libs.logback)
implementation("org.mariadb.jdbc:mariadb-java-client:3.3.1")
implementation(libs.exposedCore)
implementation(libs.exposedDao)
implementation(libs.exposedJdbc)
implementation(libs.exposedTime)
}
+22
View File
@@ -0,0 +1,22 @@
package de.steamwar
import com.github.ajalt.clikt.core.main
import com.github.ajalt.clikt.core.subcommands
import de.steamwar.commands.SteamWar
import de.steamwar.commands.database.DatabaseCommand
import de.steamwar.commands.database.InfoCommand
import de.steamwar.commands.database.ResetCommand
import de.steamwar.commands.dev.DevCommand
import de.steamwar.commands.profiler.ProfilerCommand
import de.steamwar.commands.user.UserCommand
import de.steamwar.commands.user.UserInfoCommand
import de.steamwar.commands.user.UserSearchCommand
fun main(args: Array<String>) = SteamWar()
.subcommands(
DatabaseCommand().subcommands(InfoCommand(), ResetCommand()),
UserCommand().subcommands(UserInfoCommand(), UserSearchCommand()),
DevCommand(),
ProfilerCommand()
)
.main(args)
+10
View File
@@ -0,0 +1,10 @@
package de.steamwar.commands
import com.github.ajalt.clikt.core.CliktCommand
import com.github.ajalt.mordant.rendering.TextStyles
class SteamWar: CliktCommand(name = "sw") {
override fun run() {
echo(TextStyles.bold("SteamWar-CLI"))
}
}
@@ -0,0 +1,22 @@
package de.steamwar.commands.database
import com.github.ajalt.clikt.core.CliktCommand
import com.github.ajalt.clikt.core.CliktError
import com.github.ajalt.clikt.core.Context
import com.github.ajalt.clikt.core.findOrSetObject
import com.github.ajalt.clikt.parameters.options.flag
import com.github.ajalt.clikt.parameters.options.option
import de.steamwar.db.Database
class DatabaseCommand: CliktCommand(name = "db") {
val useProduction by option().flag()
val db by findOrSetObject { Database }
override fun help(context: Context): String = "Run database commands"
override fun run() {
if (!useProduction && db.database == "production") {
throw CliktError("You should not use the production database!")
}
}
}
+25
View File
@@ -0,0 +1,25 @@
package de.steamwar.commands.database
import com.github.ajalt.clikt.core.CliktCommand
import com.github.ajalt.clikt.core.requireObject
import com.github.ajalt.mordant.table.table
import de.steamwar.db.Database
import de.steamwar.db.execute
import de.steamwar.db.useDb
class InfoCommand: CliktCommand() {
val db by requireObject<Database>()
override fun run() = useDb {
val tables = execute("SHOW TABLES") { it.getString(1) }
echo(
table {
header { row("Name") }
body {
tables.map { row(it) }
}
}
)
}
}
+33
View File
@@ -0,0 +1,33 @@
package de.steamwar.commands.database
import com.github.ajalt.clikt.core.CliktCommand
import com.github.ajalt.clikt.core.CliktError
import com.github.ajalt.clikt.core.requireObject
import com.github.ajalt.mordant.rendering.TextColors
import com.github.ajalt.mordant.rendering.TextStyles
import de.steamwar.db.Database
import de.steamwar.db.execute
import de.steamwar.db.useDb
import java.io.File
class ResetCommand: CliktCommand() {
val db by requireObject<Database>()
override fun run() = useDb {
val schemaFile = File("/var/Schema.sql")
if (!schemaFile.exists()) {
throw CliktError("Schema file not found!")
}
val schema = schemaFile.readText()
val tables = execute("SHOW TABLES;") { it.getString(1) }
for (table in tables) {
execute("DROP TABLE IF EXISTS $table;") { }
}
execute(schema) { }
echo(TextColors.brightGreen(TextStyles.bold("Database reset!")))
}
}
+179
View File
@@ -0,0 +1,179 @@
package de.steamwar.commands.dev
import com.github.ajalt.clikt.core.CliktCommand
import com.github.ajalt.clikt.core.CliktError
import com.github.ajalt.clikt.core.Context
import com.github.ajalt.clikt.parameters.arguments.argument
import com.github.ajalt.clikt.parameters.arguments.help
import com.github.ajalt.clikt.parameters.arguments.multiple
import com.github.ajalt.clikt.parameters.options.default
import com.github.ajalt.clikt.parameters.options.defaultLazy
import com.github.ajalt.clikt.parameters.options.flag
import com.github.ajalt.clikt.parameters.options.help
import com.github.ajalt.clikt.parameters.options.option
import com.github.ajalt.clikt.parameters.types.file
import com.github.ajalt.clikt.parameters.types.long
import com.github.ajalt.clikt.parameters.types.path
import com.sun.security.auth.module.UnixSystem
import java.io.File
import kotlin.io.path.absolute
import kotlin.io.path.absolutePathString
const val LOG4J_CONFIG = """<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN" packages="com.mojang.util">
<Appenders>
<Console name="WINDOWS_COMPAT" target="SYSTEM_OUT"></Console>
<Queue name="TerminalConsole">
<PatternLayout pattern="[%d{HH:mm:ss} %level]: %msg{nolookups}%n" />
</Queue>
<RollingRandomAccessFile name="File" fileName="$\{'sys:logPath'}/latest.log" filePattern="$\{'sys:logPath'}/%d{yyyy.MM.dd}.log.gz">
<PatternLayout pattern="[%d{HH:mm:ss}] [%t/%level]: %msg{nolookups}%n" />
<Policies>
<TimeBasedTriggeringPolicy />
</Policies>
<DefaultRolloverStrategy max="7"/>
</RollingRandomAccessFile>
</Appenders>
<Loggers>
<Root level="info">
<filters>
<MarkerFilter marker="NETWORK_PACKETS" onMatch="DENY" onMismatch="NEUTRAL" />
</filters>
<AppenderRef ref="WINDOWS_COMPAT" level="info"/>
<AppenderRef ref="File"/>
<AppenderRef ref="TerminalConsole" level="info"/>
</Root>
</Loggers>
</Configuration>"""
class DevCommand : CliktCommand("dev") {
override fun help(context: Context): String = "Start a dev Server"
override val treatUnknownOptionsAsArgs = true
val server by argument().help("Server Template")
val port by option("--port").long().defaultLazy { UnixSystem().uid + 1010 }.help("Port for Server")
val world by option("--world", "-w").path(canBeFile = false).help("User World")
val plugins by option("--plugins", "-p").path(true, canBeFile = false).help("Plugin Dir")
val profile by option().flag().help("Add Profiling Arguments")
val forceUpgrade by option().flag().help("Force Upgrade")
val jar by option().file(true, canBeDir = false).help("Jar File")
val jvm by option().file(true, canBeDir = false).help("Java Executable")
val jvmArgs by argument().multiple()
override val printHelpOnEmptyArgs = true
val workingDir = File("").absoluteFile
val log4jConfig = File(workingDir, "log4j2.xml")
override fun run() {
val args = mutableListOf<String>()
val serverDirectory = File(workingDir, server)
val serverDir =
if (serverDirectory.exists() && serverDirectory.isDirectory) serverDirectory else File(workingDir, server)
if (isVelocity(server)) {
runServer(args, jvmArgs, listOf(jar?.absolutePath ?: File("/jar/Velocity.jar").absolutePath), serverDir)
} else {
setLogConfig(args)
val version = findVersion(server) ?: throw CliktError("Unknown Server Version")
val worldFile = world?.absolute()?.toFile() ?: File(serverDir, "devtempworld")
val jarFile = jar?.absolutePath ?: additionalVersions[server]?.let { supportedVersionJars[it] } ?: supportedVersionJars[version]
?: throw CliktError("Unknown Server Version")
if (!worldFile.exists()) {
val templateFile = File(serverDir, "Bauwelt")
if (!templateFile.exists()) {
throw CliktError("World Template not found!")
}
templateFile.copyRecursively(worldFile)
}
val devFile = File("/configs/DevServer/${System.getProperty("user.name")}.$port.$version")
if (System.getProperty("user.name") != "minecraft") {
devFile.createNewFile()
}
runServer(
args, jvmArgs, listOf(
jarFile,
*(if (forceUpgrade) arrayOf("-forceUpgrade") else arrayOf()),
"--port", port.toString(),
"--level-name", worldFile.name,
"--world-dir", workingDir.absolutePath,
"--nogui",
*(if (plugins != null) arrayOf("--plugins", plugins!!.absolutePathString()) else arrayOf())
), serverDir
)
try {
devFile.delete()
} catch (_: Exception) { /* ignored */ }
}
}
val jvmDefaultParams = arrayOf(
"-Xmx1G",
"-Xgc:excessiveGCratio=80",
"-Xsyslog:none",
"-Xtrace:none",
"-Xnoclassgc",
"-Xdisableexplicitgc",
"-XX:+AlwaysPreTouch",
"-XX:+CompactStrings",
"-XX:-HeapDumpOnOutOfMemory",
"-XX:+ExitOnOutOfMemoryError"
)
val jvmArgOverrides = arrayOf("--add-opens", "java.base/jdk.internal.misc=ALL-UNNAMED")
val supportedVersionJars = mapOf(
8 to "/jars/paper-1.8.8.jar",
9 to "/jars/spigot-1.9.4.jar",
10 to "/jars/paper-1.10.2.jar",
12 to "/jars/spigot-1.12.2.jar",
14 to "/jars/spigot-1.14.4.jar",
15 to "/jars/spigot-1.15.2.jar",
18 to "/jars/paper-1.18.2.jar",
19 to "/jars/paper-1.19.3.jar",
20 to "/jars/paper-1.20.1.jar",
21 to "/jars/paper-1.21.6.jar"
)
val additionalVersions = mapOf(
"Tutorial" to 15,
"Lobby" to 20
)
fun findVersion(server: String): Int? = server.dropWhile { !it.isDigit() }.toIntOrNull()
fun isJava8(server: String): Boolean = findVersion(server)?.let { it <= 10 } ?: false
fun isVelocity(server: String): Boolean = server.endsWith("Velocity")
fun setLogConfig(args: MutableList<String>) {
args += "-DlogPath=${workingDir.absolutePath}/logs"
args += "-Dlog4j.configurationFile=${log4jConfig.absolutePath}"
if (!log4jConfig.exists()) {
log4jConfig.writeText(LOG4J_CONFIG)
}
}
fun runServer(args: List<String>, jvmArgs: List<String>, cmd: List<String>, serverDir: File) {
val process = ProcessBuilder(
jvm?.absolutePath ?: if (isJava8(server)) "/usr/lib/jvm/openj9-8/bin/java" else "java",
*jvmArgs.toTypedArray(),
*args.toTypedArray(),
*jvmDefaultParams,
*(if (isJava8(server)) arrayOf() else jvmArgOverrides),
*(if (profile) arrayOf("-javaagent:/jars/LixfelsProfiler.jar=start") else arrayOf()),
"-Xshareclasses:nonfatal,name=$server",
"-jar",
*cmd.toTypedArray()
).directory(serverDir).inheritIO().start()
Runtime.getRuntime().addShutdownHook(Thread { if (process.isAlive) process.destroyForcibly() })
process.waitFor()
}
}
@@ -0,0 +1,42 @@
package de.steamwar.commands.profiler
import com.github.ajalt.clikt.core.CliktCommand
import com.github.ajalt.clikt.core.Context
import com.github.ajalt.clikt.parameters.arguments.argument
import com.github.ajalt.clikt.parameters.arguments.help
import com.github.ajalt.clikt.parameters.arguments.optional
import com.github.ajalt.clikt.parameters.options.default
import com.github.ajalt.clikt.parameters.options.option
import com.github.ajalt.clikt.parameters.types.int
const val SPARK = "/jars/spark.jar"
class ProfilerCommand: CliktCommand("profiler") {
val pid by argument().help("Process id").int().optional()
val port by option("--port", "-p").int().default(8543)
override fun run() {
if (pid != null) {
ProcessBuilder()
.command("java", "-jar", SPARK, pid.toString(), "port=$port")
.start()
.waitFor()
Thread.sleep(1000)
ProcessBuilder()
.command("ssh", "-o", "StrictHostKeyChecking=no", "-o", "UserKnownHostsFile=/dev/null", "-p", port.toString(), "spark@localhost")
.inheritIO()
.start()
.waitFor()
} else {
ProcessBuilder()
.command("java", "-jar", SPARK)
.inheritIO()
.start()
.waitFor()
}
}
override fun help(context: Context): String = "Start a profiler"
}
+9
View File
@@ -0,0 +1,9 @@
package de.steamwar.commands.user
import com.github.ajalt.clikt.core.CliktCommand
import com.github.ajalt.clikt.core.Context
class UserCommand: CliktCommand("user") {
override fun run() = Unit
override fun help(context: Context): String = "User related commands"
}
+65
View File
@@ -0,0 +1,65 @@
package de.steamwar.commands.user
import com.github.ajalt.clikt.core.CliktCommand
import com.github.ajalt.clikt.core.CliktError
import com.github.ajalt.clikt.parameters.arguments.argument
import com.github.ajalt.clikt.parameters.arguments.help
import com.github.ajalt.mordant.table.table
import de.steamwar.db.findUser
import de.steamwar.db.useDb
import de.steamwar.sql.Punishment
import de.steamwar.sql.SessionTable
import de.steamwar.sql.SteamwarUser
import de.steamwar.sql.Team
import org.jetbrains.exposed.v1.core.eq
import org.jetbrains.exposed.v1.jdbc.selectAll
import java.time.Duration
class UserInfoCommand : CliktCommand("info") {
val userId by argument().help("Id, Name, UUID or DiscordId")
val user by lazy { findUser(userId) ?: throw CliktError("User not found") }
override val printHelpOnEmptyArgs = true
override fun run() = useDb {
val sessions =
SessionTable.selectAll().where { SessionTable.userId eq user.id.value }
.map { it[SessionTable.startTime] to it[SessionTable.endTime] }
val totalPlayed = sessions.sumOf { Duration.between(it.first, it.second).toMinutes() } / 60.0
val firstJoin = sessions.minByOrNull { it.first }?.first
val lastJoin = sessions.maxByOrNull { it.second }?.second
val punishments = Punishment.getAllPunishmentsOfPlayer(user.id.value)
echo(
table {
body {
row("Name", user.userName)
row("UUID", user.uuid)
row("Team", Team.byId(user.team).teamName)
row("Leader", user.leader)
row("Locale", user.locale)
row("Beigetreten am", firstJoin)
row("Zuletzt gesehen am", lastJoin)
row("Spielzeit", totalPlayed.toString() + "h")
row("Punishments", if (punishments.isEmpty()) "Keine" else table {
header { row("Typ", "Ersteller", "Von", "Bis", "Grund") }
body {
punishments.map {
row(
it.type,
SteamwarUser.byId(it.punisher)?.userName ?: it.punisher,
it.startTime.toString(),
if (it.perma) "Perma" else it.endTime.toString(),
it.reason
)
}
}
})
}
}
)
}
}
@@ -0,0 +1,42 @@
package de.steamwar.commands.user
import com.github.ajalt.clikt.core.CliktCommand
import com.github.ajalt.clikt.core.Context
import com.github.ajalt.clikt.parameters.arguments.argument
import com.github.ajalt.clikt.parameters.arguments.help
import com.github.ajalt.mordant.table.table
import de.steamwar.db.joinedOr
import de.steamwar.db.useDb
import de.steamwar.sql.SteamwarUser
import de.steamwar.sql.SteamwarUserTable
import de.steamwar.sql.Team
import org.jetbrains.exposed.v1.core.eq
import org.jetbrains.exposed.v1.core.like
class UserSearchCommand : CliktCommand("search") {
val query by argument().help("Name, Id, UUID or DiscordId")
override val printHelpOnEmptyArgs = true
override fun help(context: Context): String = "Search for users"
override fun run() = useDb {
val users = SteamwarUser.find {
joinedOr(
SteamwarUserTable.username like "%$query%",
SteamwarUserTable.uuid like "%$query%",
query.toLongOrNull()?.let { SteamwarUserTable.discordId eq it },
query.toIntOrNull()?.let { SteamwarUserTable.id eq it }
)
}
val teams = mutableMapOf<Int, Team>()
echo(table {
header { row("Id", "Username", "UUID", "Team", "DiscordId") }
body {
users.map { row(it.id.value, it.userName, it.uuid, teams.computeIfAbsent(it.team) { teamId -> Team.byId(teamId) }.teamName, it.discordId) }
}
})
}
}
+84
View File
@@ -0,0 +1,84 @@
package de.steamwar.db
import com.github.ajalt.clikt.core.BaseCliktCommand
import com.github.ajalt.clikt.core.CliktError
import de.steamwar.sql.SteamwarUser
import de.steamwar.sql.SteamwarUserTable
import org.jetbrains.exposed.v1.core.Expression
import org.jetbrains.exposed.v1.core.Op
import org.jetbrains.exposed.v1.core.eq
import org.jetbrains.exposed.v1.core.or
import org.jetbrains.exposed.v1.jdbc.Database
import org.jetbrains.exposed.v1.jdbc.JdbcTransaction
import org.jetbrains.exposed.v1.jdbc.transactions.transaction
import java.io.File
import java.sql.ResultSet
import java.util.Properties
object Database {
lateinit var host: String
lateinit var port: String
lateinit var database: String
lateinit var db: Database
fun ensureConnected() {
if (::db.isInitialized) {
return
}
val config = File(System.getProperty("user.home"), "mysql.properties")
if (!config.exists()) {
throw CliktError("Config file not found!")
}
val props = Properties();
props.load(config.inputStream())
host = props.getProperty("host")
port = props.getProperty("port")
database = props.getProperty("database")
val username = props.getProperty("user")
val password = props.getProperty("password")
val url = "jdbc:mariadb://$host:$port/$database"
db = Database.connect(url, driver = "org.mariadb.jdbc.Driver", user = username, password = password)
return
}
}
fun <T: BaseCliktCommand<T>> BaseCliktCommand<T>.findUser(query: String): SteamwarUser? = transaction {
SteamwarUser.find { joinedOr(query.toIntOrNull()?.let { SteamwarUserTable.id eq it }, (SteamwarUserTable.username eq query), SteamwarUserTable.uuid eq query, query.toLongOrNull()?.let { SteamwarUserTable.discordId eq it }) }
.firstOrNull()
?.let { return@transaction it }
}
fun joinedOr(vararg expressions: Expression<Boolean>?): Op<Boolean> =
expressions.filterNotNull().reduce { acc, expression -> acc or expression } as Op<Boolean>
fun <T> JdbcTransaction.execute(sql: String, transform: (ResultSet) -> T): List<T> {
val result = mutableListOf<T>()
exec(sql) { rs ->
while (rs.next()) {
result += transform(rs)
}
}
return result
}
fun <T> JdbcTransaction.executeSingle(sql: String, transform: (ResultSet) -> T): T? {
return execute(sql) { rs ->
if (!rs.next()) {
return@execute null
}
transform(rs)
}.single()
}
fun useDb(statement: JdbcTransaction.() -> Unit) {
de.steamwar.db.Database.ensureConnected()
transaction(de.steamwar.db.Database.db, statement)
}
+11
View File
@@ -0,0 +1,11 @@
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<root level="WARN">
<appender-ref ref="STDOUT" />
</root>
</configuration>
@@ -1,7 +1,7 @@
/* /*
* This file is a part of the SteamWar software. * This file is a part of the SteamWar software.
* *
* Copyright (C) 2025 SteamWar.de-Serverteam * Copyright (C) 2026 SteamWar.de-Serverteam
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by * it under the terms of the GNU Affero General Public License as published by
@@ -1,7 +1,7 @@
/* /*
* This file is a part of the SteamWar software. * This file is a part of the SteamWar software.
* *
* Copyright (C) 2025 SteamWar.de-Serverteam * Copyright (C) 2026 SteamWar.de-Serverteam
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by * it under the terms of the GNU Affero General Public License as published by
@@ -28,11 +28,11 @@ import org.jetbrains.exposed.v1.javatime.timestamp
import java.time.Instant import java.time.Instant
object AuditLogTable: IntIdTable("AuditLog", "AuditLogId") { object AuditLogTable: IntIdTable("AuditLog", "AuditLogId") {
val time = timestamp("Time") val time = timestamp("Time").index()
val server = varchar("ServerName", 255) val server = varchar("ServerName", 255).index()
val serverOwner = reference("ServerOwner", SteamwarUserTable).nullable() val serverOwner = reference("ServerOwner", SteamwarUserTable).nullable().index()
val actor = reference("Actor", SteamwarUserTable) val actor = reference("Actor", SteamwarUserTable).index()
val action = enumerationByName("ActionType", 255, AuditLog.Type::class) val action = enumerationByName("ActionType", 255, AuditLog.Type::class).index()
val actionText = text("ActionText") val actionText = text("ActionText")
} }
@@ -1,7 +1,7 @@
/* /*
* This file is a part of the SteamWar software. * This file is a part of the SteamWar software.
* *
* Copyright (C) 2025 SteamWar.de-Serverteam * Copyright (C) 2026 SteamWar.de-Serverteam
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by * it under the terms of the GNU Affero General Public License as published by
@@ -33,8 +33,8 @@ import java.sql.Timestamp
import java.time.Instant import java.time.Instant
object BannedUserIPsTable: CompositeIdTable("BannedUserIPs") { object BannedUserIPsTable: CompositeIdTable("BannedUserIPs") {
val userId = reference("UserID", SteamwarUserTable) val userId = reference("UserID", SteamwarUserTable).index()
val timestamp = timestamp("Timestamp") val timestamp = timestamp("Timestamp").index()
val ip = varchar("IP", 45).entityId() val ip = varchar("IP", 45).entityId()
init { init {
@@ -1,7 +1,7 @@
/* /*
* This file is a part of the SteamWar software. * This file is a part of the SteamWar software.
* *
* Copyright (C) 2025 SteamWar.de-Serverteam * Copyright (C) 2026 SteamWar.de-Serverteam
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by * it under the terms of the GNU Affero General Public License as published by
@@ -32,8 +32,8 @@ import org.jetbrains.exposed.v1.jdbc.insertIgnore
import java.util.* import java.util.*
object BauweltMemberTable: CompositeIdTable("BauweltMember") { object BauweltMemberTable: CompositeIdTable("BauweltMember") {
val bauweltId = reference("BauweltID", SteamwarUserTable) val bauweltId = reference("BauweltID", SteamwarUserTable).index()
val memberId = reference("MemberID", SteamwarUserTable) val memberId = reference("MemberID", SteamwarUserTable).index()
val build = bool("Build") val build = bool("Build")
val worldEdit = bool("WorldEdit") val worldEdit = bool("WorldEdit")
val world = bool("World") val world = bool("World")
@@ -20,6 +20,7 @@
package de.steamwar.sql package de.steamwar.sql
import de.steamwar.sql.internal.useDb import de.steamwar.sql.internal.useDb
import org.jetbrains.exposed.v1.core.ReferenceOption
import org.jetbrains.exposed.v1.core.SortOrder import org.jetbrains.exposed.v1.core.SortOrder
import org.jetbrains.exposed.v1.core.and import org.jetbrains.exposed.v1.core.and
import org.jetbrains.exposed.v1.core.dao.id.CompositeID import org.jetbrains.exposed.v1.core.dao.id.CompositeID
@@ -34,19 +35,23 @@ import org.jetbrains.exposed.v1.jdbc.insertIgnore
import java.sql.Timestamp import java.sql.Timestamp
object CheckedSchematicTable: CompositeIdTable("CheckedSchematic") { object CheckedSchematicTable: CompositeIdTable("CheckedSchematic") {
val nodeId = optReference("NodeId", SchematicNodeTable) val nodeId = optReference("NodeId", SchematicNodeTable, onDelete = ReferenceOption.SET_NULL, onUpdate = ReferenceOption.SET_NULL).index()
val nodeOwner = reference("NodeOwner", SteamwarUserTable) val nodeOwner = reference("NodeOwner", SteamwarUserTable).index()
val nodeName = varchar("NodeName", 64).entityId() val nodeName = varchar("NodeName", 64).entityId().index()
val validator = reference("Validator", SteamwarUserTable) val validator = reference("Validator", SteamwarUserTable).index()
val startTime = timestamp("StartTime").entityId() val startTime = timestamp("StartTime").entityId().index()
val endTime = timestamp("EndTime") val endTime = timestamp("EndTime")
val declineReason = text("DeclineReason") val declineReason = text("DeclineReason")
val seen = bool("Seen") val seen = bool("Seen").index()
val nodeType = varchar("NodeType", 16) val nodeType = varchar("NodeType", 16)
init { init {
addIdColumn(nodeOwner) addIdColumn(nodeOwner)
addIdColumn(nodeName) addIdColumn(nodeName)
index(false, nodeOwner, endTime)
index(false, startTime, endTime, nodeName)
index(false, seen, nodeOwner, startTime)
} }
} }
+2 -2
View File
@@ -36,8 +36,8 @@ import java.time.Instant
object EventTable : IntIdTable("Event", "EventId") { object EventTable : IntIdTable("Event", "EventId") {
val name = varchar("EventName", 100).uniqueIndex() val name = varchar("EventName", 100).uniqueIndex()
val deadline = timestamp("Deadline") val deadline = timestamp("Deadline")
val start = timestamp("Start") val start = timestamp("Start").index()
val end = timestamp("End") val end = timestamp("End").index()
val maxPlayers = integer("MaximumTeamMembers") val maxPlayers = integer("MaximumTeamMembers")
val schemType = varchar("SchemType", 16).nullable() val schemType = varchar("SchemType", 16).nullable()
val publicsOnly = bool("PublicSchemsOnly") val publicsOnly = bool("PublicSchemsOnly")
@@ -33,17 +33,17 @@ import java.time.Instant
import java.util.* import java.util.*
object EventFightTable : IntIdTable("EventFight", "FightID") { object EventFightTable : IntIdTable("EventFight", "FightID") {
val eventId = reference("EventID", EventTable) val eventId = reference("EventID", EventTable).index()
val startTime = timestamp("StartTime") val startTime = timestamp("StartTime").index()
val gamemode = text("Spielmodus") val gamemode = text("Spielmodus")
val map = text("Map") val map = text("Map")
val groupId = optReference("GroupId", EventGroupTable) val groupId = optReference("GroupId", EventGroupTable).index()
val teamBlue = reference("TeamBlue", TeamTable) val teamBlue = reference("TeamBlue", TeamTable).index()
val teamRed = reference("TeamRed", TeamTable) val teamRed = reference("TeamRed", TeamTable).index()
val spectatePort = integer("SpectatePort").nullable() val spectatePort = integer("SpectatePort").nullable()
val bestOf = integer("BestOf") val bestOf = integer("BestOf")
val ergebnis = integer("Ergebnis") val ergebnis = integer("Ergebnis")
val fight = optReference("Fight", FightTable) val fight = optReference("Fight", FightTable).index()
} }
class EventFight(id: EntityID<Int>) : IntEntity(id), Comparable<EventFight> { class EventFight(id: EntityID<Int>) : IntEntity(id), Comparable<EventFight> {
@@ -34,6 +34,10 @@ object EventGroupTable : IntIdTable("EventGroup", "Id") {
val pointsPerWin = integer("PointsPerWin").default(3) val pointsPerWin = integer("PointsPerWin").default(3)
val pointsPerLoss = integer("PointsPerLoss").default(0) val pointsPerLoss = integer("PointsPerLoss").default(0)
val pointsPerDraw = integer("PointsPerDraw").default(1) val pointsPerDraw = integer("PointsPerDraw").default(1)
init {
uniqueIndex(event, name)
}
} }
class EventGroup(id: EntityID<Int>) : IntEntity(id) { class EventGroup(id: EntityID<Int>) : IntEntity(id) {
@@ -29,7 +29,7 @@ import org.jetbrains.exposed.v1.dao.IntEntityClass
import org.jetbrains.exposed.v1.jdbc.select import org.jetbrains.exposed.v1.jdbc.select
object EventRelationTable : IntIdTable("EventRelation") { object EventRelationTable : IntIdTable("EventRelation") {
val fightId = reference("FightId", EventFightTable) val fightId = reference("FightId", EventFightTable).index()
val fightTeam = enumeration("FightTeam", EventRelation.FightTeam::class) val fightTeam = enumeration("FightTeam", EventRelation.FightTeam::class)
val fromType = enumeration("FromType", EventRelation.FromType::class) val fromType = enumeration("FromType", EventRelation.FromType::class)
val fromId = integer("FromId") val fromId = integer("FromId")
+5 -5
View File
@@ -34,14 +34,14 @@ import org.jetbrains.exposed.v1.jdbc.update
import java.sql.Timestamp import java.sql.Timestamp
object FightTable : IntIdTable("Fight", "FightId") { object FightTable : IntIdTable("Fight", "FightId") {
val gamemode = varchar("Gamemode", 30) val gamemode = varchar("Gamemode", 30).index()
val server = text("Server") val server = text("Server")
val startTime = timestamp("StartTime") val startTime = timestamp("StartTime")
val duration = integer("Duration") val duration = integer("Duration")
val blueLeader = reference("BlueLeader", SteamwarUserTable) val blueLeader = reference("BlueLeader", SteamwarUserTable).index()
val redLeader = reference("RedLeader", SteamwarUserTable) val redLeader = reference("RedLeader", SteamwarUserTable).index()
val blueSchem = optReference("BlueSchem", SchematicNodeTable, onDelete = ReferenceOption.SET_NULL) val blueSchem = optReference("BlueSchem", SchematicNodeTable, onDelete = ReferenceOption.SET_NULL).index()
val redSchem = optReference("RedSchem", SchematicNodeTable, onDelete = ReferenceOption.SET_NULL) val redSchem = optReference("RedSchem", SchematicNodeTable, onDelete = ReferenceOption.SET_NULL).index()
val win = enumeration("Win", Fight.WinningTeam::class) val win = enumeration("Win", Fight.WinningTeam::class)
val winCondition = varchar("WinCondition", 100) val winCondition = varchar("WinCondition", 100)
val replayAvailable = bool("ReplayAvailable") val replayAvailable = bool("ReplayAvailable")
@@ -30,7 +30,7 @@ import org.jetbrains.exposed.v1.jdbc.insertIgnore
object FightPlayerTable : CompositeIdTable("FightPlayer") { object FightPlayerTable : CompositeIdTable("FightPlayer") {
val fightId = reference("FightId", FightTable) val fightId = reference("FightId", FightTable)
val userId = reference("UserId", SteamwarUserTable) val userId = reference("UserId", SteamwarUserTable).index()
val team = integer("Team") val team = integer("Team")
val kit = varchar("Kit", 64) val kit = varchar("Kit", 64)
val kills = integer("Kills") val kills = integer("Kills")
@@ -1,7 +1,7 @@
/* /*
* This file is a part of the SteamWar software. * This file is a part of the SteamWar software.
* *
* Copyright (C) 2025 SteamWar.de-Serverteam * Copyright (C) 2026 SteamWar.de-Serverteam
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by * it under the terms of the GNU Affero General Public License as published by
@@ -30,8 +30,8 @@ import org.jetbrains.exposed.v1.dao.CompositeEntityClass
import java.util.* import java.util.*
object IgnoreSystemTable: CompositeIdTable("IgnoredPlayers") { object IgnoreSystemTable: CompositeIdTable("IgnoredPlayers") {
val ignorer = reference("Ignorer", SteamwarUserTable) val ignorer = reference("Ignorer", SteamwarUserTable).index()
val ignored = reference("Ignored", SteamwarUserTable) val ignored = reference("Ignored", SteamwarUserTable).index()
override val primaryKey = PrimaryKey(ignorer, ignored) override val primaryKey = PrimaryKey(ignorer, ignored)
@@ -35,7 +35,7 @@ import java.io.InputStream
import java.util.zip.GZIPInputStream import java.util.zip.GZIPInputStream
object NodeDataTable: CompositeIdTable("NodeData") { object NodeDataTable: CompositeIdTable("NodeData") {
val nodeId = reference("NodeId", SchematicNodeTable) val nodeId = reference("NodeId", SchematicNodeTable).index()
val createdAt = timestamp("CreatedAt").defaultExpression(CurrentTimestamp).entityId() val createdAt = timestamp("CreatedAt").defaultExpression(CurrentTimestamp).entityId()
val nodeFormat = enumeration("NodeFormat", NodeData.SchematicFormat::class) val nodeFormat = enumeration("NodeFormat", NodeData.SchematicFormat::class)
val schemData = blob("SchemData") val schemData = blob("SchemData")
@@ -20,6 +20,7 @@
package de.steamwar.sql package de.steamwar.sql
import de.steamwar.sql.internal.useDb import de.steamwar.sql.internal.useDb
import org.jetbrains.exposed.v1.core.ReferenceOption
import org.jetbrains.exposed.v1.core.dao.id.EntityID import org.jetbrains.exposed.v1.core.dao.id.EntityID
import org.jetbrains.exposed.v1.core.dao.id.IdTable import org.jetbrains.exposed.v1.core.dao.id.IdTable
import org.jetbrains.exposed.v1.core.eq import org.jetbrains.exposed.v1.core.eq
@@ -32,8 +33,8 @@ import java.sql.Timestamp
import java.time.Instant import java.time.Instant
object NodeDownloadTable: IdTable<Int>("NodeDownload") { object NodeDownloadTable: IdTable<Int>("NodeDownload") {
override val id = reference("NodeId", SchematicNodeTable).uniqueIndex() override val id = reference("NodeId", SchematicNodeTable, onDelete = ReferenceOption.CASCADE).uniqueIndex()
val link = varchar("Link", 255) val link = varchar("Link", 255).uniqueIndex()
val timestamp = timestamp("Timestamp").defaultExpression(CurrentTimestamp) val timestamp = timestamp("Timestamp").defaultExpression(CurrentTimestamp)
} }
@@ -20,6 +20,7 @@
package de.steamwar.sql package de.steamwar.sql
import de.steamwar.sql.internal.useDb import de.steamwar.sql.internal.useDb
import org.jetbrains.exposed.v1.core.ReferenceOption
import org.jetbrains.exposed.v1.core.and import org.jetbrains.exposed.v1.core.and
import org.jetbrains.exposed.v1.core.dao.id.CompositeID import org.jetbrains.exposed.v1.core.dao.id.CompositeID
import org.jetbrains.exposed.v1.core.dao.id.CompositeIdTable import org.jetbrains.exposed.v1.core.dao.id.CompositeIdTable
@@ -32,9 +33,9 @@ import java.util.*
import kotlin.jvm.optionals.getOrNull import kotlin.jvm.optionals.getOrNull
object NodeMemberTable : CompositeIdTable("NodeMember") { object NodeMemberTable : CompositeIdTable("NodeMember") {
val node = reference("NodeId", SchematicNodeTable) val node = reference("NodeId", SchematicNodeTable, onDelete = ReferenceOption.CASCADE, onUpdate = ReferenceOption.CASCADE).index()
val userId = reference("UserId", SteamwarUserTable) val userId = reference("UserId", SteamwarUserTable).index()
val parentNode = optReference("ParentId", SchematicNodeTable) val parentNode = optReference("ParentId", SchematicNodeTable).index()
override val primaryKey = PrimaryKey(node, userId) override val primaryKey = PrimaryKey(node, userId)
@@ -41,6 +41,7 @@ object PersonalKitTable: CompositeIdTable("PersonalKit") {
init { init {
addIdColumn(userId) addIdColumn(userId)
index(false, userId, gamemode)
} }
} }
@@ -34,12 +34,16 @@ import java.util.function.Consumer
object PunishmentTable : IntIdTable("Punishments", "PunishmentId") { object PunishmentTable : IntIdTable("Punishments", "PunishmentId") {
val userId = reference("UserId", SteamwarUserTable) val userId = reference("UserId", SteamwarUserTable)
val punisher = reference("Punisher", SteamwarUserTable) val punisher = reference("Punisher", SteamwarUserTable).index()
val type = enumerationByName("Type", 32, Punishment.PunishmentType::class) val type = enumerationByName("Type", 32, Punishment.PunishmentType::class)
val startTime = timestamp("StartTime") val startTime = timestamp("StartTime")
val endTime = timestamp("EndTime") val endTime = timestamp("EndTime")
val perma = bool("Perma") val perma = bool("Perma")
val reason = text("Reason") val reason = text("Reason")
init {
index(false, userId, type)
}
} }
class Punishment(id: EntityID<Int>) : IntEntity(id) { class Punishment(id: EntityID<Int>) : IntEntity(id) {
@@ -30,7 +30,7 @@ import org.jetbrains.exposed.v1.dao.CompositeEntityClass
object RefereeTable: CompositeIdTable("Referee") { object RefereeTable: CompositeIdTable("Referee") {
val eventId = reference("EventId", EventTable) val eventId = reference("EventId", EventTable)
val userId = reference("UserId", SteamwarUserTable) val userId = reference("UserId", SteamwarUserTable).index()
override val primaryKey = PrimaryKey(eventId, userId) override val primaryKey = PrimaryKey(eventId, userId)
@@ -34,13 +34,17 @@ import java.util.*
import java.util.function.Consumer import java.util.function.Consumer
object SchematicNodeTable : IntIdTable("SchematicNode", "NodeId") { object SchematicNodeTable : IntIdTable("SchematicNode", "NodeId") {
val owner = reference("NodeOwner", SteamwarUserTable) val owner = reference("NodeOwner", SteamwarUserTable).index()
val name = varchar("NodeName", 64) val name = varchar("NodeName", 64)
val parent = optReference("ParentNode", SchematicNodeTable) val parent = optReference("ParentNode", SchematicNodeTable).index()
val lastUpdate = timestamp("LastUpdate").defaultExpression(CurrentTimestamp) val lastUpdate = timestamp("LastUpdate").defaultExpression(CurrentTimestamp)
val item = text("NodeItem") val item = text("NodeItem")
val type = varchar("NodeType", 16).nullable() val type = varchar("NodeType", 16).nullable().index()
val config = integer("Config") val config = integer("Config")
init {
uniqueIndex(parent, owner, name)
}
} }
class SchematicNode(id: EntityID<Int>) : IntEntity(id) { class SchematicNode(id: EntityID<Int>) : IntEntity(id) {
+5 -1
View File
@@ -28,9 +28,13 @@ import org.jetbrains.exposed.v1.dao.IntEntity
import org.jetbrains.exposed.v1.dao.IntEntityClass import org.jetbrains.exposed.v1.dao.IntEntityClass
object ScriptTable: IntIdTable("Script") { object ScriptTable: IntIdTable("Script") {
val userId = reference("UserId", SteamwarUserTable) val userId = reference("UserId", SteamwarUserTable).index()
val name = varchar("Name", 64) val name = varchar("Name", 64)
val code = text("Code") val code = text("Code")
init {
uniqueIndex(userId, name)
}
} }
class Script(id: EntityID<Int>) : IntEntity(id) { class Script(id: EntityID<Int>) : IntEntity(id) {
@@ -28,7 +28,7 @@ import org.jetbrains.exposed.v1.jdbc.insert
import java.sql.Timestamp import java.sql.Timestamp
object SessionTable: Table("Session") { object SessionTable: Table("Session") {
val userId = reference("UserId", SteamwarUserTable) val userId = reference("UserId", SteamwarUserTable).index()
val startTime = timestamp("StartTime") val startTime = timestamp("StartTime")
val endTime = timestamp("EndTime").defaultExpression(CurrentTimestamp) val endTime = timestamp("EndTime").defaultExpression(CurrentTimestamp)
} }
@@ -37,15 +37,15 @@ import javax.crypto.SecretKeyFactory
import javax.crypto.spec.PBEKeySpec import javax.crypto.spec.PBEKeySpec
object SteamwarUserTable : IntIdTable("UserData", "id") { object SteamwarUserTable : IntIdTable("UserData", "id") {
val uuid = varchar("UUID", 36) val uuid = varchar("UUID", 36).uniqueIndex()
val username = varchar("UserName", 32) val username = varchar("UserName", 32).index()
val team = reference("Team", TeamTable) val team = reference("Team", TeamTable).index()
val leader = bool("Leader") val leader = bool("Leader")
val locale = varchar("Locale", 16).nullable() val locale = varchar("Locale", 16).nullable()
val manualLocale = bool("ManualLocale") val manualLocale = bool("ManualLocale")
val bedrock = bool("Bedrock") val bedrock = bool("Bedrock")
val password = text("Password").nullable() val password = text("Password").nullable()
val discordId = long("DiscordId").nullable() val discordId = long("DiscordId").nullable().uniqueIndex()
} }
class SteamwarUser(id: EntityID<Int>): IntEntity(id) { class SteamwarUser(id: EntityID<Int>): IntEntity(id) {
+2 -2
View File
@@ -28,9 +28,9 @@ import org.jetbrains.exposed.v1.dao.IntEntityClass
import org.jetbrains.exposed.v1.jdbc.select import org.jetbrains.exposed.v1.jdbc.select
object TeamTable : IntIdTable("Team", "TeamID") { object TeamTable : IntIdTable("Team", "TeamID") {
val kuerzel = varchar("TeamKuerzel", 10) val kuerzel = varchar("TeamKuerzel", 10).index()
val color = char("TeamColor", 1).default("8") val color = char("TeamColor", 1).default("8")
val name = varchar("TeamName", 16) val name = varchar("TeamName", 16).index()
val deleted = bool("TeamDeleted").default(false) val deleted = bool("TeamDeleted").default(false)
} }
@@ -32,8 +32,8 @@ import org.jetbrains.exposed.v1.jdbc.deleteWhere
import org.jetbrains.exposed.v1.jdbc.insertIgnore import org.jetbrains.exposed.v1.jdbc.insertIgnore
object TeamTeilnahmeTable : CompositeIdTable("TeamTeilnahme") { object TeamTeilnahmeTable : CompositeIdTable("TeamTeilnahme") {
val teamId = reference("teamId", TeamTable) val teamId = reference("teamId", TeamTable).index()
val eventId = reference("eventId", EventTable) val eventId = reference("eventId", EventTable).index()
val placement = integer("Placement").nullable() val placement = integer("Placement").nullable()
override val primaryKey = PrimaryKey(teamId, eventId) override val primaryKey = PrimaryKey(teamId, eventId)
+3 -3
View File
@@ -33,10 +33,10 @@ import java.sql.Timestamp
import java.util.* import java.util.*
object TokenTable: IntIdTable("Token") { object TokenTable: IntIdTable("Token") {
val name = varchar("Name", 64) val name = varchar("Name", 64).uniqueIndex()
val owner = reference("Owner", SteamwarUserTable) val owner = reference("Owner", SteamwarUserTable).index()
val created = timestamp("Created").defaultExpression(CurrentTimestamp) val created = timestamp("Created").defaultExpression(CurrentTimestamp)
val hash = varchar("Hash", 88) val hash = varchar("Hash", 88).uniqueIndex()
} }
class Token(id: EntityID<Int>): IntEntity(id) { class Token(id: EntityID<Int>): IntEntity(id) {
@@ -28,7 +28,7 @@ import org.jetbrains.exposed.v1.jdbc.insert
import org.jetbrains.exposed.v1.jdbc.selectAll import org.jetbrains.exposed.v1.jdbc.selectAll
object UserPermTable: Table("UserPerm") { object UserPermTable: Table("UserPerm") {
val user = reference("User", SteamwarUserTable.id) val user = reference("User", SteamwarUserTable.id).index()
val perm = enumerationByName("Perm", 32, UserPerm::class) val perm = enumerationByName("Perm", 32, UserPerm::class)
override val primaryKey = PrimaryKey(user, perm) override val primaryKey = PrimaryKey(user, perm)
@@ -67,7 +67,7 @@ object KotlinDatabase {
} }
} }
fun <T: Any?> useDb(statement: JdbcTransaction.() -> T): T { fun <T> useDb(statement: JdbcTransaction.() -> T): T {
KotlinDatabase.ensureConnected() KotlinDatabase.ensureConnected()
return TransactionManager.currentOrNull()?.statement() ?: transaction(KotlinDatabase.db) { return TransactionManager.currentOrNull()?.statement() ?: transaction(KotlinDatabase.db) {
statement() statement()
@@ -98,10 +98,12 @@ public class FightSystem extends JavaPlugin {
new StateDependentListener(ArenaMode.All, FightState.All, BountifulWrapper.impl.newDenyArrowPickupListener()); new StateDependentListener(ArenaMode.All, FightState.All, BountifulWrapper.impl.newDenyArrowPickupListener());
new OneShotStateDependent(ArenaMode.All, FightState.PreSchemSetup, () -> Fight.playSound(SWSound.BLOCK_NOTE_PLING.getSound(), 100.0f, 2.0f)); new OneShotStateDependent(ArenaMode.All, FightState.PreSchemSetup, () -> Fight.playSound(SWSound.BLOCK_NOTE_PLING.getSound(), 100.0f, 2.0f));
new OneShotStateDependent(ArenaMode.Test, FightState.All, WorldEditRendererCUIEditor::new); new OneShotStateDependent(ArenaMode.Test, FightState.All, WorldEditRendererCUIEditor::new);
try { if (Core.getVersion() >= 19) {
Bukkit.getWorlds().get(0).setGameRule(GameRule.REDUCED_DEBUG_INFO, ArenaMode.AntiTest.contains(Config.mode)); try {
} catch (Exception e) { Bukkit.getWorlds().get(0).setGameRule(GameRule.REDUCED_DEBUG_INFO, ArenaMode.AntiTest.contains(Config.mode));
// Ignore if failed! } catch (Exception e) {
// Ignore if failed!
}
} }
techHider = new TechHiderWrapper(); techHider = new TechHiderWrapper();
@@ -181,7 +181,12 @@ public class Permanent implements Listener {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onExplosion(EntityExplodeEvent e) { public void onExplosion(EntityExplodeEvent e) {
if (!(e.getEntity() instanceof TNTPrimed)) return; if (!(e.getEntity() instanceof TNTPrimed)) {
if (Config.GameModeConfig.Schematic.Type.toDB().equals("wargearseason26")) {
e.blockList().clear();
}
return;
}
if (!Config.GameModeConfig.Arena.WaterDamage) return; if (!Config.GameModeConfig.Arena.WaterDamage) return;
e.blockList().removeIf(block -> { e.blockList().removeIf(block -> {
if(block.getType() == Material.TNT) { if(block.getType() == Material.TNT) {
@@ -210,6 +210,7 @@ GUI_INFO_TYPE=§e{0}
GUI_INFO_DOWNLOAD=§eDownload GUI_INFO_DOWNLOAD=§eDownload
GUI_INFO_COLOR=Color translation GUI_INFO_COLOR=Color translation
GUI_INFO_REPLAY=Replay playback GUI_INFO_REPLAY=Replay playback
GUI_INFO_REPLAY_OFF=§7§lTurn off
GUI_INFO_REPLAY_TITLE=Lock playback permanently GUI_INFO_REPLAY_TITLE=Lock playback permanently
GUI_INFO_MEMBER=§eMembers GUI_INFO_MEMBER=§eMembers
GUI_INFO_MOVE=§eMove GUI_INFO_MOVE=§eMove
@@ -191,6 +191,7 @@ GUI_INFO_BACK=§eZurück
GUI_INFO_STATUS=§eStatus {0} GUI_INFO_STATUS=§eStatus {0}
GUI_INFO_COLOR=Farbersetzung GUI_INFO_COLOR=Farbersetzung
GUI_INFO_REPLAY=Replay Wiedergabe GUI_INFO_REPLAY=Replay Wiedergabe
GUI_INFO_REPLAY_OFF=§7Zum §lAusschalten
GUI_INFO_REPLAY_TITLE=Wiedergabe dauerhaft sperren GUI_INFO_REPLAY_TITLE=Wiedergabe dauerhaft sperren
GUI_INFO_MEMBER=§eMitglieder GUI_INFO_MEMBER=§eMitglieder
GUI_INFO_MOVE=§eVerschieben GUI_INFO_MOVE=§eVerschieben
@@ -151,7 +151,7 @@ public class GUI {
node.setReplaceColor(!node.replaceColor()); node.setReplaceColor(!node.replaceColor());
info(player, node, back); info(player, node, back);
}); });
inv.setItem(13, SWItem.getMaterial(node.allowReplay() ? "EYE_OF_ENDER" : "ENDER_PEARL"), SchematicSystem.MESSAGE.parse("GUI_INFO_REPLAY", player), Arrays.asList(SchematicSystem.MESSAGE.parse("CURRENT", player, SchematicSystem.MESSAGE.parse(node.allowReplay()?"ON":"OFF", player)), SchematicSystem.MESSAGE.parse("CHANGE", player), SchematicSystem.MESSAGE.parse("CLICK", player)), false, clickType -> { inv.setItem(13, SWItem.getMaterial(node.allowReplay() ? "EYE_OF_ENDER" : "ENDER_PEARL"), SchematicSystem.MESSAGE.parse("GUI_INFO_REPLAY", player), Arrays.asList(SchematicSystem.MESSAGE.parse("CURRENT", player, SchematicSystem.MESSAGE.parse(node.allowReplay()?"ON":"OFF", player)), SchematicSystem.MESSAGE.parse("GUI_INFO_REPLAY_OFF", player), SchematicSystem.MESSAGE.parse("CLICK", player)), false, clickType -> {
if(node.allowReplay()) { if(node.allowReplay()) {
SWInventory confInv = new SWInventory(player, 9, SchematicSystem.MESSAGE.parse("GUI_INFO_REPLAY_TITLE", player)); SWInventory confInv = new SWInventory(player, 9, SchematicSystem.MESSAGE.parse("GUI_INFO_REPLAY_TITLE", player));
confInv.setItem(0, SWItem.getDye(10), (byte) 10, SchematicSystem.MESSAGE.parse("CONFIRM", player), type -> { confInv.setItem(0, SWItem.getDye(10), (byte) 10, SchematicSystem.MESSAGE.parse("CONFIRM", player), type -> {
@@ -162,9 +162,6 @@ public class GUI {
info(player, node, back); info(player, node, back);
}); });
confInv.open(); confInv.open();
} else {
node.setAllowReplay(true);
info(player, node, back);
} }
}); });
} }
@@ -316,8 +316,18 @@ public class CheckCommand extends SWCommand {
SchematicNode node = SchematicNode.createSchematic(-1, name, teamFolder.getNodeId()); SchematicNode node = SchematicNode.createSchematic(-1, name, teamFolder.getNodeId());
NodeData.saveFromStream(node, data.schemData(false), data.getNodeFormat()); NodeData.saveFromStream(node, data.schemData(false), data.getNodeFormat());
// Accept the team folder schematic and set other to Normal // Accept the team folder schematic and set other to Normal as well as adding the original owner on the schematic
node.setSchemtype(GameModeConfig.getBySchematicType(schematic.getSchemtype()).Schematic.Type); node.setSchemtype(GameModeConfig.getBySchematicType(schematic.getSchemtype()).Schematic.Type);
NodeMember.createNodeMember(node.getNodeId(), schematic.getOwner());
// Remove any added players from the schematic in the folder
for (SchematicNode schematicNode : SchematicNode.getSchematicNodeInNode(teamFolder.getNodeId())) {
if (schematicNode.getNodeId() == node.getNodeId()) continue;
for (NodeMember nodeMember : NodeMember.getNodeMembers(schematicNode.getNodeId())) {
NodeMember.createNodeMember(node.getNodeId(), nodeMember.getMember());
nodeMember.delete();
}
}
// Conclude by setting send in schematic to normal and broadcast // Conclude by setting send in schematic to normal and broadcast
concludeCheckSession("freigegeben", SchematicType.Normal, () -> { concludeCheckSession("freigegeben", SchematicType.Normal, () -> {
@@ -50,7 +50,7 @@ public class WhoisCommand extends SWCommand {
@Register(description = "WHOIS_USAGE") @Register(description = "WHOIS_USAGE")
public void whois(Chatter sender, long id, WhoisParameterTypes... parameters) { public void whois(Chatter sender, long id, WhoisParameterTypes... parameters) {
if(!sender.user().hasPerm(UserPerm.ADMINISTRATION)) { if(!sender.user().hasPerm(UserPerm.ADMINISTRATION) && !sender.user().hasPerm(UserPerm.PREFIX_DEVELOPER)) {
sender.system("UNKNOWN_PLAYER"); sender.system("UNKNOWN_PLAYER");
return; return;
} }
+2
View File
@@ -183,6 +183,8 @@ include(
include("CommandFramework") include("CommandFramework")
include("CLI")
include( include(
"CommonCore", "CommonCore",
"CommonCore:Data", "CommonCore:Data",
+2
View File
@@ -33,4 +33,6 @@ artifacts:
"/jars/website-api.jar": "WebsiteBackend/build/libs/WebsiteBackend-all.jar" "/jars/website-api.jar": "WebsiteBackend/build/libs/WebsiteBackend-all.jar"
release: release:
- "rm -rf /jars/sw"
- "unzip -o CLI/build/distributions/sw.zip -d /jars"
- "sudo systemctl restart api.service" - "sudo systemctl restart api.service"