Compare commits
232 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6e919d9148 | |||
| a20ec8c93d | |||
| 18b65a2984 | |||
| 7adb1e8b4a | |||
| b88e592e79 | |||
| 914134600e | |||
| 9e43d5cd1b | |||
| 2ad9ae3c7f | |||
| 847eb3fe5d | |||
| 8fa9f7b0d3 | |||
| 559cae2b6d | |||
| 5dbf3638d0 | |||
| a9fb982143 | |||
| 5b8d881e01 | |||
| eb55f4b395 | |||
| 273db91d06 | |||
| 983ad544c1 | |||
| a6a34b2221 | |||
| 6c6bd19038 | |||
| 89e05cd109 | |||
| ea9d7ac584 | |||
| 17e1cf53b0 | |||
| f64f337f17 | |||
| c5f5be7d58 | |||
| 9f18644763 | |||
| 1de17d27f4 | |||
| 3cd0db9bdf | |||
| 9711b48f2f | |||
|
9934b8bbb2
|
|||
| 6447265b90 | |||
| 71258318db | |||
| 52e95e2649 | |||
| de6ac2cf20 | |||
| 628001e693 | |||
| 47c148d64a | |||
| 78617d5a98 | |||
| 69b924ded6 | |||
| 002f7e5542 | |||
| 5d70f75ac9 | |||
| 7f21a31ec9 | |||
| 23b5ab3e82 | |||
| 4f9fe07951 | |||
| 3bcff4c5ce | |||
| 1810cb7546 | |||
| e55ca911c4 | |||
| 793f2de6c3 | |||
| 54fa47bd99 | |||
| 14a770b207 | |||
| 7b3a04f4eb | |||
| f2a06057a8 | |||
| e11f3f7cbc | |||
| ebc10c1ce4 | |||
| d682e35159 | |||
| 7d74eb0c09 | |||
| 7e18207b87 | |||
| 72b23ad116 | |||
| c508627d92 | |||
| 93ff982649 | |||
| 21f6394359 | |||
| 29d0c8978c | |||
| 7366f83b15 | |||
| 9240bcfd5f | |||
| bede8caa82 | |||
| 108aa2af9a | |||
| d07a86c13f | |||
| 29106d5bb5 | |||
| 32fd4b4630 | |||
| c241aef932 | |||
| 2db24ef2eb | |||
| a2caa79f99 | |||
| e49cfa9495 | |||
| 1f44b3169e | |||
| 49fafa5955 | |||
| c81e6b15e5 | |||
| dc0365834a | |||
| 13334e03a4 | |||
| b35b2c0138 | |||
| 6ef311ce68 | |||
| 68d9c55525 | |||
| dcd70c5ced | |||
| a1d22b7d77 | |||
| 3b6fdbeec3 | |||
| 714f86a55b | |||
| a177cc4faf | |||
| 09aa2ee22c | |||
| b8499a7a8a | |||
| e50bff3d38 | |||
| 8424f842c3 | |||
| 8f23f57415 | |||
| 3b65b93e73 | |||
| 4a458f0e92 | |||
| 5f5a98bcd6 | |||
| 72df919312 | |||
| 7ed36fe56e | |||
| a7a8c4d051 | |||
| 5da3767378 | |||
| 53f98d4cd7 | |||
| 48fb6b5ed7 | |||
| 24d8ec7301 | |||
| ba29e5cf23 | |||
| a5992a9e4e | |||
|
e94eac9b9d
|
|||
| a000beee20 | |||
| 2fd6c40b15 | |||
| 32a2cbb4dd | |||
| cf7a1ee086 | |||
| 8da7956523 | |||
| 9b821ff08f | |||
| ae6f279dcf | |||
| deb56c0c02 | |||
| aead25650e | |||
| 53ada2de83 | |||
| 496cc3121c | |||
| e9c766dbbb | |||
| 706f6ed743 | |||
| 270d82eb71 | |||
| 6da180136e | |||
| 463d8336a7 | |||
| c241b9c264 | |||
|
b98273a7b2
|
|||
|
bd28b133a2
|
|||
| 5c618d03e8 | |||
| 89b8a3ea42 | |||
| 4198a08cda | |||
| 9f319128cc | |||
| 088d548d61 | |||
| e435154c12 | |||
| eceb58b28c | |||
| 5125453406 | |||
| d110df924e | |||
| 81dd8045f2 | |||
| 245072f02c | |||
| 00147f2a74 | |||
| fcc370c353 | |||
| 3bd1cf7167 | |||
| cfa650bcf4 | |||
| ba4ee08489 | |||
| 723a7dc0ca | |||
| 88de28ed68 | |||
| 6f1a3fe70c | |||
| 4a43e09a8b | |||
| 6fb018b86b | |||
| ec310dfee9 | |||
| 9de5a93997 | |||
| ce88e88859 | |||
|
5589c6cd20
|
|||
| 35dead9c74 | |||
| f1fbe14e60 | |||
| b146c9928f | |||
|
136b0f5b97
|
|||
|
2d679028c0
|
|||
| ce1f947f4b | |||
|
5fb51b63c3
|
|||
|
c04dc8fd86
|
|||
| ab3970981d | |||
| 9e4c9ce04a | |||
|
44e37467d6
|
|||
|
7c74ca014d
|
|||
| e7454f6ce8 | |||
| a100d2d798 | |||
| 3c48e7c02d | |||
| 2b3c79fcab | |||
| 7ff778b60a | |||
| b83476b451 | |||
| 58652cac5c | |||
| b216438a47 | |||
| 604657a084 | |||
| 5a57b5f799 | |||
| be233c65fe | |||
| 9f201f8191 | |||
|
55c1962294
|
|||
|
441932b30a
|
|||
| bdecec304a | |||
| 75e3e77478 | |||
|
5c93ca6143
|
|||
| 0452a9faa5 | |||
| 9a75f38226 | |||
|
6d24aa160f
|
|||
|
105630bbd8
|
|||
| 228ab5b2f2 | |||
| b97fe7e5b1 | |||
| 01db4fa951 | |||
|
cb153b50f1
|
|||
|
8b33bf40c3
|
|||
| 9a6221b723 | |||
|
a20b1cb263
|
|||
|
cfe6055083
|
|||
|
eea9abdc56
|
|||
| 138b94e562 | |||
|
d11467bd1b
|
|||
| 7be40d9bf9 | |||
|
dae8073992
|
|||
|
143e7dc17c
|
|||
| f4ace64173 | |||
|
236b486845
|
|||
|
c666f0228d
|
|||
| 81049856b5 | |||
| 4813e24848 | |||
| d61d001ddf | |||
| 060364abb5 | |||
| 13185f0e05 | |||
| fd266969f5 | |||
| bd471330e1 | |||
|
92602efa9e
|
|||
|
55a39ac85a
|
|||
|
39898825ef
|
|||
| 59a2d1454e | |||
|
16c324cf32
|
|||
|
b923b98b2c
|
|||
| afca7d5135 | |||
|
a05bebcd81
|
|||
|
02cc8330ca
|
|||
|
f8397b8bab
|
|||
| 38603fbe45 | |||
|
78700e868d
|
|||
|
259e8bdb7b
|
|||
| 0ea3c25b7b | |||
|
2fa1b7d329
|
|||
| af805f6ba4 | |||
|
34c361d3f8
|
|||
| 42808f40c0 | |||
| 57c21122e6 | |||
| 42faba70d9 | |||
| 99e1f01869 | |||
| 13bddbe359 | |||
| 51ff0e1a9f | |||
| 6766862a00 | |||
| c30aad179b | |||
| d3aad6a198 | |||
| 744dc67ca9 | |||
| 164a7f5826 | |||
| 210cfcf3a6 |
@@ -0,0 +1,60 @@
|
|||||||
|
name: Bug Report
|
||||||
|
about: Du hast einen Fehler gefunden? Melde ihn hier!
|
||||||
|
labels: [ "typ/bug" ]
|
||||||
|
body:
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
ACHTUNG: Sollte es bei dem Bug ein Sicherheitsrisiko geben, melde es bitte auf unserem Discord Server
|
||||||
|
- type: textarea
|
||||||
|
id: description
|
||||||
|
attributes:
|
||||||
|
label: Description
|
||||||
|
description: |
|
||||||
|
Beschreibe deinen Bug in kurzer Form.
|
||||||
|
- type: input
|
||||||
|
id: mc-ver
|
||||||
|
attributes:
|
||||||
|
label: Minecraft Version
|
||||||
|
description: Minecraft Version des Clients
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: input
|
||||||
|
id: mc-ver-ser
|
||||||
|
attributes:
|
||||||
|
label: Minecraft Version Server
|
||||||
|
description: Minecraft Version des Servers, nur bei Bau oder Arenen Servern
|
||||||
|
- type: dropdown
|
||||||
|
id: can-reproduce
|
||||||
|
attributes:
|
||||||
|
label: Kannst du den Fehler wiederholen?
|
||||||
|
description: |
|
||||||
|
Wenn du den Fehler wiederholen kannst, können wir dieses Problem schneller beheben.
|
||||||
|
Solltest du den Fehler nicht wiederholen können, melde dich bitte auf unserem Discord Server.
|
||||||
|
options:
|
||||||
|
- "Yes"
|
||||||
|
- "No"
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: reproduce-steps
|
||||||
|
attributes:
|
||||||
|
label: Wie kannst du den Fehler wiederholen?
|
||||||
|
description: Welche Schritte musst du ausführen, um den Fehler wiederholen zu können?
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: expected-result
|
||||||
|
attributes:
|
||||||
|
label: Was sollte passieren?
|
||||||
|
description: Was sollte hier deiner Erwartung nach passieren?
|
||||||
|
- type: input
|
||||||
|
id: logs
|
||||||
|
attributes:
|
||||||
|
label: Auf welchem Server ist der Fehler aufgetreten?
|
||||||
|
description: Gebe bitte den Namen des Servers an, auf dem der Fehler aufgetreten ist. z.B. "Lobby", "Lixfels Bauserver" etc.
|
||||||
|
- type: textarea
|
||||||
|
id: screenshots
|
||||||
|
attributes:
|
||||||
|
label: Screenshots
|
||||||
|
description: Sollte es ein Visuelles Problem geben, kannst du hier Screenshots hinzufügen.
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
blank_issues_enabled: true
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
name: Feature Idee
|
||||||
|
about: Du hast eine Idee für ein neues Feature, welches SteamWar nicht hat? Stelle sie hier vor.
|
||||||
|
labels: [ "typ/idee" ]
|
||||||
|
body:
|
||||||
|
- type: textarea
|
||||||
|
id: description
|
||||||
|
attributes:
|
||||||
|
label: Feature Beschreibung
|
||||||
|
placeholder: |
|
||||||
|
Ich glaube, dass ...
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: screenshots
|
||||||
|
attributes:
|
||||||
|
label: Screenshots
|
||||||
|
description: Wenn es sich um etwas grafisches handelt, kannst du hier Screenshots hinzufügen.
|
||||||
@@ -2,200 +2,192 @@ name: Backport CommonCore
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
types: [closed]
|
types:
|
||||||
|
- closed
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
issues: write
|
|
||||||
pull-requests: write
|
pull-requests: write
|
||||||
|
|
||||||
|
env:
|
||||||
|
BACKPORT_PATH: CommonCore
|
||||||
|
BACKPORT_BRANCH_PREFIX: backport/commoncore
|
||||||
|
DISABLE_BACKPORT_LABEL: no-backport
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
backport:
|
backport:
|
||||||
name: Backport CommonCore changes
|
name: Create CommonCore backport PRs
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: ${{ github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main' }}
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
with:
|
with:
|
||||||
ref: main
|
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
token: ${{ secrets.GITEA_TOKEN }}
|
|
||||||
|
|
||||||
- name: Create version branch backports
|
- name: Check backport eligibility
|
||||||
|
id: eligibility
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.CI_BOT_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
api() {
|
api_url="${GITHUB_API_URL:-${GITHUB_SERVER_URL}/api/v1}"
|
||||||
|
|
||||||
|
echo "Backport debug: event=${GITHUB_EVENT_NAME:-unknown}"
|
||||||
|
echo "Backport debug: server=${GITHUB_SERVER_URL}"
|
||||||
|
echo "Backport debug: api=${api_url}"
|
||||||
|
echo "Backport debug: repository=${GITHUB_REPOSITORY}"
|
||||||
|
echo "Backport debug: action=$(jq -r '.action // ""' "$GITHUB_EVENT_PATH")"
|
||||||
|
|
||||||
|
merged="$(jq -r '.pull_request.merged // (.pull_request.merged_at != null)' "$GITHUB_EVENT_PATH")"
|
||||||
|
base_branch="$(jq -r '.pull_request.base.ref' "$GITHUB_EVENT_PATH")"
|
||||||
|
has_disable_label="$(jq -r --arg disable_backport_label "$DISABLE_BACKPORT_LABEL" 'any(.pull_request.labels[]?; .name == $disable_backport_label)' "$GITHUB_EVENT_PATH")"
|
||||||
|
echo "Backport debug: pr=$(jq -r '.pull_request.number // ""' "$GITHUB_EVENT_PATH") base=${base_branch} merged=${merged}"
|
||||||
|
echo "Backport debug: disable label present=${has_disable_label}"
|
||||||
|
|
||||||
|
{
|
||||||
|
echo "should_backport=$([[ "$merged" == "true" && "$base_branch" == "main" && "$has_disable_label" != "true" ]] && echo true || echo false)"
|
||||||
|
echo "pr_number=$(jq -r '.pull_request.number' "$GITHUB_EVENT_PATH")"
|
||||||
|
echo "pr_title<<EOF"
|
||||||
|
jq -r '.pull_request.title' "$GITHUB_EVENT_PATH"
|
||||||
|
echo "EOF"
|
||||||
|
} >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
labels="$(curl -fsS \
|
||||||
|
-H "Accept: application/json" \
|
||||||
|
-H "Authorization: token ${GITHUB_TOKEN}" \
|
||||||
|
"${api_url}/repos/${GITHUB_REPOSITORY}/labels")"
|
||||||
|
|
||||||
|
if ! jq -e --arg disable_backport_label "$DISABLE_BACKPORT_LABEL" 'any(.[]; .name == $disable_backport_label)' <<< "$labels" >/dev/null; then
|
||||||
|
curl -fsS -X POST \
|
||||||
|
-H "Accept: application/json" \
|
||||||
|
-H "Authorization: token ${GITHUB_TOKEN}" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "$(jq -n --arg name "$DISABLE_BACKPORT_LABEL" --arg color "ededed" --arg description "Disable automatic CommonCore backporting for this pull request." '{name: $name, color: $color, description: $description}')" \
|
||||||
|
"${api_url}/repos/${GITHUB_REPOSITORY}/labels"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Create backport pull requests
|
||||||
|
if: steps.eligibility.outputs.should_backport == 'true'
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.CI_BOT_TOKEN }}
|
||||||
|
PR_NUMBER: ${{ steps.eligibility.outputs.pr_number }}
|
||||||
|
PR_TITLE: ${{ steps.eligibility.outputs.pr_title }}
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
api_url="${GITHUB_API_URL:-${GITHUB_SERVER_URL}/api/v1}"
|
||||||
|
repo_api_path="/repos/${GITHUB_REPOSITORY}"
|
||||||
|
|
||||||
|
api_request() {
|
||||||
local method="$1"
|
local method="$1"
|
||||||
local path="$2"
|
local path="$2"
|
||||||
local body="${3:-}"
|
local output="$3"
|
||||||
|
local data_file="${4:-}"
|
||||||
|
local status
|
||||||
|
local args=(-sS -X "$method" -H "Accept: application/json" -H "Authorization: token ${GITHUB_TOKEN}" -w "%{http_code}" -o "$output")
|
||||||
|
|
||||||
if [[ -n "$body" ]]; then
|
if [[ -n "$data_file" ]]; then
|
||||||
curl --fail --silent --show-error \
|
args+=(-H "Content-Type: application/json" --data-binary "@${data_file}")
|
||||||
-X "$method" \
|
fi
|
||||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
|
||||||
-H "Accept: application/json" \
|
echo "Backport debug: ${method} ${path}"
|
||||||
-H "Content-Type: application/json" \
|
if ! status="$(curl "${args[@]}" "${api_url}${path}")"; then
|
||||||
--data "$body" \
|
echo "Backport debug: ${method} ${path} failed before HTTP status was captured."
|
||||||
"${GITHUB_API_URL}${path}"
|
if [[ -s "$output" ]]; then
|
||||||
else
|
echo "Backport debug: response body:"
|
||||||
curl --fail --silent --show-error \
|
cat "$output"
|
||||||
-X "$method" \
|
fi
|
||||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
return 1
|
||||||
-H "Accept: application/json" \
|
fi
|
||||||
"${GITHUB_API_URL}${path}"
|
|
||||||
|
echo "Backport debug: ${method} ${path} -> HTTP ${status}"
|
||||||
|
if [[ ! "$status" =~ ^2 ]]; then
|
||||||
|
echo "Backport debug: response body:"
|
||||||
|
cat "$output"
|
||||||
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
repo_path="/repos/${GITHUB_REPOSITORY}"
|
echo "Backport debug: event=${GITHUB_EVENT_NAME:-unknown}"
|
||||||
pr_number="$(jq -r '.number' "$GITHUB_EVENT_PATH")"
|
echo "Backport debug: server=${GITHUB_SERVER_URL}"
|
||||||
pr_title="$(jq -r '.pull_request.title // ""' "$GITHUB_EVENT_PATH")"
|
echo "Backport debug: api=${api_url}"
|
||||||
event_commit="$(jq -r '.pull_request.merge_commit_sha // .pull_request.merged_commit_id // .commit_id // env.GITHUB_SHA' "$GITHUB_EVENT_PATH")"
|
echo "Backport debug: repository=${GITHUB_REPOSITORY}"
|
||||||
|
echo "Backport debug: pr=${PR_NUMBER}"
|
||||||
|
echo "Backport debug: actor=${GITHUB_ACTOR:-unknown}"
|
||||||
|
|
||||||
commoncore_files=()
|
git config user.name "SteamWar Backport Bot"
|
||||||
page=1
|
git config user.email "actions@steamwar.de"
|
||||||
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
|
if [[ "${GITHUB_SERVER_URL}" == https://* ]]; then
|
||||||
page=$((page + 1))
|
auth_host="${GITHUB_SERVER_URL#https://}"
|
||||||
done
|
git remote set-url origin "https://oauth2:${GITHUB_TOKEN}@${auth_host}/${GITHUB_REPOSITORY}.git"
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ "${#commoncore_files[@]}" -eq 0 ]]; then
|
git fetch --prune origin '+refs/heads/version/*:refs/remotes/origin/version/*'
|
||||||
echo "PR #${pr_number} did not change CommonCore/; nothing to backport."
|
|
||||||
|
api_request GET "${repo_api_path}" repo-debug.json
|
||||||
|
jq -r '"Backport debug: repo permissions admin=\(.permissions.admin // "unknown") push=\(.permissions.push // "unknown") pull=\(.permissions.pull // "unknown")"' repo-debug.json || true
|
||||||
|
|
||||||
|
echo "Backport debug: GET ${repo_api_path}/pulls/${PR_NUMBER}.diff"
|
||||||
|
curl -fsSL -w "Backport debug: GET ${repo_api_path}/pulls/${PR_NUMBER}.diff -> HTTP %{http_code}\n" \
|
||||||
|
-H "Accept: text/plain" \
|
||||||
|
-H "Authorization: token ${GITHUB_TOKEN}" \
|
||||||
|
"${api_url}${repo_api_path}/pulls/${PR_NUMBER}.diff" \
|
||||||
|
-o pull-request.diff
|
||||||
|
|
||||||
|
if ! grep -Eq "^diff --git a/${BACKPORT_PATH}/" pull-request.diff; then
|
||||||
|
echo "Pull request #${PR_NUMBER} has no ${BACKPORT_PATH} changes to backport."
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "PR #${pr_number} changed CommonCore files:"
|
mapfile -t target_branches < <(git for-each-ref --format='%(refname:strip=3)' refs/remotes/origin/version)
|
||||||
printf ' - %s\n' "${commoncore_files[@]}"
|
if [[ "${#target_branches[@]}" -eq 0 ]]; then
|
||||||
|
echo "No version/* branches found."
|
||||||
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
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
failures=()
|
for target_branch in "${target_branches[@]}"; do
|
||||||
for target_branch in "${version_branches[@]}"; do
|
safe_target="${target_branch//\//-}"
|
||||||
safe_target="$(sed -E 's#[^A-Za-z0-9._-]+#-#g; s#^-+##; s#-+$##' <<< "$target_branch")"
|
backport_branch="${BACKPORT_BRANCH_PREFIX}/pr-${PR_NUMBER}-to-${safe_target}"
|
||||||
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" |
|
git checkout -B "${backport_branch}" "origin/${target_branch}"
|
||||||
jq -r --arg head "$head_branch" '.[] | select(.head.ref == $head) | .number' |
|
git reset --hard "origin/${target_branch}"
|
||||||
head -n 1)"
|
|
||||||
|
|
||||||
if [[ -n "$existing_pr" ]]; then
|
if ! git apply --3way --index --include="${BACKPORT_PATH}/**" pull-request.diff; then
|
||||||
echo "Backport PR #${existing_pr} already exists for ${target_branch}; leaving it unchanged."
|
echo "Failed to apply CommonCore backport for ${target_branch}."
|
||||||
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
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if git diff --cached --quiet; then
|
||||||
|
echo "CommonCore changes from #${PR_NUMBER} are already present in ${target_branch}."
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
git commit -m "Backport CommonCore changes from #${PR_NUMBER}" -m "${PR_TITLE}"
|
||||||
|
git push --force-with-lease origin "${backport_branch}"
|
||||||
|
|
||||||
|
api_request GET "${repo_api_path}/pulls?state=open" open-pulls.json
|
||||||
|
open_pr_number="$(jq -r --arg base "$target_branch" --arg head "$backport_branch" '[.[] | select(.base.ref == $base and .head.ref == $head) | (.number // .index)][0] // empty' open-pulls.json)"
|
||||||
|
|
||||||
|
if [[ -n "$open_pr_number" ]]; then
|
||||||
|
echo "Backport PR #${open_pr_number} already exists for ${target_branch}."
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
pr_body="$(printf 'Automatic CommonCore backport of #%s.\n\nOriginal PR title: %s\n\nOnly files below `CommonCore/` are included.' "$PR_NUMBER" "$PR_TITLE")"
|
||||||
|
|
||||||
|
jq -n \
|
||||||
|
--arg base "$target_branch" \
|
||||||
|
--arg head "$backport_branch" \
|
||||||
|
--arg title "Backport CommonCore changes from #${PR_NUMBER} to ${target_branch}" \
|
||||||
|
--arg body "$pr_body" \
|
||||||
|
'{base: $base, head: $head, title: $title, body: $body}' > create-pull.json
|
||||||
|
|
||||||
|
echo "Backport debug: create PR base=${target_branch} head=${backport_branch}"
|
||||||
|
api_request POST "${repo_api_path}/pulls" create-pull-response.json create-pull.json
|
||||||
|
done
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
echo "$SW_MAVEN_CREDENTIALS" > steamwar.properties
|
echo "$SW_MAVEN_CREDENTIALS" > steamwar.properties
|
||||||
- name: Build with Gradle
|
- name: Build with Gradle
|
||||||
run: ./gradlew build --no-daemon
|
run: ./gradlew clean build --no-daemon --no-build-cache --refresh-dependencies
|
||||||
|
|
||||||
- name: Stage deploy artifacts
|
- name: Stage deploy artifacts
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -52,7 +52,6 @@ jobs:
|
|||||||
mkdir -p deploy
|
mkdir -p deploy
|
||||||
|
|
||||||
cp "BauSystem/build/libs/BauSystem-all.jar" "deploy/BauSystem.jar"
|
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 "FightSystem/build/libs/FightSystem-all.jar" "deploy/FightSystem.jar"
|
||||||
cp "KotlinCore/build/libs/KotlinCore-all.jar" "deploy/KotlinCore.jar"
|
cp "KotlinCore/build/libs/KotlinCore-all.jar" "deploy/KotlinCore.jar"
|
||||||
cp "TNTLeague/build/libs/TNTLeague.jar" "deploy/TNTLeague.jar"
|
cp "TNTLeague/build/libs/TNTLeague.jar" "deploy/TNTLeague.jar"
|
||||||
@@ -67,6 +66,7 @@ jobs:
|
|||||||
cp "VelocityCore/Dependencies/build/libs/Dependencies-all.jar" "deploy/DependenciesVelocityCore.jar"
|
cp "VelocityCore/Dependencies/build/libs/Dependencies-all.jar" "deploy/DependenciesVelocityCore.jar"
|
||||||
cp "VelocityCore/build/libs/VelocityCore-all.jar" "deploy/VelocityCore.jar"
|
cp "VelocityCore/build/libs/VelocityCore-all.jar" "deploy/VelocityCore.jar"
|
||||||
cp "WebsiteBackend/build/libs/WebsiteBackend-all.jar" "deploy/website-api.jar"
|
cp "WebsiteBackend/build/libs/WebsiteBackend-all.jar" "deploy/website-api.jar"
|
||||||
|
cp "CLI/build/distributions/sw.zip" "deploy/sw.zip"
|
||||||
|
|
||||||
- name: Upload deploy artifacts
|
- name: Upload deploy artifacts
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
@@ -129,4 +129,21 @@ jobs:
|
|||||||
ssh-keyscan -p "$port" "$DEPLOY_HOST" >> ~/.ssh/known_hosts
|
ssh-keyscan -p "$port" "$DEPLOY_HOST" >> ~/.ssh/known_hosts
|
||||||
|
|
||||||
ssh -i ~/.ssh/deploy_key -p "$port" "${DEPLOY_USER}@${DEPLOY_HOST}" "mkdir -p '$DEPLOY_PATH'"
|
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/"
|
ssh -i ~/.ssh/deploy_key -p "$port" "${DEPLOY_USER}@${DEPLOY_HOST}" "mkdir -p '$DEPLOY_PATH/upload'"
|
||||||
|
scp -i ~/.ssh/deploy_key -P "$port" deploy/* "${DEPLOY_USER}@${DEPLOY_HOST}:$DEPLOY_PATH/upload"
|
||||||
|
ssh -i ~/.ssh/deploy_key -p "$port" "${DEPLOY_USER}@${DEPLOY_HOST}" "rm -f '$DEPLOY_PATH'/*.jar '$DEPLOY_PATH'/*.zip"
|
||||||
|
ssh -i ~/.ssh/deploy_key -p "$port" "${DEPLOY_USER}@${DEPLOY_HOST}" "mv '$DEPLOY_PATH'/upload/* '$DEPLOY_PATH'"
|
||||||
|
ssh -i ~/.ssh/deploy_key -p "$port" "${DEPLOY_USER}@${DEPLOY_HOST}" "rm -r '$DEPLOY_PATH/upload'"
|
||||||
|
ssh -i ~/.ssh/deploy_key -p "$port" "${DEPLOY_USER}@${DEPLOY_HOST}" "chmod o-w '$DEPLOY_PATH'/*"
|
||||||
|
- name: Restart Services
|
||||||
|
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 }}
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
ssh -i ~/.ssh/deploy_key -p "$DEPLOY_PORT" "${DEPLOY_USER}@${DEPLOY_HOST}" "sudo systemctl restart api.service"
|
||||||
|
ssh -i ~/.ssh/deploy_key -p "$DEPLOY_PORT" "${DEPLOY_USER}@${DEPLOY_HOST}" "unzip -o /jars/current/sw.zip -d /jars"
|
||||||
|
|||||||
@@ -3,6 +3,10 @@ name: Pull Request Build
|
|||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build
|
name: Build
|
||||||
@@ -40,33 +44,33 @@ jobs:
|
|||||||
- name: Build with Gradle
|
- name: Build with Gradle
|
||||||
run: ./gradlew build --no-daemon
|
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
|
- name: Merge successful backport PR
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.CI_BOT_TOKEN }}
|
||||||
|
BACKPORT_BRANCH_PREFIX: backport/commoncore
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
pr_number="$(jq -r '.number' "$GITHUB_EVENT_PATH")"
|
head_branch="$(jq -r '.pull_request.head.ref // ""' "$GITHUB_EVENT_PATH")"
|
||||||
target_branch="$(jq -r '.pull_request.base.ref' "$GITHUB_EVENT_PATH")"
|
base_branch="$(jq -r '.pull_request.base.ref // ""' "$GITHUB_EVENT_PATH")"
|
||||||
payload="$(jq -n \
|
pr_number="$(jq -r '.pull_request.number' "$GITHUB_EVENT_PATH")"
|
||||||
--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 \
|
if [[ "${head_branch}" != "${BACKPORT_BRANCH_PREFIX}/"* ]]; then
|
||||||
-X POST \
|
echo "Not a CommonCore backport PR."
|
||||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${base_branch}" != version/* ]]; then
|
||||||
|
echo "Backport PR target is not a version/* branch."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
api_url="${GITHUB_API_URL:-${GITHUB_SERVER_URL}/api/v1}"
|
||||||
|
|
||||||
|
curl -fsS -X POST \
|
||||||
-H "Accept: application/json" \
|
-H "Accept: application/json" \
|
||||||
|
-H "Authorization: token ${GITHUB_TOKEN}" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
--data "$payload" \
|
-d '{"Do":"merge","delete_branch_after_merge":true}' \
|
||||||
"${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/pulls/${pr_number}/merge"
|
"${api_url}/repos/${GITHUB_REPOSITORY}/pulls/${pr_number}/merge"
|
||||||
|
|||||||
+15
@@ -0,0 +1,15 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="Remote JVM Debugger" type="Remote">
|
||||||
|
<option name="USE_SOCKET_TRANSPORT" value="true" />
|
||||||
|
<option name="SERVER_MODE" value="false" />
|
||||||
|
<option name="SHMEM_ADDRESS" />
|
||||||
|
<option name="HOST" value="localhost" />
|
||||||
|
<option name="PORT" value="5005" />
|
||||||
|
<option name="AUTO_RESTART" value="false" />
|
||||||
|
<RunnerSettings RunnerId="Debug">
|
||||||
|
<option name="DEBUG_PORT" value="5005" />
|
||||||
|
<option name="LOCAL" value="false" />
|
||||||
|
</RunnerSettings>
|
||||||
|
<method v="2" />
|
||||||
|
</configuration>
|
||||||
|
</component>
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of the SteamWar software.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2025 SteamWar.de-Serverteam
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
plugins {
|
|
||||||
steamwar.java
|
|
||||||
}
|
|
||||||
|
|
||||||
java {
|
|
||||||
sourceCompatibility = JavaVersion.VERSION_17
|
|
||||||
targetCompatibility = JavaVersion.VERSION_17
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
compileOnly(project(":BauSystem:BauSystem_Main", "default"))
|
|
||||||
compileOnly(project(":SpigotCore", "default"))
|
|
||||||
|
|
||||||
compileOnly(libs.nms15)
|
|
||||||
compileOnly(libs.worldedit15)
|
|
||||||
}
|
|
||||||
@@ -1,239 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of the SteamWar software.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2025 SteamWar.de-Serverteam
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.utils;
|
|
||||||
|
|
||||||
import com.sk89q.worldedit.EditSession;
|
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
|
||||||
import com.sk89q.worldedit.bukkit.BukkitWorld;
|
|
||||||
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
|
||||||
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
|
||||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
|
||||||
import com.sk89q.worldedit.extent.clipboard.io.BuiltInClipboardFormat;
|
|
||||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
|
|
||||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader;
|
|
||||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardWriter;
|
|
||||||
import com.sk89q.worldedit.function.mask.Mask;
|
|
||||||
import com.sk89q.worldedit.function.mask.Mask2D;
|
|
||||||
import com.sk89q.worldedit.function.operation.ForwardExtentCopy;
|
|
||||||
import com.sk89q.worldedit.function.operation.Operations;
|
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
|
||||||
import com.sk89q.worldedit.math.transform.AffineTransform;
|
|
||||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
|
||||||
import com.sk89q.worldedit.regions.selector.CuboidRegionSelector;
|
|
||||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
|
||||||
import com.sk89q.worldedit.world.World;
|
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
|
||||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
|
||||||
import de.steamwar.bausystem.region.Point;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.block.data.BlockData;
|
|
||||||
import org.bukkit.block.data.Waterlogged;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
import org.bukkit.util.Vector;
|
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
|
||||||
import java.util.function.BiPredicate;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
public class FlatteningWrapper15 implements FlatteningWrapper {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isNoBook(ItemStack item) {
|
|
||||||
return item.getType() != Material.WRITABLE_BOOK && item.getType() != Material.WRITTEN_BOOK;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final Set<Material> unpushable = new HashSet<>(Arrays.asList(Material.BARRIER, Material.BEACON, Material.COMMAND_BLOCK, Material.CHAIN_COMMAND_BLOCK, Material.REPEATING_COMMAND_BLOCK, Material.ENCHANTING_TABLE, Material.END_GATEWAY, Material.END_PORTAL, Material.ENDER_CHEST, Material.GRINDSTONE, Material.JIGSAW, Material.JUKEBOX, Material.NETHER_PORTAL, Material.OBSIDIAN, Material.STRUCTURE_VOID, Material.BARREL, Material.BEEHIVE, Material.BEE_NEST, Material.BLAST_FURNACE, Material.BREWING_STAND, Material.CHEST, Material.DAYLIGHT_DETECTOR, Material.DISPENSER, Material.DROPPER, Material.FURNACE, Material.HOPPER, Material.LECTERN, Material.SMOKER, Material.TRAPPED_CHEST));
|
|
||||||
|
|
||||||
// TODO: FLOWER
|
|
||||||
private static final Set<Material> breaking = new HashSet<>(Arrays.asList(Material.BAMBOO, Material.CACTUS, Material.CAKE, Material.CARVED_PUMPKIN, Material.CHORUS_FLOWER, Material.CHORUS_PLANT, Material.COBWEB, Material.COCOA, Material.DRAGON_EGG, Material.FIRE, Material.FLOWER_POT, Material.JACK_O_LANTERN, Material.LADDER, Material.LAVA, Material.LAVA, Material.LEVER, Material.LILY_PAD, Material.MELON, Material.NETHER_WART, Material.PUMPKIN, Material.COMPARATOR, Material.REDSTONE_WIRE, Material.REPEATER, Material.TORCH, Material.STRUCTURE_VOID, Material.SCAFFOLDING, Material.SEA_PICKLE, Material.SNOW, Material.SUGAR_CANE, Material.TORCH, Material.TRIPWIRE, Material.TRIPWIRE_HOOK, Material.TURTLE_EGG, Material.VINE, Material.WATER, Material.WHEAT));
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isUnpusheable(Material material) {
|
|
||||||
if (unpushable.contains(material)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
String name = material.name();
|
|
||||||
return name.contains("BANNER") || name.contains("SIGN");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isBreakingOnPush(Material material) {
|
|
||||||
if (breaking.contains(material)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
String name = material.name();
|
|
||||||
return name.contains("BED") || name.contains("BUTTON") || name.contains("CARPET") || (name.contains("DOOR") && !name.contains("TRAPDOOR")) || name.contains("HEAD") || name.contains("LEAVES") || name.contains("MUSHROOM") || name.contains("PRESSURE_PLATE") || name.contains("SHULKER_BOX");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isWorldEditCommand(String command) {
|
|
||||||
if (command.startsWith("/")) {
|
|
||||||
command = command.replaceFirst("/", "");
|
|
||||||
}
|
|
||||||
command = command.toLowerCase();
|
|
||||||
return WorldEdit.getInstance().getPlatformManager().getPlatformCommandManager().getCommandManager().containsCommand(command);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final WorldEditPlugin WORLDEDIT_PLUGIN = Objects.requireNonNull((WorldEditPlugin) Bukkit.getPluginManager().getPlugin("WorldEdit"));
|
|
||||||
private static final World BUKKITWORLD = new BukkitWorld(Bukkit.getWorlds().get(0));
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setSelection(Player p, Point minPoint, Point maxPoint) {
|
|
||||||
WORLDEDIT_PLUGIN.getSession(p).setRegionSelector(BUKKITWORLD, new CuboidRegionSelector(BUKKITWORLD, minPoint.toBlockVector3(), maxPoint.toBlockVector3()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Clipboard loadSchematic(File file) {
|
|
||||||
Clipboard clipboard;
|
|
||||||
try (ClipboardReader reader = Objects.requireNonNull(ClipboardFormats.findByFile(file)).getReader(new FileInputStream(file))) {
|
|
||||||
clipboard = reader.read();
|
|
||||||
} catch (NullPointerException | IOException e) {
|
|
||||||
throw new SecurityException("Bausystem schematic not found", e);
|
|
||||||
}
|
|
||||||
return clipboard;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EditSession paste(PasteBuilder pasteBuilder) {
|
|
||||||
try (EditSession e = WorldEdit.getInstance().getEditSessionFactory().getEditSession(new BukkitWorld(Bukkit.getWorlds().get(0)), -1)) {
|
|
||||||
Clipboard clipboard = pasteBuilder.getClipboard();
|
|
||||||
|
|
||||||
if (!pasteBuilder.getMappers().isEmpty()) {
|
|
||||||
BlockVector3 minimum = clipboard.getRegion().getMinimumPoint();
|
|
||||||
for (int x = 0; x < clipboard.getDimensions().getX(); x++) {
|
|
||||||
for (int y = 0; y < clipboard.getDimensions().getY(); y++) {
|
|
||||||
for (int z = 0; z < clipboard.getDimensions().getZ(); z++) {
|
|
||||||
BlockVector3 pos = minimum.add(x, y, z);
|
|
||||||
pasteBuilder.getMappers().forEach(mapper -> mapper.accept(clipboard, pos));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
AtomicReference<BlockVector3> pastePoint = new AtomicReference<>();
|
|
||||||
if (!pasteBuilder.getPredicates().isEmpty()) {
|
|
||||||
e.setMask(new Mask() {
|
|
||||||
@Override
|
|
||||||
public boolean test(BlockVector3 blockVector3) {
|
|
||||||
BaseBlock block = clipboard.getFullBlock(blockVector3.subtract(pastePoint.get()).add(clipboard.getRegion().getMinimumPoint()));
|
|
||||||
String blockName = block.getBlockType().toString().toLowerCase();
|
|
||||||
for (BiPredicate<BaseBlock, String> predicate : pasteBuilder.getPredicates()) {
|
|
||||||
if (!predicate.test(block, blockName)) return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Mask copy() {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
|
||||||
public Mask2D toMask2D() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
ClipboardHolder ch = new ClipboardHolder(clipboard);
|
|
||||||
BlockVector3 dimensions = clipboard.getDimensions();
|
|
||||||
BlockVector3 v = BlockVector3.at(pasteBuilder.getPastPoint().getX(), pasteBuilder.getPastPoint().getY(), pasteBuilder.getPastPoint().getZ());
|
|
||||||
BlockVector3 offset = clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin());
|
|
||||||
if (pasteBuilder.isRotate()) {
|
|
||||||
ch.setTransform(new AffineTransform().rotateY(180));
|
|
||||||
v = v.add(dimensions.getX() / 2, 0, dimensions.getZ() / 2).subtract(offset.multiply(-1, 1, -1)).subtract(0, 0, 1);
|
|
||||||
} else {
|
|
||||||
v = v.subtract(dimensions.getX() / 2, 0, dimensions.getZ() / 2).subtract(offset);
|
|
||||||
}
|
|
||||||
pastePoint.set(v);
|
|
||||||
|
|
||||||
if (pasteBuilder.isReset()) {
|
|
||||||
e.setBlocks(new CuboidRegion(pasteBuilder.getMinPoint().toBlockVector3(), pasteBuilder.getMaxPoint().toBlockVector3()), Objects.requireNonNull(BlockTypes.AIR).getDefaultState().toBaseBlock());
|
|
||||||
if (pasteBuilder.getWaterLevel() != 0) {
|
|
||||||
e.setBlocks(new CuboidRegion(pasteBuilder.getMinPoint().toBlockVector3(), pasteBuilder.getMaxPoint().toBlockVector3().withY(pasteBuilder.getWaterLevel())), Objects.requireNonNull(BlockTypes.WATER).getDefaultState().toBaseBlock());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Operations.completeBlindly(ch.createPaste(e).to(v).ignoreAirBlocks(pasteBuilder.isIgnoreAir()).build());
|
|
||||||
return e;
|
|
||||||
} catch (WorldEditException e) {
|
|
||||||
throw new SecurityException(e.getMessage(), e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Clipboard copy(Point minPoint, Point maxPoint, Point copyPoint) {
|
|
||||||
BukkitWorld bukkitWorld = new BukkitWorld(Bukkit.getWorlds().get(0));
|
|
||||||
CuboidRegion region = new CuboidRegion(bukkitWorld, minPoint.toBlockVector3(), maxPoint.toBlockVector3());
|
|
||||||
BlockArrayClipboard clipboard = new BlockArrayClipboard(region);
|
|
||||||
try (EditSession e = WorldEdit.getInstance().getEditSessionFactory().getEditSession(bukkitWorld, -1)) {
|
|
||||||
ForwardExtentCopy copy = new ForwardExtentCopy(
|
|
||||||
e, region, clipboard, region.getMinimumPoint()
|
|
||||||
);
|
|
||||||
|
|
||||||
copy.setCopyingEntities(false);
|
|
||||||
copy.setCopyingBiomes(false);
|
|
||||||
|
|
||||||
Operations.complete(copy);
|
|
||||||
clipboard.setOrigin(copyPoint.toBlockVector3());
|
|
||||||
return clipboard;
|
|
||||||
} catch (WorldEditException e) {
|
|
||||||
Bukkit.getLogger().log(Level.SEVERE, e.getMessage(), e);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean backup(Point minPoint, Point maxPoint, File file) {
|
|
||||||
Clipboard clipboard = copy(minPoint, maxPoint, minPoint);
|
|
||||||
try (ClipboardWriter writer = BuiltInClipboardFormat.SPONGE_SCHEMATIC.getWriter(new FileOutputStream(file))) {
|
|
||||||
writer.write(clipboard);
|
|
||||||
return true;
|
|
||||||
} catch (IOException e) {
|
|
||||||
Bukkit.getLogger().log(Level.SEVERE, e.getMessage(), e);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean inWater(org.bukkit.World world, Vector tntPosition) {
|
|
||||||
Block block = world.getBlockAt(tntPosition.getBlockX(), tntPosition.getBlockY(), tntPosition.getBlockZ());
|
|
||||||
if (block.getType() == Material.WATER)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
BlockData data = block.getBlockData();
|
|
||||||
if (!(data instanceof Waterlogged))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return ((Waterlogged) data).isWaterlogged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,129 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of the SteamWar software.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2025 SteamWar.de-Serverteam
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.utils;
|
|
||||||
|
|
||||||
import de.steamwar.Reflection;
|
|
||||||
import de.steamwar.bausystem.features.util.NoClipCommand;
|
|
||||||
import net.minecraft.server.v1_15_R1.*;
|
|
||||||
import org.bukkit.GameMode;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer;
|
|
||||||
import org.bukkit.craftbukkit.v1_15_R1.inventory.CraftItemStack;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class NMSWrapper15 implements NMSWrapper {
|
|
||||||
|
|
||||||
private static final Reflection.Field<EnumGamemode> playerGameMode = Reflection.getField(PlayerInteractManager.class, EnumGamemode.class, 0);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public void setInternalGameMode(Player player, GameMode gameMode) {
|
|
||||||
playerGameMode.set(((CraftPlayer) player).getHandle().playerInteractManager, EnumGamemode.getById(gameMode.getValue()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setSlotToItemStack(Player player, Object o) {
|
|
||||||
PacketPlayInSetCreativeSlot packetPlayInSetCreativeSlot = (PacketPlayInSetCreativeSlot) o;
|
|
||||||
int index = packetPlayInSetCreativeSlot.b();
|
|
||||||
if (index >= 36 && index <= 44) {
|
|
||||||
index -= 36;
|
|
||||||
} else if (index > 44) {
|
|
||||||
index -= 5;
|
|
||||||
} else if (index <= 8) {
|
|
||||||
index = index - 8 + 36;
|
|
||||||
}
|
|
||||||
player.getInventory().setItem(index, CraftItemStack.asBukkitCopy(packetPlayInSetCreativeSlot.getItemStack()));
|
|
||||||
if (index < 9) player.getInventory().setHeldItemSlot(index);
|
|
||||||
player.updateInventory();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final Reflection.Field<Integer> gameStateChangeReason = Reflection.getField(NoClipCommand.gameStateChange, int.class, 0);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setGameStateChangeReason(Object packet) {
|
|
||||||
gameStateChangeReason.set(packet, 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setPlayerBuildAbilities(Player player) {
|
|
||||||
((CraftPlayer) player).getHandle().abilities.mayBuild = true;
|
|
||||||
((CraftPlayer) player).getHandle().abilities.canInstantlyBuild = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Material pathMaterial() {
|
|
||||||
return Material.GRASS_PATH;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final int threshold = 2048;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean checkItemStack(ItemStack item) {
|
|
||||||
net.minecraft.server.v1_15_R1.ItemStack nmsItem = CraftItemStack.asNMSCopy(item);
|
|
||||||
NBTTagCompound tag = nmsItem.getTag();
|
|
||||||
if (tag != null && tag.hasKey("BlockEntityTag")) {
|
|
||||||
NBTTagCompound blockTag = tag.getCompound("BlockEntityTag");
|
|
||||||
if (blockTag.hasKey("Items")) {
|
|
||||||
return drillDown(blockTag.getList("Items", 10), 0, 0) > threshold;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private int drillDown(NBTTagList items, int layer, int start) {
|
|
||||||
if (layer > 2) return start + threshold;
|
|
||||||
int invalid = start;
|
|
||||||
for (NBTBase nbtBase : items) {
|
|
||||||
if (!(nbtBase instanceof NBTTagCompound))
|
|
||||||
continue;
|
|
||||||
NBTTagCompound slot = (NBTTagCompound) nbtBase;
|
|
||||||
if (slot.hasKey("tag")) {
|
|
||||||
invalid += slot.getByte("Count");
|
|
||||||
NBTTagCompound iTag = slot.getCompound("tag");
|
|
||||||
if (iTag.hasKey("BlockEntityTag")) {
|
|
||||||
NBTTagCompound blockTag = iTag.getCompound("BlockEntityTag");
|
|
||||||
if (blockTag.hasKey("Items")) {
|
|
||||||
invalid = drillDown(blockTag.getList("Items", 10), layer + 1, invalid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (invalid > threshold)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return invalid;
|
|
||||||
}
|
|
||||||
|
|
||||||
private final Class<?> explosionPacket = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundExplodePacket");
|
|
||||||
private final Reflection.Field<Double> a = Reflection.getField(explosionPacket, double.class, 0);
|
|
||||||
private final Reflection.Field<Double> b = Reflection.getField(explosionPacket, double.class, 1);
|
|
||||||
private final Reflection.Field<Double> c = Reflection.getField(explosionPacket, double.class, 2);
|
|
||||||
private final Reflection.Field<Float> d = Reflection.getField(explosionPacket, float.class, 0);
|
|
||||||
private final Reflection.Field<List> e = Reflection.getField(explosionPacket, List.class, 0);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object resetExplosionKnockback(Object packet) {
|
|
||||||
PacketPlayOutExplosion packetPlayOutExplosion = (PacketPlayOutExplosion) packet;
|
|
||||||
return new PacketPlayOutExplosion(a.get(packetPlayOutExplosion), b.get(packetPlayOutExplosion), c.get(packetPlayOutExplosion), d.get(packetPlayOutExplosion), e.get(packetPlayOutExplosion), Vec3D.a);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of the SteamWar software.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2025 SteamWar.de-Serverteam
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.utils;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
|
||||||
|
|
||||||
public class PlaceItemWrapper15 implements PlaceItemWrapper {
|
|
||||||
|
|
||||||
public PlaceItemWrapper15() {
|
|
||||||
for (Material material : Material.values()) {
|
|
||||||
if (!material.isBlock()) continue;
|
|
||||||
if (material.isLegacy()) continue;
|
|
||||||
|
|
||||||
String nonWall = material.name().replace("_WALL_", "").replace("WALL_", "").replace("_WALL", "");
|
|
||||||
try {
|
|
||||||
Material nonWallMaterial = Material.valueOf(nonWall);
|
|
||||||
if (nonWallMaterial != material && nonWallMaterial.isItem() && !nonWallMaterial.isBlock()) {
|
|
||||||
BLOCK_MATERIAL_TO_WALL_BLOCK_MATERIAL.put(nonWallMaterial, material);
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
// Ignore
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ITEM_MATERIAL_TO_BLOCK_MATERIAL.put(Material.REDSTONE, Material.REDSTONE_WIRE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of the SteamWar software.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2025 SteamWar.de-Serverteam
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.utils;
|
|
||||||
|
|
||||||
import de.steamwar.Reflection;
|
|
||||||
import net.minecraft.server.v1_15_R1.EntityPlayer;
|
|
||||||
import net.minecraft.server.v1_15_R1.PacketPlayInFlying;
|
|
||||||
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public class PlayerMovementWrapper15 implements PlayerMovementWrapper {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setPosition(Player player, Object object) {
|
|
||||||
PacketPlayInFlying packetPlayInFlying = ((PacketPlayInFlying) object);
|
|
||||||
EntityPlayer entityPlayer = ((CraftPlayer) player).getHandle();
|
|
||||||
if (Float.isNaN(packetPlayInFlying.a(Float.NaN))) {
|
|
||||||
entityPlayer.e(packetPlayInFlying.a(0.0), packetPlayInFlying.b(0.0), packetPlayInFlying.c(0.0));
|
|
||||||
} else {
|
|
||||||
entityPlayer.setLocation(packetPlayInFlying.a(0.0), packetPlayInFlying.b(0.0), packetPlayInFlying.c(0.0), packetPlayInFlying.a(0F), packetPlayInFlying.b(0F));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object convertToOut(Player player, Object object) {
|
|
||||||
PacketPlayInFlying packetPlayInFlying = ((PacketPlayInFlying) object);
|
|
||||||
Object packet = Reflection.newInstance(teleportPacket);
|
|
||||||
teleportEntity.set(packet, player.getEntityId());
|
|
||||||
teleportPosition.set(packet, packetPlayInFlying.a(0.0), packetPlayInFlying.b(0.0), packetPlayInFlying.c(0.0),
|
|
||||||
Float.isNaN(packetPlayInFlying.a(Float.NaN)) ? player.getLocation().getYaw() : packetPlayInFlying.a(0.0F),
|
|
||||||
Float.isNaN(packetPlayInFlying.b(Float.NaN)) ? player.getLocation().getPitch() : packetPlayInFlying.b(0.0F));
|
|
||||||
return packet;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,140 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of the SteamWar software.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2025 SteamWar.de-Serverteam
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.utils;
|
|
||||||
|
|
||||||
import de.steamwar.bausystem.region.Region;
|
|
||||||
import de.steamwar.bausystem.utils.bossbar.BossBarService;
|
|
||||||
import de.steamwar.bausystem.utils.tps.TPSFreezeUtils;
|
|
||||||
import de.steamwar.bausystem.utils.tps.TPSLimitUtils;
|
|
||||||
import de.steamwar.core.TPSWarpUtils;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
|
|
||||||
public class TickManager15 implements TickManager, Listener {
|
|
||||||
|
|
||||||
private static float currentTPSLimit = 20;
|
|
||||||
private boolean currentlyStepping = false;
|
|
||||||
private float currentLimit;
|
|
||||||
private int stepsTotal;
|
|
||||||
private int stepsLeft;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canFreeze() {
|
|
||||||
return TPSFreezeUtils.isCanFreeze();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setTickRate(float tickRate) {
|
|
||||||
if (currentlyStepping) {
|
|
||||||
currentlyStepping = false;
|
|
||||||
Bukkit.getOnlinePlayers().forEach(player -> {
|
|
||||||
BossBarService.instance.remove(player, Region.getGlobalRegion(), "TickStep");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
TPSWarpUtils.warp(tickRate);
|
|
||||||
if (currentTPSLimit == 0 && tickRate != 0) {
|
|
||||||
TPSFreezeUtils.unfreeze();
|
|
||||||
}
|
|
||||||
currentTPSLimit = tickRate;
|
|
||||||
if (tickRate == 0) {
|
|
||||||
TPSLimitUtils.unlimit();
|
|
||||||
TPSFreezeUtils.freeze();
|
|
||||||
} else if (tickRate < 20.0) {
|
|
||||||
TPSLimitUtils.limit(tickRate);
|
|
||||||
} else if (tickRate >= 20) {
|
|
||||||
TPSLimitUtils.unlimit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isFrozen() {
|
|
||||||
return TPSFreezeUtils.frozen();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setFreeze(boolean freeze) {
|
|
||||||
if (freeze) {
|
|
||||||
setTickRate(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void stepTicks(int ticks) {
|
|
||||||
currentLimit = 0;
|
|
||||||
setTickRate(20);
|
|
||||||
stepsLeft = ticks;
|
|
||||||
stepsTotal = ticks;
|
|
||||||
currentlyStepping = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void sprintTicks(int ticks) {
|
|
||||||
currentLimit = currentTPSLimit;
|
|
||||||
setTickRate(4000);
|
|
||||||
stepsLeft = ticks;
|
|
||||||
stepsTotal = ticks;
|
|
||||||
currentlyStepping = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isSprinting() {
|
|
||||||
return currentlyStepping && currentTPSLimit > 20;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isStepping() {
|
|
||||||
return currentlyStepping && currentTPSLimit <= 20;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getTickRate() {
|
|
||||||
return currentTPSLimit;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setBlockTpsPacket(boolean block) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getTotalTicks() {
|
|
||||||
return stepsTotal;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getDoneTicks() {
|
|
||||||
return stepsTotal - stepsLeft;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getRemainingTicks() {
|
|
||||||
return stepsLeft;
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onTickEnd(TickEndEvent event) {
|
|
||||||
if (!currentlyStepping) return;
|
|
||||||
stepsLeft--;
|
|
||||||
if (stepsLeft <= 0) {
|
|
||||||
setTickRate(currentLimit);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,131 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of the SteamWar software.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2025 SteamWar.de-Serverteam
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.utils.tps;
|
|
||||||
|
|
||||||
import de.steamwar.Reflection;
|
|
||||||
import com.comphenix.tinyprotocol.TinyProtocol;
|
|
||||||
import de.steamwar.core.BountifulWrapper;
|
|
||||||
import de.steamwar.core.ChatWrapper;
|
|
||||||
import de.steamwar.core.Core;
|
|
||||||
import lombok.experimental.UtilityClass;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.entity.Entity;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.entity.TNTPrimed;
|
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
import org.bukkit.scheduler.BukkitTask;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
@UtilityClass
|
|
||||||
class PacketCache {
|
|
||||||
|
|
||||||
private static List<Object> packets = new ArrayList<>();
|
|
||||||
private static Set<Entity> entities = new HashSet<>();
|
|
||||||
private static BukkitTask task = null;
|
|
||||||
|
|
||||||
private static Class<?> vec3dClass = Reflection.getClass("net.minecraft.world.phys.Vec3");
|
|
||||||
private static Reflection.Field<Object> zeroVec3d = (Reflection.Field<Object>) Reflection.getField(vec3dClass, vec3dClass, 0);
|
|
||||||
private static Object ZERO_VEC3D = zeroVec3d.get(null);
|
|
||||||
private static Class<?> velocityPacketClass = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundSetEntityMotionPacket");
|
|
||||||
private static Reflection.Constructor velocityPacketConstructor = Reflection.getConstructor(velocityPacketClass, int.class, vec3dClass);
|
|
||||||
|
|
||||||
private static Class<?> teleportPacketClass = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundTeleportEntityPacket");
|
|
||||||
private static Class<?> entityClass = Reflection.getClass("net.minecraft.world.entity.Entity");
|
|
||||||
private static Reflection.Constructor teleportPacketConstructor = Reflection.getConstructor(teleportPacketClass, entityClass);
|
|
||||||
|
|
||||||
private static Class<?> craftEntityClass = Reflection.getClass("org.bukkit.craftbukkit.entity.CraftEntity");
|
|
||||||
private static Reflection.Method getHandle = Reflection.getMethod(craftEntityClass, "getHandle");
|
|
||||||
|
|
||||||
private static Object noGravityDataWatcher = BountifulWrapper.impl.getDataWatcherObject(5, Boolean.class);
|
|
||||||
private static Object fuseDataWatcher = BountifulWrapper.impl.getDataWatcherObject(8, Integer.class);
|
|
||||||
|
|
||||||
public void continuousSendCache() {
|
|
||||||
if (task != null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
createPackets();
|
|
||||||
task = new BukkitRunnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
_sendCache();
|
|
||||||
}
|
|
||||||
}.runTaskTimer(Core.getInstance(), 1, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void sendCache() {
|
|
||||||
if (task != null) {
|
|
||||||
task.cancel();
|
|
||||||
task = null;
|
|
||||||
}
|
|
||||||
_sendCache();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void _sendCache() {
|
|
||||||
createPackets();
|
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
|
||||||
for (Object packet : packets) {
|
|
||||||
TinyProtocol.instance.sendPacket(player, packet);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void clearCache() {
|
|
||||||
packets.clear();
|
|
||||||
entities.clear();
|
|
||||||
|
|
||||||
if (task != null) {
|
|
||||||
task.cancel();
|
|
||||||
task = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void createPackets() {
|
|
||||||
if (entities.stream().anyMatch(Entity::isDead)) {
|
|
||||||
entities.clear();
|
|
||||||
packets.clear();
|
|
||||||
}
|
|
||||||
List<Entity> entities = Bukkit.getWorlds().get(0).getEntities().stream()
|
|
||||||
.filter(e -> !(e instanceof Player))
|
|
||||||
.filter(e -> PacketCache.entities.add(e))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
|
||||||
for (Entity entity : entities) {
|
|
||||||
packets.add(teleportPacketConstructor.invoke(getHandle.invoke(entity)));
|
|
||||||
}
|
|
||||||
for (Entity entity : entities) {
|
|
||||||
packets.add(velocityPacketConstructor.invoke(entity.getEntityId(), ZERO_VEC3D));
|
|
||||||
}
|
|
||||||
for (Entity entity : entities) {
|
|
||||||
packets.add(ChatWrapper.impl.getDataWatcherPacket(entity.getEntityId(), noGravityDataWatcher, true));
|
|
||||||
}
|
|
||||||
for (Entity entity : entities) {
|
|
||||||
if (!(entity instanceof TNTPrimed)) continue;
|
|
||||||
TNTPrimed tnt = (TNTPrimed) entity;
|
|
||||||
int fuse = tnt.getFuseTicks();
|
|
||||||
packets.add(ChatWrapper.impl.getDataWatcherPacket(entity.getEntityId(), fuseDataWatcher, fuse - (fuse % 5) + 1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,76 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of the SteamWar software.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2025 SteamWar.de-Serverteam
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.utils.tps;
|
|
||||||
|
|
||||||
import de.steamwar.Reflection;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.experimental.UtilityClass;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.World;
|
|
||||||
|
|
||||||
@UtilityClass
|
|
||||||
public class TPSFreezeUtils {
|
|
||||||
|
|
||||||
private static Reflection.Field<Boolean> fieldAccessor;
|
|
||||||
@Getter
|
|
||||||
private static final boolean canFreeze;
|
|
||||||
|
|
||||||
private static final Reflection.Method getWorldHandle = Reflection.getTypedMethod(Reflection.getClass("org.bukkit.craftbukkit.CraftWorld"), "getHandle", null);
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
private static boolean frozen = false;
|
|
||||||
|
|
||||||
private static final World world = Bukkit.getWorlds().get(0);
|
|
||||||
|
|
||||||
static {
|
|
||||||
Reflection.Field<Boolean> fieldAccessor;
|
|
||||||
try {
|
|
||||||
fieldAccessor = Reflection.getField(Reflection.getClass("net.minecraft.server.level.ServerLevel"), "freezed", boolean.class);
|
|
||||||
} catch (IllegalArgumentException e) {
|
|
||||||
fieldAccessor = null;
|
|
||||||
}
|
|
||||||
canFreeze = fieldAccessor != null;
|
|
||||||
TPSFreezeUtils.fieldAccessor = fieldAccessor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void freeze() {
|
|
||||||
setFreeze(world, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void unfreeze() {
|
|
||||||
setFreeze(world, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean frozen() {
|
|
||||||
return canFreeze && frozen;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setFreeze(World world, boolean state) {
|
|
||||||
if (canFreeze) {
|
|
||||||
fieldAccessor.set(getWorldHandle.invoke(world), state);
|
|
||||||
if (state) {
|
|
||||||
PacketCache.continuousSendCache();
|
|
||||||
} else {
|
|
||||||
PacketCache.clearCache();
|
|
||||||
}
|
|
||||||
frozen = state;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,124 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of the SteamWar software.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2025 SteamWar.de-Serverteam
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.utils.tps;
|
|
||||||
|
|
||||||
import de.steamwar.Reflection;
|
|
||||||
import com.comphenix.tinyprotocol.TinyProtocol;
|
|
||||||
import de.steamwar.bausystem.utils.PlayerMovementWrapper;
|
|
||||||
import de.steamwar.core.Core;
|
|
||||||
import lombok.experimental.UtilityClass;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.scheduler.BukkitTask;
|
|
||||||
|
|
||||||
import java.util.Queue;
|
|
||||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
|
||||||
import java.util.function.BiFunction;
|
|
||||||
|
|
||||||
@UtilityClass
|
|
||||||
public class TPSLimitUtils {
|
|
||||||
|
|
||||||
private static long currentTime = System.nanoTime();
|
|
||||||
private static BukkitTask tpsLimiter = null;
|
|
||||||
private static Queue<Runnable> packetQueue = new ConcurrentLinkedQueue<>();
|
|
||||||
|
|
||||||
public void unlimit() {
|
|
||||||
if (tpsLimiter != null) tpsLimiter.cancel();
|
|
||||||
tpsLimiter = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void limit(double tps) {
|
|
||||||
if (tpsLimiter != null) tpsLimiter.cancel();
|
|
||||||
|
|
||||||
double delay = 20 / tps;
|
|
||||||
int loops = (int) Math.ceil(delay);
|
|
||||||
long sleepDelay = (long) (50 * delay) / loops;
|
|
||||||
|
|
||||||
tpsLimiter = Bukkit.getScheduler().runTaskTimer(Core.getInstance(), () -> {
|
|
||||||
PacketCache.sendCache();
|
|
||||||
for (int i = 0; i < loops; i++) {
|
|
||||||
sleepUntilNextTick(sleepDelay);
|
|
||||||
PacketCache.sendCache();
|
|
||||||
while (true) {
|
|
||||||
Runnable runnable = packetQueue.poll();
|
|
||||||
if (runnable == null) break;
|
|
||||||
runnable.run();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
PacketCache.clearCache();
|
|
||||||
}, 0, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void sleepUntilNextTick(long neededDelta) {
|
|
||||||
long lastTime = currentTime;
|
|
||||||
currentTime = System.nanoTime();
|
|
||||||
|
|
||||||
long timeDelta = (currentTime - lastTime) / 1000000;
|
|
||||||
if (neededDelta - timeDelta < 0) return;
|
|
||||||
|
|
||||||
try {
|
|
||||||
Thread.sleep(neededDelta - timeDelta);
|
|
||||||
currentTime = System.nanoTime();
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
Thread.currentThread().interrupt();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
static {
|
|
||||||
long timeInterval = 50;
|
|
||||||
final long[] lastTime = {System.currentTimeMillis()};
|
|
||||||
final double[] tps = {20.0};
|
|
||||||
Bukkit.getScheduler().runTaskTimer(Core.getInstance(), () -> {
|
|
||||||
long currentTime = System.currentTimeMillis();
|
|
||||||
if (currentTime > lastTime[0]) {
|
|
||||||
tps[0] = (double)timeInterval / (double)(currentTime - lastTime[0]) * 20.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
lastTime[0] = currentTime;
|
|
||||||
|
|
||||||
Bukkit.getOnlinePlayers().forEach(player -> {
|
|
||||||
SWUtils.sendToActionbar(player, String.valueOf((int) (tps[0] * 10.0) / 10.0));
|
|
||||||
});
|
|
||||||
}, timeInterval / 50L, timeInterval / 50L);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
private static final Class<?> position = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundMovePlayerPacket$Pos");
|
|
||||||
private static final Class<?> positionLook = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundMovePlayerPacket$PosRot");
|
|
||||||
static {
|
|
||||||
BiFunction<Player, Object, Object> positionSetter = (player, o) -> {
|
|
||||||
if (tpsLimiter != null) {
|
|
||||||
Object object = PlayerMovementWrapper.impl.convertToOut(player, o);
|
|
||||||
packetQueue.add(() -> {
|
|
||||||
PlayerMovementWrapper.impl.setPosition(player, o);
|
|
||||||
Bukkit.getOnlinePlayers().forEach(p -> {
|
|
||||||
if (p == player) return;
|
|
||||||
TinyProtocol.instance.sendPacket(p, object);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return o;
|
|
||||||
};
|
|
||||||
TinyProtocol.instance.addFilter(position, positionSetter);
|
|
||||||
TinyProtocol.instance.addFilter(positionLook, positionSetter);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of the SteamWar software.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2025 SteamWar.de-Serverteam
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
plugins {
|
|
||||||
steamwar.java
|
|
||||||
}
|
|
||||||
|
|
||||||
java {
|
|
||||||
sourceCompatibility = JavaVersion.VERSION_17
|
|
||||||
targetCompatibility = JavaVersion.VERSION_17
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
compileOnly(project(":BauSystem:BauSystem_Main", "default"))
|
|
||||||
compileOnly(project(":SpigotCore", "default"))
|
|
||||||
|
|
||||||
compileOnly(libs.spigotapi)
|
|
||||||
compileOnly(libs.nms18)
|
|
||||||
}
|
|
||||||
@@ -1,135 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of the SteamWar software.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2025 SteamWar.de-Serverteam
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.utils;
|
|
||||||
|
|
||||||
import de.steamwar.Reflection;
|
|
||||||
import de.steamwar.bausystem.features.util.NoClipCommand;
|
|
||||||
import net.minecraft.nbt.NBTBase;
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
import net.minecraft.nbt.NBTTagList;
|
|
||||||
import net.minecraft.network.protocol.game.*;
|
|
||||||
import net.minecraft.server.level.PlayerInteractManager;
|
|
||||||
import net.minecraft.world.level.EnumGamemode;
|
|
||||||
import org.bukkit.GameMode;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.craftbukkit.v1_18_R2.entity.CraftPlayer;
|
|
||||||
import org.bukkit.craftbukkit.v1_18_R2.inventory.CraftItemStack;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class NMSWrapper18 implements NMSWrapper {
|
|
||||||
|
|
||||||
private static final Reflection.Field<EnumGamemode> playerGameMode = Reflection.getField(PlayerInteractManager.class, EnumGamemode.class, 0);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public void setInternalGameMode(Player player, GameMode gameMode) {
|
|
||||||
playerGameMode.set(((CraftPlayer) player).getHandle().d, EnumGamemode.a(gameMode.getValue()));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setSlotToItemStack(Player player, Object o) {
|
|
||||||
PacketPlayInSetCreativeSlot packetPlayInSetCreativeSlot = (PacketPlayInSetCreativeSlot) o;
|
|
||||||
int index = packetPlayInSetCreativeSlot.b();
|
|
||||||
if (index >= 36 && index <= 44) {
|
|
||||||
index -= 36;
|
|
||||||
} else if (index > 44) {
|
|
||||||
index -= 5;
|
|
||||||
} else if (index <= 8) {
|
|
||||||
index = index - 8 + 36;
|
|
||||||
}
|
|
||||||
player.getInventory().setItem(index, CraftItemStack.asBukkitCopy(packetPlayInSetCreativeSlot.c()));
|
|
||||||
if (index < 9) player.getInventory().setHeldItemSlot(index);
|
|
||||||
player.updateInventory();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final Reflection.Field<PacketPlayOutGameStateChange.a> gameStateChangeReason = Reflection.getField(NoClipCommand.gameStateChange, PacketPlayOutGameStateChange.a.class, 12);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setGameStateChangeReason(Object packet) {
|
|
||||||
gameStateChangeReason.set(packet, PacketPlayOutGameStateChange.d);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setPlayerBuildAbilities(Player player) {
|
|
||||||
((CraftPlayer) player).getHandle().fs().d = true;
|
|
||||||
((CraftPlayer) player).getHandle().fs().e = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Material pathMaterial() {
|
|
||||||
return Material.DIRT_PATH;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final int threshold = 2048;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean checkItemStack(ItemStack item) {
|
|
||||||
net.minecraft.world.item.ItemStack nmsItem = CraftItemStack.asNMSCopy(item);
|
|
||||||
NBTTagCompound tag = nmsItem.t();
|
|
||||||
if (tag != null && tag.e("BlockEntityTag")) {
|
|
||||||
NBTTagCompound blockTag = tag.p("BlockEntityTag");
|
|
||||||
if (blockTag.e("Items")) {
|
|
||||||
return drillDown(blockTag.c("Items", 10), 0, 0) > threshold;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private int drillDown(NBTTagList items, int layer, int start) {
|
|
||||||
if (layer > 2) return start + threshold;
|
|
||||||
int invalid = start;
|
|
||||||
for (NBTBase nbtBase : items) {
|
|
||||||
if (!(nbtBase instanceof NBTTagCompound))
|
|
||||||
continue;
|
|
||||||
NBTTagCompound slot = (NBTTagCompound) nbtBase;
|
|
||||||
if (slot.e("tag")) {
|
|
||||||
invalid += slot.f("Count");
|
|
||||||
NBTTagCompound iTag = slot.p("tag");
|
|
||||||
if (iTag.e("BlockEntityTag")) {
|
|
||||||
NBTTagCompound blockTag = iTag.p("BlockEntityTag");
|
|
||||||
if (blockTag.e("Items")) {
|
|
||||||
invalid = drillDown(blockTag.c("Items", 10), layer + 1, invalid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (invalid > threshold)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return invalid;
|
|
||||||
}
|
|
||||||
|
|
||||||
private final Class<?> explosionPacket = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundExplodePacket");
|
|
||||||
private final Reflection.Field<Double> a = Reflection.getField(explosionPacket, double.class, 0);
|
|
||||||
private final Reflection.Field<Double> b = Reflection.getField(explosionPacket, double.class, 1);
|
|
||||||
private final Reflection.Field<Double> c = Reflection.getField(explosionPacket, double.class, 2);
|
|
||||||
private final Reflection.Field<Float> d = Reflection.getField(explosionPacket, float.class, 0);
|
|
||||||
private final Reflection.Field<List> e = Reflection.getField(explosionPacket, List.class, 0);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object resetExplosionKnockback(Object packet) {
|
|
||||||
PacketPlayOutExplosion packetPlayOutExplosion = (PacketPlayOutExplosion) packet;
|
|
||||||
return new PacketPlayOutExplosion(a.get(packetPlayOutExplosion), b.get(packetPlayOutExplosion), c.get(packetPlayOutExplosion), d.get(packetPlayOutExplosion), e.get(packetPlayOutExplosion), null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of the SteamWar software.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2025 SteamWar.de-Serverteam
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.utils;
|
|
||||||
|
|
||||||
import de.steamwar.Reflection;
|
|
||||||
import net.minecraft.network.protocol.game.PacketPlayInFlying;
|
|
||||||
import net.minecraft.server.level.EntityPlayer;
|
|
||||||
import org.bukkit.craftbukkit.v1_18_R2.entity.CraftPlayer;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public class PlayerMovementWrapper18 implements PlayerMovementWrapper {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setPosition(Player player, Object object) {
|
|
||||||
PacketPlayInFlying packetPlayInFlying = ((PacketPlayInFlying) object);
|
|
||||||
EntityPlayer entityPlayer = ((CraftPlayer) player).getHandle();
|
|
||||||
if (packetPlayInFlying.h) {
|
|
||||||
entityPlayer.b(packetPlayInFlying.a, packetPlayInFlying.b, packetPlayInFlying.c, packetPlayInFlying.d, packetPlayInFlying.e);
|
|
||||||
} else {
|
|
||||||
entityPlayer.e(packetPlayInFlying.a, packetPlayInFlying.b, packetPlayInFlying.c);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object convertToOut(Player player, Object object) {
|
|
||||||
PacketPlayInFlying packetPlayInFlying = ((PacketPlayInFlying) object);
|
|
||||||
Object packet = Reflection.newInstance(teleportPacket);
|
|
||||||
teleportEntity.set(packet, player.getEntityId());
|
|
||||||
teleportPosition.set(packet, packetPlayInFlying.a, packetPlayInFlying.b, packetPlayInFlying.c,
|
|
||||||
packetPlayInFlying.h ? player.getLocation().getYaw() : packetPlayInFlying.d,
|
|
||||||
packetPlayInFlying.h ? player.getLocation().getPitch() : packetPlayInFlying.e);
|
|
||||||
return packet;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of the SteamWar software.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2025 SteamWar.de-Serverteam
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
plugins {
|
|
||||||
steamwar.java
|
|
||||||
}
|
|
||||||
|
|
||||||
java {
|
|
||||||
sourceCompatibility = JavaVersion.VERSION_17
|
|
||||||
targetCompatibility = JavaVersion.VERSION_17
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
compileOnly(project(":BauSystem:BauSystem_Main", "default"))
|
|
||||||
compileOnly(project(":SpigotCore", "default"))
|
|
||||||
|
|
||||||
compileOnly(libs.spigotapi)
|
|
||||||
compileOnly(libs.paperapi)
|
|
||||||
|
|
||||||
compileOnly(libs.nms19)
|
|
||||||
}
|
|
||||||
@@ -1,134 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of the SteamWar software.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2025 SteamWar.de-Serverteam
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.utils;
|
|
||||||
|
|
||||||
import de.steamwar.Reflection;
|
|
||||||
import de.steamwar.bausystem.features.util.NoClipCommand;
|
|
||||||
import net.minecraft.nbt.NBTBase;
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
import net.minecraft.nbt.NBTTagList;
|
|
||||||
import net.minecraft.network.protocol.game.*;
|
|
||||||
import net.minecraft.server.level.PlayerInteractManager;
|
|
||||||
import net.minecraft.world.level.EnumGamemode;
|
|
||||||
import org.bukkit.GameMode;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.craftbukkit.v1_19_R2.entity.CraftPlayer;
|
|
||||||
import org.bukkit.craftbukkit.v1_19_R2.inventory.CraftItemStack;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class NMSWrapper19 implements NMSWrapper {
|
|
||||||
|
|
||||||
private static final Reflection.Field<EnumGamemode> playerGameMode = Reflection.getField(PlayerInteractManager.class, EnumGamemode.class, 0);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public void setInternalGameMode(Player player, GameMode gameMode) {
|
|
||||||
playerGameMode.set(((CraftPlayer) player).getHandle().d, EnumGamemode.a(gameMode.getValue()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setSlotToItemStack(Player player, Object o) {
|
|
||||||
PacketPlayInSetCreativeSlot packetPlayInSetCreativeSlot = (PacketPlayInSetCreativeSlot) o;
|
|
||||||
int index = packetPlayInSetCreativeSlot.b();
|
|
||||||
if (index >= 36 && index <= 44) {
|
|
||||||
index -= 36;
|
|
||||||
} else if (index > 44) {
|
|
||||||
index -= 5;
|
|
||||||
} else if (index <= 8) {
|
|
||||||
index = index - 8 + 36;
|
|
||||||
}
|
|
||||||
player.getInventory().setItem(index, CraftItemStack.asBukkitCopy(packetPlayInSetCreativeSlot.c()));
|
|
||||||
if (index < 9) player.getInventory().setHeldItemSlot(index);
|
|
||||||
player.updateInventory();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final Reflection.Field<PacketPlayOutGameStateChange.a> gameStateChangeReason = Reflection.getField(NoClipCommand.gameStateChange, PacketPlayOutGameStateChange.a.class, 12);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setGameStateChangeReason(Object packet) {
|
|
||||||
gameStateChangeReason.set(packet, PacketPlayOutGameStateChange.d);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setPlayerBuildAbilities(Player player) {
|
|
||||||
((CraftPlayer) player).getHandle().fF().d = true;
|
|
||||||
((CraftPlayer) player).getHandle().fF().e = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Material pathMaterial() {
|
|
||||||
return Material.DIRT_PATH;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final int threshold = 2048;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean checkItemStack(ItemStack item) {
|
|
||||||
net.minecraft.world.item.ItemStack nmsItem = CraftItemStack.asNMSCopy(item);
|
|
||||||
NBTTagCompound tag = nmsItem.v();
|
|
||||||
if (tag != null && tag.e("BlockEntityTag")) {
|
|
||||||
NBTTagCompound blockTag = tag.p("BlockEntityTag");
|
|
||||||
if (blockTag.e("Items")) {
|
|
||||||
return drillDown(blockTag.c("Items", 10), 0, 0) > threshold;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private int drillDown(NBTTagList items, int layer, int start) {
|
|
||||||
if (layer > 2) return start + threshold;
|
|
||||||
int invalid = start;
|
|
||||||
for (NBTBase nbtBase : items) {
|
|
||||||
if (!(nbtBase instanceof NBTTagCompound))
|
|
||||||
continue;
|
|
||||||
NBTTagCompound slot = (NBTTagCompound) nbtBase;
|
|
||||||
if (slot.e("tag")) {
|
|
||||||
invalid += slot.f("Count");
|
|
||||||
NBTTagCompound iTag = slot.p("tag");
|
|
||||||
if (iTag.e("BlockEntityTag")) {
|
|
||||||
NBTTagCompound blockTag = iTag.p("BlockEntityTag");
|
|
||||||
if (blockTag.e("Items")) {
|
|
||||||
invalid = drillDown(blockTag.c("Items", 10), layer + 1, invalid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (invalid > threshold)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return invalid;
|
|
||||||
}
|
|
||||||
|
|
||||||
private final Class<?> explosionPacket = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundExplodePacket");
|
|
||||||
private final Reflection.Field<Double> a = Reflection.getField(explosionPacket, double.class, 0);
|
|
||||||
private final Reflection.Field<Double> b = Reflection.getField(explosionPacket, double.class, 1);
|
|
||||||
private final Reflection.Field<Double> c = Reflection.getField(explosionPacket, double.class, 2);
|
|
||||||
private final Reflection.Field<Float> d = Reflection.getField(explosionPacket, float.class, 0);
|
|
||||||
private final Reflection.Field<List> e = Reflection.getField(explosionPacket, List.class, 0);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object resetExplosionKnockback(Object packet) {
|
|
||||||
PacketPlayOutExplosion packetPlayOutExplosion = (PacketPlayOutExplosion) packet;
|
|
||||||
return new PacketPlayOutExplosion(a.get(packetPlayOutExplosion), b.get(packetPlayOutExplosion), c.get(packetPlayOutExplosion), d.get(packetPlayOutExplosion), e.get(packetPlayOutExplosion), null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of the SteamWar software.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2025 SteamWar.de-Serverteam
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.utils;
|
|
||||||
|
|
||||||
import de.steamwar.Reflection;
|
|
||||||
import net.minecraft.network.protocol.game.PacketPlayInFlying;
|
|
||||||
import net.minecraft.server.level.EntityPlayer;
|
|
||||||
import org.bukkit.craftbukkit.v1_19_R2.entity.CraftPlayer;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public class PlayerMovementWrapper19 implements PlayerMovementWrapper {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setPosition(Player player, Object object) {
|
|
||||||
PacketPlayInFlying packetPlayInFlying = ((PacketPlayInFlying) object);
|
|
||||||
EntityPlayer entityPlayer = ((CraftPlayer) player).getHandle();
|
|
||||||
if (packetPlayInFlying.h) {
|
|
||||||
entityPlayer.b(packetPlayInFlying.a, packetPlayInFlying.b, packetPlayInFlying.c, packetPlayInFlying.d, packetPlayInFlying.e);
|
|
||||||
} else {
|
|
||||||
entityPlayer.e(packetPlayInFlying.a, packetPlayInFlying.b, packetPlayInFlying.c);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object convertToOut(Player player, Object object) {
|
|
||||||
PacketPlayInFlying packetPlayInFlying = ((PacketPlayInFlying) object);
|
|
||||||
Object packet = Reflection.newInstance(teleportPacket);
|
|
||||||
teleportEntity.set(packet, player.getEntityId());
|
|
||||||
teleportPosition.set(packet, packetPlayInFlying.a, packetPlayInFlying.b, packetPlayInFlying.c,
|
|
||||||
packetPlayInFlying.h ? player.getLocation().getYaw() : packetPlayInFlying.d,
|
|
||||||
packetPlayInFlying.h ? player.getLocation().getPitch() : packetPlayInFlying.e);
|
|
||||||
return packet;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of the SteamWar software.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2025 SteamWar.de-Serverteam
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.utils;
|
|
||||||
|
|
||||||
import com.destroystokyo.paper.event.server.ServerTickEndEvent;
|
|
||||||
import com.destroystokyo.paper.event.server.ServerTickStartEvent;
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
|
|
||||||
public class TickListener19 implements TickListener, Listener {
|
|
||||||
|
|
||||||
private boolean tickStartRan = false;
|
|
||||||
|
|
||||||
public TickListener19() {
|
|
||||||
Bukkit.getPluginManager().registerEvents(this, BauSystem.getInstance());
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onServerTickStart(ServerTickStartEvent event) {
|
|
||||||
if (TickManager.impl.isFrozen()) return;
|
|
||||||
Bukkit.getPluginManager().callEvent(new TickStartEvent());
|
|
||||||
tickStartRan = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onServerTickEnd(ServerTickEndEvent event) {
|
|
||||||
if (!tickStartRan) return;
|
|
||||||
Bukkit.getPluginManager().callEvent(new TickEndEvent());
|
|
||||||
tickStartRan = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of the SteamWar software.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2025 SteamWar.de-Serverteam
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
plugins {
|
|
||||||
steamwar.java
|
|
||||||
}
|
|
||||||
|
|
||||||
java {
|
|
||||||
sourceCompatibility = JavaVersion.VERSION_17
|
|
||||||
targetCompatibility = JavaVersion.VERSION_17
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
compileOnly(project(":BauSystem:BauSystem_Main", "default"))
|
|
||||||
compileOnly(project(":SpigotCore", "default"))
|
|
||||||
|
|
||||||
compileOnly(libs.spigotapi)
|
|
||||||
|
|
||||||
compileOnly(libs.nms20)
|
|
||||||
}
|
|
||||||
@@ -1,136 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of the SteamWar software.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2025 SteamWar.de-Serverteam
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.utils;
|
|
||||||
|
|
||||||
import de.steamwar.Reflection;
|
|
||||||
import de.steamwar.bausystem.features.util.NoClipCommand;
|
|
||||||
import net.minecraft.nbt.NBTBase;
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
import net.minecraft.nbt.NBTTagList;
|
|
||||||
import net.minecraft.network.protocol.game.PacketPlayInSetCreativeSlot;
|
|
||||||
import net.minecraft.network.protocol.game.PacketPlayOutExplosion;
|
|
||||||
import net.minecraft.network.protocol.game.PacketPlayOutGameStateChange;
|
|
||||||
import net.minecraft.server.level.PlayerInteractManager;
|
|
||||||
import net.minecraft.world.level.EnumGamemode;
|
|
||||||
import org.bukkit.GameMode;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.craftbukkit.v1_20_R1.entity.CraftPlayer;
|
|
||||||
import org.bukkit.craftbukkit.v1_20_R1.inventory.CraftItemStack;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class NMSWrapper20 implements NMSWrapper {
|
|
||||||
|
|
||||||
private static final Reflection.Field<EnumGamemode> playerGameMode = Reflection.getField(PlayerInteractManager.class, EnumGamemode.class, 0);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public void setInternalGameMode(Player player, GameMode gameMode) {
|
|
||||||
playerGameMode.set(((CraftPlayer) player).getHandle().e, EnumGamemode.a(gameMode.getValue()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setSlotToItemStack(Player player, Object o) {
|
|
||||||
PacketPlayInSetCreativeSlot packetPlayInSetCreativeSlot = (PacketPlayInSetCreativeSlot) o;
|
|
||||||
int index = packetPlayInSetCreativeSlot.a();
|
|
||||||
if (index >= 36 && index <= 44) {
|
|
||||||
index -= 36;
|
|
||||||
} else if (index > 44) {
|
|
||||||
index -= 5;
|
|
||||||
} else if (index <= 8) {
|
|
||||||
index = index - 8 + 36;
|
|
||||||
}
|
|
||||||
player.getInventory().setItem(index, CraftItemStack.asBukkitCopy(packetPlayInSetCreativeSlot.c()));
|
|
||||||
if (index < 9) player.getInventory().setHeldItemSlot(index);
|
|
||||||
player.updateInventory();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final Reflection.Field<PacketPlayOutGameStateChange.a> gameStateChangeReason = Reflection.getField(NoClipCommand.gameStateChange, PacketPlayOutGameStateChange.a.class, 12);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setGameStateChangeReason(Object packet) {
|
|
||||||
gameStateChangeReason.set(packet, PacketPlayOutGameStateChange.d);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setPlayerBuildAbilities(Player player) {
|
|
||||||
((CraftPlayer) player).getHandle().fO().d = true;
|
|
||||||
((CraftPlayer) player).getHandle().fO().e = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Material pathMaterial() {
|
|
||||||
return Material.DIRT_PATH;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final int threshold = 2048;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean checkItemStack(ItemStack item) {
|
|
||||||
net.minecraft.world.item.ItemStack nmsItem = CraftItemStack.asNMSCopy(item);
|
|
||||||
NBTTagCompound tag = nmsItem.v();
|
|
||||||
if (tag != null && tag.e("BlockEntityTag")) {
|
|
||||||
NBTTagCompound blockTag = tag.p("BlockEntityTag");
|
|
||||||
if (blockTag.e("Items")) {
|
|
||||||
return drillDown(blockTag.c("Items", 10), 0, 0) > threshold;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private int drillDown(NBTTagList items, int layer, int start) {
|
|
||||||
if (layer > 2) return start + threshold;
|
|
||||||
int invalid = start;
|
|
||||||
for (NBTBase nbtBase : items) {
|
|
||||||
if (!(nbtBase instanceof NBTTagCompound))
|
|
||||||
continue;
|
|
||||||
NBTTagCompound slot = (NBTTagCompound) nbtBase;
|
|
||||||
if (slot.e("tag")) {
|
|
||||||
invalid += slot.f("Count");
|
|
||||||
NBTTagCompound iTag = slot.p("tag");
|
|
||||||
if (iTag.e("BlockEntityTag")) {
|
|
||||||
NBTTagCompound blockTag = iTag.p("BlockEntityTag");
|
|
||||||
if (blockTag.e("Items")) {
|
|
||||||
invalid = drillDown(blockTag.c("Items", 10), layer + 1, invalid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (invalid > threshold)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return invalid;
|
|
||||||
}
|
|
||||||
|
|
||||||
private final Class<?> explosionPacket = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundExplodePacket");
|
|
||||||
private final Reflection.Field<Double> a = Reflection.getField(explosionPacket, double.class, 0);
|
|
||||||
private final Reflection.Field<Double> b = Reflection.getField(explosionPacket, double.class, 1);
|
|
||||||
private final Reflection.Field<Double> c = Reflection.getField(explosionPacket, double.class, 2);
|
|
||||||
private final Reflection.Field<Float> d = Reflection.getField(explosionPacket, float.class, 0);
|
|
||||||
private final Reflection.Field<List> e = Reflection.getField(explosionPacket, List.class, 0);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object resetExplosionKnockback(Object packet) {
|
|
||||||
PacketPlayOutExplosion packetPlayOutExplosion = (PacketPlayOutExplosion) packet;
|
|
||||||
return new PacketPlayOutExplosion(a.get(packetPlayOutExplosion), b.get(packetPlayOutExplosion), c.get(packetPlayOutExplosion), d.get(packetPlayOutExplosion), e.get(packetPlayOutExplosion), null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of the SteamWar software.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2025 SteamWar.de-Serverteam
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.utils;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.data.BlockData;
|
|
||||||
|
|
||||||
public class PlaceItemWrapper20 implements PlaceItemWrapper {
|
|
||||||
|
|
||||||
public PlaceItemWrapper20() {
|
|
||||||
for (Material material : Material.values()) {
|
|
||||||
if (!material.isBlock()) continue;
|
|
||||||
if (material.isLegacy()) continue;
|
|
||||||
BlockData blockData = material.createBlockData();
|
|
||||||
Material placementMaterial = blockData.getPlacementMaterial();
|
|
||||||
if (material == placementMaterial) continue;
|
|
||||||
if (placementMaterial == Material.AIR) continue;
|
|
||||||
if (placementMaterial.isItem() && !placementMaterial.isBlock()) {
|
|
||||||
ITEM_MATERIAL_TO_BLOCK_MATERIAL.put(placementMaterial, material);
|
|
||||||
}
|
|
||||||
if (material.name().contains("WALL")) {
|
|
||||||
BLOCK_MATERIAL_TO_WALL_BLOCK_MATERIAL.put(placementMaterial, material);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of the SteamWar software.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2025 SteamWar.de-Serverteam
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.utils;
|
|
||||||
|
|
||||||
import de.steamwar.Reflection;
|
|
||||||
import net.minecraft.network.protocol.game.PacketPlayInFlying;
|
|
||||||
import net.minecraft.server.level.EntityPlayer;
|
|
||||||
import org.bukkit.craftbukkit.v1_20_R1.entity.CraftPlayer;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public class PlayerMovementWrapper20 implements PlayerMovementWrapper {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setPosition(Player player, Object object) {
|
|
||||||
PacketPlayInFlying packetPlayInFlying = ((PacketPlayInFlying) object);
|
|
||||||
EntityPlayer entityPlayer = ((CraftPlayer) player).getHandle();
|
|
||||||
if (packetPlayInFlying.h) {
|
|
||||||
entityPlayer.b(packetPlayInFlying.a, packetPlayInFlying.b, packetPlayInFlying.c, packetPlayInFlying.d, packetPlayInFlying.e);
|
|
||||||
} else {
|
|
||||||
entityPlayer.e(packetPlayInFlying.a, packetPlayInFlying.b, packetPlayInFlying.c);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object convertToOut(Player player, Object object) {
|
|
||||||
PacketPlayInFlying packetPlayInFlying = ((PacketPlayInFlying) object);
|
|
||||||
Object packet = Reflection.newInstance(teleportPacket);
|
|
||||||
teleportEntity.set(packet, player.getEntityId());
|
|
||||||
teleportPosition.set(packet, packetPlayInFlying.a, packetPlayInFlying.b, packetPlayInFlying.c,
|
|
||||||
packetPlayInFlying.h ? player.getLocation().getYaw() : packetPlayInFlying.d,
|
|
||||||
packetPlayInFlying.h ? player.getLocation().getPitch() : packetPlayInFlying.e);
|
|
||||||
return packet;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of the SteamWar software.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2025 SteamWar.de-Serverteam
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
plugins {
|
|
||||||
steamwar.java
|
|
||||||
}
|
|
||||||
|
|
||||||
java {
|
|
||||||
sourceCompatibility = JavaVersion.VERSION_21
|
|
||||||
targetCompatibility = JavaVersion.VERSION_21
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
compileOnly(project(":BauSystem:BauSystem_Main", "default"))
|
|
||||||
compileOnly(project(":SpigotCore", "default"))
|
|
||||||
|
|
||||||
compileOnly(libs.paperapi21)
|
|
||||||
|
|
||||||
compileOnly(libs.nms21)
|
|
||||||
}
|
|
||||||
@@ -1,133 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of the SteamWar software.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2025 SteamWar.de-Serverteam
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.utils;
|
|
||||||
|
|
||||||
import de.steamwar.Reflection;
|
|
||||||
import de.steamwar.bausystem.features.util.NoClipCommand;
|
|
||||||
import io.papermc.paper.datacomponent.DataComponentTypes;
|
|
||||||
import io.papermc.paper.datacomponent.item.ItemContainerContents;
|
|
||||||
import net.minecraft.network.protocol.game.ClientboundContainerSetSlotPacket;
|
|
||||||
import net.minecraft.network.protocol.game.ClientboundExplodePacket;
|
|
||||||
import net.minecraft.network.protocol.game.ClientboundGameEventPacket;
|
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
|
||||||
import net.minecraft.server.level.ServerPlayerGameMode;
|
|
||||||
import net.minecraft.world.entity.player.Abilities;
|
|
||||||
import net.minecraft.world.level.GameType;
|
|
||||||
import org.bukkit.GameMode;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
|
||||||
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
public class NMSWrapper21 implements NMSWrapper {
|
|
||||||
|
|
||||||
private static final Reflection.Field<ServerPlayerGameMode> playerInteractManager = Reflection.getField(ServerPlayer.class, null, ServerPlayerGameMode.class);
|
|
||||||
private static final Reflection.Field<GameType> playerGameMode = Reflection.getField(ServerPlayerGameMode.class, GameType.class, 0);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setInternalGameMode(Player player, GameMode gameMode) {
|
|
||||||
playerGameMode.set(playerInteractManager.get(((CraftPlayer) player).getHandle()), GameType.byId(gameMode.getValue()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setSlotToItemStack(Player player, Object o) {
|
|
||||||
ClientboundContainerSetSlotPacket packetPlayInSetCreativeSlot = (ClientboundContainerSetSlotPacket) o;
|
|
||||||
int index = packetPlayInSetCreativeSlot.getSlot();
|
|
||||||
if (index >= 36 && index <= 44) {
|
|
||||||
index -= 36;
|
|
||||||
} else if (index > 44) {
|
|
||||||
index -= 5;
|
|
||||||
} else if (index <= 8) {
|
|
||||||
index = index - 8 + 36;
|
|
||||||
}
|
|
||||||
player.getInventory().setItem(index, CraftItemStack.asBukkitCopy(packetPlayInSetCreativeSlot.getItem()));
|
|
||||||
if (index < 9) player.getInventory().setHeldItemSlot(index);
|
|
||||||
player.updateInventory();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final Reflection.Field<ClientboundGameEventPacket.Type> gameStateChangeReason = Reflection.getField(NoClipCommand.gameStateChange, ClientboundGameEventPacket.Type.class, 14);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setGameStateChangeReason(Object packet) {
|
|
||||||
gameStateChangeReason.set(packet, ClientboundGameEventPacket.CHANGE_GAME_MODE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setPlayerBuildAbilities(Player player) {
|
|
||||||
Abilities abilities = (((CraftPlayer) player).getHandle()).getAbilities();
|
|
||||||
abilities.mayBuild = true;
|
|
||||||
abilities.mayfly = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Material pathMaterial() {
|
|
||||||
return Material.DIRT_PATH;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final int threshold = 2048;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean checkItemStack(ItemStack item) {
|
|
||||||
ItemContainerContents data = item.getData(DataComponentTypes.CONTAINER);
|
|
||||||
if (data == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return drillDown(data.contents(), 0, 0) > threshold;
|
|
||||||
}
|
|
||||||
|
|
||||||
private int drillDown(List<ItemStack> items, int layer, int start) {
|
|
||||||
if (layer > 2) return start + threshold;
|
|
||||||
int invalid = start;
|
|
||||||
for (int i = start; i < items.size(); i++) {
|
|
||||||
ItemStack item = items.get(i);
|
|
||||||
if (item.isEmpty()) continue;
|
|
||||||
|
|
||||||
invalid += item.getAmount();
|
|
||||||
|
|
||||||
ItemContainerContents data = item.getData(DataComponentTypes.CONTAINER);
|
|
||||||
if (data == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<ItemStack> subItems = data.contents();
|
|
||||||
if (subItems.size() > 1) {
|
|
||||||
invalid = drillDown(subItems, layer + 1, invalid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return invalid;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object resetExplosionKnockback(Object packet) {
|
|
||||||
ClientboundExplodePacket explosion = (ClientboundExplodePacket) packet;
|
|
||||||
|
|
||||||
return new ClientboundExplodePacket(
|
|
||||||
explosion.center(),
|
|
||||||
Optional.empty(),
|
|
||||||
explosion.explosionParticle(),
|
|
||||||
explosion.explosionSound()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of the SteamWar software.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2025 SteamWar.de-Serverteam
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.utils;
|
|
||||||
|
|
||||||
import net.minecraft.network.protocol.game.ServerboundMovePlayerPacket;
|
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
|
||||||
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public class PlayerMovementWrapper21 implements PlayerMovementWrapper {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setPosition(Player player, Object object) {
|
|
||||||
ServerboundMovePlayerPacket packetPlayInFlying = ((ServerboundMovePlayerPacket) object);
|
|
||||||
ServerPlayer serverPlayer = ((CraftPlayer) player).getHandle();
|
|
||||||
if (packetPlayInFlying.hasPos) {
|
|
||||||
serverPlayer.setPosRaw(packetPlayInFlying.x, packetPlayInFlying.y, packetPlayInFlying.z);
|
|
||||||
}
|
|
||||||
if (packetPlayInFlying.hasRot) {
|
|
||||||
serverPlayer.setXRot(packetPlayInFlying.xRot);
|
|
||||||
serverPlayer.setYRot(packetPlayInFlying.yRot);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object convertToOut(Player player, Object object) {
|
|
||||||
return object;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,149 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of the SteamWar software.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2025 SteamWar.de-Serverteam
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.utils;
|
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.TinyProtocol;
|
|
||||||
import de.steamwar.Reflection;
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
|
||||||
import net.minecraft.network.protocol.game.ClientboundTickingStatePacket;
|
|
||||||
import net.minecraft.server.MinecraftServer;
|
|
||||||
import net.minecraft.server.ServerTickRateManager;
|
|
||||||
import net.minecraft.world.TickRateManager;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public class TickManager21 implements TickManager {
|
|
||||||
private static final ServerTickRateManager manager = MinecraftServer.getServer().tickRateManager();
|
|
||||||
private static final Reflection.Field<Integer> frozenTicksToRun = Reflection.getField(TickRateManager.class, int.class, 0);
|
|
||||||
private static final Reflection.Field<Long> remainingSprintTicks = Reflection.getField(ServerTickRateManager.class, long.class, 0);
|
|
||||||
|
|
||||||
private boolean blockTpsPacket = true;
|
|
||||||
private int totalSteps;
|
|
||||||
|
|
||||||
public TickManager21() {
|
|
||||||
TinyProtocol.instance.addFilter(ClientboundTickingStatePacket.class, this::blockPacket);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Object blockPacket(Player player, Object packet) {
|
|
||||||
if (blockTpsPacket) {
|
|
||||||
return new ClientboundTickingStatePacket(20, manager.isFrozen());
|
|
||||||
} else {
|
|
||||||
return packet;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canFreeze() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setBlockTpsPacket(boolean block) {
|
|
||||||
blockTpsPacket = block;
|
|
||||||
if (blockTpsPacket) {
|
|
||||||
ClientboundTickingStatePacket packet = new ClientboundTickingStatePacket(20, manager.isFrozen());
|
|
||||||
Bukkit.getOnlinePlayers().forEach(player -> TinyProtocol.instance.sendPacket(player, packet));
|
|
||||||
} else {
|
|
||||||
ClientboundTickingStatePacket packet = new ClientboundTickingStatePacket(manager.tickrate(), manager.isFrozen());
|
|
||||||
Bukkit.getOnlinePlayers().forEach(player -> TinyProtocol.instance.sendPacket(player, packet));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setTickRate(float tickRate) {
|
|
||||||
if (isFrozen()) {
|
|
||||||
setFreeze(false);
|
|
||||||
}
|
|
||||||
manager.setTickRate(tickRate);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isFrozen() {
|
|
||||||
return manager.isFrozen();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setFreeze(boolean freeze) {
|
|
||||||
manager.setFrozen(freeze);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void stepTicks(int ticks) {
|
|
||||||
if (manager.isSprinting()) {
|
|
||||||
manager.stopSprinting();
|
|
||||||
} else if (manager.isSteppingForward()) {
|
|
||||||
manager.stopStepping();
|
|
||||||
}
|
|
||||||
this.totalSteps = ticks;
|
|
||||||
manager.setFrozen(true);
|
|
||||||
manager.stepGameIfPaused(ticks);
|
|
||||||
manager.setFrozen(false);
|
|
||||||
Bukkit.getScheduler().runTaskTimer(BauSystem.getInstance(), (bukkitTask) -> {
|
|
||||||
if (manager.isSteppingForward()) return;
|
|
||||||
manager.setFrozen(true);
|
|
||||||
bukkitTask.cancel();
|
|
||||||
}, 1, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void sprintTicks(int ticks) {
|
|
||||||
if (manager.isSteppingForward()) {
|
|
||||||
manager.stopStepping();
|
|
||||||
} else if (manager.isSprinting()) {
|
|
||||||
manager.stopSprinting();
|
|
||||||
}
|
|
||||||
this.totalSteps = ticks;
|
|
||||||
manager.requestGameToSprint(ticks, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isSprinting() {
|
|
||||||
return manager.isSprinting();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isStepping() {
|
|
||||||
return manager.isSteppingForward();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getTickRate() {
|
|
||||||
return manager.tickrate();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getRemainingTicks() {
|
|
||||||
if (isSprinting()) {
|
|
||||||
return remainingSprintTicks.get(manager);
|
|
||||||
} else {
|
|
||||||
return frozenTicksToRun.get(manager);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getDoneTicks() {
|
|
||||||
return totalSteps - getRemainingTicks();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getTotalTicks() {
|
|
||||||
return totalSteps;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -26,8 +26,8 @@ tasks.compileJava {
|
|||||||
}
|
}
|
||||||
|
|
||||||
java {
|
java {
|
||||||
sourceCompatibility = JavaVersion.VERSION_17
|
sourceCompatibility = JavaVersion.VERSION_21
|
||||||
targetCompatibility = JavaVersion.VERSION_17
|
targetCompatibility = JavaVersion.VERSION_21
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@@ -35,11 +35,14 @@ dependencies {
|
|||||||
annotationProcessor(libs.classindex)
|
annotationProcessor(libs.classindex)
|
||||||
compileOnly(project(":SpigotCore", "default"))
|
compileOnly(project(":SpigotCore", "default"))
|
||||||
|
|
||||||
compileOnly(libs.spigotapi)
|
|
||||||
compileOnly(libs.axiom)
|
compileOnly(libs.axiom)
|
||||||
compileOnly(libs.authlib)
|
compileOnly(libs.authlib)
|
||||||
|
|
||||||
compileOnly(libs.fawe18)
|
compileOnly(libs.paperapi)
|
||||||
|
compileOnly(libs.nms)
|
||||||
|
|
||||||
|
compileOnly(libs.fawe)
|
||||||
|
compileOnly(libs.netty)
|
||||||
|
|
||||||
implementation(libs.luaj)
|
implementation(libs.luaj)
|
||||||
implementation(files("$projectDir/../libs/YAPION-SNAPSHOT.jar"))
|
implementation(files("$projectDir/../libs/YAPION-SNAPSHOT.jar"))
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ import de.steamwar.bausystem.features.world.BauScoreboard;
|
|||||||
import de.steamwar.bausystem.linkage.BauGuiItem;
|
import de.steamwar.bausystem.linkage.BauGuiItem;
|
||||||
import de.steamwar.bausystem.region.RegionSystem;
|
import de.steamwar.bausystem.region.RegionSystem;
|
||||||
import de.steamwar.bausystem.utils.ScoreboardElement;
|
import de.steamwar.bausystem.utils.ScoreboardElement;
|
||||||
import de.steamwar.bausystem.utils.TickListener;
|
|
||||||
import de.steamwar.bausystem.utils.TickManager;
|
import de.steamwar.bausystem.utils.TickManager;
|
||||||
import de.steamwar.bausystem.worlddata.WorldData;
|
import de.steamwar.bausystem.worlddata.WorldData;
|
||||||
import de.steamwar.command.AbstractValidator;
|
import de.steamwar.command.AbstractValidator;
|
||||||
@@ -127,8 +126,6 @@ public class BauSystem extends JavaPlugin implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
TickListener.impl.init();
|
|
||||||
|
|
||||||
TraceManager.instance.init();
|
TraceManager.instance.init();
|
||||||
TraceRecorder.instance.init();
|
TraceRecorder.instance.init();
|
||||||
|
|
||||||
|
|||||||
+12
-4
@@ -76,13 +76,21 @@ public class AttributesCopyCommand extends SWCommand {
|
|||||||
if (itemStack.getType() == Material.ZOMBIE_HEAD && block.getType() == Material.ZOMBIE_WALL_HEAD) return true;
|
if (itemStack.getType() == Material.ZOMBIE_HEAD && block.getType() == Material.ZOMBIE_WALL_HEAD) return true;
|
||||||
if (itemStack.getType() == Material.CREEPER_HEAD && block.getType() == Material.CREEPER_WALL_HEAD) return true;
|
if (itemStack.getType() == Material.CREEPER_HEAD && block.getType() == Material.CREEPER_WALL_HEAD) return true;
|
||||||
if (itemStack.getType() == Material.DRAGON_HEAD && block.getType() == Material.DRAGON_WALL_HEAD) return true;
|
if (itemStack.getType() == Material.DRAGON_HEAD && block.getType() == Material.DRAGON_WALL_HEAD) return true;
|
||||||
if (itemStack.getType() == Material.SKELETON_SKULL && block.getType() == Material.SKELETON_WALL_SKULL) return true;
|
if (itemStack.getType() == Material.SKELETON_SKULL && block.getType() == Material.SKELETON_WALL_SKULL) {
|
||||||
if (itemStack.getType() == Material.WITHER_SKELETON_SKULL && block.getType() == Material.WITHER_SKELETON_WALL_SKULL) return true;
|
return true;
|
||||||
|
}
|
||||||
|
if (itemStack.getType() == Material.WITHER_SKELETON_SKULL && block.getType() == Material.WITHER_SKELETON_WALL_SKULL) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (itemStack.getType() == Material.TORCH && block.getType() == Material.WALL_TORCH) return true;
|
if (itemStack.getType() == Material.TORCH && block.getType() == Material.WALL_TORCH) return true;
|
||||||
if (itemStack.getType() == Material.SOUL_TORCH && block.getType() == Material.SOUL_WALL_TORCH) return true;
|
if (itemStack.getType() == Material.SOUL_TORCH && block.getType() == Material.SOUL_WALL_TORCH) return true;
|
||||||
if (itemStack.getType() == Material.REDSTONE_TORCH && block.getType() == Material.REDSTONE_WALL_TORCH) return true;
|
if (itemStack.getType() == Material.REDSTONE_TORCH && block.getType() == Material.REDSTONE_WALL_TORCH) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (itemStack.getType() == Material.WHEAT_SEEDS && block.getType() == Material.WHEAT) return true;
|
if (itemStack.getType() == Material.WHEAT_SEEDS && block.getType() == Material.WHEAT) return true;
|
||||||
if (itemStack.getType().name().contains("_BANNER") && block.getType().name().contains("_WALL_BANNER")) return true;
|
if (itemStack.getType().name().contains("_BANNER") && block.getType().name().contains("_WALL_BANNER")) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -104,7 +104,8 @@ public class BackupCommand extends SWCommand {
|
|||||||
List<String> lore = Arrays.asList(BauSystem.MESSAGE.parse("BACKUP_LORE", p));
|
List<String> lore = Arrays.asList(BauSystem.MESSAGE.parse("BACKUP_LORE", p));
|
||||||
for (int i = 0; i < backups.size(); i++) {
|
for (int i = 0; i < backups.size(); i++) {
|
||||||
RegionBackups.Backup backup = backups.get(i);
|
RegionBackups.Backup backup = backups.get(i);
|
||||||
SWItem swItem = new SWItem(Material.BRICK, BauSystem.MESSAGE.parse("BACKUP_ITEM_NAME", p, backup.getName()), lore, false, clickType -> {});
|
SWItem swItem = new SWItem(Material.BRICK, BauSystem.MESSAGE.parse("BACKUP_ITEM_NAME", p, backup.getName()), lore, false, clickType -> {
|
||||||
|
});
|
||||||
swItem.getItemStack().setAmount(i + 1);
|
swItem.getItemStack().setAmount(i + 1);
|
||||||
swListEntries.add(new SWListInv.SWListEntry<>(swItem, backup));
|
swListEntries.add(new SWListInv.SWListEntry<>(swItem, backup));
|
||||||
}
|
}
|
||||||
|
|||||||
+11
-10
@@ -21,9 +21,7 @@ package de.steamwar.bausystem.features.design.endstone;
|
|||||||
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.bausystem.region.Region;
|
import de.steamwar.bausystem.region.Region;
|
||||||
import de.steamwar.entity.REntity;
|
import de.steamwar.entity.*;
|
||||||
import de.steamwar.entity.REntityServer;
|
|
||||||
import de.steamwar.entity.RFallingBlockEntity;
|
|
||||||
import net.md_5.bungee.api.ChatMessageType;
|
import net.md_5.bungee.api.ChatMessageType;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@@ -59,15 +57,15 @@ public class DesignEndStone {
|
|||||||
.filter(material -> material.getBlastResistance() > region.getGameModeConfig().Schematic.MaxDesignBlastResistance)
|
.filter(material -> material.getBlastResistance() > region.getGameModeConfig().Schematic.MaxDesignBlastResistance)
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
calculateFromBottom = region.getGameModeConfig().Arena.NoFloor;
|
calculateFromBottom = region.getGameModeConfig().Arena.NoFloor;
|
||||||
|
}
|
||||||
|
|
||||||
entityServer.setCallback((player, rEntity, entityAction) -> {
|
private void interact(Player player, RInteraction entity, REntityAction action) {
|
||||||
if (entityAction != REntityServer.EntityAction.ATTACK) return;
|
if (action != REntityAction.ATTACK) return;
|
||||||
Location location = new Location(WORLD, rEntity.getX(), rEntity.getY(), rEntity.getZ());
|
Location location = new Location(WORLD, entity.getX(), entity.getY(), entity.getZ());
|
||||||
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
|
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
|
||||||
location.getBlock().breakNaturally();
|
location.getBlock().breakNaturally();
|
||||||
calc();
|
calc();
|
||||||
}, 1);
|
}, 1);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void calc() {
|
public void calc() {
|
||||||
@@ -110,12 +108,15 @@ public class DesignEndStone {
|
|||||||
Material material = WORLD.getBlockAt(cx, cy, cz).getType();
|
Material material = WORLD.getBlockAt(cx, cy, cz).getType();
|
||||||
|
|
||||||
if (material != Material.WATER && material != Material.LAVA && limited.contains(material)) {
|
if (material != Material.WATER && material != Material.LAVA && limited.contains(material)) {
|
||||||
Location location = new Location(WORLD, cx + 0.5, cy, cz + 0.5);
|
Location location = new Location(WORLD, cx, cy, cz);
|
||||||
if (!locations.add(location)) break;
|
if (!locations.add(location)) break;
|
||||||
RFallingBlockEntity entity = new RFallingBlockEntity(entityServer, location, Material.RED_STAINED_GLASS);
|
RBlockDisplay entity = new RBlockDisplay(entityServer, location);
|
||||||
entity.setNoGravity(true);
|
entity.setBlock(Material.RED_STAINED_GLASS.createBlockData());
|
||||||
entity.setGlowing(true);
|
entity.setGlowing(true);
|
||||||
entities.add(entity);
|
entities.add(entity);
|
||||||
|
RInteraction interaction = new RInteraction(entityServer, location);
|
||||||
|
interaction.setCallback(this::interact);
|
||||||
|
entities.add(interaction);
|
||||||
break;
|
break;
|
||||||
} else if (!material.isAir() && material != Material.WATER && material != Material.LAVA) {
|
} else if (!material.isAir() && material != Material.WATER && material != Material.LAVA) {
|
||||||
break;
|
break;
|
||||||
|
|||||||
+10
-9
@@ -26,8 +26,9 @@ import de.steamwar.bausystem.features.autostart.AutostartListener;
|
|||||||
import de.steamwar.bausystem.features.detonator.storage.DetonatorStorage;
|
import de.steamwar.bausystem.features.detonator.storage.DetonatorStorage;
|
||||||
import de.steamwar.bausystem.features.detonator.storage.ItemStorage;
|
import de.steamwar.bausystem.features.detonator.storage.ItemStorage;
|
||||||
import de.steamwar.core.SWPlayer;
|
import de.steamwar.core.SWPlayer;
|
||||||
|
import de.steamwar.entity.RBlockDisplay;
|
||||||
import de.steamwar.entity.REntityServer;
|
import de.steamwar.entity.REntityServer;
|
||||||
import de.steamwar.entity.RFallingBlockEntity;
|
import de.steamwar.entity.RInteraction;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.experimental.UtilityClass;
|
import lombok.experimental.UtilityClass;
|
||||||
@@ -58,10 +59,6 @@ public class Detonator {
|
|||||||
@Override
|
@Override
|
||||||
public void onMount(SWPlayer player) {
|
public void onMount(SWPlayer player) {
|
||||||
entities.addPlayer(player.getPlayer());
|
entities.addPlayer(player.getPlayer());
|
||||||
entities.setCallback((player1, entity, action) -> {
|
|
||||||
Vector vector = new Vector(entity.getX(), entity.getY(), entity.getZ());
|
|
||||||
DetonatorListener.addLocationToDetonator(vector.toLocation(player.getWorld()).getBlock().getLocation(), player1);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -70,8 +67,6 @@ public class Detonator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Vector HALF = new Vector(0.5, 0, 0.5);
|
|
||||||
|
|
||||||
public static boolean isDetonator(ItemStack itemStack) {
|
public static boolean isDetonator(ItemStack itemStack) {
|
||||||
return ItemStorage.isDetonator(itemStack);
|
return ItemStorage.isDetonator(itemStack);
|
||||||
}
|
}
|
||||||
@@ -79,8 +74,14 @@ public class Detonator {
|
|||||||
public static void showDetonator(Player p, List<Location> locs) {
|
public static void showDetonator(Player p, List<Location> locs) {
|
||||||
DetonatorComponent detonatorComponent = SWPlayer.of(p).getComponentOrDefault(DetonatorComponent.class, DetonatorComponent::new);
|
DetonatorComponent detonatorComponent = SWPlayer.of(p).getComponentOrDefault(DetonatorComponent.class, DetonatorComponent::new);
|
||||||
locs.forEach(location -> {
|
locs.forEach(location -> {
|
||||||
RFallingBlockEntity entity = new RFallingBlockEntity(detonatorComponent.entities, location.clone().add(HALF), Material.RED_STAINED_GLASS);
|
RBlockDisplay blockDisplay = new RBlockDisplay(detonatorComponent.entities, location);
|
||||||
entity.setNoGravity(true);
|
blockDisplay.setBlock(Material.RED_STAINED_GLASS.createBlockData());
|
||||||
|
|
||||||
|
RInteraction interaction = new RInteraction(detonatorComponent.entities, location);
|
||||||
|
interaction.setCallback((player, entity, action) -> {
|
||||||
|
Vector vector = new Vector(entity.getX(), entity.getY(), entity.getZ());
|
||||||
|
DetonatorListener.addLocationToDetonator(vector.toLocation(player.getWorld()).getBlock().getLocation(), player);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-2
@@ -22,7 +22,6 @@ package de.steamwar.bausystem.features.gui.editor;
|
|||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.bausystem.features.gui.BauGUI;
|
import de.steamwar.bausystem.features.gui.BauGUI;
|
||||||
import de.steamwar.bausystem.linkage.BauGuiItem;
|
import de.steamwar.bausystem.linkage.BauGuiItem;
|
||||||
import de.steamwar.core.TrickyTrialsWrapper;
|
|
||||||
import de.steamwar.data.CMDs;
|
import de.steamwar.data.CMDs;
|
||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
import de.steamwar.inventory.SWListInv;
|
import de.steamwar.inventory.SWListInv;
|
||||||
@@ -74,7 +73,7 @@ public class BauGuiEditor implements Listener {
|
|||||||
|
|
||||||
inv.setItem(mapping.getSize() + 5, new SWItem(Material.BARRIER, BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_TRASH", p), Arrays.asList(BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_TRASH_LORE", p)), false, clickType -> {
|
inv.setItem(mapping.getSize() + 5, new SWItem(Material.BARRIER, BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_TRASH", p), Arrays.asList(BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_TRASH_LORE", p)), false, clickType -> {
|
||||||
}).getItemStack());
|
}).getItemStack());
|
||||||
inv.setItem(mapping.getSize() + 6, new SWItem(TrickyTrialsWrapper.impl.getTurtleScute(), BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_MORE", p)).getItemStack());
|
inv.setItem(mapping.getSize() + 6, new SWItem(Material.TURTLE_SCUTE, BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_MORE", p)).getItemStack());
|
||||||
inv.setItem(mapping.getSize() + 8, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_CLOSE", p)).setCustomModelData(CMDs.BACK).getItemStack());
|
inv.setItem(mapping.getSize() + 8, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_CLOSE", p)).setCustomModelData(CMDs.BACK).getItemStack());
|
||||||
|
|
||||||
p.openInventory(inv);
|
p.openInventory(inv);
|
||||||
|
|||||||
+2
-1
@@ -50,7 +50,8 @@ public class InventoryFillBauGuiItem extends BauGuiItem {
|
|||||||
@Override
|
@Override
|
||||||
public ItemStack getItem(Player player) {
|
public ItemStack getItem(Player player) {
|
||||||
String loreKey = Config.getInstance().get(player).getPlainValueOrDefault("inventoryfill", false) ? "OTHER_ITEMS_INVENTORY_FILL_LORE_ACTIVE" : "OTHER_ITEMS_INVENTORY_FILL_LORE_INACTIVE";
|
String loreKey = Config.getInstance().get(player).getPlainValueOrDefault("inventoryfill", false) ? "OTHER_ITEMS_INVENTORY_FILL_LORE_ACTIVE" : "OTHER_ITEMS_INVENTORY_FILL_LORE_INACTIVE";
|
||||||
return new SWItem(Material.HOPPER, BauSystem.MESSAGE.parse("OTHER_ITEMS_INVENTORY_FILL_NAME", player), Collections.singletonList(BauSystem.MESSAGE.parse(loreKey, player)), false, clickType -> {}).getItemStack();
|
return new SWItem(Material.HOPPER, BauSystem.MESSAGE.parse("OTHER_ITEMS_INVENTORY_FILL_NAME", player), Collections.singletonList(BauSystem.MESSAGE.parse(loreKey, player)), false, clickType -> {
|
||||||
|
}).getItemStack();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+9
-5
@@ -24,9 +24,9 @@ import de.steamwar.bausystem.region.Point;
|
|||||||
import de.steamwar.bausystem.region.Region;
|
import de.steamwar.bausystem.region.Region;
|
||||||
import de.steamwar.bausystem.utils.bossbar.BauSystemBossbar;
|
import de.steamwar.bausystem.utils.bossbar.BauSystemBossbar;
|
||||||
import de.steamwar.bausystem.utils.bossbar.BossBarService;
|
import de.steamwar.bausystem.utils.bossbar.BossBarService;
|
||||||
|
import de.steamwar.entity.RBlockDisplay;
|
||||||
import de.steamwar.entity.REntity;
|
import de.steamwar.entity.REntity;
|
||||||
import de.steamwar.entity.REntityServer;
|
import de.steamwar.entity.REntityServer;
|
||||||
import de.steamwar.entity.RFallingBlockEntity;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
@@ -104,7 +104,9 @@ public class KillcheckerVisualizer {
|
|||||||
Block block = WORLD.getBlockAt(x, y, z);
|
Block block = WORLD.getBlockAt(x, y, z);
|
||||||
if (block.getType().isAir()) continue;
|
if (block.getType().isAir()) continue;
|
||||||
String name = block.getType().name();
|
String name = block.getType().name();
|
||||||
if (!name.endsWith("_WOOL") && !name.endsWith("_STAINED_GLASS") && !name.endsWith("_CONCRETE") && !name.endsWith("_TERRACOTTA")) continue;
|
if (!name.endsWith("_WOOL") && !name.endsWith("_STAINED_GLASS") && !name.endsWith("_CONCRETE") && !name.endsWith("_TERRACOTTA")) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (name.equals("_GLAZED_TERRACOTTA")) continue;
|
if (name.equals("_GLAZED_TERRACOTTA")) continue;
|
||||||
Cuboid cuboid = create(block.getType(), x, y, z);
|
Cuboid cuboid = create(block.getType(), x, y, z);
|
||||||
cuboids.add(cuboid);
|
cuboids.add(cuboid);
|
||||||
@@ -283,11 +285,13 @@ public class KillcheckerVisualizer {
|
|||||||
}
|
}
|
||||||
kill.forEach((point, count) -> {
|
kill.forEach((point, count) -> {
|
||||||
if (rEntities.containsKey(point)) {
|
if (rEntities.containsKey(point)) {
|
||||||
if (killCount.get(point) == count && outlinePoints.contains(point) == outlinePointsCacheLast.contains(point)) return;
|
if (killCount.get(point) == count && outlinePoints.contains(point) == outlinePointsCacheLast.contains(point)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
rEntities.get(point).die();
|
rEntities.get(point).die();
|
||||||
}
|
}
|
||||||
RFallingBlockEntity entity = new RFallingBlockEntity(outlinePoints.contains(point) ? outline : inner, point.toLocation(WORLD, 0.5, 0, 0.5), MATERIALS[Math.min(count - 1, MATERIALS.length) - 1]);
|
RBlockDisplay entity = new RBlockDisplay(outlinePoints.contains(point) ? outline : inner, point.toLocation(WORLD, 0.5, 0, 0.5));
|
||||||
entity.setNoGravity(true);
|
entity.setBlock(MATERIALS[Math.min(count - 1, MATERIALS.length) - 1].createBlockData());
|
||||||
rEntities.put(point, entity);
|
rEntities.put(point, entity);
|
||||||
if (outlinePoints.contains(point)) outlinePointsCache.add(point);
|
if (outlinePoints.contains(point)) outlinePointsCache.add(point);
|
||||||
killCount.put(point, count);
|
killCount.put(point, count);
|
||||||
|
|||||||
@@ -213,7 +213,8 @@ public class Loader implements Listener, SWPlayer.Component {
|
|||||||
};
|
};
|
||||||
updateRunnable.run();
|
updateRunnable.run();
|
||||||
|
|
||||||
SWListInv<LoaderElement> swListInv = new SWListInv<>(p, BauSystem.MESSAGE.parse("LOADER_GUI_TITLE", p), false, list, (clickType, loaderElement) -> {});
|
SWListInv<LoaderElement> swListInv = new SWListInv<>(p, BauSystem.MESSAGE.parse("LOADER_GUI_TITLE", p), false, list, (clickType, loaderElement) -> {
|
||||||
|
});
|
||||||
swListInv.setCallback((clickType, entry) -> entry.click(p, () -> {
|
swListInv.setCallback((clickType, entry) -> entry.click(p, () -> {
|
||||||
updateRunnable.run();
|
updateRunnable.run();
|
||||||
swListInv.open();
|
swListInv.open();
|
||||||
@@ -363,7 +364,9 @@ public class Loader implements Listener, SWPlayer.Component {
|
|||||||
public static int LENGTH = SettingsSorting.values().length;
|
public static int LENGTH = SettingsSorting.values().length;
|
||||||
|
|
||||||
public abstract Material getMaterial();
|
public abstract Material getMaterial();
|
||||||
|
|
||||||
public abstract String getName();
|
public abstract String getName();
|
||||||
|
|
||||||
public abstract boolean shouldShow(LoaderElement previous, LoaderElement current, LoaderElement next);
|
public abstract boolean shouldShow(LoaderElement previous, LoaderElement current, LoaderElement next);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
@@ -26,6 +26,8 @@ import java.util.function.Consumer;
|
|||||||
|
|
||||||
public interface LoaderElement {
|
public interface LoaderElement {
|
||||||
SWItem menu(Player player);
|
SWItem menu(Player player);
|
||||||
|
|
||||||
void execute(Consumer<Long> delay);
|
void execute(Consumer<Long> delay);
|
||||||
|
|
||||||
void click(Player player, Runnable backAction);
|
void click(Player player, Runnable backAction);
|
||||||
}
|
}
|
||||||
|
|||||||
+14
-6
@@ -95,7 +95,8 @@ public abstract class LoaderInteractionElement<T extends Enum<T> & LoaderSetting
|
|||||||
};
|
};
|
||||||
updateRunnable.run();
|
updateRunnable.run();
|
||||||
|
|
||||||
SWListInv<Integer> listInv = new SWListInv<>(player, "Interaction Settings", false, entries, (clickType, entry) -> {});
|
SWListInv<Integer> listInv = new SWListInv<>(player, "Interaction Settings", false, entries, (clickType, entry) -> {
|
||||||
|
});
|
||||||
listInv.setCallback((clickType, entry) -> {
|
listInv.setCallback((clickType, entry) -> {
|
||||||
openIndividualSettingsMenu(player, entry, () -> {
|
openIndividualSettingsMenu(player, entry, () -> {
|
||||||
updateRunnable.run();
|
updateRunnable.run();
|
||||||
@@ -150,7 +151,10 @@ public abstract class LoaderInteractionElement<T extends Enum<T> & LoaderSetting
|
|||||||
}
|
}
|
||||||
|
|
||||||
SWInventory swInventory = new SWInventory(player, guiSize, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_TITLE", player));
|
SWInventory swInventory = new SWInventory(player, guiSize, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_TITLE", player));
|
||||||
for (int i = guiSize - 9; i < guiSize; i++) swInventory.setItem(i, new SWItem(Material.GRAY_STAINED_GLASS_PANE, "§7", clickType -> {}));
|
for (int i = guiSize - 9; i < guiSize; i++) {
|
||||||
|
swInventory.setItem(i, new SWItem(Material.GRAY_STAINED_GLASS_PANE, "§7", clickType -> {
|
||||||
|
}));
|
||||||
|
}
|
||||||
swInventory.setItem(guiSize - 9, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_BACK", player)).setCustomModelData(CMDs.BACK).getItemStack(), clickType -> back.run());
|
swInventory.setItem(guiSize - 9, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_BACK", player)).setCustomModelData(CMDs.BACK).getItemStack(), clickType -> back.run());
|
||||||
swInventory.setItem(guiSize - 5, new SWItem(Material.WOODEN_AXE, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_COPY", player)).getItemStack(), clickType -> {
|
swInventory.setItem(guiSize - 5, new SWItem(Material.WOODEN_AXE, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_COPY", player)).getItemStack(), clickType -> {
|
||||||
SWAnvilInv swAnvilInv = new SWAnvilInv(player, BauSystem.MESSAGE.parse("LOADER_GUI_COPY_TITLE", player), "1");
|
SWAnvilInv swAnvilInv = new SWAnvilInv(player, BauSystem.MESSAGE.parse("LOADER_GUI_COPY_TITLE", player), "1");
|
||||||
@@ -197,7 +201,8 @@ public abstract class LoaderInteractionElement<T extends Enum<T> & LoaderSetting
|
|||||||
for (int power = 0; power < 16; power++) {
|
for (int power = 0; power < 16; power++) {
|
||||||
int finalPowerPosition = power;
|
int finalPowerPosition = power;
|
||||||
if (power >= 9) finalPowerPosition++;
|
if (power >= 9) finalPowerPosition++;
|
||||||
SWItem powerItem = new SWItem(Material.REDSTONE, BauSystem.MESSAGE.parse("LOADER_SETTING_POWER", player, power), Arrays.asList(), false, clickType -> {});
|
SWItem powerItem = new SWItem(Material.REDSTONE, BauSystem.MESSAGE.parse("LOADER_SETTING_POWER", player, power), Arrays.asList(), false, clickType -> {
|
||||||
|
});
|
||||||
powerItem.getItemStack().setAmount(Math.max(power, 1));
|
powerItem.getItemStack().setAmount(Math.max(power, 1));
|
||||||
if (extraPower.get(index) == power) powerItem.setEnchanted(true);
|
if (extraPower.get(index) == power) powerItem.setEnchanted(true);
|
||||||
|
|
||||||
@@ -210,7 +215,8 @@ public abstract class LoaderInteractionElement<T extends Enum<T> & LoaderSetting
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (currentElement.hasTicks(this)) {
|
if (currentElement.hasTicks(this)) {
|
||||||
swInventory.setItem(ticksStart + 3, new SWItem(SWItem.getDye(1), BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_REMOVE_ONE", player), Arrays.asList(BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_REMOVE_ONE_SHIFT", player)), false, clickType -> {}).getItemStack(), clickType -> {
|
swInventory.setItem(ticksStart + 3, new SWItem(Material.RED_DYE, BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_REMOVE_ONE", player), Arrays.asList(BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_REMOVE_ONE_SHIFT", player)), false, clickType -> {
|
||||||
|
}).getItemStack(), clickType -> {
|
||||||
long ticks = extraTicks.get(index);
|
long ticks = extraTicks.get(index);
|
||||||
ticks -= clickType.isShiftClick() ? 5 : 1;
|
ticks -= clickType.isShiftClick() ? 5 : 1;
|
||||||
if (ticks < 1) ticks = 1;
|
if (ticks < 1) ticks = 1;
|
||||||
@@ -218,7 +224,8 @@ public abstract class LoaderInteractionElement<T extends Enum<T> & LoaderSetting
|
|||||||
openIndividualSettingsMenu(player, index, back, delete);
|
openIndividualSettingsMenu(player, index, back, delete);
|
||||||
});
|
});
|
||||||
|
|
||||||
SWItem ticksItem = new SWItem(Material.CLOCK, BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS", player, extraTicks.get(index)), Arrays.asList(BauSystem.MESSAGE.parse("LOADER_GUI_CLICK_TO_EDIT", player)), false, clickType -> {});
|
SWItem ticksItem = new SWItem(Material.CLOCK, BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS", player, extraTicks.get(index)), Arrays.asList(BauSystem.MESSAGE.parse("LOADER_GUI_CLICK_TO_EDIT", player)), false, clickType -> {
|
||||||
|
});
|
||||||
ticksItem.getItemStack().setAmount((int) Math.min(extraTicks.get(index), 64));
|
ticksItem.getItemStack().setAmount((int) Math.min(extraTicks.get(index), 64));
|
||||||
swInventory.setItem(ticksStart + 4, ticksItem.getItemStack(), clickType -> {
|
swInventory.setItem(ticksStart + 4, ticksItem.getItemStack(), clickType -> {
|
||||||
SWAnvilInv swAnvilInv = new SWAnvilInv(player, BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_NAME", player), extraTicks.get(index) + "");
|
SWAnvilInv swAnvilInv = new SWAnvilInv(player, BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_NAME", player), extraTicks.get(index) + "");
|
||||||
@@ -234,7 +241,8 @@ public abstract class LoaderInteractionElement<T extends Enum<T> & LoaderSetting
|
|||||||
swAnvilInv.open();
|
swAnvilInv.open();
|
||||||
});
|
});
|
||||||
|
|
||||||
swInventory.setItem(ticksStart + 5, new SWItem(SWItem.getDye(10), BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_ADD_ONE", player), Arrays.asList(BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_ADD_ONE_SHIFT", player)), false, clickType -> {}).getItemStack(), clickType -> {
|
swInventory.setItem(ticksStart + 5, new SWItem(Material.LIME_DYE, BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_ADD_ONE", player), Arrays.asList(BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_ADD_ONE_SHIFT", player)), false, clickType -> {
|
||||||
|
}).getItemStack(), clickType -> {
|
||||||
long ticks = extraTicks.get(index);
|
long ticks = extraTicks.get(index);
|
||||||
ticks += clickType.isShiftClick() ? 5 : 1;
|
ticks += clickType.isShiftClick() ? 5 : 1;
|
||||||
extraTicks.set(index, ticks);
|
extraTicks.set(index, ticks);
|
||||||
|
|||||||
+3
@@ -28,10 +28,13 @@ import java.util.function.Consumer;
|
|||||||
|
|
||||||
public interface LoaderSettingsEnum<T, P extends LoaderInteractionElement<E>, E extends Enum<E> & LoaderSettingsEnum<T, P, E>> {
|
public interface LoaderSettingsEnum<T, P extends LoaderInteractionElement<E>, E extends Enum<E> & LoaderSettingsEnum<T, P, E>> {
|
||||||
int getPos();
|
int getPos();
|
||||||
|
|
||||||
SWItem menu(Player player, P parent, int power, long ticks);
|
SWItem menu(Player player, P parent, int power, long ticks);
|
||||||
|
|
||||||
default boolean hasPower(P parent) {
|
default boolean hasPower(P parent) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
default boolean hasTicks(P parent) {
|
default boolean hasTicks(P parent) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-2
@@ -63,7 +63,8 @@ public class LoaderWait implements LoaderElement {
|
|||||||
for (int i = 9; i < 18; i++) swInventory.setItem(i, new SWItem(Material.GRAY_STAINED_GLASS_PANE, "§7"));
|
for (int i = 9; i < 18; i++) swInventory.setItem(i, new SWItem(Material.GRAY_STAINED_GLASS_PANE, "§7"));
|
||||||
swInventory.setItem(9, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("LOADER_GUI_WAIT_BACK", player)).setCustomModelData(CMDs.BACK).getItemStack(), clickType -> backAction.run());
|
swInventory.setItem(9, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("LOADER_GUI_WAIT_BACK", player)).setCustomModelData(CMDs.BACK).getItemStack(), clickType -> backAction.run());
|
||||||
|
|
||||||
swInventory.setItem(3, new SWItem(SWItem.getDye(1), BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_REMOVE_ONE", player), Arrays.asList(BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_REMOVE_ONE_SHIFT", player)), false, clickType -> {}).getItemStack(), clickType -> {
|
swInventory.setItem(3, new SWItem(Material.RED_DYE, BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_REMOVE_ONE", player), Arrays.asList(BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_REMOVE_ONE_SHIFT", player)), false, clickType -> {
|
||||||
|
}).getItemStack(), clickType -> {
|
||||||
delay -= clickType.isShiftClick() ? 5 : 1;
|
delay -= clickType.isShiftClick() ? 5 : 1;
|
||||||
if (delay < 0) delay = 0;
|
if (delay < 0) delay = 0;
|
||||||
swInventory.setItem(4, menu(player));
|
swInventory.setItem(4, menu(player));
|
||||||
@@ -80,7 +81,8 @@ public class LoaderWait implements LoaderElement {
|
|||||||
});
|
});
|
||||||
swAnvilInv.open();
|
swAnvilInv.open();
|
||||||
});
|
});
|
||||||
swInventory.setItem(5, new SWItem(SWItem.getDye(10), BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_ADD_ONE", player), Arrays.asList(BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_ADD_ONE_SHIFT", player)), false, clickType -> {}).getItemStack(), clickType -> {
|
swInventory.setItem(5, new SWItem(Material.LIME_DYE, BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_ADD_ONE", player), Arrays.asList(BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_ADD_ONE_SHIFT", player)), false, clickType -> {
|
||||||
|
}).getItemStack(), clickType -> {
|
||||||
delay += clickType.isShiftClick() ? 5 : 1;
|
delay += clickType.isShiftClick() ? 5 : 1;
|
||||||
swInventory.setItem(4, menu(player));
|
swInventory.setItem(4, menu(player));
|
||||||
});
|
});
|
||||||
|
|||||||
+2
-4
@@ -146,8 +146,7 @@ public class Loadtimer implements Listener {
|
|||||||
if ((stage == Stage.COUNTING || stage == Stage.ACTIVATED)) {
|
if ((stage == Stage.COUNTING || stage == Stage.ACTIVATED)) {
|
||||||
stage = Stage.IGNITION;
|
stage = Stage.IGNITION;
|
||||||
ignite = TPSUtils.currentRealTick.get();
|
ignite = TPSUtils.currentRealTick.get();
|
||||||
if (activate == -1)
|
if (activate == -1) activate = TPSUtils.currentRealTick.get();
|
||||||
activate = TPSUtils.currentRealTick.get();
|
|
||||||
if (finishOnActive) {
|
if (finishOnActive) {
|
||||||
stage = Stage.END;
|
stage = Stage.END;
|
||||||
print();
|
print();
|
||||||
@@ -184,8 +183,7 @@ public class Loadtimer implements Listener {
|
|||||||
|
|
||||||
long ignTime = ignite - activate;
|
long ignTime = ignite - activate;
|
||||||
long explTime = explode - ignTime - activate;
|
long explTime = explode - ignTime - activate;
|
||||||
if (explTime < 0)
|
if (explTime < 0) explTime = loadTime;
|
||||||
explTime = loadTime;
|
|
||||||
|
|
||||||
int finalAllTnt = allTnt;
|
int finalAllTnt = allTnt;
|
||||||
long finalExplTime = explTime;
|
long finalExplTime = explTime;
|
||||||
|
|||||||
+4
-2
@@ -40,17 +40,19 @@ public class LoadtimerCommand extends SWCommand {
|
|||||||
public void start(@Validator Player p, TimerMode mode) {
|
public void start(@Validator Player p, TimerMode mode) {
|
||||||
Region r = Region.getRegion(p.getLocation());
|
Region r = Region.getRegion(p.getLocation());
|
||||||
if (r.getType().isGlobal()) return;
|
if (r.getType().isGlobal()) return;
|
||||||
if (!Loadtimer.hasTimer(r))
|
if (!Loadtimer.hasTimer(r)) {
|
||||||
Loadtimer.createLoadtimer(r, mode == TimerMode.HALF);
|
Loadtimer.createLoadtimer(r, mode == TimerMode.HALF);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Register(value = "stop", description = "LOADTIMER_HELP_STOP")
|
@Register(value = "stop", description = "LOADTIMER_HELP_STOP")
|
||||||
public void stop(@Validator Player p) {
|
public void stop(@Validator Player p) {
|
||||||
Region r = Region.getRegion(p.getLocation());
|
Region r = Region.getRegion(p.getLocation());
|
||||||
if (r.getType().isGlobal()) return;
|
if (r.getType().isGlobal()) return;
|
||||||
if (Loadtimer.hasTimer(r))
|
if (Loadtimer.hasTimer(r)) {
|
||||||
Loadtimer.getTimer(r).delete();
|
Loadtimer.getTimer(r).delete();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public enum TimerMode {
|
public enum TimerMode {
|
||||||
FULL,
|
FULL,
|
||||||
|
|||||||
+2
-1
@@ -46,8 +46,9 @@ public class LoadtimerGuiItem extends BauGuiItem {
|
|||||||
@Override
|
@Override
|
||||||
public ItemStack getItem(Player player) {
|
public ItemStack getItem(Player player) {
|
||||||
Region r = Region.getRegion(player.getLocation());
|
Region r = Region.getRegion(player.getLocation());
|
||||||
if (r.getType().isGlobal())
|
if (r.getType().isGlobal()) {
|
||||||
return new SWItem(Material.BOWL, BauSystem.MESSAGE.parse("LOADTIMER_GUI_GLOBAL", player)).getItemStack();
|
return new SWItem(Material.BOWL, BauSystem.MESSAGE.parse("LOADTIMER_GUI_GLOBAL", player)).getItemStack();
|
||||||
|
}
|
||||||
if (Loadtimer.hasTimer(r)) {
|
if (Loadtimer.hasTimer(r)) {
|
||||||
return new SWItem(Material.BOW, BauSystem.MESSAGE.parse("LOADTIMER_GUI_STOP", player)).getItemStack();
|
return new SWItem(Material.BOW, BauSystem.MESSAGE.parse("LOADTIMER_GUI_STOP", player)).getItemStack();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+3
-3
@@ -20,9 +20,9 @@
|
|||||||
package de.steamwar.bausystem.features.loadtimer;
|
package de.steamwar.bausystem.features.loadtimer;
|
||||||
|
|
||||||
import de.steamwar.bausystem.region.Region;
|
import de.steamwar.bausystem.region.Region;
|
||||||
import de.steamwar.core.TrickyTrialsWrapper;
|
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
@@ -57,7 +57,7 @@ public class LoadtimerListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onEntitySpawn(EntitySpawnEvent event) {
|
public void onEntitySpawn(EntitySpawnEvent event) {
|
||||||
if (!getTimers().isEmpty() && event.getEntityType() == TrickyTrialsWrapper.impl.getTntEntityType()) {
|
if (!getTimers().isEmpty() && event.getEntityType() == EntityType.TNT) {
|
||||||
Region r = Region.getRegion(event.getLocation());
|
Region r = Region.getRegion(event.getLocation());
|
||||||
if (hasTimer(r)) {
|
if (hasTimer(r)) {
|
||||||
getTimer(r).onTntSpawn();
|
getTimer(r).onTntSpawn();
|
||||||
@@ -67,7 +67,7 @@ public class LoadtimerListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onEntityExplode(EntityExplodeEvent event) {
|
public void onEntityExplode(EntityExplodeEvent event) {
|
||||||
if (!getTimers().isEmpty() && event.getEntityType() == TrickyTrialsWrapper.impl.getTntEntityType()) {
|
if (!getTimers().isEmpty() && event.getEntityType() == EntityType.TNT) {
|
||||||
Region r = Region.getRegion(event.getLocation());
|
Region r = Region.getRegion(event.getLocation());
|
||||||
if (hasTimer(r)) {
|
if (hasTimer(r)) {
|
||||||
getTimer(r).onTntExplode(event);
|
getTimer(r).onTntExplode(event);
|
||||||
|
|||||||
+3
-4
@@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.features.observer;
|
package de.steamwar.bausystem.features.observer;
|
||||||
|
|
||||||
import de.steamwar.Reflection;
|
|
||||||
import de.steamwar.bausystem.region.Point;
|
import de.steamwar.bausystem.region.Point;
|
||||||
import de.steamwar.core.SWPlayer;
|
import de.steamwar.core.SWPlayer;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@@ -29,8 +28,9 @@ import org.bukkit.block.Block;
|
|||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.block.data.Bisected;
|
import org.bukkit.block.data.Bisected;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
import org.bukkit.block.data.type.Observer;
|
|
||||||
import org.bukkit.block.data.type.*;
|
import org.bukkit.block.data.type.*;
|
||||||
|
import org.bukkit.block.data.type.Observer;
|
||||||
|
import org.bukkit.craftbukkit.block.impl.CraftPoweredRail;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@@ -171,7 +171,6 @@ public class ObserverTracer implements SWPlayer.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Class<?> craftPoweredRail = Reflection.getClass("org.bukkit.craftbukkit.block.impl.CraftPoweredRail");
|
|
||||||
private boolean checkAllowed(Block block, BlockData blockData) {
|
private boolean checkAllowed(Block block, BlockData blockData) {
|
||||||
if (checkMaterial(block)) return true;
|
if (checkMaterial(block)) return true;
|
||||||
if (block.getType() == Material.BELL) {
|
if (block.getType() == Material.BELL) {
|
||||||
@@ -180,7 +179,7 @@ public class ObserverTracer implements SWPlayer.Component {
|
|||||||
|
|
||||||
return blockData instanceof Door
|
return blockData instanceof Door
|
||||||
|| blockData instanceof Gate
|
|| blockData instanceof Gate
|
||||||
|| craftPoweredRail.isInstance(blockData)
|
|| blockData instanceof CraftPoweredRail
|
||||||
|| blockData instanceof TrapDoor
|
|| blockData instanceof TrapDoor
|
||||||
|| blockData instanceof GlassPane;
|
|| blockData instanceof GlassPane;
|
||||||
}
|
}
|
||||||
|
|||||||
-2
@@ -28,7 +28,6 @@ import de.steamwar.command.SWCommand;
|
|||||||
import de.steamwar.entity.CRay;
|
import de.steamwar.entity.CRay;
|
||||||
import de.steamwar.entity.REntityServer;
|
import de.steamwar.entity.REntityServer;
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import de.steamwar.linkage.MinVersion;
|
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -42,7 +41,6 @@ import org.bukkit.util.RayTraceResult;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Linked
|
@Linked
|
||||||
@MinVersion(20)
|
|
||||||
public class RayVisualizerCommand extends SWCommand implements Listener {
|
public class RayVisualizerCommand extends SWCommand implements Listener {
|
||||||
|
|
||||||
private BlockData VISIBLE = Material.LIME_CONCRETE.createBlockData();
|
private BlockData VISIBLE = Material.LIME_CONCRETE.createBlockData();
|
||||||
|
|||||||
+6
-2
@@ -36,12 +36,16 @@ public class FireListener implements Listener, ScoreboardElement {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onFireDamage(BlockBurnEvent e) {
|
public void onFireDamage(BlockBurnEvent e) {
|
||||||
if (Region.getRegion(e.getBlock().getLocation()).getRegionData().get(Flag.FIRE).isWithDefault(FireMode.DENY)) e.setCancelled(true);
|
if (Region.getRegion(e.getBlock().getLocation()).getRegionData().get(Flag.FIRE).isWithDefault(FireMode.DENY)) {
|
||||||
|
e.setCancelled(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onFireSpread(BlockSpreadEvent e) {
|
public void onFireSpread(BlockSpreadEvent e) {
|
||||||
if (Region.getRegion(e.getBlock().getLocation()).getRegionData().get(Flag.FIRE).isWithDefault(FireMode.DENY)) e.setCancelled(true);
|
if (Region.getRegion(e.getBlock().getLocation()).getRegionData().get(Flag.FIRE).isWithDefault(FireMode.DENY)) {
|
||||||
|
e.setCancelled(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+11
-7
@@ -24,8 +24,6 @@ import de.steamwar.bausystem.region.Region;
|
|||||||
import de.steamwar.bausystem.region.flags.Flag;
|
import de.steamwar.bausystem.region.flags.Flag;
|
||||||
import de.steamwar.bausystem.region.flags.FreezeMode;
|
import de.steamwar.bausystem.region.flags.FreezeMode;
|
||||||
import de.steamwar.bausystem.utils.ScoreboardElement;
|
import de.steamwar.bausystem.utils.ScoreboardElement;
|
||||||
import de.steamwar.core.Core;
|
|
||||||
import de.steamwar.core.TrickyTrialsWrapper;
|
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@@ -33,6 +31,7 @@ import org.bukkit.block.Block;
|
|||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.block.data.type.NoteBlock;
|
import org.bukkit.block.data.type.NoteBlock;
|
||||||
import org.bukkit.block.data.type.Switch;
|
import org.bukkit.block.data.type.Switch;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
@@ -48,7 +47,9 @@ public class FreezeListener implements Listener, ScoreboardElement {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onBlockExplode(BlockExplodeEvent e) {
|
public void onBlockExplode(BlockExplodeEvent e) {
|
||||||
if (Region.getRegion(e.getBlock().getLocation()).getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.INACTIVE)) return;
|
if (Region.getRegion(e.getBlock().getLocation()).getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.INACTIVE)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
BlockState state = e.getBlock().getState();
|
BlockState state = e.getBlock().getState();
|
||||||
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
|
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
|
||||||
@@ -58,9 +59,11 @@ public class FreezeListener implements Listener, ScoreboardElement {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onEntitySpawn(EntitySpawnEvent e) {
|
public void onEntitySpawn(EntitySpawnEvent e) {
|
||||||
if (Region.getRegion(e.getLocation()).getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.INACTIVE)) return;
|
if (Region.getRegion(e.getLocation()).getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.INACTIVE)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
if (e.getEntityType() == TrickyTrialsWrapper.impl.getTntEntityType()) {
|
if (e.getEntityType() == EntityType.TNT) {
|
||||||
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
|
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
|
||||||
e.getLocation().getBlock().setType(Material.TNT, false);
|
e.getLocation().getBlock().setType(Material.TNT, false);
|
||||||
}, 1L);
|
}, 1L);
|
||||||
@@ -70,7 +73,9 @@ public class FreezeListener implements Listener, ScoreboardElement {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onBlockCanBuild(BlockCanBuildEvent e) {
|
public void onBlockCanBuild(BlockCanBuildEvent e) {
|
||||||
if (!e.isBuildable()) return;
|
if (!e.isBuildable()) return;
|
||||||
if (Region.getRegion(e.getBlock().getLocation()).getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.INACTIVE)) return;
|
if (Region.getRegion(e.getBlock().getLocation()).getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.INACTIVE)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (e.getMaterial() == Material.TNT) {
|
if (e.getMaterial() == Material.TNT) {
|
||||||
e.setBuildable(false);
|
e.setBuildable(false);
|
||||||
e.getBlock().setType(Material.TNT, false);
|
e.getBlock().setType(Material.TNT, false);
|
||||||
@@ -155,7 +160,6 @@ public class FreezeListener implements Listener, ScoreboardElement {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onBlockBreak(BlockBreakEvent e) {
|
public void onBlockBreak(BlockBreakEvent e) {
|
||||||
if (Core.getVersion() < 19) return;
|
|
||||||
if (e.getPlayer().getInventory().getItemInMainHand().getType() == Material.DEBUG_STICK) return;
|
if (e.getPlayer().getInventory().getItemInMainHand().getType() == Material.DEBUG_STICK) return;
|
||||||
if (Region.getRegion(e.getBlock().getLocation()).getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
if (Region.getRegion(e.getBlock().getLocation()).getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
|
|||||||
@@ -25,11 +25,9 @@ import de.steamwar.bausystem.region.flags.Flag;
|
|||||||
import de.steamwar.bausystem.region.flags.ItemMode;
|
import de.steamwar.bausystem.region.flags.ItemMode;
|
||||||
import de.steamwar.command.SWCommand;
|
import de.steamwar.command.SWCommand;
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import de.steamwar.linkage.MinVersion;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@Linked
|
@Linked
|
||||||
@MinVersion(19)
|
|
||||||
public class ItemsCommand extends SWCommand {
|
public class ItemsCommand extends SWCommand {
|
||||||
|
|
||||||
public ItemsCommand() {
|
public ItemsCommand() {
|
||||||
|
|||||||
@@ -25,14 +25,12 @@ import de.steamwar.bausystem.region.flags.Flag;
|
|||||||
import de.steamwar.bausystem.region.flags.ItemMode;
|
import de.steamwar.bausystem.region.flags.ItemMode;
|
||||||
import de.steamwar.bausystem.utils.ScoreboardElement;
|
import de.steamwar.bausystem.utils.ScoreboardElement;
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import de.steamwar.linkage.MinVersion;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.entity.ItemSpawnEvent;
|
import org.bukkit.event.entity.ItemSpawnEvent;
|
||||||
|
|
||||||
@Linked
|
@Linked
|
||||||
@MinVersion(19)
|
|
||||||
public class ItemsListener implements Listener, ScoreboardElement {
|
public class ItemsListener implements Listener, ScoreboardElement {
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
|||||||
+3
-1
@@ -59,7 +59,9 @@ public class RegionListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onBlockPhysics(final BlockPhysicsEvent event) {
|
public void onBlockPhysics(final BlockPhysicsEvent event) {
|
||||||
if (event.getBlock().getType() != event.getChangedType()) RegionListener.tagChangedRegion(event.getBlock().getLocation());
|
if (event.getBlock().getType() != event.getChangedType()) {
|
||||||
|
RegionListener.tagChangedRegion(event.getBlock().getLocation());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
|
|||||||
+3
-1
@@ -36,7 +36,9 @@ public class WaterDestroyListener implements Listener, ScoreboardElement {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onBlockFromTo(BlockFromToEvent event) {
|
public void onBlockFromTo(BlockFromToEvent event) {
|
||||||
if (event.getBlock().getType() == Material.WATER && event.getToBlock().getType() != Material.AIR && Region.getRegion(event.getBlock().getLocation()).getRegionData().get(Flag.WATER_DESTROY).isWithDefault(WaterDestroyMode.DENY)) event.setCancelled(true);
|
if (event.getBlock().getType() == Material.WATER && event.getToBlock().getType() != Material.AIR && Region.getRegion(event.getBlock().getLocation()).getRegionData().get(Flag.WATER_DESTROY).isWithDefault(WaterDestroyMode.DENY)) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -75,7 +75,8 @@ public class ScriptGUI implements Listener {
|
|||||||
lore.add(BauSystem.MESSAGE.parse("SCRIPT_MENU_GUI_ITEM_LORE_3", player));
|
lore.add(BauSystem.MESSAGE.parse("SCRIPT_MENU_GUI_ITEM_LORE_3", player));
|
||||||
lore.add(BauSystem.MESSAGE.parse("SCRIPT_MENU_GUI_ITEM_LORE_4", player));
|
lore.add(BauSystem.MESSAGE.parse("SCRIPT_MENU_GUI_ITEM_LORE_4", player));
|
||||||
|
|
||||||
entries.add(new SWListInv.SWListEntry<>(new SWItem(Material.ENCHANTED_BOOK, script.getName(), new ArrayList<>(lore), false, clickType -> {}), script));
|
entries.add(new SWListInv.SWListEntry<>(new SWItem(Material.ENCHANTED_BOOK, script.getName(), new ArrayList<>(lore), false, clickType -> {
|
||||||
|
}), script));
|
||||||
lore.clear();
|
lore.clear();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -26,10 +26,10 @@ import de.steamwar.bausystem.features.script.lua.SteamWarGlobalLuaPlugin;
|
|||||||
import de.steamwar.bausystem.features.script.lua.libs.StorageLib;
|
import de.steamwar.bausystem.features.script.lua.libs.StorageLib;
|
||||||
import de.steamwar.bausystem.region.Region;
|
import de.steamwar.bausystem.region.Region;
|
||||||
import de.steamwar.core.SWPlayer;
|
import de.steamwar.core.SWPlayer;
|
||||||
import de.steamwar.core.TrickyTrialsWrapper;
|
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
@@ -141,7 +141,7 @@ public class EventListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGH)
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
public void onEntitySpawn(EntitySpawnEvent event) {
|
public void onEntitySpawn(EntitySpawnEvent event) {
|
||||||
if (event.getEntityType() != TrickyTrialsWrapper.impl.getTntEntityType()) {
|
if (event.getEntityType() != EntityType.TNT) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Region tntRegion = Region.getRegion(event.getLocation());
|
Region tntRegion = Region.getRegion(event.getLocation());
|
||||||
@@ -156,7 +156,7 @@ public class EventListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void onEntityExplode(EntityExplodeEvent event) {
|
public void onEntityExplode(EntityExplodeEvent event) {
|
||||||
if (event.getEntityType() != TrickyTrialsWrapper.impl.getTntEntityType()) {
|
if (event.getEntityType() != EntityType.TNT) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Region tntRegion = Region.getRegion(event.getLocation());
|
Region tntRegion = Region.getRegion(event.getLocation());
|
||||||
|
|||||||
+14
-6
@@ -82,7 +82,9 @@ public interface LuaLib {
|
|||||||
default Class<? extends LuaLib> parent() {
|
default Class<? extends LuaLib> parent() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
String name();
|
String name();
|
||||||
|
|
||||||
LuaTable get(Player player);
|
LuaTable get(Player player);
|
||||||
|
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@@ -103,27 +105,33 @@ public interface LuaLib {
|
|||||||
try {
|
try {
|
||||||
consumer.accept(luaValue.toboolean());
|
consumer.accept(luaValue.toboolean());
|
||||||
return NIL;
|
return NIL;
|
||||||
} catch (Exception ingored) {}
|
} catch (Exception ingored) {
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
consumer.accept((long) luaValue.toint());
|
consumer.accept((long) luaValue.toint());
|
||||||
return NIL;
|
return NIL;
|
||||||
} catch (Exception ignored) {}
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
consumer.accept(luaValue.toint());
|
consumer.accept(luaValue.toint());
|
||||||
return NIL;
|
return NIL;
|
||||||
} catch (Exception ignored) {}
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
consumer.accept(luaValue.todouble());
|
consumer.accept(luaValue.todouble());
|
||||||
return NIL;
|
return NIL;
|
||||||
} catch (Exception ignored) {}
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
consumer.accept((float) luaValue.todouble());
|
consumer.accept((float) luaValue.todouble());
|
||||||
return NIL;
|
return NIL;
|
||||||
} catch (Exception ignored) {}
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
consumer.accept(luaValue.toString());
|
consumer.accept(luaValue.toString());
|
||||||
return NIL;
|
return NIL;
|
||||||
} catch (Exception ignored) {}
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
throw new LuaError("Invalid lua type: " + luaValue.typename());
|
throw new LuaError("Invalid lua type: " + luaValue.typename());
|
||||||
} catch (Throwable throwable) {
|
} catch (Throwable throwable) {
|
||||||
throw new LuaError("Error in '" + name + "' " + throwable.getMessage());
|
throw new LuaError("Error in '" + name + "' " + throwable.getMessage());
|
||||||
|
|||||||
+33
-18
@@ -22,7 +22,6 @@ package de.steamwar.bausystem.features.script.lua.libs;
|
|||||||
import com.google.gson.*;
|
import com.google.gson.*;
|
||||||
import de.steamwar.bausystem.region.Region;
|
import de.steamwar.bausystem.region.Region;
|
||||||
import de.steamwar.bausystem.region.RegionSystem;
|
import de.steamwar.bausystem.region.RegionSystem;
|
||||||
import de.steamwar.core.Core;
|
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import de.steamwar.linkage.api.Disable;
|
import de.steamwar.linkage.api.Disable;
|
||||||
import de.steamwar.linkage.api.Enable;
|
import de.steamwar.linkage.api.Enable;
|
||||||
@@ -56,7 +55,6 @@ public class StorageLib implements LuaLib, Enable, Disable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void enable() {
|
public void enable() {
|
||||||
if (Core.getVersion() <= 15) return;
|
|
||||||
if (!storageDirectory.exists()) storageDirectory.mkdirs();
|
if (!storageDirectory.exists()) storageDirectory.mkdirs();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -64,7 +62,8 @@ public class StorageLib implements LuaLib, Enable, Disable {
|
|||||||
jsonObject.keySet().forEach(key -> {
|
jsonObject.keySet().forEach(key -> {
|
||||||
GLOBAL_STORAGE.put(key, fromJson(jsonObject.get(key)));
|
GLOBAL_STORAGE.put(key, fromJson(jsonObject.get(key)));
|
||||||
});
|
});
|
||||||
} catch (Exception e) {}
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
|
||||||
File regionStorageDirectory = new File(storageDirectory, "region");
|
File regionStorageDirectory = new File(storageDirectory, "region");
|
||||||
regionStorageDirectory.mkdirs();
|
regionStorageDirectory.mkdirs();
|
||||||
@@ -77,7 +76,8 @@ public class StorageLib implements LuaLib, Enable, Disable {
|
|||||||
});
|
});
|
||||||
Region region = RegionSystem.INSTANCE.getRegion(UUID.fromString(regionStorage.getName().substring(0, regionStorage.getName().length() - ".json".length()))).orElse(null);
|
Region region = RegionSystem.INSTANCE.getRegion(UUID.fromString(regionStorage.getName().substring(0, regionStorage.getName().length() - ".json".length()))).orElse(null);
|
||||||
REGION_STORAGE.put(region, map);
|
REGION_STORAGE.put(region, map);
|
||||||
} catch (Exception e) {}
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
File playerStorageDirectory = new File(storageDirectory, "player");
|
File playerStorageDirectory = new File(storageDirectory, "player");
|
||||||
@@ -91,7 +91,8 @@ public class StorageLib implements LuaLib, Enable, Disable {
|
|||||||
});
|
});
|
||||||
SteamwarUser steamwarUser = SteamwarUser.byId(Integer.parseInt(playerStorage.getName().substring(0, playerStorage.getName().length() - ".json".length())));
|
SteamwarUser steamwarUser = SteamwarUser.byId(Integer.parseInt(playerStorage.getName().substring(0, playerStorage.getName().length() - ".json".length())));
|
||||||
PLAYER_STORAGE.put(steamwarUser.getUUID(), map);
|
PLAYER_STORAGE.put(steamwarUser.getUUID(), map);
|
||||||
} catch (Exception e) {}
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,10 +108,12 @@ public class StorageLib implements LuaLib, Enable, Disable {
|
|||||||
if (jsonPrimitive.isNumber()) {
|
if (jsonPrimitive.isNumber()) {
|
||||||
try {
|
try {
|
||||||
return LuaValue.valueOf(jsonPrimitive.getAsInt());
|
return LuaValue.valueOf(jsonPrimitive.getAsInt());
|
||||||
} catch (NumberFormatException e) {}
|
} catch (NumberFormatException e) {
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
return LuaValue.valueOf(jsonPrimitive.getAsDouble());
|
return LuaValue.valueOf(jsonPrimitive.getAsDouble());
|
||||||
} catch (NumberFormatException e) {}
|
} catch (NumberFormatException e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (jsonPrimitive.isString()) {
|
if (jsonPrimitive.isString()) {
|
||||||
return LuaValue.valueOf(jsonPrimitive.getAsString());
|
return LuaValue.valueOf(jsonPrimitive.getAsString());
|
||||||
@@ -132,13 +135,13 @@ public class StorageLib implements LuaLib, Enable, Disable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void disable() {
|
public void disable() {
|
||||||
if (Core.getVersion() <= 15) return;
|
|
||||||
if (!storageDirectory.exists()) storageDirectory.mkdirs();
|
if (!storageDirectory.exists()) storageDirectory.mkdirs();
|
||||||
try {
|
try {
|
||||||
FileWriter fileWriter = new FileWriter(new File(storageDirectory, "global.json"));
|
FileWriter fileWriter = new FileWriter(new File(storageDirectory, "global.json"));
|
||||||
gson.toJson(toJson(GLOBAL_STORAGE), fileWriter);
|
gson.toJson(toJson(GLOBAL_STORAGE), fileWriter);
|
||||||
fileWriter.close();
|
fileWriter.close();
|
||||||
} catch (IOException e) {}
|
} catch (IOException e) {
|
||||||
|
}
|
||||||
|
|
||||||
File regionStorageDirectory = new File(storageDirectory, "region");
|
File regionStorageDirectory = new File(storageDirectory, "region");
|
||||||
regionStorageDirectory.mkdirs();
|
regionStorageDirectory.mkdirs();
|
||||||
@@ -147,7 +150,8 @@ public class StorageLib implements LuaLib, Enable, Disable {
|
|||||||
FileWriter fileWriter = new FileWriter(new File(regionStorageDirectory, entry.getKey().getID().toString() + ".json"));
|
FileWriter fileWriter = new FileWriter(new File(regionStorageDirectory, entry.getKey().getID().toString() + ".json"));
|
||||||
gson.toJson(toJson(entry.getValue()), fileWriter);
|
gson.toJson(toJson(entry.getValue()), fileWriter);
|
||||||
fileWriter.close();
|
fileWriter.close();
|
||||||
} catch (IOException e) {}
|
} catch (IOException e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
File playerStorageDirectory = new File(storageDirectory, "player");
|
File playerStorageDirectory = new File(storageDirectory, "player");
|
||||||
@@ -157,7 +161,8 @@ public class StorageLib implements LuaLib, Enable, Disable {
|
|||||||
FileWriter fileWriter = new FileWriter(new File(playerStorageDirectory, SteamwarUser.get(entry.getKey()).getId() + ".json"));
|
FileWriter fileWriter = new FileWriter(new File(playerStorageDirectory, SteamwarUser.get(entry.getKey()).getId() + ".json"));
|
||||||
gson.toJson(toJson(entry.getValue()), fileWriter);
|
gson.toJson(toJson(entry.getValue()), fileWriter);
|
||||||
fileWriter.close();
|
fileWriter.close();
|
||||||
} catch (IOException e) {}
|
} catch (IOException e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,13 +182,16 @@ public class StorageLib implements LuaLib, Enable, Disable {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
return new JsonPrimitive(luaValue.checkboolean());
|
return new JsonPrimitive(luaValue.checkboolean());
|
||||||
} catch (Exception e) {}
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
return new JsonPrimitive(luaValue.checkint());
|
return new JsonPrimitive(luaValue.checkint());
|
||||||
} catch (Exception e) {}
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
return new JsonPrimitive(luaValue.checkdouble());
|
return new JsonPrimitive(luaValue.checkdouble());
|
||||||
} catch (Exception e) {}
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
|
||||||
if (luaValue.isstring()) {
|
if (luaValue.isstring()) {
|
||||||
return new JsonPrimitive(luaValue.tojstring());
|
return new JsonPrimitive(luaValue.tojstring());
|
||||||
@@ -196,7 +204,8 @@ public class StorageLib implements LuaLib, Enable, Disable {
|
|||||||
if (value == null) continue;
|
if (value == null) continue;
|
||||||
try {
|
try {
|
||||||
jsonObject.add(key.checkjstring(), value);
|
jsonObject.add(key.checkjstring(), value);
|
||||||
} catch (Exception e) {}
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return jsonObject;
|
return jsonObject;
|
||||||
}
|
}
|
||||||
@@ -252,7 +261,9 @@ public class StorageLib implements LuaLib, Enable, Disable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
|
|
||||||
|
;
|
||||||
});
|
});
|
||||||
storageLib.set("global", global);
|
storageLib.set("global", global);
|
||||||
|
|
||||||
@@ -297,7 +308,9 @@ public class StorageLib implements LuaLib, Enable, Disable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
|
|
||||||
|
;
|
||||||
});
|
});
|
||||||
storageLib.set("player", playerStorage);
|
storageLib.set("player", playerStorage);
|
||||||
|
|
||||||
@@ -346,7 +359,9 @@ public class StorageLib implements LuaLib, Enable, Disable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
|
|
||||||
|
;
|
||||||
});
|
});
|
||||||
storageLib.set("region", regionStorage);
|
storageLib.set("region", regionStorage);
|
||||||
|
|
||||||
|
|||||||
+2
@@ -26,7 +26,9 @@ import org.bukkit.entity.Player;
|
|||||||
public interface BlockDataConfiguration<T extends BlockData> {
|
public interface BlockDataConfiguration<T extends BlockData> {
|
||||||
|
|
||||||
void previous();
|
void previous();
|
||||||
|
|
||||||
void next();
|
void next();
|
||||||
|
|
||||||
SWItem get(Player player);
|
SWItem get(Player player);
|
||||||
|
|
||||||
void apply(T copied, T worldOriginal);
|
void apply(T copied, T worldOriginal);
|
||||||
|
|||||||
-2
@@ -29,14 +29,12 @@ import de.steamwar.command.TypeMapper;
|
|||||||
import de.steamwar.command.TypeValidator;
|
import de.steamwar.command.TypeValidator;
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import de.steamwar.linkage.LinkedInstance;
|
import de.steamwar.linkage.LinkedInstance;
|
||||||
import de.steamwar.linkage.MinVersion;
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
@Linked
|
@Linked
|
||||||
@MinVersion(19)
|
|
||||||
public class SimulatorCommand extends SWCommand {
|
public class SimulatorCommand extends SWCommand {
|
||||||
|
|
||||||
@LinkedInstance
|
@LinkedInstance
|
||||||
|
|||||||
+7
-11
@@ -20,7 +20,6 @@
|
|||||||
package de.steamwar.bausystem.features.simulator;
|
package de.steamwar.bausystem.features.simulator;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.TinyProtocol;
|
import com.comphenix.tinyprotocol.TinyProtocol;
|
||||||
import de.steamwar.Reflection;
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.bausystem.Permission;
|
import de.steamwar.bausystem.Permission;
|
||||||
import de.steamwar.bausystem.SWUtils;
|
import de.steamwar.bausystem.SWUtils;
|
||||||
@@ -45,9 +44,9 @@ import de.steamwar.entity.REntityServer;
|
|||||||
import de.steamwar.entity.RFallingBlockEntity;
|
import de.steamwar.entity.RFallingBlockEntity;
|
||||||
import de.steamwar.inventory.SWAnvilInv;
|
import de.steamwar.inventory.SWAnvilInv;
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import de.steamwar.linkage.MinVersion;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import net.minecraft.network.protocol.game.ServerboundMovePlayerPacket;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@@ -68,13 +67,9 @@ import java.util.function.Function;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Linked
|
@Linked
|
||||||
@MinVersion(19)
|
|
||||||
public class SimulatorCursor implements Listener {
|
public class SimulatorCursor implements Listener {
|
||||||
|
|
||||||
private static final World WORLD = Bukkit.getWorlds().get(0);
|
private static final World WORLD = Bukkit.getWorlds().get(0);
|
||||||
private Class<?> position = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundMovePlayerPacket$Pos");
|
|
||||||
private Class<?> look = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundMovePlayerPacket$Rot");
|
|
||||||
private Class<?> positionLook = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundMovePlayerPacket$PosRot");
|
|
||||||
|
|
||||||
private static Map<Player, CursorType> cursorType = Collections.synchronizedMap(new HashMap<>());
|
private static Map<Player, CursorType> cursorType = Collections.synchronizedMap(new HashMap<>());
|
||||||
private static Map<Player, REntityServer> cursors = Collections.synchronizedMap(new HashMap<>());
|
private static Map<Player, REntityServer> cursors = Collections.synchronizedMap(new HashMap<>());
|
||||||
@@ -85,13 +80,13 @@ public class SimulatorCursor implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public SimulatorCursor() {
|
public SimulatorCursor() {
|
||||||
BiFunction<Player, Object, Object> function = (player, object) -> {
|
BiFunction<Player, ServerboundMovePlayerPacket, Object> function = (player, object) -> {
|
||||||
calcCursor(player);
|
calcCursor(player);
|
||||||
return object;
|
return object;
|
||||||
};
|
};
|
||||||
TinyProtocol.instance.addFilter(position, function);
|
TinyProtocol.instance.addFilter(ServerboundMovePlayerPacket.Pos.class, function);
|
||||||
TinyProtocol.instance.addFilter(look, function);
|
TinyProtocol.instance.addFilter(ServerboundMovePlayerPacket.Rot.class, function);
|
||||||
TinyProtocol.instance.addFilter(positionLook, function);
|
TinyProtocol.instance.addFilter(ServerboundMovePlayerPacket.PosRot.class, function);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@@ -298,8 +293,9 @@ public class SimulatorCursor implements Listener {
|
|||||||
|
|
||||||
if (!player.isSneaking()) {
|
if (!player.isSneaking()) {
|
||||||
pos.setX(pos.getBlockX() + 0.5);
|
pos.setX(pos.getBlockX() + 0.5);
|
||||||
if (face == null || face.getModY() == 0)
|
if (face == null || face.getModY() == 0) {
|
||||||
pos.setY(pos.getBlockY() + 0.0);
|
pos.setY(pos.getBlockY() + 0.0);
|
||||||
|
}
|
||||||
pos.setZ(pos.getBlockZ() + 0.5);
|
pos.setZ(pos.getBlockZ() + 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
-2
@@ -32,7 +32,6 @@ import de.steamwar.bausystem.utils.ItemUtils;
|
|||||||
import de.steamwar.inventory.SWAnvilInv;
|
import de.steamwar.inventory.SWAnvilInv;
|
||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import de.steamwar.linkage.MinVersion;
|
|
||||||
import de.steamwar.linkage.api.Enable;
|
import de.steamwar.linkage.api.Enable;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@@ -47,7 +46,6 @@ import java.util.*;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Linked
|
@Linked
|
||||||
@MinVersion(19)
|
|
||||||
public class SimulatorStorage implements Enable {
|
public class SimulatorStorage implements Enable {
|
||||||
|
|
||||||
public static final File simulatorsDir = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "simulators");
|
public static final File simulatorsDir = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "simulators");
|
||||||
|
|||||||
-2
@@ -28,7 +28,6 @@ import de.steamwar.entity.REntity;
|
|||||||
import de.steamwar.entity.REntityServer;
|
import de.steamwar.entity.REntityServer;
|
||||||
import de.steamwar.entity.RFallingBlockEntity;
|
import de.steamwar.entity.RFallingBlockEntity;
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import de.steamwar.linkage.MinVersion;
|
|
||||||
import lombok.experimental.UtilityClass;
|
import lombok.experimental.UtilityClass;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@@ -75,7 +74,6 @@ public class SimulatorWatcher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Linked
|
@Linked
|
||||||
@MinVersion(19)
|
|
||||||
public static class QuitListener implements Listener {
|
public static class QuitListener implements Listener {
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
|||||||
+6
-2
@@ -120,6 +120,10 @@ public abstract class SimulatorElement<T extends SimulatorPhase> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public abstract String getType();
|
public abstract String getType();
|
||||||
public void saveExtra(YAPIONObject elementObject) {}
|
|
||||||
public void loadExtra(YAPIONObject elementObject) {}
|
public void saveExtra(YAPIONObject elementObject) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loadExtra(YAPIONObject elementObject) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-2
@@ -37,6 +37,10 @@ public abstract class SimulatorPhase {
|
|||||||
protected int order = 0;
|
protected int order = 0;
|
||||||
|
|
||||||
public abstract void toSimulatorActions(Vector position, BiConsumer<Integer, SimulatorAction> tickStart, BiConsumer<Integer, SimulatorAction> tickEnd);
|
public abstract void toSimulatorActions(Vector position, BiConsumer<Integer, SimulatorAction> tickStart, BiConsumer<Integer, SimulatorAction> tickEnd);
|
||||||
public void saveExtra(YAPIONObject phaseObject) {}
|
|
||||||
public void loadExtra(YAPIONObject phaseObject) {}
|
public void saveExtra(YAPIONObject phaseObject) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loadExtra(YAPIONObject phaseObject) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -65,7 +65,9 @@ public final class TNTPhase extends SimulatorPhase {
|
|||||||
@Override
|
@Override
|
||||||
public void accept(World world) {
|
public void accept(World world) {
|
||||||
Location location = position.toLocation(world);
|
Location location = position.toLocation(world);
|
||||||
if (Region.getRegion(location).getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) return;
|
if (Region.getRegion(location).getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
TNTPrimed tnt = world.spawn(location, TNTPrimed.class);
|
TNTPrimed tnt = world.spawn(location, TNTPrimed.class);
|
||||||
if (!xJump) tnt.setVelocity(tnt.getVelocity().setX(0));
|
if (!xJump) tnt.setVelocity(tnt.getVelocity().setX(0));
|
||||||
if (!yJump) tnt.setVelocity(tnt.getVelocity().setY(0));
|
if (!yJump) tnt.setVelocity(tnt.getVelocity().setY(0));
|
||||||
|
|||||||
+13
-6
@@ -19,16 +19,16 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.features.simulator.execute;
|
package de.steamwar.bausystem.features.simulator.execute;
|
||||||
|
|
||||||
|
import com.destroystokyo.paper.event.server.ServerTickEndEvent;
|
||||||
|
import com.destroystokyo.paper.event.server.ServerTickStartEvent;
|
||||||
import de.steamwar.bausystem.features.simulator.data.Simulator;
|
import de.steamwar.bausystem.features.simulator.data.Simulator;
|
||||||
import de.steamwar.bausystem.features.simulator.data.SimulatorElement;
|
import de.steamwar.bausystem.features.simulator.data.SimulatorElement;
|
||||||
import de.steamwar.bausystem.features.simulator.data.SimulatorGroup;
|
import de.steamwar.bausystem.features.simulator.data.SimulatorGroup;
|
||||||
import de.steamwar.bausystem.features.tpslimit.TPSUtils;
|
import de.steamwar.bausystem.features.tpslimit.TPSUtils;
|
||||||
import de.steamwar.bausystem.features.tracer.TraceRecorder;
|
import de.steamwar.bausystem.features.tracer.TraceRecorder;
|
||||||
import de.steamwar.bausystem.region.Region;
|
import de.steamwar.bausystem.region.Region;
|
||||||
import de.steamwar.bausystem.utils.TickEndEvent;
|
import de.steamwar.bausystem.utils.TickManager;
|
||||||
import de.steamwar.bausystem.utils.TickStartEvent;
|
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import de.steamwar.linkage.MinVersion;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -39,7 +39,6 @@ import java.util.*;
|
|||||||
import java.util.concurrent.atomic.AtomicLong;
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
|
|
||||||
@Linked
|
@Linked
|
||||||
@MinVersion(19)
|
|
||||||
public class SimulatorExecutor implements Listener {
|
public class SimulatorExecutor implements Listener {
|
||||||
|
|
||||||
private static final World WORLD = Bukkit.getWorlds().get(0);
|
private static final World WORLD = Bukkit.getWorlds().get(0);
|
||||||
@@ -109,8 +108,13 @@ public class SimulatorExecutor implements Listener {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean tickStartRan = false;
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onTickStart(TickStartEvent event) {
|
public void onServerTickStart(ServerTickStartEvent event) {
|
||||||
|
if (TickManager.impl.isFrozen()) return;
|
||||||
|
tickStartRan = true;
|
||||||
|
|
||||||
long currentTick = TPSUtils.currentRealTick.get();
|
long currentTick = TPSUtils.currentRealTick.get();
|
||||||
Map<Integer, List<SimulatorAction>> actionsToRun = tickStartActions.remove(currentTick);
|
Map<Integer, List<SimulatorAction>> actionsToRun = tickStartActions.remove(currentTick);
|
||||||
if (actionsToRun == null) return;
|
if (actionsToRun == null) return;
|
||||||
@@ -123,7 +127,10 @@ public class SimulatorExecutor implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onTickEnd(TickEndEvent event) {
|
public void onServerTickEnd(ServerTickEndEvent event) {
|
||||||
|
if (!tickStartRan) return;
|
||||||
|
tickStartRan = false;
|
||||||
|
|
||||||
long currentTick = TPSUtils.currentRealTick.get() - 1;
|
long currentTick = TPSUtils.currentRealTick.get() - 1;
|
||||||
List<SimulatorAction> actionsToRun = tickEndActions.remove(currentTick);
|
List<SimulatorAction> actionsToRun = tickEndActions.remove(currentTick);
|
||||||
if (actionsToRun == null) return;
|
if (actionsToRun == null) return;
|
||||||
|
|||||||
+2
-1
@@ -55,8 +55,9 @@ public class StabGenerator extends StabStep implements Listener {
|
|||||||
if (!(event.getEntity() instanceof TNTPrimed)) return;
|
if (!(event.getEntity() instanceof TNTPrimed)) return;
|
||||||
if (Region.getRegion(event.getEntity().getLocation()) == data.region) {
|
if (Region.getRegion(event.getEntity().getLocation()) == data.region) {
|
||||||
event.blockList().forEach(block -> {
|
event.blockList().forEach(block -> {
|
||||||
if (!data.region.getTestblockArea().inRegion(block.getLocation(), true))
|
if (!data.region.getTestblockArea().inRegion(block.getLocation(), true)) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
int component = data.direction.component.apply(block.getLocation().toVector());
|
int component = data.direction.component.apply(block.getLocation().toVector());
|
||||||
destroyedBlocksPerSlice.computeIfAbsent(component, __ -> new HashSet<>())
|
destroyedBlocksPerSlice.computeIfAbsent(component, __ -> new HashSet<>())
|
||||||
.add(block.getLocation());
|
.add(block.getLocation());
|
||||||
|
|||||||
+8
-8
@@ -69,7 +69,7 @@ public class SimulatorGroupSettingsGui extends SimulatorBaseGui {
|
|||||||
|
|
||||||
// Base Tick
|
// Base Tick
|
||||||
int baseTicks = simulatorGroup.getBaseTick();
|
int baseTicks = simulatorGroup.getBaseTick();
|
||||||
inventory.setItem(9, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(9, new SWItem(Material.LIME_DYE, "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
simulatorGroup.changeBaseTicks(clickType.isShiftClick() ? 5 : 1);
|
simulatorGroup.changeBaseTicks(clickType.isShiftClick() ? 5 : 1);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
||||||
@@ -83,7 +83,7 @@ public class SimulatorGroupSettingsGui extends SimulatorBaseGui {
|
|||||||
});
|
});
|
||||||
baseTick.getItemStack().setAmount(Math.max(1, Math.min(baseTicks, 64)));
|
baseTick.getItemStack().setAmount(Math.max(1, Math.min(baseTicks, 64)));
|
||||||
inventory.setItem(18, baseTick);
|
inventory.setItem(18, baseTick);
|
||||||
inventory.setItem(27, new SWItem(SWItem.getDye(baseTicks > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(27, new SWItem(baseTicks > 0 ? Material.RED_DYE : Material.GRAY_DYE, "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
if (baseTicks - (clickType.isShiftClick() ? 5 : 1) < 0) {
|
if (baseTicks - (clickType.isShiftClick() ? 5 : 1) < 0) {
|
||||||
simulatorGroup.changeBaseTicks(-baseTicks);
|
simulatorGroup.changeBaseTicks(-baseTicks);
|
||||||
} else {
|
} else {
|
||||||
@@ -163,7 +163,7 @@ public class SimulatorGroupSettingsGui extends SimulatorBaseGui {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Pos X
|
//Pos X
|
||||||
inventory.setItem(15, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList(allTNT ? "§7Shift§8: §e+0.0625" : "§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(15, new SWItem(Material.LIME_DYE, "§e+1", Arrays.asList(allTNT ? "§7Shift§8: §e+0.0625" : "§7Shift§8: §e+5"), false, clickType -> {
|
||||||
simulatorGroup.move(clickType.isShiftClick() ? (allTNT ? 0.0625 : 5) : 1, 0, 0);
|
simulatorGroup.move(clickType.isShiftClick() ? (allTNT ? 0.0625 : 5) : 1, 0, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
||||||
@@ -177,13 +177,13 @@ public class SimulatorGroupSettingsGui extends SimulatorBaseGui {
|
|||||||
return true;
|
return true;
|
||||||
}, this).setItem(Material.PAPER).open();
|
}, this).setItem(Material.PAPER).open();
|
||||||
}));
|
}));
|
||||||
inventory.setItem(33, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList(allTNT ? "§7Shift§8: §e-0.0625" : "§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(33, new SWItem(Material.RED_DYE, "§e-1", Arrays.asList(allTNT ? "§7Shift§8: §e-0.0625" : "§7Shift§8: §e-5"), false, clickType -> {
|
||||||
simulatorGroup.move(clickType.isShiftClick() ? (allTNT ? -0.0625 : -5) : -1, 0, 0);
|
simulatorGroup.move(clickType.isShiftClick() ? (allTNT ? -0.0625 : -5) : -1, 0, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
||||||
|
|
||||||
//Pos Y
|
//Pos Y
|
||||||
inventory.setItem(16, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList(allTNT ? "§7Shift§8: §e+0.0625" : "§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(16, new SWItem(Material.LIME_DYE, "§e+1", Arrays.asList(allTNT ? "§7Shift§8: §e+0.0625" : "§7Shift§8: §e+5"), false, clickType -> {
|
||||||
simulatorGroup.move(0, clickType.isShiftClick() ? (allTNT ? 0.0625 : 5) : 1, 0);
|
simulatorGroup.move(0, clickType.isShiftClick() ? (allTNT ? 0.0625 : 5) : 1, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
||||||
@@ -197,13 +197,13 @@ public class SimulatorGroupSettingsGui extends SimulatorBaseGui {
|
|||||||
return true;
|
return true;
|
||||||
}, this).setItem(Material.PAPER).open();
|
}, this).setItem(Material.PAPER).open();
|
||||||
}));
|
}));
|
||||||
inventory.setItem(34, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList(allTNT ? "§7Shift§8: §e-0.0625" : "§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(34, new SWItem(Material.RED_DYE, "§e-1", Arrays.asList(allTNT ? "§7Shift§8: §e-0.0625" : "§7Shift§8: §e-5"), false, clickType -> {
|
||||||
simulatorGroup.move(0, clickType.isShiftClick() ? (allTNT ? -0.0625 : -5) : -1, 0);
|
simulatorGroup.move(0, clickType.isShiftClick() ? (allTNT ? -0.0625 : -5) : -1, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.ENABLED_OR_DISABLED));
|
}).setCustomModelData(CMDs.Simulator.ENABLED_OR_DISABLED));
|
||||||
|
|
||||||
//Pos Z
|
//Pos Z
|
||||||
inventory.setItem(17, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList(allTNT ? "§7Shift§8: §e+0.0625" : "§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(17, new SWItem(Material.LIME_DYE, "§e+1", Arrays.asList(allTNT ? "§7Shift§8: §e+0.0625" : "§7Shift§8: §e+5"), false, clickType -> {
|
||||||
simulatorGroup.move(0, 0, clickType.isShiftClick() ? (allTNT ? 0.0625 : 5) : 1);
|
simulatorGroup.move(0, 0, clickType.isShiftClick() ? (allTNT ? 0.0625 : 5) : 1);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
||||||
@@ -217,7 +217,7 @@ public class SimulatorGroupSettingsGui extends SimulatorBaseGui {
|
|||||||
return true;
|
return true;
|
||||||
}, this).setItem(Material.PAPER).open();
|
}, this).setItem(Material.PAPER).open();
|
||||||
}));
|
}));
|
||||||
inventory.setItem(35, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList(allTNT ? "§7Shift§8: §e-0.0625" : "§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(35, new SWItem(Material.RED_DYE, "§e-1", Arrays.asList(allTNT ? "§7Shift§8: §e-0.0625" : "§7Shift§8: §e-5"), false, clickType -> {
|
||||||
simulatorGroup.move(0, 0, clickType.isShiftClick() ? (allTNT ? -0.0625 : -5) : -1);
|
simulatorGroup.move(0, 0, clickType.isShiftClick() ? (allTNT ? -0.0625 : -5) : -1);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
||||||
|
|||||||
+4
-4
@@ -149,13 +149,13 @@ public class SimulatorObserverGui extends SimulatorScrollGui<ObserverPhase> {
|
|||||||
Supplier<Integer> getter = observerPhase::getTickOffset;
|
Supplier<Integer> getter = observerPhase::getTickOffset;
|
||||||
Consumer<Integer> setter = observerPhase::setTickOffset;
|
Consumer<Integer> setter = observerPhase::setTickOffset;
|
||||||
return new SWItem[]{
|
return new SWItem[]{
|
||||||
new SWItem(SWItem.getDye(getter.get() < max ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
|
new SWItem(getter.get() < max ? Material.LIME_DYE : Material.GRAY_DYE, "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
setter.accept(Math.min(max, getter.get() + (clickType.isShiftClick() ? 5 : 1)));
|
setter.accept(Math.min(max, getter.get() + (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED),
|
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED),
|
||||||
observer,
|
observer,
|
||||||
new SWItem(SWItem.getDye(getter.get() > min ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8:§e -5"), false, clickType -> {
|
new SWItem(getter.get() > min ? Material.RED_DYE : Material.GRAY_DYE, "§e-1", Arrays.asList("§7Shift§8:§e -5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
setter.accept(Math.max(min, getter.get() - (clickType.isShiftClick() ? 5 : 1)));
|
setter.accept(Math.max(min, getter.get() - (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
@@ -169,13 +169,13 @@ public class SimulatorObserverGui extends SimulatorScrollGui<ObserverPhase> {
|
|||||||
@Override
|
@Override
|
||||||
public SWItem[] lastColumn() {
|
public SWItem[] lastColumn() {
|
||||||
return new SWItem[]{
|
return new SWItem[]{
|
||||||
new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
|
new SWItem(Material.LIME_DYE, "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
|
||||||
addNewPhase(clickType.isShiftClick());
|
addNewPhase(clickType.isShiftClick());
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED),
|
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED),
|
||||||
new SWItem(Material.QUARTZ, "§eObserver§8:§a New Phase", clickType -> {
|
new SWItem(Material.QUARTZ, "§eObserver§8:§a New Phase", clickType -> {
|
||||||
addNewPhase(false);
|
addNewPhase(false);
|
||||||
}).setCustomModelData(CMDs.Simulator.NEW_PHASE),
|
}).setCustomModelData(CMDs.Simulator.NEW_PHASE),
|
||||||
new SWItem(SWItem.getDye(8), "§7", clickType -> {
|
new SWItem(Material.GRAY_DYE, "§7", clickType -> {
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED),
|
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-8
@@ -26,7 +26,6 @@ import de.steamwar.bausystem.features.simulator.data.observer.ObserverElement;
|
|||||||
import de.steamwar.bausystem.features.simulator.data.observer.ObserverPhase;
|
import de.steamwar.bausystem.features.simulator.data.observer.ObserverPhase;
|
||||||
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorAnvilGui;
|
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorAnvilGui;
|
||||||
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
|
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
|
||||||
import de.steamwar.core.Core;
|
|
||||||
import de.steamwar.data.CMDs;
|
import de.steamwar.data.CMDs;
|
||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@@ -97,7 +96,7 @@ public class SimulatorObserverPhaseSettingsGui extends SimulatorBaseGui {
|
|||||||
|
|
||||||
//Tick Offset
|
//Tick Offset
|
||||||
int offset = observer.getTickOffset();
|
int offset = observer.getTickOffset();
|
||||||
inventory.setItem(10, new SWItem(SWItem.getDye(offset < max ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(10, new SWItem(offset < max ? Material.LIME_DYE : Material.GRAY_DYE, "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
observer.setTickOffset(Math.min(max, offset + (clickType.isShiftClick() ? 5 : 1)));
|
observer.setTickOffset(Math.min(max, offset + (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
@@ -114,7 +113,7 @@ public class SimulatorObserverPhaseSettingsGui extends SimulatorBaseGui {
|
|||||||
offsetItem.getItemStack().setAmount(Math.max(1, Math.min(offset, 64)));
|
offsetItem.getItemStack().setAmount(Math.max(1, Math.min(offset, 64)));
|
||||||
inventory.setItem(19, offsetItem);
|
inventory.setItem(19, offsetItem);
|
||||||
|
|
||||||
inventory.setItem(28, new SWItem(SWItem.getDye(offset > min ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(28, new SWItem(offset > min ? Material.RED_DYE : Material.GRAY_DYE, "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
observer.setTickOffset(Math.max(min, offset - (clickType.isShiftClick() ? 5 : 1)));
|
observer.setTickOffset(Math.max(min, offset - (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
@@ -122,26 +121,25 @@ public class SimulatorObserverPhaseSettingsGui extends SimulatorBaseGui {
|
|||||||
|
|
||||||
//Order
|
//Order
|
||||||
int order = observer.getOrder();
|
int order = observer.getOrder();
|
||||||
inventory.setItem(13, new SWItem(SWItem.getDye(order < SimulatorPhase.ORDER_LIMIT ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(13, new SWItem(order < SimulatorPhase.ORDER_LIMIT ? Material.LIME_DYE : Material.GRAY_DYE, "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
observer.setOrder(Math.min(SimulatorPhase.ORDER_LIMIT, order + (clickType.isShiftClick() ? 5 : 1)));
|
observer.setOrder(Math.min(SimulatorPhase.ORDER_LIMIT, order + (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
||||||
|
|
||||||
Material negativeNumbers = Material.getMaterial(Core.getVersion() >= 19 ? "RECOVERY_COMPASS" : "FIREWORK_STAR");
|
SWItem orderItem = new SWItem(order >= 0 ? Material.COMPASS : Material.RECOVERY_COMPASS, "§eActivation Order§8:§7 " + order, clickType -> {
|
||||||
SWItem orderItem = new SWItem(order >= 0 ? Material.COMPASS : negativeNumbers, "§eActivation Order§8:§7 " + order, clickType -> {
|
|
||||||
new SimulatorAnvilGui<>(player, "Activation Order", order + "", Integer::parseInt, integer -> {
|
new SimulatorAnvilGui<>(player, "Activation Order", order + "", Integer::parseInt, integer -> {
|
||||||
if (integer < -SimulatorPhase.ORDER_LIMIT) return false;
|
if (integer < -SimulatorPhase.ORDER_LIMIT) return false;
|
||||||
if (integer > SimulatorPhase.ORDER_LIMIT) return false;
|
if (integer > SimulatorPhase.ORDER_LIMIT) return false;
|
||||||
observer.setOrder(integer);
|
observer.setOrder(integer);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
return true;
|
return true;
|
||||||
}, this).setItem(order >= 0 ? Material.COMPASS : negativeNumbers).open();
|
}, this).setItem(order >= 0 ? Material.COMPASS : Material.RECOVERY_COMPASS).open();
|
||||||
});
|
});
|
||||||
orderItem.getItemStack().setAmount(Math.max(1, Math.min(Math.abs(order), 30)));
|
orderItem.getItemStack().setAmount(Math.max(1, Math.min(Math.abs(order), 30)));
|
||||||
inventory.setItem(22, orderItem);
|
inventory.setItem(22, orderItem);
|
||||||
|
|
||||||
inventory.setItem(31, new SWItem(SWItem.getDye(order > -SimulatorPhase.ORDER_LIMIT ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(31, new SWItem(order > -SimulatorPhase.ORDER_LIMIT ? Material.RED_DYE : Material.GRAY_DYE, "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
observer.setOrder(Math.max(-SimulatorPhase.ORDER_LIMIT, order - (clickType.isShiftClick() ? 5 : 1)));
|
observer.setOrder(Math.max(-SimulatorPhase.ORDER_LIMIT, order - (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
|
|||||||
+8
-8
@@ -67,7 +67,7 @@ public class SimulatorObserverSettingsGui extends SimulatorBaseGui {
|
|||||||
|
|
||||||
// Base Tick
|
// Base Tick
|
||||||
int baseTicks = observer.getBaseTick();
|
int baseTicks = observer.getBaseTick();
|
||||||
inventory.setItem(9, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(9, new SWItem(Material.LIME_DYE, "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
observer.changeBaseTicks(clickType.isShiftClick() ? 5 : 1);
|
observer.changeBaseTicks(clickType.isShiftClick() ? 5 : 1);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
@@ -82,7 +82,7 @@ public class SimulatorObserverSettingsGui extends SimulatorBaseGui {
|
|||||||
});
|
});
|
||||||
baseTick.getItemStack().setAmount(Math.max(1, Math.min(baseTicks, 64)));
|
baseTick.getItemStack().setAmount(Math.max(1, Math.min(baseTicks, 64)));
|
||||||
inventory.setItem(18, baseTick);
|
inventory.setItem(18, baseTick);
|
||||||
inventory.setItem(27, new SWItem(SWItem.getDye(baseTicks > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(27, new SWItem(baseTicks > 0 ? Material.RED_DYE : Material.GRAY_DYE, "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
if (baseTicks - (clickType.isShiftClick() ? 5 : 1) < 0) {
|
if (baseTicks - (clickType.isShiftClick() ? 5 : 1) < 0) {
|
||||||
observer.changeBaseTicks(-baseTicks);
|
observer.changeBaseTicks(-baseTicks);
|
||||||
@@ -93,7 +93,7 @@ public class SimulatorObserverSettingsGui extends SimulatorBaseGui {
|
|||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
||||||
|
|
||||||
//Pos X
|
//Pos X
|
||||||
inventory.setItem(15, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(15, new SWItem(Material.LIME_DYE, "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
observer.move(clickType.isShiftClick() ? 5 : 1, 0, 0);
|
observer.move(clickType.isShiftClick() ? 5 : 1, 0, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
@@ -105,14 +105,14 @@ public class SimulatorObserverSettingsGui extends SimulatorBaseGui {
|
|||||||
return true;
|
return true;
|
||||||
}, this).open();
|
}, this).open();
|
||||||
}));
|
}));
|
||||||
inventory.setItem(33, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(33, new SWItem(Material.RED_DYE, "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
observer.move(clickType.isShiftClick() ? -5 : -1, 0, 0);
|
observer.move(clickType.isShiftClick() ? -5 : -1, 0, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
||||||
|
|
||||||
//Pos Y
|
//Pos Y
|
||||||
inventory.setItem(16, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(16, new SWItem(Material.LIME_DYE, "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
observer.move(0, clickType.isShiftClick() ? 5 : 1, 0);
|
observer.move(0, clickType.isShiftClick() ? 5 : 1, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
@@ -124,14 +124,14 @@ public class SimulatorObserverSettingsGui extends SimulatorBaseGui {
|
|||||||
return true;
|
return true;
|
||||||
}, this).open();
|
}, this).open();
|
||||||
}));
|
}));
|
||||||
inventory.setItem(34, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(34, new SWItem(Material.RED_DYE, "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
observer.move(0, clickType.isShiftClick() ? -5 : -1, 0);
|
observer.move(0, clickType.isShiftClick() ? -5 : -1, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
||||||
|
|
||||||
//Pos Z
|
//Pos Z
|
||||||
inventory.setItem(17, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(17, new SWItem(Material.LIME_DYE, "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
observer.move(0, 0, clickType.isShiftClick() ? 5 : 1);
|
observer.move(0, 0, clickType.isShiftClick() ? 5 : 1);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
@@ -143,7 +143,7 @@ public class SimulatorObserverSettingsGui extends SimulatorBaseGui {
|
|||||||
return true;
|
return true;
|
||||||
}, this).open();
|
}, this).open();
|
||||||
}));
|
}));
|
||||||
inventory.setItem(35, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(35, new SWItem(Material.RED_DYE, "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
observer.move(0, 0, clickType.isShiftClick() ? -5 : -1);
|
observer.move(0, 0, clickType.isShiftClick() ? -5 : -1);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
|
|||||||
+4
-4
@@ -164,13 +164,13 @@ public class SimulatorRedstoneGui extends SimulatorScrollGui<SimulatorRedstoneGu
|
|||||||
Supplier<Integer> getter = redstoneSubPhase.place ? redstoneSubPhase.phase::getTickOffset : redstoneSubPhase.phase::getLifetime;
|
Supplier<Integer> getter = redstoneSubPhase.place ? redstoneSubPhase.phase::getTickOffset : redstoneSubPhase.phase::getLifetime;
|
||||||
Consumer<Integer> setter = redstoneSubPhase.place ? redstoneSubPhase.phase::setTickOffset : redstoneSubPhase.phase::setLifetime;
|
Consumer<Integer> setter = redstoneSubPhase.place ? redstoneSubPhase.phase::setTickOffset : redstoneSubPhase.phase::setLifetime;
|
||||||
return new SWItem[]{
|
return new SWItem[]{
|
||||||
new SWItem(SWItem.getDye(getter.get() < max ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
|
new SWItem(getter.get() < max ? Material.LIME_DYE : Material.GRAY_DYE, "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
setter.accept(Math.min(max, getter.get() + (clickType.isShiftClick() ? 5 : 1)));
|
setter.accept(Math.min(max, getter.get() + (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED),
|
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED),
|
||||||
redstone,
|
redstone,
|
||||||
new SWItem(SWItem.getDye(getter.get() > min ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8:§e -5"), false, clickType -> {
|
new SWItem(getter.get() > min ? Material.RED_DYE : Material.GRAY_DYE, "§e-1", Arrays.asList("§7Shift§8:§e -5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
setter.accept(Math.max(min, getter.get() - (clickType.isShiftClick() ? 5 : 1)));
|
setter.accept(Math.max(min, getter.get() - (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
@@ -184,13 +184,13 @@ public class SimulatorRedstoneGui extends SimulatorScrollGui<SimulatorRedstoneGu
|
|||||||
@Override
|
@Override
|
||||||
public SWItem[] lastColumn() {
|
public SWItem[] lastColumn() {
|
||||||
return new SWItem[]{
|
return new SWItem[]{
|
||||||
new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
|
new SWItem(Material.LIME_DYE, "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
|
||||||
addNewPhase(clickType.isShiftClick());
|
addNewPhase(clickType.isShiftClick());
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED),
|
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED),
|
||||||
new SWItem(Material.REDSTONE, "§eRedstone§8:§a New Phase", clickType -> {
|
new SWItem(Material.REDSTONE, "§eRedstone§8:§a New Phase", clickType -> {
|
||||||
addNewPhase(false);
|
addNewPhase(false);
|
||||||
}).setCustomModelData(CMDs.Simulator.NEW_PHASE),
|
}).setCustomModelData(CMDs.Simulator.NEW_PHASE),
|
||||||
new SWItem(SWItem.getDye(8), "§7", clickType -> {
|
new SWItem(Material.GRAY_DYE, "§7", clickType -> {
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED),
|
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-10
@@ -26,7 +26,6 @@ import de.steamwar.bausystem.features.simulator.data.redstone.RedstoneElement;
|
|||||||
import de.steamwar.bausystem.features.simulator.data.redstone.RedstonePhase;
|
import de.steamwar.bausystem.features.simulator.data.redstone.RedstonePhase;
|
||||||
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorAnvilGui;
|
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorAnvilGui;
|
||||||
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
|
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
|
||||||
import de.steamwar.core.Core;
|
|
||||||
import de.steamwar.data.CMDs;
|
import de.steamwar.data.CMDs;
|
||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@@ -98,7 +97,7 @@ public class SimulatorRedstonePhaseSettingsGui extends SimulatorBaseGui {
|
|||||||
|
|
||||||
//Tick Offset
|
//Tick Offset
|
||||||
int offset = redstone.getTickOffset();
|
int offset = redstone.getTickOffset();
|
||||||
inventory.setItem(10, new SWItem(SWItem.getDye(offset < maxOffset ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(10, new SWItem(offset < maxOffset ? Material.LIME_DYE : Material.GRAY_DYE, "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
redstone.setTickOffset(Math.min(maxOffset, offset + (clickType.isShiftClick() ? 5 : 1)));
|
redstone.setTickOffset(Math.min(maxOffset, offset + (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
@@ -115,7 +114,7 @@ public class SimulatorRedstonePhaseSettingsGui extends SimulatorBaseGui {
|
|||||||
offsetItem.getItemStack().setAmount(Math.max(1, Math.min(offset, 64)));
|
offsetItem.getItemStack().setAmount(Math.max(1, Math.min(offset, 64)));
|
||||||
inventory.setItem(19, offsetItem);
|
inventory.setItem(19, offsetItem);
|
||||||
|
|
||||||
inventory.setItem(28, new SWItem(SWItem.getDye(offset > min ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(28, new SWItem(offset > min ? Material.RED_DYE : Material.GRAY_DYE, "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
redstone.setTickOffset(Math.max(min, offset - (clickType.isShiftClick() ? 5 : 1)));
|
redstone.setTickOffset(Math.max(min, offset - (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
@@ -123,7 +122,7 @@ public class SimulatorRedstonePhaseSettingsGui extends SimulatorBaseGui {
|
|||||||
|
|
||||||
//Lifetime
|
//Lifetime
|
||||||
int lifetime = redstone.getLifetime();
|
int lifetime = redstone.getLifetime();
|
||||||
inventory.setItem(11, new SWItem(SWItem.getDye(lifetime < maxLifetime ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(11, new SWItem(lifetime < maxLifetime ? Material.LIME_DYE : Material.GRAY_DYE, "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
redstone.setLifetime(Math.min(maxLifetime, lifetime + (clickType.isShiftClick() ? 5 : 1)));
|
redstone.setLifetime(Math.min(maxLifetime, lifetime + (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
@@ -140,7 +139,7 @@ public class SimulatorRedstonePhaseSettingsGui extends SimulatorBaseGui {
|
|||||||
lifetimeItem.getItemStack().setAmount(Math.max(1, Math.min(lifetime, 64)));
|
lifetimeItem.getItemStack().setAmount(Math.max(1, Math.min(lifetime, 64)));
|
||||||
inventory.setItem(20, lifetimeItem);
|
inventory.setItem(20, lifetimeItem);
|
||||||
|
|
||||||
inventory.setItem(29, new SWItem(SWItem.getDye(lifetime > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(29, new SWItem(lifetime > 0 ? Material.RED_DYE : Material.GRAY_DYE, "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
redstone.setLifetime(Math.max(0, lifetime - (clickType.isShiftClick() ? 5 : 1)));
|
redstone.setLifetime(Math.max(0, lifetime - (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
@@ -148,26 +147,25 @@ public class SimulatorRedstonePhaseSettingsGui extends SimulatorBaseGui {
|
|||||||
|
|
||||||
//Order
|
//Order
|
||||||
int order = redstone.getOrder();
|
int order = redstone.getOrder();
|
||||||
inventory.setItem(13, new SWItem(SWItem.getDye(order < SimulatorPhase.ORDER_LIMIT ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(13, new SWItem(order < SimulatorPhase.ORDER_LIMIT ? Material.LIME_DYE : Material.GRAY_DYE, "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
redstone.setOrder(Math.min(SimulatorPhase.ORDER_LIMIT, order + (clickType.isShiftClick() ? 5 : 1)));
|
redstone.setOrder(Math.min(SimulatorPhase.ORDER_LIMIT, order + (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
||||||
|
|
||||||
Material negativeNumbers = Material.getMaterial(Core.getVersion() >= 19 ? "RECOVERY_COMPASS" : "FIREWORK_STAR");
|
SWItem orderItem = new SWItem(order >= 0 ? Material.COMPASS : Material.RECOVERY_COMPASS, "§eActivation Order§8:§7 " + order, clickType -> {
|
||||||
SWItem orderItem = new SWItem(order >= 0 ? Material.COMPASS : negativeNumbers, "§eActivation Order§8:§7 " + order, clickType -> {
|
|
||||||
new SimulatorAnvilGui<>(player, "Activation Order", order + "", Integer::parseInt, integer -> {
|
new SimulatorAnvilGui<>(player, "Activation Order", order + "", Integer::parseInt, integer -> {
|
||||||
if (integer < -SimulatorPhase.ORDER_LIMIT) return false;
|
if (integer < -SimulatorPhase.ORDER_LIMIT) return false;
|
||||||
if (integer > SimulatorPhase.ORDER_LIMIT) return false;
|
if (integer > SimulatorPhase.ORDER_LIMIT) return false;
|
||||||
redstone.setOrder(integer);
|
redstone.setOrder(integer);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
return true;
|
return true;
|
||||||
}, this).setItem(order >= 0 ? Material.COMPASS : negativeNumbers).open();
|
}, this).setItem(order >= 0 ? Material.COMPASS : Material.RECOVERY_COMPASS).open();
|
||||||
});
|
});
|
||||||
orderItem.getItemStack().setAmount(Math.max(1, Math.min(Math.abs(order), 30)));
|
orderItem.getItemStack().setAmount(Math.max(1, Math.min(Math.abs(order), 30)));
|
||||||
inventory.setItem(22, orderItem);
|
inventory.setItem(22, orderItem);
|
||||||
|
|
||||||
inventory.setItem(31, new SWItem(SWItem.getDye(order > -SimulatorPhase.ORDER_LIMIT ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(31, new SWItem(order > -SimulatorPhase.ORDER_LIMIT ? Material.RED_DYE : Material.GRAY_DYE, "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
redstone.setOrder(Math.max(-SimulatorPhase.ORDER_LIMIT, order - (clickType.isShiftClick() ? 5 : 1)));
|
redstone.setOrder(Math.max(-SimulatorPhase.ORDER_LIMIT, order - (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
|
|||||||
+8
-8
@@ -66,7 +66,7 @@ public class SimulatorRedstoneSettingsGui extends SimulatorBaseGui {
|
|||||||
|
|
||||||
// Base Tick
|
// Base Tick
|
||||||
int baseTicks = redstone.getBaseTick();
|
int baseTicks = redstone.getBaseTick();
|
||||||
inventory.setItem(9, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(9, new SWItem(Material.LIME_DYE, "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
redstone.changeBaseTicks(clickType.isShiftClick() ? 5 : 1);
|
redstone.changeBaseTicks(clickType.isShiftClick() ? 5 : 1);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
@@ -81,7 +81,7 @@ public class SimulatorRedstoneSettingsGui extends SimulatorBaseGui {
|
|||||||
});
|
});
|
||||||
baseTick.getItemStack().setAmount(Math.max(1, Math.min(baseTicks, 64)));
|
baseTick.getItemStack().setAmount(Math.max(1, Math.min(baseTicks, 64)));
|
||||||
inventory.setItem(18, baseTick);
|
inventory.setItem(18, baseTick);
|
||||||
inventory.setItem(27, new SWItem(SWItem.getDye(baseTicks > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(27, new SWItem(baseTicks > 0 ? Material.RED_DYE : Material.GRAY_DYE, "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
if (baseTicks - (clickType.isShiftClick() ? 5 : 1) < 0) {
|
if (baseTicks - (clickType.isShiftClick() ? 5 : 1) < 0) {
|
||||||
redstone.changeBaseTicks(-baseTicks);
|
redstone.changeBaseTicks(-baseTicks);
|
||||||
@@ -92,7 +92,7 @@ public class SimulatorRedstoneSettingsGui extends SimulatorBaseGui {
|
|||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
||||||
|
|
||||||
//Pos X
|
//Pos X
|
||||||
inventory.setItem(15, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(15, new SWItem(Material.LIME_DYE, "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
redstone.move(clickType.isShiftClick() ? 5 : 1, 0, 0);
|
redstone.move(clickType.isShiftClick() ? 5 : 1, 0, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
@@ -104,14 +104,14 @@ public class SimulatorRedstoneSettingsGui extends SimulatorBaseGui {
|
|||||||
return true;
|
return true;
|
||||||
}, this).open();
|
}, this).open();
|
||||||
}));
|
}));
|
||||||
inventory.setItem(33, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(33, new SWItem(Material.RED_DYE, "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
redstone.move(clickType.isShiftClick() ? -5 : -1, 0, 0);
|
redstone.move(clickType.isShiftClick() ? -5 : -1, 0, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
||||||
|
|
||||||
//Pos Y
|
//Pos Y
|
||||||
inventory.setItem(16, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(16, new SWItem(Material.LIME_DYE, "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
redstone.move(0, clickType.isShiftClick() ? 5 : 1, 0);
|
redstone.move(0, clickType.isShiftClick() ? 5 : 1, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
@@ -123,14 +123,14 @@ public class SimulatorRedstoneSettingsGui extends SimulatorBaseGui {
|
|||||||
return true;
|
return true;
|
||||||
}, this).open();
|
}, this).open();
|
||||||
}));
|
}));
|
||||||
inventory.setItem(34, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(34, new SWItem(Material.RED_DYE, "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
redstone.move(0, clickType.isShiftClick() ? -5 : -1, 0);
|
redstone.move(0, clickType.isShiftClick() ? -5 : -1, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
||||||
|
|
||||||
//Pos Z
|
//Pos Z
|
||||||
inventory.setItem(17, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(17, new SWItem(Material.LIME_DYE, "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
redstone.move(0, 0, clickType.isShiftClick() ? 5 : 1);
|
redstone.move(0, 0, clickType.isShiftClick() ? 5 : 1);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
@@ -142,7 +142,7 @@ public class SimulatorRedstoneSettingsGui extends SimulatorBaseGui {
|
|||||||
return true;
|
return true;
|
||||||
}, this).open();
|
}, this).open();
|
||||||
}));
|
}));
|
||||||
inventory.setItem(35, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(35, new SWItem(Material.RED_DYE, "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
redstone.move(0, 0, clickType.isShiftClick() ? -5 : -1);
|
redstone.move(0, 0, clickType.isShiftClick() ? -5 : -1);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
|
|||||||
+6
-6
@@ -66,37 +66,37 @@ public class SimulatorSettingsGui extends SimulatorBaseGui {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
//Pos X
|
//Pos X
|
||||||
inventory.setItem(15, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(15, new SWItem(Material.LIME_DYE, "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
simulator.move(clickType.isShiftClick() ? 5 : 1, 0, 0);
|
simulator.move(clickType.isShiftClick() ? 5 : 1, 0, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
||||||
inventory.setItem(24, new SWItem(Material.PAPER, "§eX", clickType -> {
|
inventory.setItem(24, new SWItem(Material.PAPER, "§eX", clickType -> {
|
||||||
}));
|
}));
|
||||||
inventory.setItem(33, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(33, new SWItem(Material.RED_DYE, "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
simulator.move(clickType.isShiftClick() ? -5 : -1, 0, 0);
|
simulator.move(clickType.isShiftClick() ? -5 : -1, 0, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
||||||
|
|
||||||
//Pos Y
|
//Pos Y
|
||||||
inventory.setItem(16, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(16, new SWItem(Material.LIME_DYE, "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
simulator.move(0, clickType.isShiftClick() ? 5 : 1, 0);
|
simulator.move(0, clickType.isShiftClick() ? 5 : 1, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
||||||
inventory.setItem(25, new SWItem(Material.PAPER, "§eY", clickType -> {
|
inventory.setItem(25, new SWItem(Material.PAPER, "§eY", clickType -> {
|
||||||
}));
|
}));
|
||||||
inventory.setItem(34, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(34, new SWItem(Material.RED_DYE, "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
simulator.move(0, clickType.isShiftClick() ? -5 : -1, 0);
|
simulator.move(0, clickType.isShiftClick() ? -5 : -1, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
||||||
|
|
||||||
//Pos Z
|
//Pos Z
|
||||||
inventory.setItem(17, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(17, new SWItem(Material.LIME_DYE, "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
simulator.move(0, 0, clickType.isShiftClick() ? 5 : 1);
|
simulator.move(0, 0, clickType.isShiftClick() ? 5 : 1);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
||||||
inventory.setItem(26, new SWItem(Material.PAPER, "§eZ", clickType -> {
|
inventory.setItem(26, new SWItem(Material.PAPER, "§eZ", clickType -> {
|
||||||
}));
|
}));
|
||||||
inventory.setItem(35, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(35, new SWItem(Material.RED_DYE, "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
simulator.move(0, 0, clickType.isShiftClick() ? -5 : -1);
|
simulator.move(0, 0, clickType.isShiftClick() ? -5 : -1);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
||||||
|
|||||||
+4
-7
@@ -29,7 +29,6 @@ import de.steamwar.bausystem.features.simulator.gui.base.SimulatorAnvilGui;
|
|||||||
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
|
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
|
||||||
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorScrollGui;
|
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorScrollGui;
|
||||||
import de.steamwar.bausystem.region.Region;
|
import de.steamwar.bausystem.region.Region;
|
||||||
import de.steamwar.core.Core;
|
|
||||||
import de.steamwar.data.CMDs;
|
import de.steamwar.data.CMDs;
|
||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@@ -102,7 +101,6 @@ public class SimulatorTNTGui extends SimulatorScrollGui<TNTPhase> {
|
|||||||
tnt.setDisabled(!tnt.isDisabled());
|
tnt.setDisabled(!tnt.isDisabled());
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.ENABLED_OR_DISABLED));
|
}).setCustomModelData(CMDs.Simulator.ENABLED_OR_DISABLED));
|
||||||
if (Core.getVersion() > 19) {
|
|
||||||
inventory.setItem(49, new SWItem(Material.CALIBRATED_SCULK_SENSOR, "§eCreate Stab", click -> {
|
inventory.setItem(49, new SWItem(Material.CALIBRATED_SCULK_SENSOR, "§eCreate Stab", click -> {
|
||||||
new SimulatorAnvilGui<>(player, "Depth Limit", "", Integer::parseInt, depthLimit -> {
|
new SimulatorAnvilGui<>(player, "Depth Limit", "", Integer::parseInt, depthLimit -> {
|
||||||
if (depthLimit <= 0) return false;
|
if (depthLimit <= 0) return false;
|
||||||
@@ -111,7 +109,6 @@ public class SimulatorTNTGui extends SimulatorScrollGui<TNTPhase> {
|
|||||||
return true;
|
return true;
|
||||||
}, null).open();
|
}, null).open();
|
||||||
}).setCustomModelData(CMDs.Simulator.CREATE_STAB));
|
}).setCustomModelData(CMDs.Simulator.CREATE_STAB));
|
||||||
}
|
|
||||||
inventory.setItem(50, new SWItem(Material.CHEST, parent.getElements().size() == 1 ? "§eMake Group" : "§eAdd another TNT to Group", clickType -> {
|
inventory.setItem(50, new SWItem(Material.CHEST, parent.getElements().size() == 1 ? "§eMake Group" : "§eAdd another TNT to Group", clickType -> {
|
||||||
TNTElement tntElement = new TNTElement(tnt.getPosition().clone());
|
TNTElement tntElement = new TNTElement(tnt.getPosition().clone());
|
||||||
tntElement.add(new TNTPhase());
|
tntElement.add(new TNTPhase());
|
||||||
@@ -137,13 +134,13 @@ public class SimulatorTNTGui extends SimulatorScrollGui<TNTPhase> {
|
|||||||
tnt.getItemStack().setAmount(Math.min(tntSetting.getCount(), 64));
|
tnt.getItemStack().setAmount(Math.min(tntSetting.getCount(), 64));
|
||||||
|
|
||||||
return new SWItem[]{
|
return new SWItem[]{
|
||||||
new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
|
new SWItem(Material.LIME_DYE, "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
tntSetting.setCount(tntSetting.getCount() + (clickType.isShiftClick() ? 5 : 1));
|
tntSetting.setCount(tntSetting.getCount() + (clickType.isShiftClick() ? 5 : 1));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED),
|
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED),
|
||||||
tnt,
|
tnt,
|
||||||
new SWItem(SWItem.getDye(tntSetting.getCount() > 1 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8:§e -5"), false, clickType -> {
|
new SWItem(tntSetting.getCount() > 1 ? Material.RED_DYE : Material.GRAY_DYE, "§e-1", Arrays.asList("§7Shift§8:§e -5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
tntSetting.setCount(Math.max(1, tntSetting.getCount() - (clickType.isShiftClick() ? 5 : 1)));
|
tntSetting.setCount(Math.max(1, tntSetting.getCount() - (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
@@ -157,13 +154,13 @@ public class SimulatorTNTGui extends SimulatorScrollGui<TNTPhase> {
|
|||||||
@Override
|
@Override
|
||||||
public SWItem[] lastColumn() {
|
public SWItem[] lastColumn() {
|
||||||
return new SWItem[]{
|
return new SWItem[]{
|
||||||
new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
|
new SWItem(Material.LIME_DYE, "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
|
||||||
addNewPhase(clickType.isShiftClick());
|
addNewPhase(clickType.isShiftClick());
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED),
|
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED),
|
||||||
new SWItem(Material.GUNPOWDER, "§eTNT§8:§a New Phase", clickType -> {
|
new SWItem(Material.GUNPOWDER, "§eTNT§8:§a New Phase", clickType -> {
|
||||||
addNewPhase(false);
|
addNewPhase(false);
|
||||||
}).setCustomModelData(CMDs.Simulator.NEW_PHASE),
|
}).setCustomModelData(CMDs.Simulator.NEW_PHASE),
|
||||||
new SWItem(SWItem.getDye(8), "§7", clickType -> {
|
new SWItem(Material.GRAY_DYE, "§7", clickType -> {
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED),
|
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-12
@@ -26,7 +26,6 @@ import de.steamwar.bausystem.features.simulator.data.tnt.TNTElement;
|
|||||||
import de.steamwar.bausystem.features.simulator.data.tnt.TNTPhase;
|
import de.steamwar.bausystem.features.simulator.data.tnt.TNTPhase;
|
||||||
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorAnvilGui;
|
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorAnvilGui;
|
||||||
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
|
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
|
||||||
import de.steamwar.core.Core;
|
|
||||||
import de.steamwar.data.CMDs;
|
import de.steamwar.data.CMDs;
|
||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@@ -78,7 +77,7 @@ public class SimulatorTNTPhaseSettingsGui extends SimulatorBaseGui {
|
|||||||
|
|
||||||
//Count
|
//Count
|
||||||
int count = tnt.getCount();
|
int count = tnt.getCount();
|
||||||
inventory.setItem(9, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(9, new SWItem(Material.LIME_DYE, "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
tnt.setCount(count + (clickType.isShiftClick() ? 5 : 1));
|
tnt.setCount(count + (clickType.isShiftClick() ? 5 : 1));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
@@ -95,7 +94,7 @@ public class SimulatorTNTPhaseSettingsGui extends SimulatorBaseGui {
|
|||||||
countItem.getItemStack().setAmount(Math.max(1, Math.min(count, 64)));
|
countItem.getItemStack().setAmount(Math.max(1, Math.min(count, 64)));
|
||||||
inventory.setItem(18, countItem);
|
inventory.setItem(18, countItem);
|
||||||
|
|
||||||
inventory.setItem(27, new SWItem(SWItem.getDye(count > 1 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(27, new SWItem(count > 1 ? Material.RED_DYE : Material.GRAY_DYE, "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
tnt.setCount(Math.max(1, count - (clickType.isShiftClick() ? 5 : 1)));
|
tnt.setCount(Math.max(1, count - (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
@@ -103,7 +102,7 @@ public class SimulatorTNTPhaseSettingsGui extends SimulatorBaseGui {
|
|||||||
|
|
||||||
//Tick Offset
|
//Tick Offset
|
||||||
int offset = tnt.getTickOffset();
|
int offset = tnt.getTickOffset();
|
||||||
inventory.setItem(10, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(10, new SWItem(Material.LIME_DYE, "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
tnt.setTickOffset(offset + (clickType.isShiftClick() ? 5 : 1));
|
tnt.setTickOffset(offset + (clickType.isShiftClick() ? 5 : 1));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
@@ -120,7 +119,7 @@ public class SimulatorTNTPhaseSettingsGui extends SimulatorBaseGui {
|
|||||||
offsetItem.getItemStack().setAmount(Math.max(1, Math.min(offset, 64)));
|
offsetItem.getItemStack().setAmount(Math.max(1, Math.min(offset, 64)));
|
||||||
inventory.setItem(19, offsetItem);
|
inventory.setItem(19, offsetItem);
|
||||||
|
|
||||||
inventory.setItem(28, new SWItem(SWItem.getDye(offset > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(28, new SWItem(offset > 0 ? Material.RED_DYE : Material.GRAY_DYE, "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
tnt.setTickOffset(Math.max(0, offset - (clickType.isShiftClick() ? 5 : 1)));
|
tnt.setTickOffset(Math.max(0, offset - (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
@@ -128,7 +127,7 @@ public class SimulatorTNTPhaseSettingsGui extends SimulatorBaseGui {
|
|||||||
|
|
||||||
//Lifetime
|
//Lifetime
|
||||||
int lifetime = tnt.getLifetime();
|
int lifetime = tnt.getLifetime();
|
||||||
inventory.setItem(11, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(11, new SWItem(Material.LIME_DYE, "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
tnt.setLifetime(lifetime + (clickType.isShiftClick() ? 5 : 1));
|
tnt.setLifetime(lifetime + (clickType.isShiftClick() ? 5 : 1));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
@@ -145,7 +144,7 @@ public class SimulatorTNTPhaseSettingsGui extends SimulatorBaseGui {
|
|||||||
lifetimeItem.getItemStack().setAmount(Math.max(1, Math.min(lifetime, 64)));
|
lifetimeItem.getItemStack().setAmount(Math.max(1, Math.min(lifetime, 64)));
|
||||||
inventory.setItem(20, lifetimeItem);
|
inventory.setItem(20, lifetimeItem);
|
||||||
|
|
||||||
inventory.setItem(29, new SWItem(SWItem.getDye(lifetime > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(29, new SWItem(lifetime > 0 ? Material.GRAY_DYE : Material.GRAY_DYE, "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
tnt.setLifetime(Math.max(1, lifetime - (clickType.isShiftClick() ? 5 : 1)));
|
tnt.setLifetime(Math.max(1, lifetime - (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
@@ -153,26 +152,25 @@ public class SimulatorTNTPhaseSettingsGui extends SimulatorBaseGui {
|
|||||||
|
|
||||||
//Order
|
//Order
|
||||||
int order = tnt.getOrder();
|
int order = tnt.getOrder();
|
||||||
inventory.setItem(13, new SWItem(SWItem.getDye(order < SimulatorPhase.ORDER_LIMIT ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(13, new SWItem(order < SimulatorPhase.ORDER_LIMIT ? Material.LIME_DYE : Material.GRAY_DYE, "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
tnt.setOrder(Math.min(SimulatorPhase.ORDER_LIMIT, order + (clickType.isShiftClick() ? 5 : 1)));
|
tnt.setOrder(Math.min(SimulatorPhase.ORDER_LIMIT, order + (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
||||||
|
|
||||||
Material negativeNumbers = Material.getMaterial(Core.getVersion() >= 19 ? "RECOVERY_COMPASS" : "FIREWORK_STAR");
|
SWItem orderItem = new SWItem(order >= 0 ? Material.COMPASS : Material.RECOVERY_COMPASS, "§eCalculation Order§8:§7 " + order, clickType -> {
|
||||||
SWItem orderItem = new SWItem(order >= 0 ? Material.COMPASS : negativeNumbers, "§eCalculation Order§8:§7 " + order, clickType -> {
|
|
||||||
new SimulatorAnvilGui<>(player, "Calculation Order", order + "", Integer::parseInt, integer -> {
|
new SimulatorAnvilGui<>(player, "Calculation Order", order + "", Integer::parseInt, integer -> {
|
||||||
if (integer < -SimulatorPhase.ORDER_LIMIT) return false;
|
if (integer < -SimulatorPhase.ORDER_LIMIT) return false;
|
||||||
if (integer > SimulatorPhase.ORDER_LIMIT) return false;
|
if (integer > SimulatorPhase.ORDER_LIMIT) return false;
|
||||||
tnt.setOrder(integer);
|
tnt.setOrder(integer);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
return true;
|
return true;
|
||||||
}, this).setItem(order >= 0 ? Material.COMPASS : negativeNumbers).open();
|
}, this).setItem(order >= 0 ? Material.COMPASS : Material.RECOVERY_COMPASS).open();
|
||||||
});
|
});
|
||||||
orderItem.getItemStack().setAmount(Math.max(1, Math.min(Math.abs(order), 30)));
|
orderItem.getItemStack().setAmount(Math.max(1, Math.min(Math.abs(order), 30)));
|
||||||
inventory.setItem(22, orderItem);
|
inventory.setItem(22, orderItem);
|
||||||
|
|
||||||
inventory.setItem(31, new SWItem(SWItem.getDye(order > -SimulatorPhase.ORDER_LIMIT ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(31, new SWItem(order > -SimulatorPhase.ORDER_LIMIT ? Material.RED_DYE : Material.GRAY_DYE, "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
tnt.setOrder(Math.max(-SimulatorPhase.ORDER_LIMIT, order - (clickType.isShiftClick() ? 5 : 1)));
|
tnt.setOrder(Math.max(-SimulatorPhase.ORDER_LIMIT, order - (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
|
|||||||
+8
-8
@@ -75,7 +75,7 @@ public class SimulatorTNTSettingsGui extends SimulatorBaseGui {
|
|||||||
|
|
||||||
// Base Tick
|
// Base Tick
|
||||||
int baseTicks = tnt.getBaseTick();
|
int baseTicks = tnt.getBaseTick();
|
||||||
inventory.setItem(9, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(9, new SWItem(Material.LIME_DYE, "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
tnt.changeBaseTicks(clickType.isShiftClick() ? 5 : 1);
|
tnt.changeBaseTicks(clickType.isShiftClick() ? 5 : 1);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
@@ -90,7 +90,7 @@ public class SimulatorTNTSettingsGui extends SimulatorBaseGui {
|
|||||||
});
|
});
|
||||||
baseTick.getItemStack().setAmount(Math.max(1, Math.min(baseTicks, 64)));
|
baseTick.getItemStack().setAmount(Math.max(1, Math.min(baseTicks, 64)));
|
||||||
inventory.setItem(18, baseTick);
|
inventory.setItem(18, baseTick);
|
||||||
inventory.setItem(27, new SWItem(SWItem.getDye(baseTicks > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(27, new SWItem(baseTicks > 0 ? Material.RED_DYE : Material.GRAY_DYE, "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
if (baseTicks - (clickType.isShiftClick() ? 5 : 1) < 0) {
|
if (baseTicks - (clickType.isShiftClick() ? 5 : 1) < 0) {
|
||||||
tnt.changeBaseTicks(-baseTicks);
|
tnt.changeBaseTicks(-baseTicks);
|
||||||
@@ -138,7 +138,7 @@ public class SimulatorTNTSettingsGui extends SimulatorBaseGui {
|
|||||||
inventory.setItem(30, positivXItem);
|
inventory.setItem(30, positivXItem);
|
||||||
|
|
||||||
// Pos X
|
// Pos X
|
||||||
inventory.setItem(15, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+0.0625"), false, clickType -> {
|
inventory.setItem(15, new SWItem(Material.LIME_DYE, "§e+1", Arrays.asList("§7Shift§8: §e+0.0625"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
tnt.move(clickType.isShiftClick() ? 0.0625 : 1, 0, 0);
|
tnt.move(clickType.isShiftClick() ? 0.0625 : 1, 0, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
@@ -150,14 +150,14 @@ public class SimulatorTNTSettingsGui extends SimulatorBaseGui {
|
|||||||
return true;
|
return true;
|
||||||
}, this).open();
|
}, this).open();
|
||||||
}));
|
}));
|
||||||
inventory.setItem(33, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-0.0625"), false, clickType -> {
|
inventory.setItem(33, new SWItem(Material.RED_DYE, "§e-1", Arrays.asList("§7Shift§8: §e-0.0625"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
tnt.move(clickType.isShiftClick() ? -0.0625 : -1, 0, 0);
|
tnt.move(clickType.isShiftClick() ? -0.0625 : -1, 0, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
||||||
|
|
||||||
// Pos Y
|
// Pos Y
|
||||||
inventory.setItem(16, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+0.0625"), false, clickType -> {
|
inventory.setItem(16, new SWItem(Material.LIME_DYE, "§e+1", Arrays.asList("§7Shift§8: §e+0.0625"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
tnt.move(0, clickType.isShiftClick() ? 0.0625 : 1, 0);
|
tnt.move(0, clickType.isShiftClick() ? 0.0625 : 1, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
@@ -169,14 +169,14 @@ public class SimulatorTNTSettingsGui extends SimulatorBaseGui {
|
|||||||
return true;
|
return true;
|
||||||
}, this).open();
|
}, this).open();
|
||||||
}));
|
}));
|
||||||
inventory.setItem(34, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-0.0625"), false, clickType -> {
|
inventory.setItem(34, new SWItem(Material.RED_DYE, "§e-1", Arrays.asList("§7Shift§8: §e-0.0625"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
tnt.move(0, clickType.isShiftClick() ? -0.0625 : -1, 0);
|
tnt.move(0, clickType.isShiftClick() ? -0.0625 : -1, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
||||||
|
|
||||||
// Pos Z
|
// Pos Z
|
||||||
inventory.setItem(17, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+0.0625"), false, clickType -> {
|
inventory.setItem(17, new SWItem(Material.LIME_DYE, "§e+1", Arrays.asList("§7Shift§8: §e+0.0625"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
tnt.move(0, 0, clickType.isShiftClick() ? 0.0625 : 1);
|
tnt.move(0, 0, clickType.isShiftClick() ? 0.0625 : 1);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
@@ -188,7 +188,7 @@ public class SimulatorTNTSettingsGui extends SimulatorBaseGui {
|
|||||||
return true;
|
return true;
|
||||||
}, this).open();
|
}, this).open();
|
||||||
}));
|
}));
|
||||||
inventory.setItem(35, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-0.0625"), false, clickType -> {
|
inventory.setItem(35, new SWItem(Material.RED_DYE, "§e-1", Arrays.asList("§7Shift§8: §e-0.0625"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
tnt.move(0, 0, clickType.isShiftClick() ? -0.0625 : -1);
|
tnt.move(0, 0, clickType.isShiftClick() ? -0.0625 : -1);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
|
|||||||
+1
-7
@@ -21,7 +21,6 @@ package de.steamwar.bausystem.features.simulator.gui.base;
|
|||||||
|
|
||||||
import de.steamwar.bausystem.features.simulator.SimulatorWatcher;
|
import de.steamwar.bausystem.features.simulator.SimulatorWatcher;
|
||||||
import de.steamwar.bausystem.features.simulator.data.Simulator;
|
import de.steamwar.bausystem.features.simulator.data.Simulator;
|
||||||
import de.steamwar.core.Core;
|
|
||||||
import de.steamwar.inventory.SWInventory;
|
import de.steamwar.inventory.SWInventory;
|
||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@@ -47,10 +46,7 @@ public abstract class SimulatorBaseGui {
|
|||||||
public final void open() {
|
public final void open() {
|
||||||
if (!shouldOpen()) return;
|
if (!shouldOpen()) return;
|
||||||
|
|
||||||
String newTitle = title();
|
if (inv != null) {
|
||||||
String originalTitle = player.getOpenInventory().getTitle();
|
|
||||||
|
|
||||||
if (inv != null && (Core.getVersion() > 19 || newTitle.equals(originalTitle))) {
|
|
||||||
// TODO: Flickering is better but not gone!
|
// TODO: Flickering is better but not gone!
|
||||||
for (int i = 9; i < size - 9; i++) {
|
for (int i = 9; i < size - 9; i++) {
|
||||||
inv.setItem(i, null);
|
inv.setItem(i, null);
|
||||||
@@ -60,9 +56,7 @@ public abstract class SimulatorBaseGui {
|
|||||||
inventory.open();
|
inventory.open();
|
||||||
SimulatorWatcher.watch(player, simulator, this::open);
|
SimulatorWatcher.watch(player, simulator, this::open);
|
||||||
}
|
}
|
||||||
if (Core.getVersion() > 19) {
|
|
||||||
player.getOpenInventory().setTitle(title());
|
player.getOpenInventory().setTitle(title());
|
||||||
}
|
|
||||||
if (simulator != null && simulator.getStabGenerator() != null) {
|
if (simulator != null && simulator.getStabGenerator() != null) {
|
||||||
populateStabGenerator();
|
populateStabGenerator();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+3
-2
@@ -23,6 +23,7 @@ import de.steamwar.bausystem.features.simulator.data.Simulator;
|
|||||||
import de.steamwar.core.Core;
|
import de.steamwar.core.Core;
|
||||||
import de.steamwar.data.CMDs;
|
import de.steamwar.data.CMDs;
|
||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -51,14 +52,14 @@ public abstract class SimulatorPageGui<T> extends SimulatorBaseGui {
|
|||||||
headerAndFooter();
|
headerAndFooter();
|
||||||
page = Math.min(page, maxPage());
|
page = Math.min(page, maxPage());
|
||||||
|
|
||||||
inventory.setItem(size - 9, new SWItem(SWItem.getDye(page > 0 ? 10 : 8), page > 0 ? (byte) 10 : (byte) 8, Core.MESSAGE.parse(page > 0 ? "SWLISINV_PREVIOUS_PAGE_ACTIVE" : "SWLISINV_PREVIOUS_PAGE_INACTIVE", player), clickType -> {
|
inventory.setItem(size - 9, new SWItem(page > 0 ? Material.LIME_DYE : Material.GRAY_DYE, page > 0 ? (byte) 10 : (byte) 8, Core.MESSAGE.parse(page > 0 ? "SWLISINV_PREVIOUS_PAGE_ACTIVE" : "SWLISINV_PREVIOUS_PAGE_INACTIVE", player), clickType -> {
|
||||||
if (page > 0) {
|
if (page > 0) {
|
||||||
page--;
|
page--;
|
||||||
open();
|
open();
|
||||||
}
|
}
|
||||||
}).setCustomModelData(CMDs.PREVIOUS_PAGE));
|
}).setCustomModelData(CMDs.PREVIOUS_PAGE));
|
||||||
boolean hasNext = page < maxPage() - (data.size() % (size - 18) == 0 ? 1 : 0);
|
boolean hasNext = page < maxPage() - (data.size() % (size - 18) == 0 ? 1 : 0);
|
||||||
inventory.setItem(size - 1, new SWItem(SWItem.getDye(hasNext ? 10 : 8), hasNext ? (byte) 10 : (byte) 8, Core.MESSAGE.parse(hasNext ? "SWLISINV_NEXT_PAGE_ACTIVE" : "SWLISINV_NEXT_PAGE_INACTIVE", player), clickType -> {
|
inventory.setItem(size - 1, new SWItem(hasNext ? Material.LIME_DYE : Material.GRAY_DYE, hasNext ? (byte) 10 : (byte) 8, Core.MESSAGE.parse(hasNext ? "SWLISINV_NEXT_PAGE_ACTIVE" : "SWLISINV_NEXT_PAGE_INACTIVE", player), clickType -> {
|
||||||
if (hasNext) {
|
if (hasNext) {
|
||||||
page++;
|
page++;
|
||||||
open();
|
open();
|
||||||
|
|||||||
+3
-2
@@ -24,6 +24,7 @@ import de.steamwar.bausystem.features.simulator.data.Simulator;
|
|||||||
import de.steamwar.core.Core;
|
import de.steamwar.core.Core;
|
||||||
import de.steamwar.data.CMDs;
|
import de.steamwar.data.CMDs;
|
||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -51,14 +52,14 @@ public abstract class SimulatorScrollGui<T> extends SimulatorBaseGui {
|
|||||||
headerAndFooter();
|
headerAndFooter();
|
||||||
scroll = maxScroll();
|
scroll = maxScroll();
|
||||||
|
|
||||||
inventory.setItem(size - 9, new SWItem(SWItem.getDye(scroll > 0 ? 10 : 8), scroll > 0 ? (byte) 10 : (byte) 8, Core.MESSAGE.parse(scroll > 0 ? "SWLISINV_PREVIOUS_PAGE_ACTIVE" : "SWLISINV_PREVIOUS_PAGE_INACTIVE", player), clickType -> {
|
inventory.setItem(size - 9, new SWItem(scroll > 0 ? Material.LIME_DYE : Material.GRAY_DYE, scroll > 0 ? (byte) 10 : (byte) 8, Core.MESSAGE.parse(scroll > 0 ? "SWLISINV_PREVIOUS_PAGE_ACTIVE" : "SWLISINV_PREVIOUS_PAGE_INACTIVE", player), clickType -> {
|
||||||
if (scroll > 0) {
|
if (scroll > 0) {
|
||||||
scroll = Math.max(0, scroll - 9);
|
scroll = Math.max(0, scroll - 9);
|
||||||
open();
|
open();
|
||||||
}
|
}
|
||||||
}).setCustomModelData(CMDs.PREVIOUS_PAGE));
|
}).setCustomModelData(CMDs.PREVIOUS_PAGE));
|
||||||
boolean hasNext = (data.size() + 1) - scroll > 9;
|
boolean hasNext = (data.size() + 1) - scroll > 9;
|
||||||
inventory.setItem(size - 1, new SWItem(SWItem.getDye(hasNext ? 10 : 8), hasNext ? (byte) 10 : (byte) 8, Core.MESSAGE.parse(hasNext ? "SWLISINV_NEXT_PAGE_ACTIVE" : "SWLISINV_NEXT_PAGE_INACTIVE", player), clickType -> {
|
inventory.setItem(size - 1, new SWItem(hasNext ? Material.LIME_DYE : Material.GRAY_DYE, hasNext ? (byte) 10 : (byte) 8, Core.MESSAGE.parse(hasNext ? "SWLISINV_NEXT_PAGE_ACTIVE" : "SWLISINV_NEXT_PAGE_INACTIVE", player), clickType -> {
|
||||||
if (hasNext) {
|
if (hasNext) {
|
||||||
scroll = Math.min(scroll + 9, data.size() + 1 - 9);
|
scroll = Math.min(scroll + 9, data.size() + 1 - 9);
|
||||||
open();
|
open();
|
||||||
|
|||||||
+1
-5
@@ -21,8 +21,6 @@ package de.steamwar.bausystem.features.slaves.laufbau;
|
|||||||
|
|
||||||
import com.sk89q.worldedit.blocks.SkullBlock;
|
import com.sk89q.worldedit.blocks.SkullBlock;
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
import de.steamwar.bausystem.utils.NMSWrapper;
|
|
||||||
import de.steamwar.core.Core;
|
|
||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
@@ -100,7 +98,7 @@ public class BlockBoundingBox {
|
|||||||
// addPixel(Material.COBWEB.createBlockData(), 0, 0, 0, 0, 0, 0, createItem("LAUFBAU_BLOCK_COBWEB", Material.COBWEB));
|
// addPixel(Material.COBWEB.createBlockData(), 0, 0, 0, 0, 0, 0, createItem("LAUFBAU_BLOCK_COBWEB", Material.COBWEB));
|
||||||
addPixel(Material.END_STONE.createBlockData(), 0, 0, 0, 16, 16, 16, null);
|
addPixel(Material.END_STONE.createBlockData(), 0, 0, 0, 16, 16, 16, null);
|
||||||
|
|
||||||
addPixel(NMSWrapper.impl.pathMaterial().createBlockData(), 0, 0, 0, 16, 15, 16, createItem("LAUFBAU_BLOCK_GRASS_PATH", NMSWrapper.impl.pathMaterial()));
|
addPixel(Material.DIRT_PATH.createBlockData(), 0, 0, 0, 16, 15, 16, createItem("LAUFBAU_BLOCK_GRASS_PATH", Material.DIRT_PATH));
|
||||||
addPixel(Material.MUD.createBlockData(), 0, 0, 0, 16, 14, 16, createItem("LAUFBAU_BLOCK_SOUL_SAND", Material.SOUL_SAND));
|
addPixel(Material.MUD.createBlockData(), 0, 0, 0, 16, 14, 16, createItem("LAUFBAU_BLOCK_SOUL_SAND", Material.SOUL_SAND));
|
||||||
|
|
||||||
Cocoa cocoaNorth = (Cocoa) Material.COCOA.createBlockData();
|
Cocoa cocoaNorth = (Cocoa) Material.COCOA.createBlockData();
|
||||||
@@ -235,7 +233,6 @@ public class BlockBoundingBox {
|
|||||||
endRodEastWest.setFacing(BlockFace.EAST);
|
endRodEastWest.setFacing(BlockFace.EAST);
|
||||||
addPixel(endRodEastWest, 0, 6, 6, 16, 4, 4, createItem("LAUFBAU_BLOCK_END_ROD", Material.END_ROD, "LAUFBAU_FACING_EAST", "LAUFBAU_FACING_WEST"));
|
addPixel(endRodEastWest, 0, 6, 6, 16, 4, 4, createItem("LAUFBAU_BLOCK_END_ROD", Material.END_ROD, "LAUFBAU_FACING_EAST", "LAUFBAU_FACING_WEST"));
|
||||||
|
|
||||||
if (Core.getVersion() >= 19) {
|
|
||||||
Directional lightningRodBottomTop = (Directional) Material.LIGHTNING_ROD.createBlockData();
|
Directional lightningRodBottomTop = (Directional) Material.LIGHTNING_ROD.createBlockData();
|
||||||
lightningRodBottomTop.setFacing(BlockFace.UP);
|
lightningRodBottomTop.setFacing(BlockFace.UP);
|
||||||
addPixel(lightningRodBottomTop, 6, 0, 6, 4, 16, 4, createItem("LAUFBAU_BLOCK_LIGHTNING_ROD", Material.LIGHTNING_ROD, "LAUFBAU_FACING_UP", "LAUFBAU_FACING_DOWN"));
|
addPixel(lightningRodBottomTop, 6, 0, 6, 4, 16, 4, createItem("LAUFBAU_BLOCK_LIGHTNING_ROD", Material.LIGHTNING_ROD, "LAUFBAU_FACING_UP", "LAUFBAU_FACING_DOWN"));
|
||||||
@@ -247,7 +244,6 @@ public class BlockBoundingBox {
|
|||||||
Directional lightningRodEastWest = (Directional) Material.LIGHTNING_ROD.createBlockData();
|
Directional lightningRodEastWest = (Directional) Material.LIGHTNING_ROD.createBlockData();
|
||||||
lightningRodEastWest.setFacing(BlockFace.EAST);
|
lightningRodEastWest.setFacing(BlockFace.EAST);
|
||||||
addPixel(lightningRodEastWest, 0, 6, 6, 16, 4, 4, createItem("LAUFBAU_BLOCK_LIGHTNING_ROD", Material.LIGHTNING_ROD, "LAUFBAU_FACING_EAST", "LAUFBAU_FACING_WEST"));
|
addPixel(lightningRodEastWest, 0, 6, 6, 16, 4, 4, createItem("LAUFBAU_BLOCK_LIGHTNING_ROD", Material.LIGHTNING_ROD, "LAUFBAU_FACING_EAST", "LAUFBAU_FACING_WEST"));
|
||||||
}
|
|
||||||
|
|
||||||
Waterlogged conduit = (Waterlogged) Material.CONDUIT.createBlockData();
|
Waterlogged conduit = (Waterlogged) Material.CONDUIT.createBlockData();
|
||||||
conduit.setWaterlogged(false);
|
conduit.setWaterlogged(false);
|
||||||
|
|||||||
-2
@@ -25,14 +25,12 @@ import de.steamwar.bausystem.shared.Pair;
|
|||||||
import de.steamwar.bausystem.utils.WorldEditUtils;
|
import de.steamwar.bausystem.utils.WorldEditUtils;
|
||||||
import de.steamwar.command.SWCommand;
|
import de.steamwar.command.SWCommand;
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import de.steamwar.linkage.MinVersion;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
@Linked
|
@Linked
|
||||||
@MinVersion(19)
|
|
||||||
public class LaufbauCommand extends SWCommand {
|
public class LaufbauCommand extends SWCommand {
|
||||||
|
|
||||||
public LaufbauCommand() {
|
public LaufbauCommand() {
|
||||||
|
|||||||
+7
-3
@@ -33,6 +33,7 @@ import java.util.*;
|
|||||||
public class LaufbauSettings {
|
public class LaufbauSettings {
|
||||||
|
|
||||||
private static Map<Pair<Material, String>, List<BlockBoundingBox>> groupMap = new LinkedHashMap<>();
|
private static Map<Pair<Material, String>, List<BlockBoundingBox>> groupMap = new LinkedHashMap<>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
BlockBoundingBox.elements.forEach(blockBoundingBox -> {
|
BlockBoundingBox.elements.forEach(blockBoundingBox -> {
|
||||||
if (blockBoundingBox.getSwItem() == null) return;
|
if (blockBoundingBox.getSwItem() == null) return;
|
||||||
@@ -115,12 +116,15 @@ public class LaufbauSettings {
|
|||||||
} else {
|
} else {
|
||||||
long count = blockBoundingBoxes.stream().filter(bb -> LaufbauUtils.isDeactivated(p, bb)).count();
|
long count = blockBoundingBoxes.stream().filter(bb -> LaufbauUtils.isDeactivated(p, bb)).count();
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
return new SWItem(material, BauSystem.MESSAGE.parse(group, p), Arrays.asList("", BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_ACTIVE", p), "", BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_ADVANCED", p), BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_TOGGLE", p)), false, clickType -> {});
|
return new SWItem(material, BauSystem.MESSAGE.parse(group, p), Arrays.asList("", BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_ACTIVE", p), "", BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_ADVANCED", p), BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_TOGGLE", p)), false, clickType -> {
|
||||||
|
});
|
||||||
}
|
}
|
||||||
if (count == blockBoundingBoxes.size()) {
|
if (count == blockBoundingBoxes.size()) {
|
||||||
return new SWItem(material, BauSystem.MESSAGE.parse(group, p), Arrays.asList("", BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_INACTIVE", p), "", BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_ADVANCED", p), BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_TOGGLE", p)), false, clickType -> {});
|
return new SWItem(material, BauSystem.MESSAGE.parse(group, p), Arrays.asList("", BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_INACTIVE", p), "", BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_ADVANCED", p), BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_TOGGLE", p)), false, clickType -> {
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return new SWItem(material, BauSystem.MESSAGE.parse(group, p), Arrays.asList("", BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_MIXED", p, blockBoundingBoxes.size() - count, blockBoundingBoxes.size()), "", BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_ADVANCED", p), BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_TOGGLE", p)), false, clickType -> {});
|
return new SWItem(material, BauSystem.MESSAGE.parse(group, p), Arrays.asList("", BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_MIXED", p, blockBoundingBoxes.size() - count, blockBoundingBoxes.size()), "", BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_ADVANCED", p), BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_TOGGLE", p)), false, clickType -> {
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
-2
@@ -23,7 +23,6 @@ import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
|
|||||||
import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader;
|
import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader;
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import de.steamwar.linkage.MinVersion;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.block.data.type.AmethystCluster;
|
import org.bukkit.block.data.type.AmethystCluster;
|
||||||
@@ -35,7 +34,6 @@ import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createI
|
|||||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid;
|
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid;
|
||||||
|
|
||||||
@Linked
|
@Linked
|
||||||
@MinVersion(19)
|
|
||||||
public class AmethystBoundingBox implements BoundingBoxLoader {
|
public class AmethystBoundingBox implements BoundingBoxLoader {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
-2
@@ -23,7 +23,6 @@ import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
|
|||||||
import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader;
|
import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader;
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import de.steamwar.linkage.MinVersion;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
|
|
||||||
@@ -34,7 +33,6 @@ import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createI
|
|||||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid;
|
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid;
|
||||||
|
|
||||||
@Linked
|
@Linked
|
||||||
@MinVersion(19)
|
|
||||||
public class AzaleaBoundingBox implements BoundingBoxLoader {
|
public class AzaleaBoundingBox implements BoundingBoxLoader {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
-2
@@ -23,7 +23,6 @@ import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
|
|||||||
import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader;
|
import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader;
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import de.steamwar.linkage.MinVersion;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.data.Lightable;
|
import org.bukkit.block.data.Lightable;
|
||||||
import org.bukkit.block.data.type.Candle;
|
import org.bukkit.block.data.type.Candle;
|
||||||
@@ -35,7 +34,6 @@ import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createI
|
|||||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid;
|
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid;
|
||||||
|
|
||||||
@Linked
|
@Linked
|
||||||
@MinVersion(19)
|
|
||||||
public class CandleBoundingBox implements BoundingBoxLoader {
|
public class CandleBoundingBox implements BoundingBoxLoader {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
-2
@@ -23,7 +23,6 @@ import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
|
|||||||
import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader;
|
import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader;
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import de.steamwar.linkage.MinVersion;
|
|
||||||
import org.bukkit.Axis;
|
import org.bukkit.Axis;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.data.Orientable;
|
import org.bukkit.block.data.Orientable;
|
||||||
@@ -35,7 +34,6 @@ import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createI
|
|||||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid;
|
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid;
|
||||||
|
|
||||||
@Linked
|
@Linked
|
||||||
@MinVersion(19)
|
|
||||||
public class ChainBoundingBox implements BoundingBoxLoader {
|
public class ChainBoundingBox implements BoundingBoxLoader {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
-2
@@ -23,7 +23,6 @@ import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
|
|||||||
import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader;
|
import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader;
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import de.steamwar.linkage.MinVersion;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
|
|
||||||
@@ -34,7 +33,6 @@ import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createI
|
|||||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid;
|
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid;
|
||||||
|
|
||||||
@Linked
|
@Linked
|
||||||
@MinVersion(19)
|
|
||||||
public class DragonEggBoundingBox implements BoundingBoxLoader {
|
public class DragonEggBoundingBox implements BoundingBoxLoader {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
-2
@@ -23,7 +23,6 @@ import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
|
|||||||
import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader;
|
import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader;
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import de.steamwar.linkage.MinVersion;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.data.type.BigDripleaf;
|
import org.bukkit.block.data.type.BigDripleaf;
|
||||||
|
|
||||||
@@ -34,7 +33,6 @@ import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createI
|
|||||||
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid;
|
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid;
|
||||||
|
|
||||||
@Linked
|
@Linked
|
||||||
@MinVersion(19)
|
|
||||||
public class DripLeafBoundingBox implements BoundingBoxLoader {
|
public class DripLeafBoundingBox implements BoundingBoxLoader {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
-42
@@ -22,11 +22,9 @@ package de.steamwar.bausystem.features.slaves.laufbau.boundingboxes;
|
|||||||
import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
|
import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader;
|
import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader;
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
||||||
import de.steamwar.core.Core;
|
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.block.data.type.Fence;
|
|
||||||
import org.bukkit.block.data.type.Wall;
|
import org.bukkit.block.data.type.Wall;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -40,11 +38,7 @@ public class WallBoundingBox implements BoundingBoxLoader {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load() {
|
public void load() {
|
||||||
if (Core.getVersion() > 15) {
|
|
||||||
v18();
|
v18();
|
||||||
} else {
|
|
||||||
v15();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void v18() {
|
private void v18() {
|
||||||
@@ -82,40 +76,4 @@ public class WallBoundingBox implements BoundingBoxLoader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void v15() {
|
|
||||||
for (int nx = 0; nx < 2; nx++) {
|
|
||||||
for (int nz = 0; nz < 2; nz++) {
|
|
||||||
for (int px = 0; px < 2; px++) {
|
|
||||||
for (int pz = 0; pz < 2; pz++) {
|
|
||||||
Fence fence = (Fence) Material.END_STONE_BRICK_WALL.createBlockData();
|
|
||||||
List<String> lore = new ArrayList<>();
|
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
|
||||||
cuboidList.add(pixelCuboid(4, 0, 4, 8, 24, 8));
|
|
||||||
if (nz == 1) {
|
|
||||||
lore.add("LAUFBAU_CONNECTION_NORTH");
|
|
||||||
fence.setFace(BlockFace.NORTH, true);
|
|
||||||
cuboidList.add(pixelCuboid(5, 0, 0, 6, 24, 4));
|
|
||||||
}
|
|
||||||
if (pz == 1) {
|
|
||||||
lore.add("LAUFBAU_CONNECTION_SOUTH");
|
|
||||||
fence.setFace(BlockFace.SOUTH, true);
|
|
||||||
cuboidList.add(pixelCuboid(5, 0, 12, 6, 24, 4));
|
|
||||||
}
|
|
||||||
if (nx == 1) {
|
|
||||||
lore.add("LAUFBAU_CONNECTION_WEST");
|
|
||||||
fence.setFace(BlockFace.WEST, true);
|
|
||||||
cuboidList.add(pixelCuboid(0, 0, 5, 4, 24, 6));
|
|
||||||
}
|
|
||||||
if (px == 1) {
|
|
||||||
lore.add("LAUFBAU_CONNECTION_EAST");
|
|
||||||
fence.setFace(BlockFace.EAST, true);
|
|
||||||
cuboidList.add(pixelCuboid(12, 0, 5, 4, 24, 6));
|
|
||||||
}
|
|
||||||
new BlockBoundingBox(fence, cuboidList, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_WALL", Material.END_STONE_BRICK_WALL, lore.toArray(new String[0])));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -87,8 +87,9 @@ public class ProcessingTracesState implements LaufbauState {
|
|||||||
|
|
||||||
TNTPoint current = TNTPoints.remove(0);
|
TNTPoint current = TNTPoints.remove(0);
|
||||||
if (FlatteningWrapper.impl.inWater(world, current.getLocation().toVector())) return;
|
if (FlatteningWrapper.impl.inWater(world, current.getLocation().toVector())) return;
|
||||||
if (!(inRegion(current.getLocation().toVector(), 1) || (current.getPrevious().isPresent() && inRegion(current.getPrevious().get().getLocation().toVector(), 1))))
|
if (!(inRegion(current.getLocation().toVector(), 1) || (current.getPrevious().isPresent() && inRegion(current.getPrevious().get().getLocation().toVector(), 1)))) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Location location = current.getLocation();
|
Location location = current.getLocation();
|
||||||
if (current.getPrevious().isPresent()) {
|
if (current.getPrevious().isPresent()) {
|
||||||
|
|||||||
+2
-3
@@ -25,7 +25,6 @@ import com.sk89q.worldedit.world.block.BaseBlock;
|
|||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||||
import de.steamwar.bausystem.utils.WorldEditUtils;
|
import de.steamwar.bausystem.utils.WorldEditUtils;
|
||||||
import de.steamwar.core.Core;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@@ -41,6 +40,7 @@ import java.util.*;
|
|||||||
public class Panzern {
|
public class Panzern {
|
||||||
|
|
||||||
private static List<PanzernAlgorithm> panzernAlgorithmList = new ArrayList<>();
|
private static List<PanzernAlgorithm> panzernAlgorithmList = new ArrayList<>();
|
||||||
|
|
||||||
public static void add(PanzernAlgorithm panzernAlgorithm) {
|
public static void add(PanzernAlgorithm panzernAlgorithm) {
|
||||||
panzernAlgorithmList.add(panzernAlgorithm);
|
panzernAlgorithmList.add(panzernAlgorithm);
|
||||||
}
|
}
|
||||||
@@ -57,9 +57,8 @@ public class Panzern {
|
|||||||
|
|
||||||
private BaseBlock blockType;
|
private BaseBlock blockType;
|
||||||
private BaseBlock slabType;
|
private BaseBlock slabType;
|
||||||
private static final BaseBlock jukeboxType = (Core.getVersion() > 19 ? BlockTypes.get("lodestone"): BlockTypes.get("jukebox")).getDefaultState().toBaseBlock();
|
private static final BaseBlock jukeboxType = BlockTypes.get("lodestone").getDefaultState().toBaseBlock();
|
||||||
private static final BaseBlock cobwebType = BlockTypes.COBWEB.getDefaultState().toBaseBlock();
|
private static final BaseBlock cobwebType = BlockTypes.COBWEB.getDefaultState().toBaseBlock();
|
||||||
private static final BaseBlock airType = BlockTypes.AIR.getDefaultState().toBaseBlock();
|
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private EditSession editSession;
|
private EditSession editSession;
|
||||||
|
|||||||
+5
-9
@@ -20,13 +20,11 @@
|
|||||||
package de.steamwar.bausystem.features.smartplace;
|
package de.steamwar.bausystem.features.smartplace;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.TinyProtocol;
|
import com.comphenix.tinyprotocol.TinyProtocol;
|
||||||
import de.steamwar.Reflection;
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.bausystem.Permission;
|
import de.steamwar.bausystem.Permission;
|
||||||
import de.steamwar.bausystem.configplayer.Config;
|
import de.steamwar.bausystem.configplayer.Config;
|
||||||
import de.steamwar.core.Core;
|
|
||||||
import de.steamwar.inventory.SWItem;
|
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
|
import net.minecraft.network.protocol.game.ServerboundUseItemOnPacket;
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
@@ -77,19 +75,17 @@ public class SmartPlaceListener implements Listener {
|
|||||||
|
|
||||||
IGNORED.add(Material.TNT);
|
IGNORED.add(Material.TNT);
|
||||||
IGNORED.add(Material.REDSTONE_ORE);
|
IGNORED.add(Material.REDSTONE_ORE);
|
||||||
IGNORED.add(SWItem.getMaterial("BEEHIVE"));
|
IGNORED.add(Material.BEEHIVE);
|
||||||
IGNORED.add(SWItem.getMaterial("SEA_PICKLE"));
|
IGNORED.add(Material.SEA_PICKLE);
|
||||||
IGNORED.remove(Material.STONE);
|
IGNORED.remove(Material.STONE);
|
||||||
IGNORED.remove(Material.BARRIER);
|
IGNORED.remove(Material.BARRIER);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Class<?> useItem = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundUseItemOnPacket");
|
|
||||||
|
|
||||||
private static final Set<Player> SMART_PLACING = new HashSet<>();
|
private static final Set<Player> SMART_PLACING = new HashSet<>();
|
||||||
private static final Set<Player> WAS_EXECUTED = new HashSet<>();
|
private static final Set<Player> WAS_EXECUTED = new HashSet<>();
|
||||||
|
|
||||||
public SmartPlaceListener() {
|
public SmartPlaceListener() {
|
||||||
TinyProtocol.instance.addFilter(useItem, (player, packet) -> {
|
TinyProtocol.instance.addFilter(ServerboundUseItemOnPacket.class, (player, packet) -> {
|
||||||
if (!Permission.BUILD.hasPermission(player)) return packet;
|
if (!Permission.BUILD.hasPermission(player)) return packet;
|
||||||
if (!Config.getInstance().get(player).getPlainValueOrDefault("smartPlace", false)) return packet;
|
if (!Config.getInstance().get(player).getPlainValueOrDefault("smartPlace", false)) return packet;
|
||||||
RayTraceResult rayTraceResult = player.rayTraceBlocks(6);
|
RayTraceResult rayTraceResult = player.rayTraceBlocks(6);
|
||||||
@@ -152,7 +148,7 @@ public class SmartPlaceListener implements Listener {
|
|||||||
if (!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
if (!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||||
if (!Config.getInstance().get(event.getPlayer()).getPlainValueOrDefault("smartPlace", false)) return;
|
if (!Config.getInstance().get(event.getPlayer()).getPlainValueOrDefault("smartPlace", false)) return;
|
||||||
if (!SMART_PLACING.contains(event.getPlayer())) {
|
if (!SMART_PLACING.contains(event.getPlayer())) {
|
||||||
if (Core.getVersion() >= 20 && CONTAINERS.contains(event.getBlockAgainst().getType())) {
|
if (CONTAINERS.contains(event.getBlockAgainst().getType())) {
|
||||||
SoundGroup soundGroup = event.getBlockPlaced().getBlockData().getSoundGroup();
|
SoundGroup soundGroup = event.getBlockPlaced().getBlockData().getSoundGroup();
|
||||||
event.getPlayer().playSound(event.getBlockPlaced().getLocation(), soundGroup.getPlaceSound(), soundGroup.getVolume() * 0.8F, soundGroup.getPitch() * 0.8F);
|
event.getPlayer().playSound(event.getBlockPlaced().getLocation(), soundGroup.getPlaceSound(), soundGroup.getVolume() * 0.8F, soundGroup.getPitch() * 0.8F);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-2
@@ -22,7 +22,6 @@ package de.steamwar.bausystem.features.team.boundary;
|
|||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.bausystem.region.Point;
|
import de.steamwar.bausystem.region.Point;
|
||||||
import de.steamwar.bausystem.region.Region;
|
import de.steamwar.bausystem.region.Region;
|
||||||
import de.steamwar.core.TrickyParticleWrapper;
|
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Particle;
|
import org.bukkit.Particle;
|
||||||
@@ -53,7 +52,7 @@ public class BoundaryViewer implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void showRegion(Region region, Player player) {
|
private void showRegion(Region region, Player player) {
|
||||||
drawCuboid(player, TrickyParticleWrapper.impl.getVillagerHappy(), region.getArea().getMinPoint(false), region.getArea().getMaxPoint(false));
|
drawCuboid(player, Particle.HAPPY_VILLAGER, region.getArea().getMinPoint(false), region.getArea().getMaxPoint(false));
|
||||||
if (!region.getTestblockArea().isEmpty()) {
|
if (!region.getTestblockArea().isEmpty()) {
|
||||||
drawCuboid(player, Particle.END_ROD, region.getTestblockArea().getMinPoint(true), region.getTestblockArea().getMaxPoint(true));
|
drawCuboid(player, Particle.END_ROD, region.getTestblockArea().getMinPoint(true), region.getTestblockArea().getMaxPoint(true));
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -31,7 +31,6 @@ import de.steamwar.command.TypeMapper;
|
|||||||
import de.steamwar.core.CraftbukkitWrapper;
|
import de.steamwar.core.CraftbukkitWrapper;
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import de.steamwar.linkage.LinkedInstance;
|
import de.steamwar.linkage.LinkedInstance;
|
||||||
import de.steamwar.techhider.TechHider;
|
|
||||||
import net.md_5.bungee.api.ChatMessageType;
|
import net.md_5.bungee.api.ChatMessageType;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@@ -39,6 +38,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
import de.steamwar.techhider.legacy.TechHider;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -92,7 +92,7 @@ public class TechHiderCommand extends SWCommand implements Listener, ScoreboardE
|
|||||||
BauSystem.MESSAGE.sendPrefixless("TECHHIDER_ON", player, ChatMessageType.ACTION_BAR);
|
BauSystem.MESSAGE.sendPrefixless("TECHHIDER_ON", player, ChatMessageType.ACTION_BAR);
|
||||||
}
|
}
|
||||||
region.getBuildArea().forEachChunk((x, z) -> {
|
region.getBuildArea().forEachChunk((x, z) -> {
|
||||||
CraftbukkitWrapper.impl.sendChunk(player, x, z);
|
CraftbukkitWrapper.sendChunk(player, x, z);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user