@@ -7,8 +7,8 @@ body:
|
|
7
7
|
attributes:
|
8
8
|
value: |
|
9
9
|
Thanks for taking the time to fill out this bug report for PlotSquared! Fill out the following form to your best ability to help us fix the problem.
|
10
|
-
Only use this if you're absolutely sure that you found a bug and can reproduce it. For anything else, use: [our Discord server](https://discord.gg/intellectualsites) or [the wiki](https://intellectualsites.
|
11
|
-
Do NOT use the public issue tracker to report security vulnerabilities! They are disclosed using [this](https://
|
10
|
+
Only use this if you're absolutely sure that you found a bug and can reproduce it. For anything else, use: [our Discord server](https://discord.gg/intellectualsites) or [the wiki](https://intellectualsites.gitbook.io/plotsquared/).
|
11
|
+
Do NOT use the public issue tracker to report security vulnerabilities! They are disclosed using [this](https://github.com/IntellectualSites/PlotSquared/security/policy) GitHub form!
|
12
12
|
|
13
13
|
- type: dropdown
|
14
14
|
attributes:
|
@@ -27,6 +27,9 @@ body:
|
|
27
27
|
description: Which server version version you using? If your server version is not listed, it is not supported. Update to a supported version first.
|
28
28
|
multiple: false
|
29
29
|
options:
|
30
|
+
- '1.20.1'
|
31
|
+
- '1.20'
|
32
|
+
- '1.19.4'
|
30
33
|
- '1.19.3'
|
31
34
|
- '1.19.2'
|
32
35
|
- '1.19.1'
|
@@ -4,5 +4,5 @@ contact_links:
|
|
4
4
|
url: https://discord.gg/intellectualsites
|
5
5
|
about: Our support Discord, please ask questions and seek support here.
|
6
6
|
- name: PlotSquared Wiki
|
7
|
-
url: https://intellectualsites.
|
7
|
+
url: https://intellectualsites.gitbook.io/plotsquared/
|
8
8
|
about: Take a look at the wiki page for instructions how to setup PlotSquared and use its commands.
|
@@ -7,7 +7,7 @@ body:
|
|
7
7
|
attributes:
|
8
8
|
value: |
|
9
9
|
Thanks for taking the time to fill out this feature request for PlotSquared! Fill out the following form to your best ability to help us understand your feature request and greately improve the change of it getting added.
|
10
|
-
For anything else than a feature request, use: [our Discord server](https://discord.gg/intellectualsites) or [the wiki](https://intellectualsites.
|
10
|
+
For anything else than a feature request, use: [our Discord server](https://discord.gg/intellectualsites) or [the wiki](https://intellectualsites.gitbook.io/plotsquared/).
|
11
11
|
|
12
12
|
- type: textarea
|
13
13
|
attributes:
|
@@ -0,0 +1,19 @@
|
|
1
|
+
{
|
2
|
+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
3
|
+
"extends": [
|
4
|
+
"config:base",
|
5
|
+
":semanticCommitsDisabled"
|
6
|
+
],
|
7
|
+
"automerge": true,
|
8
|
+
"labels": [
|
9
|
+
"dependencies"
|
10
|
+
],
|
11
|
+
"rebaseWhen": "conflicted",
|
12
|
+
"schedule": ["on the first day of the month"],
|
13
|
+
"ignoreDeps": [
|
14
|
+
"com.google.code.gson:gson",
|
15
|
+
"com.google.guava:guava",
|
16
|
+
"org.yaml:snakeyaml",
|
17
|
+
"org.apache.logging.log4j:log4j-api",
|
18
|
+
]
|
19
|
+
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
name: Announce release on discord
|
2
2
|
on:
|
3
3
|
release:
|
4
|
-
types: [published]
|
4
|
+
types: [ published ]
|
5
5
|
jobs:
|
6
6
|
send_announcement:
|
7
7
|
runs-on: ubuntu-latest
|
@@ -11,7 +11,7 @@ jobs:
|
|
11
11
|
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
12
12
|
DISCORD_USERNAME: PlotSquared Release
|
13
13
|
DISCORD_AVATAR: https://raw.githubusercontent.com/IntellectualSites/Assets/main/plugins/PlotSquared/PlotSquared.png
|
14
|
-
uses: Ilshidur/action-discord@
|
14
|
+
uses: Ilshidur/action-discord@0.3.2
|
15
15
|
with:
|
16
16
|
args: |
|
17
17
|
"<@&525015541815967744> <@&679322738552471574> <@&699293353862496266>"
|
@@ -1,17 +1,17 @@
|
|
1
1
|
name: Build PR
|
2
|
-
on: [pull_request]
|
2
|
+
on: [ pull_request ]
|
3
3
|
jobs:
|
4
4
|
build_pr:
|
5
5
|
if: github.repository_owner == 'IntellectualSites'
|
6
6
|
runs-on: ${{ matrix.os }}
|
7
7
|
strategy:
|
8
8
|
matrix:
|
9
|
-
os: [ubuntu-latest, windows-latest, macos-latest]
|
9
|
+
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
10
10
|
steps:
|
11
11
|
- name: Checkout Repository
|
12
12
|
uses: actions/checkout@v3
|
13
13
|
- name: Validate Gradle Wrapper
|
14
|
-
uses: gradle/wrapper-validation-action@
|
14
|
+
uses: gradle/wrapper-validation-action@v1
|
15
15
|
- name: Setup Java
|
16
16
|
uses: actions/setup-java@v3
|
17
17
|
with:
|
@@ -2,7 +2,7 @@ name: build
|
|
2
2
|
on:
|
3
3
|
push:
|
4
4
|
branches:
|
5
|
-
-
|
5
|
+
- main
|
6
6
|
jobs:
|
7
7
|
build:
|
8
8
|
if: github.repository_owner == 'IntellectualSites'
|
@@ -11,7 +11,7 @@ jobs:
|
|
11
11
|
- name: Checkout Repository
|
12
12
|
uses: actions/checkout@v3
|
13
13
|
- name: Validate Gradle Wrapper
|
14
|
-
uses: gradle/wrapper-validation-action@
|
14
|
+
uses: gradle/wrapper-validation-action@v1
|
15
15
|
- name: Setup Java
|
16
16
|
uses: actions/setup-java@v3
|
17
17
|
with:
|
@@ -28,7 +28,7 @@ jobs:
|
|
28
28
|
echo "STATUS=release" >> $GITHUB_ENV
|
29
29
|
fi
|
30
30
|
- name: Publish Release
|
31
|
-
if: ${{ runner.os == 'Linux' && env.STATUS == 'release' && github.event_name == 'push' && github.ref == 'refs/heads/
|
31
|
+
if: ${{ runner.os == 'Linux' && env.STATUS == 'release' && github.event_name == 'push' && github.ref == 'refs/heads/main'}}
|
32
32
|
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository
|
33
33
|
env:
|
34
34
|
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
|
@@ -36,14 +36,14 @@ jobs:
|
|
36
36
|
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
|
37
37
|
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}
|
38
38
|
- name: Publish Snapshot
|
39
|
-
if: ${{ runner.os == 'Linux' && env.STATUS != 'release' && github.event_name == 'push' && github.ref == 'refs/heads/
|
39
|
+
if: ${{ runner.os == 'Linux' && env.STATUS != 'release' && github.event_name == 'push' && github.ref == 'refs/heads/main' }}
|
40
40
|
run: ./gradlew publishToSonatype
|
41
41
|
env:
|
42
42
|
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
|
43
43
|
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
|
44
44
|
- name: Publish core javadoc
|
45
|
-
if: ${{ runner.os == 'Linux' && env.STATUS == 'release' && github.event_name == 'push' && github.ref == 'refs/heads/
|
46
|
-
uses: cpina/github-action-push-to-another-repository@
|
45
|
+
if: ${{ runner.os == 'Linux' && env.STATUS == 'release' && github.event_name == 'push' && github.ref == 'refs/heads/main'}}
|
46
|
+
uses: cpina/github-action-push-to-another-repository@main
|
47
47
|
env:
|
48
48
|
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }}
|
49
49
|
with:
|
@@ -52,10 +52,10 @@ jobs:
|
|
52
52
|
destination-repository-name: 'plotsquared-javadocs'
|
53
53
|
user-email: ${{ secrets.USER_EMAIL }}
|
54
54
|
target-branch: main
|
55
|
-
target-directory: core
|
55
|
+
target-directory: v7/core
|
56
56
|
- name: Publish bukkit javadoc
|
57
|
-
if: ${{ runner.os == 'Linux' && env.STATUS == 'release' && github.event_name == 'push' && github.ref == 'refs/heads/
|
58
|
-
uses: cpina/github-action-push-to-another-repository@
|
57
|
+
if: ${{ runner.os == 'Linux' && env.STATUS == 'release' && github.event_name == 'push' && github.ref == 'refs/heads/main'}}
|
58
|
+
uses: cpina/github-action-push-to-another-repository@main
|
59
59
|
env:
|
60
60
|
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }}
|
61
61
|
with:
|
@@ -64,4 +64,4 @@ jobs:
|
|
64
64
|
destination-repository-name: 'plotsquared-javadocs'
|
65
65
|
user-email: ${{ secrets.USER_EMAIL }}
|
66
66
|
target-branch: main
|
67
|
-
target-directory: bukkit
|
67
|
+
target-directory: v7/bukkit
|
@@ -1,8 +1,11 @@
|
|
1
1
|
name: "CodeQL"
|
2
2
|
on:
|
3
|
+
push:
|
4
|
+
branches: [ main ]
|
3
5
|
pull_request:
|
4
6
|
# The branches below must be a subset of the branches above
|
5
|
-
branches: [
|
7
|
+
branches: [ main ]
|
8
|
+
|
6
9
|
jobs:
|
7
10
|
analyze:
|
8
11
|
name: Analyze
|
@@ -14,15 +17,20 @@ jobs:
|
|
14
17
|
strategy:
|
15
18
|
fail-fast: false
|
16
19
|
matrix:
|
17
|
-
language: ['java']
|
20
|
+
language: [ 'java' ]
|
18
21
|
steps:
|
19
22
|
- name: Checkout repository
|
20
23
|
uses: actions/checkout@v3
|
24
|
+
- name: Setup Java
|
25
|
+
uses: actions/setup-java@v3
|
26
|
+
with:
|
27
|
+
distribution: temurin
|
28
|
+
java-version: 17
|
21
29
|
- name: Initialize CodeQL
|
22
|
-
uses: github/codeql-action/init@
|
30
|
+
uses: github/codeql-action/init@v2
|
23
31
|
with:
|
24
32
|
languages: ${{ matrix.language }}
|
25
33
|
- name: Autobuild
|
26
|
-
uses: github/codeql-action/autobuild@
|
34
|
+
uses: github/codeql-action/autobuild@v2
|
27
35
|
- name: Perform CodeQL Analysis
|
28
|
-
uses: github/codeql-action/analyze@
|
36
|
+
uses: github/codeql-action/analyze@v2
|
@@ -2,11 +2,11 @@ name: draft release
|
|
2
2
|
on:
|
3
3
|
push:
|
4
4
|
branches:
|
5
|
-
-
|
5
|
+
- main
|
6
6
|
pull_request:
|
7
|
-
types: [opened, reopened, synchronize]
|
7
|
+
types: [ opened, reopened, synchronize ]
|
8
8
|
pull_request_target:
|
9
|
-
types: [opened, reopened, synchronize]
|
9
|
+
types: [ opened, reopened, synchronize ]
|
10
10
|
jobs:
|
11
11
|
update_release_draft:
|
12
12
|
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
|
@@ -137,3 +137,7 @@ docs/
|
|
137
137
|
build/
|
138
138
|
|
139
139
|
.DS_Store
|
140
|
+
# Ignore run folders
|
141
|
+
run-[0-0].[0-9]/
|
142
|
+
run-[0-0].[0-9].[0-9]/
|
143
|
+
|
@@ -1,48 +1,144 @@
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2
|
-
<svg
|
3
|
-
|
2
|
+
<svg
|
3
|
+
version="1.1"
|
4
|
+
id="svg2"
|
5
|
+
xml:space="preserve"
|
6
|
+
width="512"
|
7
|
+
height="512"
|
8
|
+
viewBox="0 0 512 512.00001"
|
9
|
+
sodipodi:docname="icon.svg"
|
10
|
+
inkscape:version="1.1.2 (b8e25be8, 2022-02-05)"
|
11
|
+
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
12
|
+
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
13
|
+
xmlns="http://www.w3.org/2000/svg"
|
14
|
+
xmlns:svg="http://www.w3.org/2000/svg"
|
15
|
+
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
16
|
+
xmlns:cc="http://creativecommons.org/ns#"
|
17
|
+
xmlns:dc="http://purl.org/dc/elements/1.1/">
|
18
|
+
<metadata
|
19
|
+
id="metadata8">
|
4
20
|
<rdf:RDF>
|
5
|
-
<cc:Work
|
21
|
+
<cc:Work
|
22
|
+
rdf:about="">
|
6
23
|
<dc:format>image/svg+xml</dc:format>
|
7
|
-
<dc:type
|
24
|
+
<dc:type
|
25
|
+
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
8
26
|
</cc:Work>
|
9
27
|
</rdf:RDF>
|
10
28
|
</metadata>
|
11
|
-
<defs
|
12
|
-
|
13
|
-
|
29
|
+
<defs
|
30
|
+
id="defs6">
|
31
|
+
<clipPath
|
32
|
+
clipPathUnits="userSpaceOnUse"
|
33
|
+
id="clipPath18">
|
34
|
+
<path
|
35
|
+
d="M 0,2500 H 3000 V 0 H 0 Z"
|
36
|
+
id="path16" />
|
14
37
|
</clipPath>
|
15
38
|
</defs>
|
16
|
-
<sodipodi:namedview
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
39
|
+
<sodipodi:namedview
|
40
|
+
pagecolor="#ffffff"
|
41
|
+
bordercolor="#666666"
|
42
|
+
borderopacity="1"
|
43
|
+
objecttolerance="10"
|
44
|
+
gridtolerance="10"
|
45
|
+
guidetolerance="10"
|
46
|
+
inkscape:pageopacity="0"
|
47
|
+
inkscape:pageshadow="2"
|
48
|
+
inkscape:window-width="1440"
|
49
|
+
inkscape:window-height="900"
|
50
|
+
id="namedview4"
|
51
|
+
inkscape:pagecheckerboard="0"
|
52
|
+
showgrid="false"
|
53
|
+
inkscape:zoom="0.1632"
|
54
|
+
inkscape:cx="1087.6225"
|
55
|
+
inkscape:cy="1666.6666"
|
56
|
+
inkscape:window-x="0"
|
57
|
+
inkscape:window-y="0"
|
58
|
+
inkscape:window-maximized="0"
|
59
|
+
inkscape:current-layer="g10" />
|
60
|
+
<g
|
61
|
+
id="g10"
|
62
|
+
inkscape:groupmode="layer"
|
63
|
+
inkscape:label="PlotSquared"
|
64
|
+
transform="matrix(1.3333333,0,0,-1.3333333,0,3333.3333)">
|
65
|
+
<g
|
66
|
+
id="g12"
|
67
|
+
transform="matrix(0.16955078,0,0,0.16955078,-68.456969,2101.8529)">
|
68
|
+
<g
|
69
|
+
id="g14"
|
70
|
+
clip-path="url(#clipPath18)">
|
71
|
+
<g
|
72
|
+
id="g20"
|
73
|
+
transform="translate(1486.1511,2242.6453)">
|
74
|
+
<path
|
75
|
+
d="m 0,0 c 16.533,10.846 33.211,21.453 50.104,31.699 78.972,-48.281 153.985,-102.704 227.269,-159.144 148.61,-115.422 287.884,-243.01 414.393,-382.333 111.39,-122.861 212.751,-255.152 298.898,-396.971 52.744,-87.322 100.544,-177.884 139.514,-272.214 -11.638,-3.551 -23.108,-7.655 -34.362,-12.286 l -0.24,0.288 c -11.135,12.982 -24.141,24.212 -34.915,37.506 -22.557,23.013 -45.425,45.737 -68.03,68.678 -19.725,20.253 -40.601,39.45 -58.958,60.974 -36.355,36.451 -72.517,73.093 -108.944,109.471 -22.628,26.013 -48.064,49.385 -71.965,74.197 -19.029,19.485 -38.706,38.346 -57.519,57.999 -12.166,14.998 -26.684,27.716 -39.93,41.658 -27.668,27.524 -54.903,55.479 -82.571,82.979 -23.924,27.956 -51.664,52.264 -76.692,79.164 -4.68,4.487 -8.855,10.774 -15.886,11.326 -22.34,34.027 -58.311,57.327 -97.377,67.502 -104.312,99.153 -215.487,191.202 -332.661,274.782 -117.942,-83.94 -229.476,-176.781 -334.484,-276.39 -26.684,-0.024 -53.368,0.024 -80.076,-0.024 0.024,-26.564 0.048,-53.104 0,-79.668 -72.229,-73.021 -139.491,-150.937 -202.385,-232.092 -63.758,-82.619 -121.973,-169.51 -173.541,-260.264 131.932,-69.061 257.864,-149.521 375.926,-240.275 0.096,-26.444 -0.12,-52.888 0.096,-79.332 l 0.744,-0.984 c 20.109,-24.14 43.409,-45.233 65.126,-67.861 15.118,-15.382 30.571,-30.404 45.569,-45.881 17.565,-20.733 37.698,-39.042 56.607,-58.503 19.917,-20.781 41.25,-40.218 59.967,-62.151 29.156,-29.299 58.167,-58.815 87.515,-87.922 29.155,-33.043 61.502,-63.111 92.169,-94.738 13.726,-12.67 25.124,-27.571 38.634,-40.457 25.029,-25.365 50.129,-50.657 75.325,-75.853 -37.914,-51.208 -73.741,-103.952 -107.192,-158.183 -167.83,273.317 -397.235,507.305 -662.37,687.158 -81.875,55.335 -167.23,105.584 -255.681,149.641 -52.815,26.276 -106.831,50.248 -162.239,70.381 99.393,233.628 242.795,446.715 410.289,636.79 93.562,106.088 194.634,205.433 301.466,298.13 C -217.335,-155.808 -111.439,-73.789 0,0"
|
76
|
+
style="fill:#062f4c;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
77
|
+
id="path22" />
|
22
78
|
</g>
|
23
|
-
<g
|
24
|
-
|
79
|
+
<g
|
80
|
+
id="g24"
|
81
|
+
transform="translate(1201.7948,1741.5303)">
|
82
|
+
<path
|
83
|
+
d="M 0,0 C 105.008,99.609 216.543,192.45 334.485,276.39 451.659,192.81 562.833,100.76 667.146,1.608 c -34.987,8.83 -71.51,9.718 -107.264,6.431 -41.202,-4.296 -82.907,-19.077 -112.543,-48.953 -33.019,-32.155 -49.456,-77.604 -55.311,-122.501 -28.124,27.908 -56.104,55.983 -84.035,84.083 -2.976,2.976 -6.839,4.823 -10.391,6.911 -19.029,26.348 -45.953,46.673 -76.62,57.495 C 187.555,-2.472 151.513,-0.12 116.166,0 Z"
|
84
|
+
style="fill:#4c8fcc;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
85
|
+
id="path26" />
|
25
86
|
</g>
|
26
|
-
<g
|
27
|
-
|
87
|
+
<g
|
88
|
+
id="g28"
|
89
|
+
transform="translate(919.3342,1429.7462)">
|
90
|
+
<path
|
91
|
+
d="m 0,0 c 62.894,81.156 130.156,159.072 202.385,232.092 0.048,-244.21 0.024,-488.421 0,-732.631 C 84.323,-409.785 -41.61,-329.325 -173.541,-260.264 -121.973,-169.51 -63.758,-82.619 0,0"
|
92
|
+
style="fill:#4c8fcc;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
93
|
+
id="path30" />
|
28
94
|
</g>
|
29
|
-
<g
|
30
|
-
|
95
|
+
<g
|
96
|
+
id="g32"
|
97
|
+
transform="translate(1649.134,1700.6166)">
|
98
|
+
<path
|
99
|
+
d="m 0,0 c 29.635,29.875 71.341,44.657 112.543,48.952 35.754,3.288 72.277,2.4 107.263,-6.431 39.066,-10.174 75.037,-33.474 97.377,-67.501 11.879,-17.661 20.181,-37.411 26.42,-57.687 10.871,-38.802 11.95,-79.356 11.446,-119.358 -44.345,-0.072 -88.69,0.048 -133.035,-0.072 -1.032,30.907 3.263,63.686 -10.175,92.626 -9.526,20.325 -32.107,31.243 -53.751,32.131 -21.453,1.44 -45.065,-4.32 -59.175,-21.597 -12.79,-15.861 -15.382,-37.002 -16.558,-56.655 -1.295,-29.132 3.696,-59.031 17.518,-84.923 16.821,-30.619 39.378,-57.783 64.526,-81.9 31.387,-32.634 67.501,-60.374 97.857,-94.041 27.332,-28.988 51.256,-61.479 68.005,-97.785 20.541,-41.13 26.972,-87.827 25.82,-133.372 -0.912,-32.107 -5.231,-64.406 -16.149,-94.737 -11.59,-31.699 -31.123,-61.047 -58.335,-81.371 -25.124,-19.125 -55.696,-29.852 -86.651,-34.771 -49.552,-6.743 -101.888,-4.847 -148.465,14.854 -35.227,14.829 -64.238,42.689 -81.708,76.548 -20.996,40.242 -27.115,86.339 -27.259,131.212 0.048,17.829 0,35.658 0.048,53.463 44.345,0.048 88.69,-0.023 133.059,0.048 1.728,-35.538 -4.055,-72.06 5.663,-106.807 5.783,-22.173 26.204,-37.794 48.185,-41.754 20.733,-3.431 43.577,-2.015 61.622,9.791 15.502,9.43 23.949,26.78 26.78,44.225 5.903,35.922 1.872,74.293 -15.381,106.688 -16.918,30.595 -39.474,57.711 -64.55,81.899 -33.187,34.099 -71.173,63.254 -102.585,99.081 -26.756,28.867 -49.408,61.646 -65.486,97.641 -24.572,52.48 -26.731,112.422 -20.18,169.102 C -49.456,-77.604 -33.019,-32.155 0,0"
|
100
|
+
style="fill:#feeeee;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
101
|
+
id="path34" />
|
31
102
|
</g>
|
32
|
-
<g
|
33
|
-
|
103
|
+
<g
|
104
|
+
id="g36"
|
105
|
+
transform="translate(1262.7214,1613.126)">
|
106
|
+
<path
|
107
|
+
d="m 0,0 v -301.13 c 23.204,0.024 46.409,-0.048 69.613,0.024 18.525,0.288 38.202,6.575 50.153,21.429 12.43,17.277 13.917,39.522 14.613,60.111 0.024,43.985 -0.048,87.994 0.024,131.979 -0.48,23.637 -0.983,50.369 -17.277,69.23 C 104.864,-5.711 86.867,-0.24 69.589,0 46.385,0.048 23.204,0.024 0,0 m -141.002,128.38 c 26.708,0.048 53.392,0 80.075,0.024 H 55.24 c 35.346,-0.12 71.389,-2.471 104.815,-14.925 30.668,-10.823 57.592,-31.148 76.621,-57.496 26.852,-39.09 36.69,-87.202 38.058,-133.947 0.024,-48.833 0.096,-97.689 -0.024,-146.521 -1.728,-47.993 -11.974,-97.953 -41.514,-136.971 -22.748,-30.644 -57.495,-50.801 -94.281,-59.583 -45.377,-11.878 -92.578,-6.791 -138.891,-7.847 -0.072,-111.799 0,-223.574 -0.024,-335.373 -13.942,0 -27.86,0.024 -41.778,-0.024 -32.802,0.072 -65.605,0 -98.384,0.048 l -0.744,0.984 c -0.216,26.444 0,52.888 -0.096,79.332 0.024,244.211 0.048,488.421 0,732.632 0.048,26.563 0.024,53.103 0,79.667"
|
108
|
+
style="fill:#feeeee;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
109
|
+
id="path38" />
|
34
110
|
</g>
|
35
|
-
<g
|
36
|
-
|
111
|
+
<g
|
112
|
+
id="g40"
|
113
|
+
transform="translate(1966.3174,1675.6364)">
|
114
|
+
<path
|
115
|
+
d="m 0,0 c 7.031,-0.552 11.206,-6.839 15.885,-11.326 25.029,-26.9 52.768,-51.208 76.693,-79.164 27.667,-27.5 54.903,-55.456 82.571,-82.979 13.246,-13.942 27.764,-26.66 39.93,-41.658 18.813,-19.653 38.49,-38.514 57.519,-57.999 23.9,-24.812 49.337,-48.185 71.965,-74.197 36.427,-36.378 72.589,-73.02 108.943,-109.471 18.358,-21.524 39.234,-40.722 58.959,-60.974 22.605,-22.941 45.473,-45.665 68.03,-68.678 10.774,-13.294 23.78,-24.524 34.914,-37.506 -103.904,-41.97 -203.488,-94.114 -298.922,-152.761 -246.994,-152.28 -466.224,-350.298 -639.333,-583.398 -25.197,25.196 -50.297,50.488 -75.325,75.852 -13.51,12.886 -24.908,27.788 -38.634,40.458 -30.667,31.627 -63.014,61.695 -92.17,94.738 -29.347,29.107 -58.359,58.623 -87.514,87.922 -18.717,21.933 -40.05,41.37 -59.967,62.151 -18.909,19.461 -39.042,37.77 -56.607,58.503 -14.998,15.477 -30.452,30.499 -45.569,45.88 -21.717,22.629 -45.017,43.722 -65.126,67.862 32.779,-0.048 65.582,0.024 98.384,-0.048 114.391,-98.097 220.407,-205.984 315.384,-322.99 92.914,114.318 196.242,220.022 307.753,316.271 30.955,4.919 61.526,15.646 86.65,34.771 27.212,20.325 46.745,49.672 58.335,81.371 107.312,77.988 219.327,149.929 337.509,210.376 -35.299,64.67 -75.829,126.437 -118.254,186.643 C 176.253,-228.037 104.24,-140.115 26.42,-57.687 20.181,-37.41 11.878,-17.661 0,0"
|
116
|
+
style="fill:#042338;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
117
|
+
id="path42" />
|
37
118
|
</g>
|
38
|
-
<g
|
39
|
-
|
119
|
+
<g
|
120
|
+
id="g44"
|
121
|
+
transform="translate(1499.3971,1669.1094)">
|
122
|
+
<path
|
123
|
+
d="m 0,0 c 3.551,-2.088 7.415,-3.935 10.39,-6.911 27.932,-28.1 55.912,-56.175 84.036,-84.083 -6.551,-56.679 -4.392,-116.622 20.18,-169.102 16.078,-35.994 38.73,-68.774 65.486,-97.641 31.412,-35.826 69.398,-64.982 102.585,-99.081 25.076,-24.188 47.632,-51.304 64.55,-81.899 17.253,-32.395 21.284,-70.765 15.381,-106.688 -2.831,-17.445 -11.278,-34.794 -26.78,-44.225 -18.045,-11.806 -40.889,-13.222 -61.622,-9.79 -21.981,3.959 -42.402,19.58 -48.185,41.753 -9.718,34.747 -3.935,71.269 -5.663,106.808 -44.369,-0.072 -88.714,0 -133.059,-0.048 -0.048,-17.806 0,-35.635 -0.048,-53.464 0.144,-44.873 6.263,-90.97 27.259,-131.212 17.47,-33.859 46.481,-61.718 81.708,-76.548 46.577,-19.701 98.913,-21.597 148.465,-14.854 -111.511,-96.249 -214.839,-201.953 -307.753,-316.271 -94.977,117.006 -200.993,224.893 -315.383,322.99 13.918,0.048 27.836,0.024 41.777,0.024 0.024,111.799 -0.048,223.574 0.024,335.372 46.313,1.056 93.514,-4.031 138.891,7.847 36.786,8.783 71.533,28.94 94.282,59.583 29.539,39.018 39.785,88.978 41.513,136.971 0.12,48.833 0.048,97.689 0.024,146.522 C 36.69,-87.203 26.852,-39.09 0,0"
|
124
|
+
style="fill:#1c72ba;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
125
|
+
id="path46" />
|
40
126
|
</g>
|
41
|
-
<g
|
42
|
-
|
127
|
+
<g
|
128
|
+
id="g48"
|
129
|
+
transform="translate(1748.0469,1601.6797)">
|
130
|
+
<path
|
131
|
+
d="M 0,0 C 14.11,17.277 37.722,23.036 59.175,21.597 80.82,20.709 103.4,9.791 112.927,-10.534 c 13.438,-28.94 9.142,-61.719 10.174,-92.626 44.345,0.12 88.691,0 133.036,0.072 0.504,40.002 -0.576,80.556 -11.447,119.358 77.82,-82.428 149.833,-170.35 215.583,-262.664 42.426,-60.207 82.956,-121.973 118.254,-186.643 -118.182,-60.447 -230.196,-132.388 -337.508,-210.376 10.918,30.331 15.238,62.63 16.149,94.737 1.152,45.545 -5.279,92.242 -25.82,133.372 -16.749,36.306 -40.673,68.797 -68.005,97.785 -30.355,33.667 -66.47,61.406 -97.857,94.041 -25.148,24.117 -47.705,51.28 -64.526,81.9 -13.822,25.892 -18.813,55.791 -17.517,84.923 C -15.382,-37.002 -12.79,-15.862 0,0"
|
132
|
+
style="fill:#1c72ba;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
133
|
+
id="path50" />
|
43
134
|
</g>
|
44
|
-
<g
|
45
|
-
|
135
|
+
<g
|
136
|
+
id="g52"
|
137
|
+
transform="translate(1262.7214,1613.126)">
|
138
|
+
<path
|
139
|
+
d="m 0,0 c 23.204,0.024 46.385,0.048 69.589,0 17.278,-0.24 35.275,-5.711 47.537,-18.357 16.294,-18.861 16.797,-45.593 17.277,-69.23 -0.072,-43.985 0,-87.994 -0.024,-131.979 -0.696,-20.589 -2.183,-42.834 -14.613,-60.111 -11.951,-14.854 -31.628,-21.141 -50.153,-21.429 -23.204,-0.072 -46.409,0 -69.613,-0.024 z"
|
140
|
+
style="fill:#1c72ba;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
141
|
+
id="path54" />
|
46
142
|
</g>
|
47
143
|
</g>
|
48
144
|
</g>
|
@@ -18,23 +18,23 @@ repositories {
|
|
18
18
|
}
|
19
19
|
|
20
20
|
dependencies {
|
21
|
-
api(projects.
|
21
|
+
api(projects.plotsquaredCore)
|
22
22
|
|
23
23
|
// Metrics
|
24
|
-
implementation(
|
24
|
+
implementation(libs.bstatsBukkit)
|
25
25
|
|
26
26
|
// Paper
|
27
|
-
compileOnly(
|
28
|
-
implementation(
|
27
|
+
compileOnly(libs.paper)
|
28
|
+
implementation(libs.paperlib)
|
29
29
|
|
30
30
|
// Plugins
|
31
31
|
compileOnly(libs.worldeditBukkit) {
|
32
32
|
exclude(group = "org.bukkit")
|
33
33
|
exclude(group = "org.spigotmc")
|
34
34
|
}
|
35
|
-
compileOnly(
|
36
|
-
testImplementation(
|
37
|
-
compileOnly(
|
35
|
+
compileOnly(libs.faweBukkit) { isTransitive = false }
|
36
|
+
testImplementation(libs.faweBukkit) { isTransitive = false }
|
37
|
+
compileOnly(libs.vault) {
|
38
38
|
exclude(group = "org.bukkit")
|
39
39
|
}
|
40
40
|
compileOnly(libs.placeholderapi)
|
@@ -44,16 +44,15 @@ dependencies {
|
|
44
44
|
|
45
45
|
// Other libraries
|
46
46
|
implementation(libs.squirrelid) { isTransitive = false }
|
47
|
-
implementation(
|
47
|
+
implementation(libs.serverlib)
|
48
48
|
|
49
49
|
// Our libraries
|
50
50
|
implementation(libs.arkitektonika)
|
51
|
-
implementation(libs.
|
52
|
-
implementation(
|
53
|
-
implementation("com.intellectualsites.informative-annotations:informative-annotations")
|
51
|
+
implementation(libs.paster)
|
52
|
+
implementation(libs.informativeAnnotations)
|
54
53
|
|
55
54
|
// Adventure
|
56
|
-
implementation(
|
55
|
+
implementation(libs.adventureBukkit)
|
57
56
|
}
|
58
57
|
|
59
58
|
tasks.processResources {
|
@@ -63,6 +62,7 @@ tasks.processResources {
|
|
63
62
|
}
|
64
63
|
|
65
64
|
tasks.named<ShadowJar>("shadowJar") {
|
65
|
+
dependsOn(":plotsquared-core:shadowJar")
|
66
66
|
dependencies {
|
67
67
|
exclude(dependency("org.checkerframework:"))
|
68
68
|
}
|
@@ -88,7 +88,7 @@ tasks.named<ShadowJar>("shadowJar") {
|
|
88
88
|
relocate("javax.inject", "com.plotsquared.core.annotation.inject")
|
89
89
|
relocate("net.jcip", "com.plotsquared.core.annotations.jcip")
|
90
90
|
relocate("edu.umd.cs.findbugs", "com.plotsquared.core.annotations.findbugs")
|
91
|
-
relocate("com.intellectualsites.
|
91
|
+
relocate("com.intellectualsites.annotations", "com.plotsquared.core.annotations.informative")
|
92
92
|
|
93
93
|
// Get rid of all the libs which are 100% unused.
|
94
94
|
minimize()
|
@@ -100,10 +100,10 @@ tasks {
|
|
100
100
|
withType<Javadoc> {
|
101
101
|
val isRelease = if (rootProject.version.toString().endsWith("-SNAPSHOT")) "TODO" else rootProject.version.toString()
|
102
102
|
val opt = options as StandardJavadocDocletOptions
|
103
|
-
opt.links("https://jd.papermc.io/paper/1.
|
103
|
+
opt.links("https://jd.papermc.io/paper/1.19/")
|
104
104
|
opt.links("https://docs.enginehub.org/javadoc/com.sk89q.worldedit/worldedit-bukkit/" + libs.worldeditBukkit.get().versionConstraint.toString())
|
105
105
|
opt.links("https://intellectualsites.github.io/plotsquared-javadocs/core/")
|
106
|
-
opt.links("https://jd.
|
106
|
+
opt.links("https://jd.advntr.dev/api/4.14.0/")
|
107
107
|
opt.links("https://google.github.io/guice/api-docs/" + libs.guice.get().versionConstraint.toString() + "/javadoc/")
|
108
108
|
opt.links("https://checkerframework.org/api/")
|
109
109
|
opt.isLinkSource = true
|
@@ -49,6 +49,7 @@ import com.plotsquared.bukkit.player.BukkitPlayerManager;
|
|
49
49
|
import com.plotsquared.bukkit.util.BukkitUtil;
|
50
50
|
import com.plotsquared.bukkit.util.BukkitWorld;
|
51
51
|
import com.plotsquared.bukkit.util.SetGenCB;
|
52
|
+
import com.plotsquared.bukkit.util.TranslationUpdateManager;
|
52
53
|
import com.plotsquared.bukkit.util.UpdateUtility;
|
53
54
|
import com.plotsquared.bukkit.util.task.BukkitTaskManager;
|
54
55
|
import com.plotsquared.bukkit.util.task.PaperTimeConverter;
|
@@ -140,6 +141,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
|
140
141
|
import org.incendo.serverlib.ServerLib;
|
141
142
|
|
142
143
|
import java.io.File;
|
144
|
+
import java.io.IOException;
|
143
145
|
import java.lang.reflect.Method;
|
144
146
|
import java.util.ArrayList;
|
145
147
|
import java.util.Arrays;
|
@@ -293,6 +295,12 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|
293
295
|
);
|
294
296
|
this.injector.injectMembers(this);
|
295
297
|
|
298
|
+
try {
|
299
|
+
this.injector.getInstance(TranslationUpdateManager.class).upgradeTranslationFile();
|
300
|
+
} catch (IOException e) {
|
301
|
+
throw new RuntimeException(e);
|
302
|
+
}
|
303
|
+
|
296
304
|
this.serverLocale = Locale.forLanguageTag(Settings.Enabled_Components.DEFAULT_LOCALE);
|
297
305
|
|
298
306
|
if (PremiumVerification.isPremium() && Settings.Enabled_Components.UPDATE_NOTIFICATIONS) {
|
@@ -358,7 +366,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|
358
366
|
getServer().getPluginManager().registerEvents(injector().getInstance(ServerListener.class), this);
|
359
367
|
getServer().getPluginManager().registerEvents(injector().getInstance(EntitySpawnListener.class), this);
|
360
368
|
if (PaperLib.isPaper() && Settings.Paper_Components.PAPER_LISTENERS) {
|
361
|
-
|
369
|
+
getServer().getPluginManager().registerEvents(injector().getInstance(PaperListener.class), this);
|
362
370
|
} else {
|
363
371
|
getServer().getPluginManager().registerEvents(injector().getInstance(SpigotListener.class), this);
|
364
372
|
}
|
@@ -1177,9 +1185,17 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|
1177
1185
|
public @NonNull String worldEditImplementations() {
|
1178
1186
|
StringBuilder msg = new StringBuilder();
|
1179
1187
|
if (Bukkit.getPluginManager().getPlugin("FastAsyncWorldEdit") != null) {
|
1180
|
-
msg.append("FastAsyncWorldEdit: ").append(Bukkit
|
1188
|
+
msg.append("FastAsyncWorldEdit: ").append(Bukkit
|
1189
|
+
.getPluginManager()
|
1190
|
+
.getPlugin("FastAsyncWorldEdit")
|
1191
|
+
.getDescription()
|
1192
|
+
.getVersion());
|
1181
1193
|
} else if (Bukkit.getPluginManager().getPlugin("AsyncWorldEdit") != null) {
|
1182
|
-
msg.append("AsyncWorldEdit: ").append(Bukkit
|
1194
|
+
msg.append("AsyncWorldEdit: ").append(Bukkit
|
1195
|
+
.getPluginManager()
|
1196
|
+
.getPlugin("AsyncWorldEdit")
|
1197
|
+
.getDescription()
|
1198
|
+
.getVersion()).append("\n");
|
1183
1199
|
msg.append("WorldEdit: ").append(Bukkit.getPluginManager().getPlugin("WorldEdit").getDescription().getVersion());
|
1184
1200
|
} else {
|
1185
1201
|
msg.append("WorldEdit: ").append(Bukkit.getPluginManager().getPlugin("WorldEdit").getDescription().getVersion());
|
@@ -101,50 +101,26 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
|
101
101
|
this.noGravity = true;
|
102
102
|
}
|
103
103
|
switch (entity.getType().toString()) {
|
104
|
-
case "BOAT"
|
104
|
+
case "BOAT" -> {
|
105
105
|
Boat boat = (Boat) entity;
|
106
106
|
this.dataByte = getOrdinal(TreeSpecies.values(), boat.getWoodType());
|
107
107
|
return;
|
108
|
-
|
109
|
-
case "EGG"
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
case "FALLING_BLOCK":
|
115
|
-
case "FIREBALL":
|
116
|
-
case "FIREWORK":
|
117
|
-
case "FISHING_HOOK":
|
118
|
-
case "LEASH_HITCH":
|
119
|
-
case "LIGHTNING":
|
120
|
-
case "MINECART":
|
121
|
-
case "MINECART_COMMAND":
|
122
|
-
case "MINECART_MOB_SPAWNER":
|
123
|
-
case "MINECART_TNT":
|
124
|
-
case "PLAYER":
|
125
|
-
case "PRIMED_TNT":
|
126
|
-
case "SLIME":
|
127
|
-
case "SMALL_FIREBALL":
|
128
|
-
case "SNOWBALL":
|
129
|
-
case "MINECART_FURNACE":
|
130
|
-
case "SPLASH_POTION":
|
131
|
-
case "THROWN_EXP_BOTTLE":
|
132
|
-
case "WITHER_SKULL":
|
133
|
-
case "UNKNOWN":
|
134
|
-
case "SPECTRAL_ARROW":
|
135
|
-
case "SHULKER_BULLET":
|
136
|
-
case "DRAGON_FIREBALL":
|
137
|
-
case "AREA_EFFECT_CLOUD":
|
138
|
-
case "TRIDENT":
|
139
|
-
case "LLAMA_SPIT":
|
108
|
+
}
|
109
|
+
case "ARROW", "EGG", "ENDER_CRYSTAL", "ENDER_PEARL", "ENDER_SIGNAL", "EXPERIENCE_ORB", "FALLING_BLOCK", "FIREBALL",
|
110
|
+
"FIREWORK", "FISHING_HOOK", "LEASH_HITCH", "LIGHTNING", "MINECART", "MINECART_COMMAND", "MINECART_MOB_SPAWNER",
|
111
|
+
"MINECART_TNT", "PLAYER", "PRIMED_TNT", "SLIME", "SMALL_FIREBALL", "SNOWBALL", "MINECART_FURNACE", "SPLASH_POTION",
|
112
|
+
"THROWN_EXP_BOTTLE", "WITHER_SKULL", "UNKNOWN", "SPECTRAL_ARROW", "SHULKER_BULLET", "DRAGON_FIREBALL", "AREA_EFFECT_CLOUD",
|
113
|
+
"TRIDENT", "LLAMA_SPIT" -> {
|
140
114
|
// Do this stuff later
|
141
115
|
return;
|
116
|
+
}
|
142
117
|
// MISC //
|
143
|
-
case "DROPPED_ITEM"
|
118
|
+
case "DROPPED_ITEM" -> {
|
144
119
|
Item item = (Item) entity;
|
145
120
|
this.stack = item.getItemStack();
|
146
121
|
return;
|
147
|
-
|
122
|
+
}
|
123
|
+
case "ITEM_FRAME" -> {
|
148
124
|
this.x = Math.floor(this.getX());
|
149
125
|
this.y = Math.floor(this.getY());
|
150
126
|
this.z = Math.floor(this.getZ());
|
@@ -152,7 +128,8 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
|
152
128
|
this.dataByte = getOrdinal(Rotation.values(), itemFrame.getRotation());
|
153
129
|
this.stack = itemFrame.getItem().clone();
|
154
130
|
return;
|
155
|
-
|
131
|
+
}
|
132
|
+
case "PAINTING" -> {
|
156
133
|
this.x = Math.floor(this.getX());
|
157
134
|
this.y = Math.floor(this.getY());
|
158
135
|
this.z = Math.floor(this.getZ());
|
@@ -165,20 +142,17 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
|
165
142
|
}
|
166
143
|
this.dataString = art.name();
|
167
144
|
return;
|
145
|
+
}
|
168
146
|
// END MISC //
|
169
147
|
// INVENTORY HOLDER //
|
170
|
-
case "MINECART_CHEST"
|
171
|
-
case "MINECART_HOPPER":
|
148
|
+
case "MINECART_CHEST", "MINECART_HOPPER" -> {
|
172
149
|
storeInventory((InventoryHolder) entity);
|
173
150
|
return;
|
151
|
+
}
|
174
152
|
// START LIVING ENTITY //
|
175
153
|
// START AGEABLE //
|
176
154
|
// START TAMEABLE //
|
177
|
-
case "HORSE"
|
178
|
-
case "DONKEY":
|
179
|
-
case "LLAMA":
|
180
|
-
case "MULE":
|
181
|
-
case "SKELETON_HORSE":
|
155
|
+
case "HORSE", "DONKEY", "LLAMA", "MULE", "SKELETON_HORSE" -> {
|
182
156
|
AbstractHorse horse = (AbstractHorse) entity;
|
183
157
|
this.horse = new HorseStats();
|
184
158
|
this.horse.jump = horse.getJumpStrength();
|
@@ -194,16 +168,17 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
|
194
168
|
storeLiving(horse);
|
195
169
|
storeInventory(horse);
|
196
170
|
return;
|
171
|
+
}
|
197
172
|
// END INVENTORY HOLDER //
|
198
|
-
case "WOLF"
|
199
|
-
case "OCELOT":
|
173
|
+
case "WOLF", "OCELOT" -> {
|
200
174
|
storeTameable((Tameable) entity);
|
201
175
|
storeAgeable((Ageable) entity);
|
202
176
|
storeLiving((LivingEntity) entity);
|
203
177
|
return;
|
178
|
+
}
|
204
179
|
// END TAMEABLE //
|
205
180
|
//todo fix sheep
|
206
|
-
case "SHEEP"
|
181
|
+
case "SHEEP" -> {
|
207
182
|
Sheep sheep = (Sheep) entity;
|
208
183
|
if (sheep.isSheared()) {
|
209
184
|
this.dataByte = (byte) 1;
|
@@ -214,23 +189,20 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
|
214
189
|
storeAgeable(sheep);
|
215
190
|
storeLiving(sheep);
|
216
191
|
return;
|
217
|
-
|
218
|
-
case "CHICKEN"
|
219
|
-
case "COW":
|
220
|
-
case "MUSHROOM_COW":
|
221
|
-
case "PIG":
|
222
|
-
case "TURTLE":
|
223
|
-
case "POLAR_BEAR":
|
192
|
+
}
|
193
|
+
case "VILLAGER", "CHICKEN", "COW", "MUSHROOM_COW", "PIG", "TURTLE", "POLAR_BEAR" -> {
|
224
194
|
storeAgeable((Ageable) entity);
|
225
195
|
storeLiving((LivingEntity) entity);
|
226
196
|
return;
|
227
|
-
|
197
|
+
}
|
198
|
+
case "RABBIT" -> {
|
228
199
|
this.dataByte = getOrdinal(Rabbit.Type.values(), ((Rabbit) entity).getRabbitType());
|
229
200
|
storeAgeable((Ageable) entity);
|
230
201
|
storeLiving((LivingEntity) entity);
|
231
202
|
return;
|
203
|
+
}
|
232
204
|
// END AGEABLE //
|
233
|
-
case "ARMOR_STAND"
|
205
|
+
case "ARMOR_STAND" -> {
|
234
206
|
ArmorStand stand = (ArmorStand) entity;
|
235
207
|
this.inventory =
|
236
208
|
new ItemStack[]{stand.getItemInHand().clone(), stand.getHelmet().clone(),
|
@@ -238,37 +210,30 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
|
238
210
|
stand.getBoots().clone()};
|
239
211
|
storeLiving(stand);
|
240
212
|
this.stand = new ArmorStandStats();
|
241
|
-
|
242
213
|
EulerAngle head = stand.getHeadPose();
|
243
214
|
this.stand.head[0] = (float) head.getX();
|
244
215
|
this.stand.head[1] = (float) head.getY();
|
245
216
|
this.stand.head[2] = (float) head.getZ();
|
246
|
-
|
247
217
|
EulerAngle body = stand.getBodyPose();
|
248
218
|
this.stand.body[0] = (float) body.getX();
|
249
219
|
this.stand.body[1] = (float) body.getY();
|
250
220
|
this.stand.body[2] = (float) body.getZ();
|
251
|
-
|
252
221
|
EulerAngle leftLeg = stand.getLeftLegPose();
|
253
222
|
this.stand.leftLeg[0] = (float) leftLeg.getX();
|
254
223
|
this.stand.leftLeg[1] = (float) leftLeg.getY();
|
255
224
|
this.stand.leftLeg[2] = (float) leftLeg.getZ();
|
256
|
-
|
257
225
|
EulerAngle rightLeg = stand.getRightLegPose();
|
258
226
|
this.stand.rightLeg[0] = (float) rightLeg.getX();
|
259
227
|
this.stand.rightLeg[1] = (float) rightLeg.getY();
|
260
228
|
this.stand.rightLeg[2] = (float) rightLeg.getZ();
|
261
|
-
|
262
229
|
EulerAngle leftArm = stand.getLeftArmPose();
|
263
230
|
this.stand.leftArm[0] = (float) leftArm.getX();
|
264
231
|
this.stand.leftArm[1] = (float) leftArm.getY();
|
265
232
|
this.stand.leftArm[2] = (float) leftArm.getZ();
|
266
|
-
|
267
233
|
EulerAngle rightArm = stand.getRightArmPose();
|
268
234
|
this.stand.rightArm[0] = (float) rightArm.getX();
|
269
235
|
this.stand.rightArm[1] = (float) rightArm.getY();
|
270
236
|
this.stand.rightArm[2] = (float) rightArm.getZ();
|
271
|
-
|
272
237
|
if (stand.hasArms()) {
|
273
238
|
this.stand.arms = true;
|
274
239
|
}
|
@@ -282,53 +247,38 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
|
282
247
|
this.stand.small = true;
|
283
248
|
}
|
284
249
|
return;
|
285
|
-
|
250
|
+
}
|
251
|
+
case "ENDERMITE" -> {
|
286
252
|
return;
|
287
|
-
|
253
|
+
}
|
254
|
+
case "BAT" -> {
|
288
255
|
if (((Bat) entity).isAwake()) {
|
289
256
|
this.dataByte = (byte) 1;
|
290
257
|
} else {
|
291
258
|
this.dataByte = (byte) 0;
|
292
259
|
}
|
293
260
|
return;
|
294
|
-
|
261
|
+
}
|
262
|
+
case "ENDER_DRAGON" -> {
|
295
263
|
EnderDragon entity1 = (EnderDragon) entity;
|
296
264
|
this.dataByte = (byte) entity1.getPhase().ordinal();
|
297
265
|
return;
|
298
|
-
|
299
|
-
case "WITHER_SKELETON"
|
300
|
-
|
301
|
-
|
302
|
-
case "GHAST":
|
303
|
-
case "MAGMA_CUBE":
|
304
|
-
case "SQUID":
|
305
|
-
case "PIG_ZOMBIE":
|
306
|
-
case "HOGLIN":
|
307
|
-
case "ZOMBIFIED_PIGLIN":
|
308
|
-
case "PIGLIN":
|
309
|
-
case "PIGLIN_BRUTE":
|
310
|
-
case "ZOMBIE":
|
311
|
-
case "WITHER":
|
312
|
-
case "WITCH":
|
313
|
-
case "SPIDER":
|
314
|
-
case "CAVE_SPIDER":
|
315
|
-
case "SILVERFISH":
|
316
|
-
case "GIANT":
|
317
|
-
case "ENDERMAN":
|
318
|
-
case "CREEPER":
|
319
|
-
case "BLAZE":
|
320
|
-
case "SHULKER":
|
321
|
-
case "SNOWMAN":
|
266
|
+
}
|
267
|
+
case "SKELETON", "WITHER_SKELETON", "GUARDIAN", "ELDER_GUARDIAN", "GHAST", "MAGMA_CUBE", "SQUID", "PIG_ZOMBIE", "HOGLIN",
|
268
|
+
"ZOMBIFIED_PIGLIN", "PIGLIN", "PIGLIN_BRUTE", "ZOMBIE", "WITHER", "WITCH", "SPIDER", "CAVE_SPIDER", "SILVERFISH",
|
269
|
+
"GIANT", "ENDERMAN", "CREEPER", "BLAZE", "SHULKER", "SNOWMAN" -> {
|
322
270
|
storeLiving((LivingEntity) entity);
|
323
271
|
return;
|
324
|
-
|
272
|
+
}
|
273
|
+
case "IRON_GOLEM" -> {
|
325
274
|
if (((IronGolem) entity).isPlayerCreated()) {
|
326
275
|
this.dataByte = (byte) 1;
|
327
276
|
} else {
|
328
277
|
this.dataByte = (byte) 0;
|
329
278
|
}
|
330
279
|
storeLiving((LivingEntity) entity);
|
331
|
-
|
280
|
+
}
|
281
|
+
// END LIVING //
|
332
282
|
}
|
333
283
|
}
|
334
284
|
|
@@ -465,20 +415,15 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
|
465
415
|
}
|
466
416
|
Entity entity;
|
467
417
|
switch (this.getType().toString()) {
|
468
|
-
case "DROPPED_ITEM"
|
418
|
+
case "DROPPED_ITEM" -> {
|
469
419
|
return world.dropItem(location, this.stack);
|
470
|
-
|
471
|
-
case "LEASH_HITCH"
|
420
|
+
}
|
421
|
+
case "PLAYER", "LEASH_HITCH" -> {
|
472
422
|
return null;
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
entity = world.spawn(location, Painting.class);
|
478
|
-
break;
|
479
|
-
default:
|
480
|
-
entity = world.spawnEntity(location, this.getType());
|
481
|
-
break;
|
423
|
+
}
|
424
|
+
case "ITEM_FRAME" -> entity = world.spawn(location, ItemFrame.class);
|
425
|
+
case "PAINTING" -> entity = world.spawn(location, Painting.class);
|
426
|
+
default -> entity = world.spawnEntity(location, this.getType());
|
482
427
|
}
|
483
428
|
if (this.depth == 0) {
|
484
429
|
return entity;
|
@@ -506,72 +451,46 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
|
506
451
|
entity.setGravity(false);
|
507
452
|
}
|
508
453
|
switch (entity.getType().toString()) {
|
509
|
-
case "BOAT"
|
454
|
+
case "BOAT" -> {
|
510
455
|
Boat boat = (Boat) entity;
|
511
456
|
boat.setWoodType(TreeSpecies.values()[dataByte]);
|
512
457
|
return entity;
|
513
|
-
|
458
|
+
}
|
459
|
+
case "SLIME" -> {
|
514
460
|
((Slime) entity).setSize(this.dataByte);
|
515
461
|
return entity;
|
516
|
-
|
517
|
-
case "EGG"
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
case "EXPERIENCE_ORB":
|
523
|
-
case "FALLING_BLOCK":
|
524
|
-
case "FIREBALL":
|
525
|
-
case "FIREWORK":
|
526
|
-
case "FISHING_HOOK":
|
527
|
-
case "LEASH_HITCH":
|
528
|
-
case "LIGHTNING":
|
529
|
-
case "MINECART":
|
530
|
-
case "MINECART_COMMAND":
|
531
|
-
case "MINECART_MOB_SPAWNER":
|
532
|
-
case "MINECART_TNT":
|
533
|
-
case "PLAYER":
|
534
|
-
case "PRIMED_TNT":
|
535
|
-
case "SMALL_FIREBALL":
|
536
|
-
case "SNOWBALL":
|
537
|
-
case "SPLASH_POTION":
|
538
|
-
case "THROWN_EXP_BOTTLE":
|
539
|
-
case "SPECTRAL_ARROW":
|
540
|
-
case "SHULKER_BULLET":
|
541
|
-
case "AREA_EFFECT_CLOUD":
|
542
|
-
case "DRAGON_FIREBALL":
|
543
|
-
case "WITHER_SKULL":
|
544
|
-
case "MINECART_FURNACE":
|
545
|
-
case "LLAMA_SPIT":
|
546
|
-
case "TRIDENT":
|
547
|
-
case "UNKNOWN":
|
462
|
+
}
|
463
|
+
case "ARROW", "EGG", "ENDER_CRYSTAL", "ENDER_PEARL", "ENDER_SIGNAL", "DROPPED_ITEM", "EXPERIENCE_ORB", "FALLING_BLOCK",
|
464
|
+
"FIREBALL", "FIREWORK", "FISHING_HOOK", "LEASH_HITCH", "LIGHTNING", "MINECART", "MINECART_COMMAND",
|
465
|
+
"MINECART_MOB_SPAWNER", "MINECART_TNT", "PLAYER", "PRIMED_TNT", "SMALL_FIREBALL", "SNOWBALL",
|
466
|
+
"SPLASH_POTION", "THROWN_EXP_BOTTLE", "SPECTRAL_ARROW", "SHULKER_BULLET", "AREA_EFFECT_CLOUD",
|
467
|
+
"DRAGON_FIREBALL", "WITHER_SKULL", "MINECART_FURNACE", "LLAMA_SPIT", "TRIDENT", "UNKNOWN" -> {
|
548
468
|
// Do this stuff later
|
549
469
|
return entity;
|
470
|
+
}
|
550
471
|
// MISC //
|
551
|
-
case "ITEM_FRAME"
|
472
|
+
case "ITEM_FRAME" -> {
|
552
473
|
ItemFrame itemframe = (ItemFrame) entity;
|
553
474
|
itemframe.setRotation(Rotation.values()[this.dataByte]);
|
554
475
|
itemframe.setItem(this.stack);
|
555
476
|
return entity;
|
556
|
-
|
477
|
+
}
|
478
|
+
case "PAINTING" -> {
|
557
479
|
Painting painting = (Painting) entity;
|
558
480
|
painting.setFacingDirection(BlockFace.values()[this.dataByte], true);
|
559
481
|
painting.setArt(Art.getByName(this.dataString), true);
|
560
482
|
return entity;
|
483
|
+
}
|
561
484
|
// END MISC //
|
562
485
|
// INVENTORY HOLDER //
|
563
|
-
case "MINECART_CHEST"
|
564
|
-
case "MINECART_HOPPER":
|
486
|
+
case "MINECART_CHEST", "MINECART_HOPPER" -> {
|
565
487
|
restoreInventory((InventoryHolder) entity);
|
566
488
|
return entity;
|
489
|
+
}
|
567
490
|
// START LIVING ENTITY //
|
568
491
|
// START AGEABLE //
|
569
492
|
// START TAMEABLE //
|
570
|
-
case "HORSE"
|
571
|
-
case "LLAMA":
|
572
|
-
case "SKELETON_HORSE":
|
573
|
-
case "DONKEY":
|
574
|
-
case "MULE":
|
493
|
+
case "HORSE", "LLAMA", "SKELETON_HORSE", "DONKEY", "MULE" -> {
|
575
494
|
AbstractHorse horse = (AbstractHorse) entity;
|
576
495
|
horse.setJumpStrength(this.horse.jump);
|
577
496
|
if (horse instanceof ChestedHorse) {
|
@@ -586,15 +505,16 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
|
586
505
|
restoreLiving(horse);
|
587
506
|
restoreInventory(horse);
|
588
507
|
return entity;
|
508
|
+
}
|
589
509
|
// END INVENTORY HOLDER //
|
590
|
-
case "WOLF"
|
591
|
-
case "OCELOT":
|
510
|
+
case "WOLF", "OCELOT" -> {
|
592
511
|
restoreTameable((Tameable) entity);
|
593
512
|
restoreAgeable((Ageable) entity);
|
594
513
|
restoreLiving((LivingEntity) entity);
|
595
514
|
return entity;
|
515
|
+
}
|
596
516
|
// END AGEABLE //
|
597
|
-
case "SHEEP"
|
517
|
+
case "SHEEP" -> {
|
598
518
|
Sheep sheep = (Sheep) entity;
|
599
519
|
if (this.dataByte == 1) {
|
600
520
|
sheep.setSheared(true);
|
@@ -605,25 +525,22 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
|
605
525
|
restoreAgeable(sheep);
|
606
526
|
restoreLiving(sheep);
|
607
527
|
return sheep;
|
608
|
-
|
609
|
-
case "CHICKEN"
|
610
|
-
case "COW":
|
611
|
-
case "TURTLE":
|
612
|
-
case "POLAR_BEAR":
|
613
|
-
case "MUSHROOM_COW":
|
614
|
-
case "PIG":
|
528
|
+
}
|
529
|
+
case "VILLAGER", "CHICKEN", "COW", "TURTLE", "POLAR_BEAR", "MUSHROOM_COW", "PIG" -> {
|
615
530
|
restoreAgeable((Ageable) entity);
|
616
531
|
restoreLiving((LivingEntity) entity);
|
617
532
|
return entity;
|
533
|
+
}
|
618
534
|
// END AGEABLE //
|
619
|
-
case "RABBIT"
|
535
|
+
case "RABBIT" -> {
|
620
536
|
if (this.dataByte != 0) {
|
621
537
|
((Rabbit) entity).setRabbitType(Rabbit.Type.values()[this.dataByte]);
|
622
538
|
}
|
623
539
|
restoreAgeable((Ageable) entity);
|
624
540
|
restoreLiving((LivingEntity) entity);
|
625
541
|
return entity;
|
626
|
-
|
542
|
+
}
|
543
|
+
case "ARMOR_STAND" -> {
|
627
544
|
// CHECK positions
|
628
545
|
ArmorStand stand = (ArmorStand) entity;
|
629
546
|
if (this.inventory[0] != null) {
|
@@ -693,56 +610,38 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
|
693
610
|
}
|
694
611
|
restoreLiving(stand);
|
695
612
|
return stand;
|
696
|
-
|
613
|
+
}
|
614
|
+
case "BAT" -> {
|
697
615
|
if (this.dataByte != 0) {
|
698
616
|
((Bat) entity).setAwake(true);
|
699
617
|
}
|
700
618
|
restoreLiving((LivingEntity) entity);
|
701
619
|
return entity;
|
702
|
-
|
620
|
+
}
|
621
|
+
case "ENDER_DRAGON" -> {
|
703
622
|
if (this.dataByte != 0) {
|
704
623
|
((EnderDragon) entity).setPhase(EnderDragon.Phase.values()[this.dataByte]);
|
705
624
|
}
|
706
625
|
restoreLiving((LivingEntity) entity);
|
707
626
|
return entity;
|
708
|
-
|
709
|
-
case "GHAST"
|
710
|
-
case "MAGMA_CUBE":
|
711
|
-
case "SQUID":
|
712
|
-
case "PIG_ZOMBIE":
|
713
|
-
case "HOGLIN":
|
714
|
-
case "PIGLIN":
|
715
|
-
case "ZOMBIFIED_PIGLIN":
|
716
|
-
case "PIGLIN_BRUTE":
|
717
|
-
case "ZOMBIE":
|
718
|
-
case "WITHER":
|
719
|
-
case "WITCH":
|
720
|
-
case "SPIDER":
|
721
|
-
case "CAVE_SPIDER":
|
722
|
-
case "SILVERFISH":
|
723
|
-
case "GIANT":
|
724
|
-
case "ENDERMAN":
|
725
|
-
case "CREEPER":
|
726
|
-
case "BLAZE":
|
727
|
-
case "SNOWMAN":
|
728
|
-
case "SHULKER":
|
729
|
-
case "GUARDIAN":
|
730
|
-
case "ELDER_GUARDIAN":
|
731
|
-
case "SKELETON":
|
732
|
-
case "WITHER_SKELETON":
|
627
|
+
}
|
628
|
+
case "ENDERMITE", "GHAST", "MAGMA_CUBE", "SQUID", "PIG_ZOMBIE", "HOGLIN", "PIGLIN", "ZOMBIFIED_PIGLIN", "PIGLIN_BRUTE", "ZOMBIE", "WITHER", "WITCH", "SPIDER", "CAVE_SPIDER", "SILVERFISH", "GIANT", "ENDERMAN", "CREEPER", "BLAZE", "SNOWMAN", "SHULKER", "GUARDIAN", "ELDER_GUARDIAN", "SKELETON", "WITHER_SKELETON" -> {
|
733
629
|
restoreLiving((LivingEntity) entity);
|
734
630
|
return entity;
|
735
|
-
|
631
|
+
}
|
632
|
+
case "IRON_GOLEM" -> {
|
736
633
|
if (this.dataByte != 0) {
|
737
634
|
((IronGolem) entity).setPlayerCreated(true);
|
738
635
|
}
|
739
636
|
restoreLiving((LivingEntity) entity);
|
740
637
|
return entity;
|
741
|
-
|
638
|
+
}
|
639
|
+
default -> {
|
742
640
|
if (Settings.DEBUG) {
|
743
641
|
LOGGER.info("Could not identify entity: {}", entity.getType());
|
744
642
|
}
|
745
643
|
return entity;
|
644
|
+
}
|
746
645
|
// END LIVING
|
747
646
|
}
|
748
647
|
}
|
@@ -24,9 +24,8 @@ import com.plotsquared.core.generator.IndependentPlotGenerator;
|
|
24
24
|
import com.plotsquared.core.location.Location;
|
25
25
|
import com.plotsquared.core.location.UncheckedWorldLocation;
|
26
26
|
import com.plotsquared.core.plot.PlotArea;
|
27
|
-
import com.plotsquared.core.plot.world.PlotAreaManager;
|
28
27
|
import com.plotsquared.core.plot.world.SinglePlotArea;
|
29
|
-
import com.plotsquared.core.queue.
|
28
|
+
import com.plotsquared.core.queue.ZeroedDelegateScopedQueueCoordinator;
|
30
29
|
import org.bukkit.generator.BlockPopulator;
|
31
30
|
import org.bukkit.generator.LimitedRegion;
|
32
31
|
import org.bukkit.generator.WorldInfo;
|
@@ -47,17 +46,6 @@ final class BlockStatePopulator extends BlockPopulator {
|
|
47
46
|
this.plotGenerator = plotGenerator;
|
48
47
|
}
|
49
48
|
|
50
|
-
/**
|
51
|
-
* @deprecated Use {@link BlockStatePopulator#BlockStatePopulator(IndependentPlotGenerator)} as plotAreManager is unused
|
52
|
-
*/
|
53
|
-
@Deprecated(forRemoval = true, since = "6.9.0")
|
54
|
-
public BlockStatePopulator(
|
55
|
-
final @NonNull IndependentPlotGenerator plotGenerator,
|
56
|
-
final @NonNull PlotAreaManager plotAreaManager
|
57
|
-
) {
|
58
|
-
this.plotGenerator = plotGenerator;
|
59
|
-
}
|
60
|
-
|
61
49
|
@Override
|
62
50
|
public void populate(
|
63
51
|
@NonNull final WorldInfo worldInfo,
|
@@ -80,7 +68,7 @@ final class BlockStatePopulator extends BlockPopulator {
|
|
80
68
|
worldInfo.getMaxHeight(),
|
81
69
|
(chunkZ << 4) + 15
|
82
70
|
);
|
83
|
-
|
71
|
+
ZeroedDelegateScopedQueueCoordinator offsetChunkQueue = new ZeroedDelegateScopedQueueCoordinator(wrapped, min, max);
|
84
72
|
this.plotGenerator.populateChunk(offsetChunkQueue, area);
|
85
73
|
}
|
86
74
|
|
@@ -22,28 +22,47 @@ import com.plotsquared.bukkit.queue.GenChunk;
|
|
22
22
|
import com.plotsquared.bukkit.util.BukkitUtil;
|
23
23
|
import com.plotsquared.bukkit.util.BukkitWorld;
|
24
24
|
import com.plotsquared.core.PlotSquared;
|
25
|
+
import com.plotsquared.core.generator.ClassicPlotWorld;
|
25
26
|
import com.plotsquared.core.generator.GeneratorWrapper;
|
26
27
|
import com.plotsquared.core.generator.IndependentPlotGenerator;
|
27
28
|
import com.plotsquared.core.generator.SingleWorldGenerator;
|
28
29
|
import com.plotsquared.core.location.ChunkWrapper;
|
30
|
+
import com.plotsquared.core.location.UncheckedWorldLocation;
|
29
31
|
import com.plotsquared.core.plot.PlotArea;
|
30
32
|
import com.plotsquared.core.plot.world.PlotAreaManager;
|
31
|
-
import com.plotsquared.core.queue.
|
33
|
+
import com.plotsquared.core.queue.ZeroedDelegateScopedQueueCoordinator;
|
32
34
|
import com.plotsquared.core.util.ChunkManager;
|
35
|
+
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
33
36
|
import com.sk89q.worldedit.math.BlockVector2;
|
37
|
+
import com.sk89q.worldedit.math.BlockVector3;
|
38
|
+
import org.apache.logging.log4j.LogManager;
|
39
|
+
import org.apache.logging.log4j.Logger;
|
40
|
+
import org.bukkit.HeightMap;
|
41
|
+
import org.bukkit.NamespacedKey;
|
42
|
+
import org.bukkit.Registry;
|
34
43
|
import org.bukkit.World;
|
35
44
|
import org.bukkit.block.Biome;
|
45
|
+
import org.bukkit.generator.BiomeProvider;
|
36
46
|
import org.bukkit.generator.BlockPopulator;
|
37
47
|
import org.bukkit.generator.ChunkGenerator;
|
48
|
+
import org.bukkit.generator.WorldInfo;
|
38
49
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
50
|
+
import org.jetbrains.annotations.NotNull;
|
51
|
+
import org.jetbrains.annotations.Nullable;
|
39
52
|
|
40
53
|
import java.util.ArrayList;
|
54
|
+
import java.util.Arrays;
|
55
|
+
import java.util.EnumSet;
|
41
56
|
import java.util.List;
|
42
57
|
import java.util.Random;
|
43
58
|
import java.util.Set;
|
44
59
|
|
60
|
+
import static java.util.function.Predicate.not;
|
61
|
+
|
45
62
|
public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrapper<ChunkGenerator> {
|
46
63
|
|
64
|
+
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + BukkitPlotGenerator.class.getSimpleName());
|
65
|
+
|
47
66
|
@SuppressWarnings("unused")
|
48
67
|
public final boolean PAPER_ASYNC_SAFE = true;
|
49
68
|
|
@@ -52,9 +71,15 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap
|
|
52
71
|
private final ChunkGenerator platformGenerator;
|
53
72
|
private final boolean full;
|
54
73
|
private final String levelName;
|
74
|
+
private final boolean useNewGenerationMethods;
|
75
|
+
private final BiomeProvider biomeProvider;
|
55
76
|
private List<BlockPopulator> populators;
|
56
77
|
private boolean loaded = false;
|
57
78
|
|
79
|
+
private PlotArea lastPlotArea;
|
80
|
+
private int lastChunkX = Integer.MIN_VALUE;
|
81
|
+
private int lastChunkZ = Integer.MIN_VALUE;
|
82
|
+
|
58
83
|
public BukkitPlotGenerator(
|
59
84
|
final @NonNull String name,
|
60
85
|
final @NonNull IndependentPlotGenerator generator,
|
@@ -72,18 +97,23 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap
|
|
72
97
|
this.populators.add(new LegacyBlockStatePopulator(this.plotGenerator));
|
73
98
|
}
|
74
99
|
this.full = true;
|
100
|
+
this.useNewGenerationMethods = PlotSquared.platform().serverVersion()[1] >= 19;
|
101
|
+
this.biomeProvider = new BukkitPlotBiomeProvider();
|
75
102
|
}
|
76
103
|
|
77
104
|
public BukkitPlotGenerator(final String world, final ChunkGenerator cg, final @NonNull PlotAreaManager plotAreaManager) {
|
78
105
|
if (cg instanceof BukkitPlotGenerator) {
|
79
|
-
throw new IllegalArgumentException("ChunkGenerator: " + cg
|
80
|
-
|
106
|
+
throw new IllegalArgumentException("ChunkGenerator: " + cg
|
107
|
+
.getClass()
|
108
|
+
.getName() + " is already a BukkitPlotGenerator!");
|
81
109
|
}
|
82
110
|
this.plotAreaManager = plotAreaManager;
|
83
111
|
this.levelName = world;
|
84
112
|
this.full = false;
|
85
113
|
this.platformGenerator = cg;
|
86
114
|
this.plotGenerator = new DelegatePlotGenerator(cg, world);
|
115
|
+
this.useNewGenerationMethods = PlotSquared.platform().serverVersion()[1] >= 19;
|
116
|
+
this.biomeProvider = null;
|
87
117
|
}
|
88
118
|
|
89
119
|
@Override
|
@@ -111,7 +141,7 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap
|
|
111
141
|
try {
|
112
142
|
checkLoaded(world);
|
113
143
|
} catch (Exception e) {
|
114
|
-
|
144
|
+
LOGGER.error("Error attempting to load world into PlotSquared.", e);
|
115
145
|
}
|
116
146
|
ArrayList<BlockPopulator> toAdd = new ArrayList<>();
|
117
147
|
List<BlockPopulator> existing = world.getPopulators();
|
@@ -128,6 +158,7 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap
|
|
128
158
|
return toAdd;
|
129
159
|
}
|
130
160
|
|
161
|
+
// Extracted to synchronized method for thread-safety, preventing multiple internal world load calls
|
131
162
|
private synchronized void checkLoaded(@NonNull World world) {
|
132
163
|
// Do not attempt to load configurations until WorldEdit has a platform ready.
|
133
164
|
if (!PlotSquared.get().isWeInitialised()) {
|
@@ -153,7 +184,7 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap
|
|
153
184
|
}
|
154
185
|
}
|
155
186
|
|
156
|
-
@SuppressWarnings("deprecation")
|
187
|
+
@SuppressWarnings("deprecation") // Kept for compatibility with <=1.17.1
|
157
188
|
private void setSpawnLimits(@NonNull World world, int limit) {
|
158
189
|
world.setAmbientSpawnLimit(limit);
|
159
190
|
world.setAnimalSpawnLimit(limit);
|
@@ -161,17 +192,118 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap
|
|
161
192
|
world.setWaterAnimalSpawnLimit(limit);
|
162
193
|
}
|
163
194
|
|
195
|
+
@Override
|
196
|
+
public void generateNoise(
|
197
|
+
@NotNull final WorldInfo worldInfo,
|
198
|
+
@NotNull final Random random,
|
199
|
+
final int chunkX,
|
200
|
+
final int chunkZ,
|
201
|
+
@NotNull final ChunkData chunkData
|
202
|
+
) {
|
203
|
+
if (this.platformGenerator != this) {
|
204
|
+
this.platformGenerator.generateNoise(worldInfo, random, chunkX, chunkZ, chunkData);
|
205
|
+
return;
|
206
|
+
}
|
207
|
+
int minY = chunkData.getMinHeight();
|
208
|
+
int maxY = chunkData.getMaxHeight();
|
209
|
+
GenChunk result = new GenChunk(minY, maxY);
|
210
|
+
// Set the chunk location
|
211
|
+
result.setChunk(new ChunkWrapper(worldInfo.getName(), chunkX, chunkZ));
|
212
|
+
// Set the result data
|
213
|
+
result.setChunkData(chunkData);
|
214
|
+
result.result = null;
|
215
|
+
|
216
|
+
// Catch any exceptions (as exceptions usually thrown)
|
217
|
+
try {
|
218
|
+
generate(BlockVector2.at(chunkX, chunkZ), worldInfo.getName(), result, false);
|
219
|
+
} catch (Throwable e) {
|
220
|
+
LOGGER.error("Error attempting to generate chunk.", e);
|
221
|
+
}
|
222
|
+
}
|
223
|
+
|
224
|
+
@Override
|
225
|
+
public void generateSurface(
|
226
|
+
@NotNull final WorldInfo worldInfo,
|
227
|
+
@NotNull final Random random,
|
228
|
+
final int chunkX,
|
229
|
+
final int chunkZ,
|
230
|
+
@NotNull final ChunkData chunkData
|
231
|
+
) {
|
232
|
+
if (platformGenerator != this) {
|
233
|
+
platformGenerator.generateSurface(worldInfo, random, chunkX, chunkZ, chunkData);
|
234
|
+
}
|
235
|
+
}
|
236
|
+
|
237
|
+
@Override
|
238
|
+
public void generateBedrock(
|
239
|
+
@NotNull final WorldInfo worldInfo,
|
240
|
+
@NotNull final Random random,
|
241
|
+
final int chunkX,
|
242
|
+
final int chunkZ,
|
243
|
+
@NotNull final ChunkData chunkData
|
244
|
+
) {
|
245
|
+
if (platformGenerator != this) {
|
246
|
+
platformGenerator.generateBedrock(worldInfo, random, chunkX, chunkZ, chunkData);
|
247
|
+
}
|
248
|
+
}
|
249
|
+
|
250
|
+
@Override
|
251
|
+
public void generateCaves(
|
252
|
+
@NotNull final WorldInfo worldInfo,
|
253
|
+
@NotNull final Random random,
|
254
|
+
final int chunkX,
|
255
|
+
final int chunkZ,
|
256
|
+
@NotNull final ChunkData chunkData
|
257
|
+
) {
|
258
|
+
if (platformGenerator != this) {
|
259
|
+
platformGenerator.generateCaves(worldInfo, random, chunkX, chunkZ, chunkData);
|
260
|
+
}
|
261
|
+
}
|
262
|
+
|
263
|
+
@Override
|
264
|
+
public @Nullable BiomeProvider getDefaultBiomeProvider(@NotNull final WorldInfo worldInfo) {
|
265
|
+
if (platformGenerator != this) {
|
266
|
+
return platformGenerator.getDefaultBiomeProvider(worldInfo);
|
267
|
+
}
|
268
|
+
return biomeProvider;
|
269
|
+
}
|
270
|
+
|
271
|
+
@Override
|
272
|
+
public int getBaseHeight(
|
273
|
+
@NotNull final WorldInfo worldInfo,
|
274
|
+
@NotNull final Random random,
|
275
|
+
final int x,
|
276
|
+
final int z,
|
277
|
+
@NotNull final HeightMap heightMap
|
278
|
+
) {
|
279
|
+
PlotArea area = getPlotArea(worldInfo.getName(), x, z);
|
280
|
+
if (area instanceof ClassicPlotWorld cpw) {
|
281
|
+
// Default to plot height being the heighest point before decoration (i.e. roads, walls etc.)
|
282
|
+
return cpw.PLOT_HEIGHT;
|
283
|
+
}
|
284
|
+
return super.getBaseHeight(worldInfo, random, x, z, heightMap);
|
285
|
+
}
|
286
|
+
|
164
287
|
/**
|
165
288
|
* The entire method is deprecated, but kept for compatibility with versions lower than or equal to 1.16.2.
|
166
289
|
* The method will be removed in future versions, because WorldEdit and FastAsyncWorldEdit only support the latest point
|
167
290
|
* release.
|
168
291
|
*/
|
169
|
-
@
|
292
|
+
@SuppressWarnings("deprecation") // The entire method is deprecated, but kept for compatibility with <=1.16.2
|
170
293
|
@Override
|
294
|
+
@Deprecated(since = "7.0.0")
|
171
295
|
public @NonNull ChunkData generateChunkData(
|
172
|
-
@NonNull World world, @NonNull Random random, int x, int z,
|
173
|
-
@NonNull BiomeGrid biome
|
296
|
+
@NonNull World world, @NonNull Random random, int x, int z, @NonNull BiomeGrid biome
|
174
297
|
) {
|
298
|
+
if (useNewGenerationMethods) {
|
299
|
+
if (this.platformGenerator != this) {
|
300
|
+
return this.platformGenerator.generateChunkData(world, random, x, z, biome);
|
301
|
+
} else {
|
302
|
+
// Throw exception to be caught by the server that indicates the new generation API is being used.
|
303
|
+
throw new UnsupportedOperationException("Using new generation methods. This method is unsupported.");
|
304
|
+
}
|
305
|
+
}
|
306
|
+
|
175
307
|
int minY = BukkitWorld.getMinWorldHeight(world);
|
176
308
|
int maxY = BukkitWorld.getMaxWorldHeight(world);
|
177
309
|
GenChunk result = new GenChunk(minY, maxY);
|
@@ -181,7 +313,6 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap
|
|
181
313
|
for (int chunkZ = 0; chunkZ < 16; chunkZ++) {
|
182
314
|
for (int y = minY; y < maxY; y++) {
|
183
315
|
biome.setBiome(chunkX, y, chunkZ, Biome.PLAINS);
|
184
|
-
|
185
316
|
}
|
186
317
|
}
|
187
318
|
}
|
@@ -201,35 +332,32 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap
|
|
201
332
|
if (this.platformGenerator != this) {
|
202
333
|
return this.platformGenerator.generateChunkData(world, random, x, z, biome);
|
203
334
|
} else {
|
204
|
-
generate(BlockVector2.at(x, z), world, result);
|
335
|
+
generate(BlockVector2.at(x, z), world.getName(), result, true);
|
205
336
|
}
|
206
337
|
} catch (Throwable e) {
|
207
|
-
|
338
|
+
LOGGER.error("Error attempting to load world into PlotSquared.", e);
|
208
339
|
}
|
209
340
|
// Return the result data
|
210
341
|
return result.getChunkData();
|
211
342
|
}
|
212
343
|
|
213
|
-
private void generate(BlockVector2 loc,
|
344
|
+
private void generate(BlockVector2 loc, String world, ZeroedDelegateScopedQueueCoordinator result, boolean biomes) {
|
214
345
|
// Load if improperly loaded
|
215
346
|
if (!this.loaded) {
|
216
|
-
|
347
|
+
synchronized (this) {
|
348
|
+
PlotSquared.get().loadWorld(world, this);
|
349
|
+
}
|
217
350
|
}
|
218
351
|
// Process the chunk
|
219
352
|
if (ChunkManager.preProcessChunk(loc, result)) {
|
220
353
|
return;
|
221
354
|
}
|
222
|
-
PlotArea area =
|
223
|
-
if (area == null && (area = this.plotAreaManager.getPlotArea(this.levelName, null)) == null) {
|
224
|
-
throw new IllegalStateException(
|
225
|
-
"Cannot regenerate chunk that does not belong to a plot area." + " Location: " + loc
|
226
|
-
+ ", world: " + world);
|
227
|
-
}
|
355
|
+
PlotArea area = getPlotArea(world, loc.getX(), loc.getZ());
|
228
356
|
try {
|
229
|
-
this.plotGenerator.generateChunk(result, area);
|
357
|
+
this.plotGenerator.generateChunk(result, area, biomes);
|
230
358
|
} catch (Throwable e) {
|
231
359
|
// Recover from generator error
|
232
|
-
|
360
|
+
LOGGER.error("Error attempting to generate chunk.", e);
|
233
361
|
}
|
234
362
|
ChunkManager.postProcessChunk(loc, result);
|
235
363
|
}
|
@@ -283,4 +411,63 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap
|
|
283
411
|
return this.levelName;
|
284
412
|
}
|
285
413
|
|
414
|
+
private synchronized PlotArea getPlotArea(String name, int chunkX, int chunkZ) {
|
415
|
+
// Load if improperly loaded
|
416
|
+
if (!this.loaded) {
|
417
|
+
PlotSquared.get().loadWorld(name, this);
|
418
|
+
// Do not set loaded to true as we want to ensure spawn limits are set when "loading" is actually able to be
|
419
|
+
// completed properly.
|
420
|
+
}
|
421
|
+
if (lastPlotArea != null && name.equals(this.levelName) && chunkX == lastChunkX && chunkZ == lastChunkZ) {
|
422
|
+
return lastPlotArea;
|
423
|
+
}
|
424
|
+
BlockVector3 loc = BlockVector3.at(chunkX << 4, 0, chunkZ << 4);
|
425
|
+
if (lastPlotArea != null && lastPlotArea.getRegion().contains(loc) && lastPlotArea.getRegion().contains(loc)) {
|
426
|
+
return lastPlotArea;
|
427
|
+
}
|
428
|
+
PlotArea area = UncheckedWorldLocation.at(name, loc).getPlotArea();
|
429
|
+
if (area == null) {
|
430
|
+
throw new IllegalStateException(String.format(
|
431
|
+
"Cannot generate chunk that does not belong to a plot area. World: %s",
|
432
|
+
name
|
433
|
+
));
|
434
|
+
}
|
435
|
+
this.lastChunkX = chunkX;
|
436
|
+
this.lastChunkZ = chunkZ;
|
437
|
+
return this.lastPlotArea = area;
|
438
|
+
}
|
439
|
+
|
440
|
+
/**
|
441
|
+
* Biome provider should never need to be accessed outside of this class.
|
442
|
+
*/
|
443
|
+
private final class BukkitPlotBiomeProvider extends BiomeProvider {
|
444
|
+
|
445
|
+
private static final List<Biome> BIOMES;
|
446
|
+
|
447
|
+
static {
|
448
|
+
Set<Biome> disabledBiomes = EnumSet.of(Biome.CUSTOM);
|
449
|
+
if (PlotSquared.platform().serverVersion()[1] <= 19) {
|
450
|
+
final Biome cherryGrove = Registry.BIOME.get(NamespacedKey.minecraft("cherry_grove"));
|
451
|
+
if (cherryGrove != null) {
|
452
|
+
disabledBiomes.add(cherryGrove);
|
453
|
+
}
|
454
|
+
}
|
455
|
+
BIOMES = Arrays.stream(Biome.values())
|
456
|
+
.filter(not(disabledBiomes::contains))
|
457
|
+
.toList();
|
458
|
+
}
|
459
|
+
|
460
|
+
@Override
|
461
|
+
public @NotNull Biome getBiome(@NotNull final WorldInfo worldInfo, final int x, final int y, final int z) {
|
462
|
+
PlotArea area = getPlotArea(worldInfo.getName(), x >> 4, z >> 4);
|
463
|
+
return BukkitAdapter.adapt(plotGenerator.getBiome(area, x, y, z));
|
464
|
+
}
|
465
|
+
|
466
|
+
@Override
|
467
|
+
public @NotNull List<Biome> getBiomes(@NotNull final WorldInfo worldInfo) {
|
468
|
+
return BIOMES; // Allow all biomes
|
469
|
+
}
|
470
|
+
|
471
|
+
}
|
472
|
+
|
286
473
|
}
|
@@ -24,9 +24,10 @@ import com.plotsquared.core.generator.IndependentPlotGenerator;
|
|
24
24
|
import com.plotsquared.core.location.Location;
|
25
25
|
import com.plotsquared.core.plot.PlotArea;
|
26
26
|
import com.plotsquared.core.plot.PlotId;
|
27
|
-
import com.plotsquared.core.queue.
|
27
|
+
import com.plotsquared.core.queue.ZeroedDelegateScopedQueueCoordinator;
|
28
28
|
import com.plotsquared.core.util.MathMan;
|
29
29
|
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
30
|
+
import com.sk89q.worldedit.world.biome.BiomeType;
|
30
31
|
import org.bukkit.World;
|
31
32
|
import org.bukkit.block.Biome;
|
32
33
|
import org.bukkit.generator.BlockPopulator;
|
@@ -49,6 +50,11 @@ final class DelegatePlotGenerator extends IndependentPlotGenerator {
|
|
49
50
|
public void initialize(PlotArea area) {
|
50
51
|
}
|
51
52
|
|
53
|
+
@Override
|
54
|
+
public BiomeType getBiome(final PlotArea settings, final int x, final int y, final int z) {
|
55
|
+
return null;
|
56
|
+
}
|
57
|
+
|
52
58
|
@Override
|
53
59
|
public String getName() {
|
54
60
|
return this.chunkGenerator.getClass().getName();
|
@@ -60,7 +66,7 @@ final class DelegatePlotGenerator extends IndependentPlotGenerator {
|
|
60
66
|
}
|
61
67
|
|
62
68
|
@Override
|
63
|
-
public void generateChunk(final
|
69
|
+
public void generateChunk(final ZeroedDelegateScopedQueueCoordinator result, PlotArea settings, boolean biomes) {
|
64
70
|
World world = BukkitUtil.getWorld(this.world);
|
65
71
|
Location min = result.getMin();
|
66
72
|
int chunkX = min.getX() >> 4;
|
@@ -26,7 +26,7 @@ import com.plotsquared.core.location.UncheckedWorldLocation;
|
|
26
26
|
import com.plotsquared.core.plot.PlotArea;
|
27
27
|
import com.plotsquared.core.plot.world.SinglePlotArea;
|
28
28
|
import com.plotsquared.core.queue.QueueCoordinator;
|
29
|
-
import com.plotsquared.core.queue.
|
29
|
+
import com.plotsquared.core.queue.ZeroedDelegateScopedQueueCoordinator;
|
30
30
|
import com.sk89q.worldedit.bukkit.BukkitWorld;
|
31
31
|
import com.sk89q.worldedit.util.SideEffectSet;
|
32
32
|
import org.bukkit.Chunk;
|
@@ -65,7 +65,7 @@ final class LegacyBlockStatePopulator extends BlockPopulator {
|
|
65
65
|
queue.setChunkObject(source);
|
66
66
|
Location min = UncheckedWorldLocation.at(world.getName(), chunkMinX, world.getMinHeight(), chunkMinZ);
|
67
67
|
Location max = UncheckedWorldLocation.at(world.getName(), chunkMinX + 15, world.getMaxHeight(), chunkMinZ + 15);
|
68
|
-
|
68
|
+
ZeroedDelegateScopedQueueCoordinator offsetChunkQueue = new ZeroedDelegateScopedQueueCoordinator(queue, min, max);
|
69
69
|
this.plotGenerator.populateChunk(offsetChunkQueue, area);
|
70
70
|
queue.enqueue();
|
71
71
|
}
|
@@ -61,11 +61,12 @@ import com.plotsquared.core.util.task.TaskTime;
|
|
61
61
|
import com.sk89q.worldedit.WorldEdit;
|
62
62
|
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
63
63
|
import com.sk89q.worldedit.world.block.BlockType;
|
64
|
-
import net.kyori.adventure.text.
|
64
|
+
import net.kyori.adventure.text.Component;
|
65
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
66
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
65
67
|
import org.bukkit.Bukkit;
|
66
68
|
import org.bukkit.GameMode;
|
67
69
|
import org.bukkit.Material;
|
68
|
-
import org.bukkit.Tag;
|
69
70
|
import org.bukkit.block.Block;
|
70
71
|
import org.bukkit.block.BlockFace;
|
71
72
|
import org.bukkit.block.BlockState;
|
@@ -114,6 +115,10 @@ import java.util.UUID;
|
|
114
115
|
import java.util.stream.Collectors;
|
115
116
|
import java.util.stream.Stream;
|
116
117
|
|
118
|
+
import static org.bukkit.Tag.CORALS;
|
119
|
+
import static org.bukkit.Tag.CORAL_BLOCKS;
|
120
|
+
import static org.bukkit.Tag.WALL_CORALS;
|
121
|
+
|
117
122
|
@SuppressWarnings("unused")
|
118
123
|
public class BlockEventListener implements Listener {
|
119
124
|
|
@@ -276,13 +281,23 @@ public class BlockEventListener implements Listener {
|
|
276
281
|
if (plot != null) {
|
277
282
|
if (area.notifyIfOutsideBuildArea(pp, location.getY())) {
|
278
283
|
event.setCancelled(true);
|
284
|
+
pp.sendMessage(
|
285
|
+
TranslatableCaption.of("height.height_limit"),
|
286
|
+
TagResolver.builder()
|
287
|
+
.tag("minheight", Tag.inserting(Component.text(area.getMinBuildHeight())))
|
288
|
+
.tag("maxheight", Tag.inserting(Component.text(area.getMaxBuildHeight())))
|
289
|
+
.build()
|
290
|
+
);
|
279
291
|
return;
|
280
292
|
}
|
281
293
|
if (!plot.hasOwner()) {
|
282
294
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_BUILD_UNOWNED)) {
|
283
295
|
pp.sendMessage(
|
284
296
|
TranslatableCaption.of("permission.no_permission_event"),
|
285
|
-
|
297
|
+
TagResolver.resolver(
|
298
|
+
"node",
|
299
|
+
Tag.inserting(Permission.PERMISSION_ADMIN_BUILD_UNOWNED)
|
300
|
+
)
|
286
301
|
);
|
287
302
|
event.setCancelled(true);
|
288
303
|
return;
|
@@ -299,7 +314,10 @@ public class BlockEventListener implements Listener {
|
|
299
314
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
|
300
315
|
pp.sendMessage(
|
301
316
|
TranslatableCaption.of("permission.no_permission_event"),
|
302
|
-
|
317
|
+
TagResolver.resolver(
|
318
|
+
"node",
|
319
|
+
Tag.inserting(Permission.PERMISSION_ADMIN_BUILD_OTHER)
|
320
|
+
)
|
303
321
|
);
|
304
322
|
event.setCancelled(true);
|
305
323
|
plot.debug(player.getName() + " could not place " + event.getBlock().getType()
|
@@ -326,7 +344,10 @@ public class BlockEventListener implements Listener {
|
|
326
344
|
} else if (!pp.hasPermission(Permission.PERMISSION_ADMIN_BUILD_ROAD)) {
|
327
345
|
pp.sendMessage(
|
328
346
|
TranslatableCaption.of("permission.no_permission_event"),
|
329
|
-
|
347
|
+
TagResolver.resolver(
|
348
|
+
"node",
|
349
|
+
Tag.inserting(Permission.PERMISSION_ADMIN_BUILD_ROAD)
|
350
|
+
)
|
330
351
|
);
|
331
352
|
event.setCancelled(true);
|
332
353
|
}
|
@@ -348,13 +369,23 @@ public class BlockEventListener implements Listener {
|
|
348
369
|
if (!plotPlayer.hasPermission(Permission.PERMISSION_ADMIN_DESTROY_GROUNDLEVEL)) {
|
349
370
|
plotPlayer.sendMessage(
|
350
371
|
TranslatableCaption.of("permission.no_permission_event"),
|
351
|
-
|
372
|
+
TagResolver.resolver(
|
373
|
+
"node",
|
374
|
+
Tag.inserting(Permission.PERMISSION_ADMIN_DESTROY_GROUNDLEVEL)
|
375
|
+
)
|
352
376
|
);
|
353
377
|
event.setCancelled(true);
|
354
378
|
return;
|
355
379
|
}
|
356
380
|
} else if (area.notifyIfOutsideBuildArea(plotPlayer, location.getY())) {
|
357
381
|
event.setCancelled(true);
|
382
|
+
plotPlayer.sendMessage(
|
383
|
+
TranslatableCaption.of("height.height_limit"),
|
384
|
+
TagResolver.builder()
|
385
|
+
.tag("minheight", Tag.inserting(Component.text(area.getMinBuildHeight())))
|
386
|
+
.tag("maxheight", Tag.inserting(Component.text(area.getMaxBuildHeight())))
|
387
|
+
.build()
|
388
|
+
);
|
358
389
|
return;
|
359
390
|
}
|
360
391
|
if (!plot.hasOwner()) {
|
@@ -377,7 +408,10 @@ public class BlockEventListener implements Listener {
|
|
377
408
|
}
|
378
409
|
plotPlayer.sendMessage(
|
379
410
|
TranslatableCaption.of("permission.no_permission_event"),
|
380
|
-
|
411
|
+
TagResolver.resolver(
|
412
|
+
"node",
|
413
|
+
Tag.inserting(Permission.PERMISSION_ADMIN_DESTROY_OTHER)
|
414
|
+
)
|
381
415
|
);
|
382
416
|
event.setCancelled(true);
|
383
417
|
} else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
|
@@ -403,7 +437,10 @@ public class BlockEventListener implements Listener {
|
|
403
437
|
}
|
404
438
|
pp.sendMessage(
|
405
439
|
TranslatableCaption.of("permission.no_permission_event"),
|
406
|
-
|
440
|
+
TagResolver.resolver(
|
441
|
+
"node",
|
442
|
+
Tag.inserting(Permission.PERMISSION_ADMIN_DESTROY_ROAD)
|
443
|
+
)
|
407
444
|
);
|
408
445
|
event.setCancelled(true);
|
409
446
|
}
|
@@ -536,14 +573,14 @@ public class BlockEventListener implements Listener {
|
|
536
573
|
event.setCancelled(true);
|
537
574
|
return;
|
538
575
|
}
|
539
|
-
if (SNOW.
|
576
|
+
if (org.bukkit.Tag.SNOW.isTagged(event.getNewState().getType())) {
|
540
577
|
if (!plot.getFlag(SnowFormFlag.class)) {
|
541
578
|
plot.debug("Snow could not form because snow-form = false");
|
542
579
|
event.setCancelled(true);
|
543
580
|
}
|
544
581
|
return;
|
545
582
|
}
|
546
|
-
if (Tag.ICE.isTagged(event.getNewState().getType())) {
|
583
|
+
if (org.bukkit.Tag.ICE.isTagged(event.getNewState().getType())) {
|
547
584
|
if (!plot.getFlag(IceFormFlag.class)) {
|
548
585
|
plot.debug("Ice could not form because ice-form = false");
|
549
586
|
event.setCancelled(true);
|
@@ -568,9 +605,9 @@ public class BlockEventListener implements Listener {
|
|
568
605
|
return;
|
569
606
|
}
|
570
607
|
Class<? extends BooleanFlag<?>> flag;
|
571
|
-
if (SNOW.
|
608
|
+
if (org.bukkit.Tag.SNOW.isTagged(event.getNewState().getType())) {
|
572
609
|
flag = SnowFormFlag.class;
|
573
|
-
} else if (Tag.ICE.isTagged(event.getNewState().getType())) {
|
610
|
+
} else if (org.bukkit.Tag.ICE.isTagged(event.getNewState().getType())) {
|
574
611
|
flag = IceFormFlag.class;
|
575
612
|
} else {
|
576
613
|
return;
|
@@ -676,14 +713,14 @@ public class BlockEventListener implements Listener {
|
|
676
713
|
return;
|
677
714
|
}
|
678
715
|
Material blockType = block.getType();
|
679
|
-
if (Tag.ICE.isTagged(blockType)) {
|
716
|
+
if (org.bukkit.Tag.ICE.isTagged(blockType)) {
|
680
717
|
if (!plot.getFlag(IceMeltFlag.class)) {
|
681
718
|
plot.debug("Ice could not melt because ice-melt = false");
|
682
719
|
event.setCancelled(true);
|
683
720
|
}
|
684
721
|
return;
|
685
722
|
}
|
686
|
-
if (SNOW.
|
723
|
+
if (org.bukkit.Tag.SNOW.isTagged(blockType)) {
|
687
724
|
if (!plot.getFlag(SnowMeltFlag.class)) {
|
688
725
|
plot.debug("Snow could not melt because snow-melt = false");
|
689
726
|
event.setCancelled(true);
|
@@ -697,7 +734,7 @@ public class BlockEventListener implements Listener {
|
|
697
734
|
}
|
698
735
|
return;
|
699
736
|
}
|
700
|
-
if (
|
737
|
+
if (CORAL_BLOCKS.isTagged(blockType) || CORALS.isTagged(blockType) || WALL_CORALS.isTagged(blockType)) {
|
701
738
|
if (!plot.getFlag(CoralDryFlag.class)) {
|
702
739
|
plot.debug("Coral could not dry because coral-dry = false");
|
703
740
|
event.setCancelled(true);
|
@@ -722,7 +759,9 @@ public class BlockEventListener implements Listener {
|
|
722
759
|
return;
|
723
760
|
}
|
724
761
|
|
725
|
-
if (block.getBlockData() instanceof Farmland farmland && event
|
762
|
+
if (block.getBlockData() instanceof Farmland farmland && event
|
763
|
+
.getNewState()
|
764
|
+
.getBlockData() instanceof Farmland newFarmland) {
|
726
765
|
int currentMoisture = farmland.getMoisture();
|
727
766
|
int newMoisture = newFarmland.getMoisture();
|
728
767
|
|
@@ -785,7 +824,10 @@ public class BlockEventListener implements Listener {
|
|
785
824
|
}
|
786
825
|
|
787
826
|
if (toPlot != null) {
|
788
|
-
if (!toArea.contains(fromLocation.getX(), fromLocation.getZ()) || !Objects.equals(
|
827
|
+
if (!toArea.contains(fromLocation.getX(), fromLocation.getZ()) || !Objects.equals(
|
828
|
+
toPlot,
|
829
|
+
toArea.getOwnedPlot(fromLocation)
|
830
|
+
)) {
|
789
831
|
event.setCancelled(true);
|
790
832
|
return;
|
791
833
|
}
|
@@ -801,7 +843,10 @@ public class BlockEventListener implements Listener {
|
|
801
843
|
toPlot.debug("Liquid could not flow because liquid-flow = disabled");
|
802
844
|
event.setCancelled(true);
|
803
845
|
}
|
804
|
-
} else if (!toArea.contains(fromLocation.getX(), fromLocation.getZ()) || !Objects.equals(
|
846
|
+
} else if (!toArea.contains(fromLocation.getX(), fromLocation.getZ()) || !Objects.equals(
|
847
|
+
null,
|
848
|
+
toArea.getOwnedPlot(fromLocation)
|
849
|
+
)) {
|
805
850
|
event.setCancelled(true);
|
806
851
|
} else if (event.getBlock().isLiquid()) {
|
807
852
|
final org.bukkit.Location location = event.getBlock().getLocation();
|
@@ -1071,6 +1116,7 @@ public class BlockEventListener implements Listener {
|
|
1071
1116
|
if (plot != null) {
|
1072
1117
|
plot.debug("Explosion was cancelled because explosion = false");
|
1073
1118
|
}
|
1119
|
+
return;
|
1074
1120
|
}
|
1075
1121
|
event.blockList().removeIf(blox -> !plot.equals(area.getOwnedPlot(BukkitUtil.adapt(blox.getLocation()))));
|
1076
1122
|
}
|
@@ -1124,7 +1170,10 @@ public class BlockEventListener implements Listener {
|
|
1124
1170
|
)) {
|
1125
1171
|
pp.sendMessage(
|
1126
1172
|
TranslatableCaption.of("permission.no_permission_event"),
|
1127
|
-
|
1173
|
+
TagResolver.resolver(
|
1174
|
+
"node",
|
1175
|
+
Tag.inserting(Permission.PERMISSION_ADMIN_BUILD_ROAD)
|
1176
|
+
)
|
1128
1177
|
);
|
1129
1178
|
event.setCancelled(true);
|
1130
1179
|
}
|
@@ -1134,7 +1183,10 @@ public class BlockEventListener implements Listener {
|
|
1134
1183
|
)) {
|
1135
1184
|
pp.sendMessage(
|
1136
1185
|
TranslatableCaption.of("permission.no_permission_event"),
|
1137
|
-
|
1186
|
+
TagResolver.resolver(
|
1187
|
+
"node",
|
1188
|
+
Tag.inserting(Permission.PERMISSION_ADMIN_BUILD_UNOWNED)
|
1189
|
+
)
|
1138
1190
|
);
|
1139
1191
|
event.setCancelled(true);
|
1140
1192
|
}
|
@@ -1142,7 +1194,10 @@ public class BlockEventListener implements Listener {
|
|
1142
1194
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
|
1143
1195
|
pp.sendMessage(
|
1144
1196
|
TranslatableCaption.of("permission.no_permission_event"),
|
1145
|
-
|
1197
|
+
TagResolver.resolver(
|
1198
|
+
"node",
|
1199
|
+
Tag.inserting(Permission.PERMISSION_ADMIN_BUILD_OTHER)
|
1200
|
+
)
|
1146
1201
|
);
|
1147
1202
|
event.setCancelled(true);
|
1148
1203
|
}
|
@@ -1268,16 +1323,29 @@ public class BlockEventListener implements Listener {
|
|
1268
1323
|
) && !(Objects.equals(currentLocation.getPlot(), plot))) {
|
1269
1324
|
pp.sendMessage(
|
1270
1325
|
TranslatableCaption.of("permission.no_permission_event"),
|
1271
|
-
|
1326
|
+
TagResolver.resolver("node", Tag.inserting(Permission.PERMISSION_ADMIN_BUILD_ROAD))
|
1272
1327
|
);
|
1273
1328
|
event.setCancelled(true);
|
1274
1329
|
break;
|
1275
1330
|
}
|
1276
|
-
if (
|
1277
|
-
|
1278
|
-
|
1331
|
+
if (pp.hasPermission(Permission.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) {
|
1332
|
+
continue;
|
1333
|
+
}
|
1334
|
+
if (currentLocation.getY() >= area.getMaxBuildHeight() || currentLocation.getY() < area.getMinBuildHeight()) {
|
1335
|
+
pp.sendMessage(
|
1336
|
+
TranslatableCaption.of("height.height_limit"),
|
1337
|
+
TagResolver.builder()
|
1338
|
+
.tag("minheight", Tag.inserting(Component.text(area.getMinBuildHeight())))
|
1339
|
+
.tag("maxheight", Tag.inserting(Component.text(area.getMaxBuildHeight())))
|
1340
|
+
.build()
|
1341
|
+
);
|
1342
|
+
if (area.notifyIfOutsideBuildArea(pp, currentLocation.getY())) {
|
1343
|
+
event.setCancelled(true);
|
1344
|
+
break;
|
1345
|
+
}
|
1279
1346
|
}
|
1280
1347
|
}
|
1348
|
+
|
1281
1349
|
}
|
1282
1350
|
|
1283
1351
|
}
|
@@ -26,6 +26,7 @@ import com.plotsquared.core.plot.Plot;
|
|
26
26
|
import com.plotsquared.core.plot.PlotArea;
|
27
27
|
import com.plotsquared.core.plot.flag.implementations.CopperOxideFlag;
|
28
28
|
import com.plotsquared.core.plot.flag.implementations.MiscInteractFlag;
|
29
|
+
import com.plotsquared.core.plot.flag.implementations.SculkSensorInteractFlag;
|
29
30
|
import com.plotsquared.core.util.PlotFlagUtil;
|
30
31
|
import org.bukkit.Material;
|
31
32
|
import org.bukkit.block.Block;
|
@@ -92,12 +93,16 @@ public class BlockEventListener117 implements Listener {
|
|
92
93
|
}
|
93
94
|
|
94
95
|
Plot plot = location.getOwnedPlot();
|
95
|
-
if (plot == null && !PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(
|
96
|
-
|
96
|
+
if (plot == null && !PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(
|
97
|
+
area,
|
98
|
+
MiscInteractFlag.class,
|
99
|
+
true
|
100
|
+
) || plot != null && (!plot.getFlag(MiscInteractFlag.class) || !plot.getFlag(SculkSensorInteractFlag.class))) {
|
97
101
|
if (plotPlayer != null) {
|
98
102
|
if (plot != null) {
|
99
103
|
if (!plot.isAdded(plotPlayer.getUUID())) {
|
100
|
-
plot.debug(plotPlayer.getName() + " couldn't trigger sculk sensors because
|
104
|
+
plot.debug(plotPlayer.getName() + " couldn't trigger sculk sensors because both " +
|
105
|
+
"sculk-sensor-interact and misc-interact = false");
|
101
106
|
event.setCancelled(true);
|
102
107
|
}
|
103
108
|
}
|
@@ -108,13 +113,15 @@ public class BlockEventListener117 implements Listener {
|
|
108
113
|
if (plot != null) {
|
109
114
|
if (itemThrower == null && (itemThrower = item.getOwner()) == null) {
|
110
115
|
plot.debug(
|
111
|
-
"A thrown item couldn't trigger sculk sensors because
|
116
|
+
"A thrown item couldn't trigger sculk sensors because both sculk-sensor-interact and " +
|
117
|
+
"misc-interact = false and the item's owner could not be resolved.");
|
112
118
|
event.setCancelled(true);
|
113
119
|
return;
|
114
120
|
}
|
115
121
|
if (!plot.isAdded(itemThrower)) {
|
116
122
|
if (!plot.isAdded(itemThrower)) {
|
117
|
-
plot.debug("A thrown item couldn't trigger sculk sensors because
|
123
|
+
plot.debug("A thrown item couldn't trigger sculk sensors because both sculk-sensor-interact and " +
|
124
|
+
"misc-interact = false");
|
118
125
|
event.setCancelled(true);
|
119
126
|
}
|
120
127
|
}
|
@@ -133,7 +140,6 @@ public class BlockEventListener117 implements Listener {
|
|
133
140
|
if (area == null) {
|
134
141
|
for (int i = blocks.size() - 1; i >= 0; i--) {
|
135
142
|
Location blockLocation = BukkitUtil.adapt(blocks.get(i).getLocation());
|
136
|
-
blockLocation = BukkitUtil.adapt(blocks.get(i).getLocation());
|
137
143
|
if (blockLocation.isPlotArea()) {
|
138
144
|
blocks.remove(i);
|
139
145
|
}
|
@@ -26,6 +26,7 @@ import com.plotsquared.core.plot.Plot;
|
|
26
26
|
import com.plotsquared.core.plot.PlotArea;
|
27
27
|
import com.plotsquared.core.plot.world.PlotAreaManager;
|
28
28
|
import com.plotsquared.core.plot.world.SinglePlotArea;
|
29
|
+
import com.plotsquared.core.util.ReflectionUtils;
|
29
30
|
import com.plotsquared.core.util.ReflectionUtils.RefClass;
|
30
31
|
import com.plotsquared.core.util.ReflectionUtils.RefField;
|
31
32
|
import com.plotsquared.core.util.ReflectionUtils.RefMethod;
|
@@ -64,9 +65,11 @@ public class ChunkListener implements Listener {
|
|
64
65
|
private final PlotAreaManager plotAreaManager;
|
65
66
|
private final int version;
|
66
67
|
|
68
|
+
private RefMethod methodSetUnsaved;
|
67
69
|
private RefMethod methodGetHandleChunk;
|
68
70
|
private RefMethod methodGetHandleWorld;
|
69
|
-
private RefField
|
71
|
+
private RefField mustNotSave;
|
72
|
+
private Object objChunkStatusFull = null;
|
70
73
|
/*
|
71
74
|
private RefMethod methodGetFullChunk;
|
72
75
|
private RefMethod methodGetBukkitChunk;
|
@@ -79,7 +82,6 @@ public class ChunkListener implements Listener {
|
|
79
82
|
*/
|
80
83
|
private Chunk lastChunk;
|
81
84
|
private boolean ignoreUnload = false;
|
82
|
-
private boolean isTrueForNotSave = true;
|
83
85
|
|
84
86
|
@Inject
|
85
87
|
public ChunkListener(final @NonNull PlotAreaManager plotAreaManager) {
|
@@ -90,22 +92,27 @@ public class ChunkListener implements Listener {
|
|
90
92
|
}
|
91
93
|
try {
|
92
94
|
RefClass classCraftWorld = getRefClass("{cb}.CraftWorld");
|
93
|
-
this.methodGetHandleWorld = classCraftWorld.getMethod("getHandle");
|
94
95
|
RefClass classCraftChunk = getRefClass("{cb}.CraftChunk");
|
95
|
-
|
96
|
+
ReflectionUtils.RefClass classChunkAccess = getRefClass("net.minecraft.world.level.chunk.IChunkAccess");
|
97
|
+
this.methodSetUnsaved = classChunkAccess.getMethod("a", boolean.class);
|
98
|
+
try {
|
99
|
+
this.methodGetHandleChunk = classCraftChunk.getMethod("getHandle");
|
100
|
+
} catch (NoSuchMethodException ignored) {
|
101
|
+
try {
|
102
|
+
RefClass classChunkStatus = getRefClass("net.minecraft.world.level.chunk.ChunkStatus");
|
103
|
+
this.objChunkStatusFull = classChunkStatus.getRealClass().getField("n").get(null);
|
104
|
+
this.methodGetHandleChunk = classCraftChunk.getMethod("getHandle", classChunkStatus.getRealClass());
|
105
|
+
} catch (NoSuchMethodException ex) {
|
106
|
+
throw new RuntimeException(ex);
|
107
|
+
}
|
108
|
+
}
|
96
109
|
try {
|
97
110
|
if (version < 17) {
|
98
111
|
RefClass classChunk = getRefClass("{nms}.Chunk");
|
99
|
-
|
100
|
-
this.mustSave = classChunk.getField("mustSave");
|
101
|
-
this.isTrueForNotSave = false;
|
102
|
-
} else {
|
103
|
-
this.mustSave = classChunk.getField("mustNotSave");
|
104
|
-
}
|
112
|
+
this.mustNotSave = classChunk.getField("mustNotSave");
|
105
113
|
} else {
|
106
114
|
RefClass classChunk = getRefClass("net.minecraft.world.level.chunk.Chunk");
|
107
|
-
this.
|
108
|
-
|
115
|
+
this.mustNotSave = classChunk.getField("mustNotSave");
|
109
116
|
}
|
110
117
|
} catch (NoSuchFieldException e) {
|
111
118
|
e.printStackTrace();
|
@@ -167,10 +174,13 @@ public class ChunkListener implements Listener {
|
|
167
174
|
if (safe && shouldSave(world, chunk.getX(), chunk.getZ())) {
|
168
175
|
return false;
|
169
176
|
}
|
170
|
-
Object c =
|
171
|
-
|
172
|
-
|
173
|
-
|
177
|
+
Object c = objChunkStatusFull != null
|
178
|
+
? this.methodGetHandleChunk.of(chunk).call(objChunkStatusFull)
|
179
|
+
: this.methodGetHandleChunk.of(chunk).call();
|
180
|
+
RefField.RefExecutor field = this.mustNotSave.of(c);
|
181
|
+
methodSetUnsaved.of(c).call(false);
|
182
|
+
if (!((Boolean) field.get())) {
|
183
|
+
field.set(true);
|
174
184
|
if (chunk.isLoaded()) {
|
175
185
|
ignoreUnload = true;
|
176
186
|
chunk.unload(false);
|
@@ -234,7 +244,8 @@ public class ChunkListener implements Listener {
|
|
234
244
|
Chunk chunk = event.getChunk();
|
235
245
|
if (Settings.Chunk_Processor.AUTO_TRIM) {
|
236
246
|
String world = chunk.getWorld().getName();
|
237
|
-
if ((!Settings.Enabled_Components.WORLDS || !SinglePlotArea.isSinglePlotWorld(world)) && this.plotAreaManager.hasPlotArea(
|
247
|
+
if ((!Settings.Enabled_Components.WORLDS || !SinglePlotArea.isSinglePlotWorld(world)) && this.plotAreaManager.hasPlotArea(
|
248
|
+
world)) {
|
238
249
|
if (unloadChunk(world, chunk, true)) {
|
239
250
|
return;
|
240
251
|
}
|
@@ -145,54 +145,38 @@ public class EntityEventListener implements Listener {
|
|
145
145
|
}
|
146
146
|
CreatureSpawnEvent.SpawnReason reason = event.getSpawnReason();
|
147
147
|
switch (reason.toString()) {
|
148
|
-
case "DISPENSE_EGG"
|
149
|
-
case "EGG":
|
150
|
-
case "OCELOT_BABY":
|
151
|
-
case "SPAWNER_EGG":
|
148
|
+
case "DISPENSE_EGG", "EGG", "OCELOT_BABY", "SPAWNER_EGG" -> {
|
152
149
|
if (!area.isSpawnEggs()) {
|
153
150
|
event.setCancelled(true);
|
154
151
|
return;
|
155
152
|
}
|
156
|
-
|
157
|
-
case "REINFORCEMENTS"
|
158
|
-
|
159
|
-
|
160
|
-
case "PATROL":
|
161
|
-
case "RAID":
|
162
|
-
case "SHEARED":
|
163
|
-
case "SILVERFISH_BLOCK":
|
164
|
-
case "ENDER_PEARL":
|
165
|
-
case "TRAP":
|
166
|
-
case "VILLAGE_DEFENSE":
|
167
|
-
case "VILLAGE_INVASION":
|
168
|
-
case "BEEHIVE":
|
169
|
-
case "CHUNK_GEN":
|
153
|
+
}
|
154
|
+
case "REINFORCEMENTS", "NATURAL", "MOUNT", "PATROL", "RAID", "SHEARED", "SILVERFISH_BLOCK", "ENDER_PEARL",
|
155
|
+
"TRAP", "VILLAGE_DEFENSE", "VILLAGE_INVASION", "BEEHIVE", "CHUNK_GEN", "NETHER_PORTAL",
|
156
|
+
"DUPLICATION", "FROZEN", "SPELL" -> {
|
170
157
|
if (!area.isMobSpawning()) {
|
171
158
|
event.setCancelled(true);
|
172
159
|
return;
|
173
160
|
}
|
174
|
-
|
175
|
-
case "BREEDING"
|
161
|
+
}
|
162
|
+
case "BREEDING" -> {
|
176
163
|
if (!area.isSpawnBreeding()) {
|
177
164
|
event.setCancelled(true);
|
178
165
|
return;
|
179
166
|
}
|
180
|
-
|
181
|
-
case "BUILD_IRONGOLEM"
|
182
|
-
case "BUILD_SNOWMAN":
|
183
|
-
case "BUILD_WITHER":
|
184
|
-
case "CUSTOM":
|
167
|
+
}
|
168
|
+
case "BUILD_IRONGOLEM", "BUILD_SNOWMAN", "BUILD_WITHER", "CUSTOM" -> {
|
185
169
|
if (!area.isSpawnCustom() && entity.getType() != EntityType.ARMOR_STAND) {
|
186
170
|
event.setCancelled(true);
|
187
171
|
return;
|
188
172
|
}
|
189
|
-
|
190
|
-
case "SPAWNER"
|
173
|
+
}
|
174
|
+
case "SPAWNER" -> {
|
191
175
|
if (!area.isMobSpawnerSpawning()) {
|
192
176
|
event.setCancelled(true);
|
193
177
|
return;
|
194
178
|
}
|
195
|
-
|
179
|
+
}
|
196
180
|
}
|
197
181
|
Plot plot = area.getOwnedPlotAbs(location);
|
198
182
|
if (plot == null) {
|
@@ -44,7 +44,9 @@ import com.plotsquared.core.plot.flag.implementations.ProjectilesFlag;
|
|
44
44
|
import com.plotsquared.core.plot.flag.types.BooleanFlag;
|
45
45
|
import com.plotsquared.core.plot.world.PlotAreaManager;
|
46
46
|
import com.plotsquared.core.util.PlotFlagUtil;
|
47
|
-
import net.kyori.adventure.text.
|
47
|
+
import net.kyori.adventure.text.Component;
|
48
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
49
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
48
50
|
import org.bukkit.Chunk;
|
49
51
|
import org.bukkit.block.Block;
|
50
52
|
import org.bukkit.block.TileState;
|
@@ -176,59 +178,41 @@ public class PaperListener implements Listener {
|
|
176
178
|
}
|
177
179
|
CreatureSpawnEvent.SpawnReason reason = event.getReason();
|
178
180
|
switch (reason.toString()) {
|
179
|
-
case "DISPENSE_EGG"
|
180
|
-
case "EGG":
|
181
|
-
case "OCELOT_BABY":
|
182
|
-
case "SPAWNER_EGG":
|
181
|
+
case "DISPENSE_EGG", "EGG", "OCELOT_BABY", "SPAWNER_EGG" -> {
|
183
182
|
if (!area.isSpawnEggs()) {
|
184
183
|
event.setShouldAbortSpawn(true);
|
185
184
|
event.setCancelled(true);
|
186
185
|
return;
|
187
186
|
}
|
188
|
-
|
189
|
-
case "REINFORCEMENTS"
|
190
|
-
case "NATURAL":
|
191
|
-
case "MOUNT":
|
192
|
-
case "PATROL":
|
193
|
-
case "RAID":
|
194
|
-
case "SHEARED":
|
195
|
-
case "SILVERFISH_BLOCK":
|
196
|
-
case "ENDER_PEARL":
|
197
|
-
case "TRAP":
|
198
|
-
case "VILLAGE_DEFENSE":
|
199
|
-
case "VILLAGE_INVASION":
|
200
|
-
case "BEEHIVE":
|
201
|
-
case "CHUNK_GEN":
|
187
|
+
}
|
188
|
+
case "REINFORCEMENTS", "NATURAL", "MOUNT", "PATROL", "RAID", "SHEARED", "SILVERFISH_BLOCK", "ENDER_PEARL", "TRAP", "VILLAGE_DEFENSE", "VILLAGE_INVASION", "BEEHIVE", "CHUNK_GEN" -> {
|
202
189
|
if (!area.isMobSpawning()) {
|
203
190
|
event.setShouldAbortSpawn(true);
|
204
191
|
event.setCancelled(true);
|
205
192
|
return;
|
206
193
|
}
|
207
|
-
|
208
|
-
case "BREEDING"
|
194
|
+
}
|
195
|
+
case "BREEDING" -> {
|
209
196
|
if (!area.isSpawnBreeding()) {
|
210
197
|
event.setShouldAbortSpawn(true);
|
211
198
|
event.setCancelled(true);
|
212
199
|
return;
|
213
200
|
}
|
214
|
-
|
215
|
-
case "BUILD_IRONGOLEM"
|
216
|
-
case "BUILD_SNOWMAN":
|
217
|
-
case "BUILD_WITHER":
|
218
|
-
case "CUSTOM":
|
201
|
+
}
|
202
|
+
case "BUILD_IRONGOLEM", "BUILD_SNOWMAN", "BUILD_WITHER", "CUSTOM" -> {
|
219
203
|
if (!area.isSpawnCustom() && event.getType() != EntityType.ARMOR_STAND) {
|
220
204
|
event.setShouldAbortSpawn(true);
|
221
205
|
event.setCancelled(true);
|
222
206
|
return;
|
223
207
|
}
|
224
|
-
|
225
|
-
case "SPAWNER"
|
208
|
+
}
|
209
|
+
case "SPAWNER" -> {
|
226
210
|
if (!area.isMobSpawnerSpawning()) {
|
227
211
|
event.setShouldAbortSpawn(true);
|
228
212
|
event.setCancelled(true);
|
229
213
|
return;
|
230
214
|
}
|
231
|
-
|
215
|
+
}
|
232
216
|
}
|
233
217
|
Plot plot = location.getOwnedPlotAbs();
|
234
218
|
if (plot == null) {
|
@@ -302,7 +286,7 @@ public class PaperListener implements Listener {
|
|
302
286
|
final PlotPlayer<?> plotPlayer = BukkitUtil.adapt(event.getPlayer());
|
303
287
|
plotPlayer.sendMessage(
|
304
288
|
TranslatableCaption.of("errors.tile_entity_cap_reached"),
|
305
|
-
|
289
|
+
TagResolver.resolver("amount", Tag.inserting(Component.text(Settings.Chunk_Processor.MAX_TILES)))
|
306
290
|
);
|
307
291
|
event.setCancelled(true);
|
308
292
|
event.setBuild(false);
|
@@ -339,7 +323,10 @@ public class PaperListener implements Listener {
|
|
339
323
|
)) {
|
340
324
|
pp.sendMessage(
|
341
325
|
TranslatableCaption.of("permission.no_permission_event"),
|
342
|
-
|
326
|
+
TagResolver.resolver(
|
327
|
+
"node",
|
328
|
+
Tag.inserting(Permission.PERMISSION_ADMIN_PROJECTILE_ROAD)
|
329
|
+
)
|
343
330
|
);
|
344
331
|
entity.remove();
|
345
332
|
event.setCancelled(true);
|
@@ -348,7 +335,10 @@ public class PaperListener implements Listener {
|
|
348
335
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED)) {
|
349
336
|
pp.sendMessage(
|
350
337
|
TranslatableCaption.of("permission.no_permission_event"),
|
351
|
-
|
338
|
+
TagResolver.resolver(
|
339
|
+
"node",
|
340
|
+
Tag.inserting(Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED)
|
341
|
+
)
|
352
342
|
);
|
353
343
|
entity.remove();
|
354
344
|
event.setCancelled(true);
|
@@ -358,7 +348,10 @@ public class PaperListener implements Listener {
|
|
358
348
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_PROJECTILE_OTHER)) {
|
359
349
|
pp.sendMessage(
|
360
350
|
TranslatableCaption.of("permission.no_permission_event"),
|
361
|
-
|
351
|
+
TagResolver.resolver(
|
352
|
+
"node",
|
353
|
+
Tag.inserting(Permission.PERMISSION_ADMIN_PROJECTILE_OTHER)
|
354
|
+
)
|
362
355
|
);
|
363
356
|
entity.remove();
|
364
357
|
event.setCancelled(true);
|
@@ -446,9 +439,11 @@ public class PaperListener implements Listener {
|
|
446
439
|
}
|
447
440
|
}
|
448
441
|
|
449
|
-
private boolean getBooleanFlagValue(
|
450
|
-
|
451
|
-
|
442
|
+
private boolean getBooleanFlagValue(
|
443
|
+
@NonNull FlagContainer container,
|
444
|
+
@NonNull Class<? extends BooleanFlag<?>> flagClass,
|
445
|
+
boolean defaultValue
|
446
|
+
) {
|
452
447
|
BooleanFlag<?> flag = container.getFlag(flagClass);
|
453
448
|
return flag == null ? defaultValue : flag.getValue();
|
454
449
|
}
|
@@ -1,91 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* PlotSquared, a land and world management plugin for Minecraft.
|
3
|
-
* Copyright (C) IntellectualSites <https://intellectualsites.com>
|
4
|
-
* Copyright (C) IntellectualSites team and contributors
|
5
|
-
*
|
6
|
-
* This program is free software: you can redistribute it and/or modify
|
7
|
-
* it under the terms of the GNU General Public License as published by
|
8
|
-
* the Free Software Foundation, either version 3 of the License, or
|
9
|
-
* (at your option) any later version.
|
10
|
-
*
|
11
|
-
* This program is distributed in the hope that it will be useful,
|
12
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
-
* GNU General Public License for more details.
|
15
|
-
*
|
16
|
-
* You should have received a copy of the GNU General Public License
|
17
|
-
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
18
|
-
*/
|
19
|
-
package com.plotsquared.bukkit.listener;
|
20
|
-
|
21
|
-
import com.google.inject.Inject;
|
22
|
-
import com.plotsquared.bukkit.util.BukkitUtil;
|
23
|
-
import com.plotsquared.core.configuration.Settings;
|
24
|
-
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
25
|
-
import com.plotsquared.core.location.Location;
|
26
|
-
import com.plotsquared.core.player.PlotPlayer;
|
27
|
-
import com.plotsquared.core.plot.PlotArea;
|
28
|
-
import com.plotsquared.core.plot.world.PlotAreaManager;
|
29
|
-
import net.kyori.adventure.text.minimessage.Template;
|
30
|
-
import org.bukkit.block.Banner;
|
31
|
-
import org.bukkit.block.Beacon;
|
32
|
-
import org.bukkit.block.BlockState;
|
33
|
-
import org.bukkit.block.CommandBlock;
|
34
|
-
import org.bukkit.block.Comparator;
|
35
|
-
import org.bukkit.block.Conduit;
|
36
|
-
import org.bukkit.block.Container;
|
37
|
-
import org.bukkit.block.CreatureSpawner;
|
38
|
-
import org.bukkit.block.DaylightDetector;
|
39
|
-
import org.bukkit.block.EnchantingTable;
|
40
|
-
import org.bukkit.block.EndGateway;
|
41
|
-
import org.bukkit.block.EnderChest;
|
42
|
-
import org.bukkit.block.Jukebox;
|
43
|
-
import org.bukkit.block.Sign;
|
44
|
-
import org.bukkit.block.Skull;
|
45
|
-
import org.bukkit.block.Structure;
|
46
|
-
import org.bukkit.block.data.type.Bed;
|
47
|
-
import org.bukkit.event.EventHandler;
|
48
|
-
import org.bukkit.event.block.BlockPlaceEvent;
|
49
|
-
import org.checkerframework.checker.nullness.qual.NonNull;
|
50
|
-
|
51
|
-
/**
|
52
|
-
* @deprecated P2 effectively no longer supports 1.13
|
53
|
-
*/
|
54
|
-
@Deprecated(forRemoval = true, since = "6.10.4")
|
55
|
-
public class PaperListener113 extends PaperListener {
|
56
|
-
|
57
|
-
@Inject
|
58
|
-
public PaperListener113(@NonNull PlotAreaManager plotAreaManager) {
|
59
|
-
super(plotAreaManager);
|
60
|
-
}
|
61
|
-
|
62
|
-
@EventHandler
|
63
|
-
public void onBlockPlace(BlockPlaceEvent event) {
|
64
|
-
if (!Settings.Paper_Components.TILE_ENTITY_CHECK || !Settings.Enabled_Components.CHUNK_PROCESSOR) {
|
65
|
-
return;
|
66
|
-
}
|
67
|
-
BlockState state = event.getBlock().getState(false);
|
68
|
-
if (!(state instanceof Banner || state instanceof Beacon || state instanceof Bed || state instanceof CommandBlock
|
69
|
-
|| state instanceof Comparator || state instanceof Conduit || state instanceof Container || state instanceof CreatureSpawner
|
70
|
-
|| state instanceof DaylightDetector || state instanceof EnchantingTable || state instanceof EnderChest || state instanceof EndGateway
|
71
|
-
|| state instanceof Jukebox || state instanceof Sign || state instanceof Skull || state instanceof Structure)) {
|
72
|
-
return;
|
73
|
-
}
|
74
|
-
final Location location = BukkitUtil.adapt(event.getBlock().getLocation());
|
75
|
-
final PlotArea plotArea = location.getPlotArea();
|
76
|
-
if (plotArea == null) {
|
77
|
-
return;
|
78
|
-
}
|
79
|
-
final int tileEntityCount = event.getBlock().getChunk().getTileEntities(false).length;
|
80
|
-
if (tileEntityCount >= Settings.Chunk_Processor.MAX_TILES) {
|
81
|
-
final PlotPlayer<?> plotPlayer = BukkitUtil.adapt(event.getPlayer());
|
82
|
-
plotPlayer.sendMessage(
|
83
|
-
TranslatableCaption.of("errors.tile_entity_cap_reached"),
|
84
|
-
Template.of("amount", String.valueOf(Settings.Chunk_Processor.MAX_TILES))
|
85
|
-
);
|
86
|
-
event.setCancelled(true);
|
87
|
-
event.setBuild(false);
|
88
|
-
}
|
89
|
-
}
|
90
|
-
|
91
|
-
}
|
@@ -77,12 +77,13 @@ import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
|
77
77
|
import com.sk89q.worldedit.world.block.BlockType;
|
78
78
|
import io.papermc.lib.PaperLib;
|
79
79
|
import net.kyori.adventure.text.Component;
|
80
|
-
import net.kyori.adventure.text.minimessage.
|
80
|
+
import net.kyori.adventure.text.minimessage.MiniMessage;
|
81
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
82
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
83
|
+
import net.kyori.adventure.text.minimessage.tag.standard.StandardTags;
|
81
84
|
import org.bukkit.Bukkit;
|
82
|
-
import org.bukkit.ChatColor;
|
83
85
|
import org.bukkit.FluidCollisionMode;
|
84
86
|
import org.bukkit.Material;
|
85
|
-
import org.bukkit.Tag;
|
86
87
|
import org.bukkit.block.Block;
|
87
88
|
import org.bukkit.block.BlockFace;
|
88
89
|
import org.bukkit.block.BlockState;
|
@@ -272,8 +273,7 @@ public class PlayerEventListener implements Listener {
|
|
272
273
|
Plot plot = plotPlayer.getCurrentPlot();
|
273
274
|
// Check WorldEdit
|
274
275
|
switch (parts[0]) {
|
275
|
-
case "up":
|
276
|
-
case "worldedit:up":
|
276
|
+
case "up", "worldedit:up" -> {
|
277
277
|
if (plot == null || (!plot.isAdded(plotPlayer.getUUID()) && !plotPlayer.hasPermission(
|
278
278
|
Permission.PERMISSION_ADMIN_BUILD_OTHER,
|
279
279
|
true
|
@@ -281,6 +281,7 @@ public class PlayerEventListener implements Listener {
|
|
281
281
|
event.setCancelled(true);
|
282
282
|
return;
|
283
283
|
}
|
284
|
+
}
|
284
285
|
}
|
285
286
|
if (plot == null && !area.isRoadFlags()) {
|
286
287
|
return;
|
@@ -398,11 +399,15 @@ public class PlayerEventListener implements Listener {
|
|
398
399
|
&& PremiumVerification.isPremium() && UpdateUtility.hasUpdate) {
|
399
400
|
Caption boundary = TranslatableCaption.of("update.update_boundary");
|
400
401
|
Caption updateNotification = TranslatableCaption.of("update.update_notification");
|
401
|
-
Template internalVersion = Template.of("p2version", UpdateUtility.internalVersion.versionString());
|
402
|
-
Template spigotVersion = Template.of("spigotversion", UpdateUtility.spigotVersion);
|
403
|
-
Template downloadUrl = Template.of("downloadurl", "https://www.spigotmc.org/resources/77506/updates");
|
404
402
|
pp.sendMessage(boundary);
|
405
|
-
pp.sendMessage(
|
403
|
+
pp.sendMessage(
|
404
|
+
updateNotification,
|
405
|
+
TagResolver.builder()
|
406
|
+
.tag("p2version", Tag.inserting(Component.text(UpdateUtility.internalVersion.versionString())))
|
407
|
+
.tag("spigotversion", Tag.inserting(Component.text(UpdateUtility.spigotVersion)))
|
408
|
+
.tag("downloadurl", Tag.preProcessParsed("https://www.spigotmc.org/resources/77506/updates"))
|
409
|
+
.build()
|
410
|
+
);
|
406
411
|
pp.sendMessage(boundary);
|
407
412
|
}
|
408
413
|
}
|
@@ -454,7 +459,7 @@ public class PlayerEventListener implements Listener {
|
|
454
459
|
.equals(BukkitUtil.adaptComplete(to)))) {
|
455
460
|
pp.sendMessage(
|
456
461
|
TranslatableCaption.of("deny.no_enter"),
|
457
|
-
|
462
|
+
TagResolver.resolver("plot", Tag.inserting(Component.text(plot.toString())))
|
458
463
|
);
|
459
464
|
event.setCancelled(true);
|
460
465
|
}
|
@@ -567,10 +572,14 @@ public class PlayerEventListener implements Listener {
|
|
567
572
|
if (now == null) {
|
568
573
|
try (final MetaDataAccess<Boolean> kickAccess =
|
569
574
|
pp.accessTemporaryMetaData(PlayerMetaDataKeys.TEMPORARY_KICK)) {
|
570
|
-
if (lastPlot != null && !plotListener.plotExit(pp, lastPlot) && this.tmpTeleport && !kickAccess.get().orElse(
|
575
|
+
if (lastPlot != null && !plotListener.plotExit(pp, lastPlot) && this.tmpTeleport && !kickAccess.get().orElse(
|
576
|
+
false)) {
|
571
577
|
pp.sendMessage(
|
572
578
|
TranslatableCaption.of("permission.no_permission_event"),
|
573
|
-
|
579
|
+
TagResolver.resolver(
|
580
|
+
"node",
|
581
|
+
Tag.inserting(Permission.PERMISSION_ADMIN_EXIT_DENIED)
|
582
|
+
)
|
574
583
|
);
|
575
584
|
this.tmpTeleport = false;
|
576
585
|
if (lastPlot.equals(BukkitUtil.adapt(from).getPlot())) {
|
@@ -588,7 +597,7 @@ public class PlayerEventListener implements Listener {
|
|
588
597
|
} else if (!plotListener.plotEntry(pp, now) && this.tmpTeleport) {
|
589
598
|
pp.sendMessage(
|
590
599
|
TranslatableCaption.of("deny.no_enter"),
|
591
|
-
|
600
|
+
TagResolver.resolver("plot", Tag.inserting(Component.text(now.toString())))
|
592
601
|
);
|
593
602
|
this.tmpTeleport = false;
|
594
603
|
to.setX(from.getBlockX());
|
@@ -657,10 +666,14 @@ public class PlayerEventListener implements Listener {
|
|
657
666
|
if (plot == null) {
|
658
667
|
try (final MetaDataAccess<Boolean> kickAccess =
|
659
668
|
pp.accessTemporaryMetaData(PlayerMetaDataKeys.TEMPORARY_KICK)) {
|
660
|
-
if (lastPlot != null && !plotListener.plotExit(pp, lastPlot) && this.tmpTeleport && !kickAccess.get().orElse(
|
669
|
+
if (lastPlot != null && !plotListener.plotExit(pp, lastPlot) && this.tmpTeleport && !kickAccess.get().orElse(
|
670
|
+
false)) {
|
661
671
|
pp.sendMessage(
|
662
672
|
TranslatableCaption.of("permission.no_permission_event"),
|
663
|
-
|
673
|
+
TagResolver.resolver(
|
674
|
+
"node",
|
675
|
+
Tag.inserting(Permission.PERMISSION_ADMIN_EXIT_DENIED)
|
676
|
+
)
|
664
677
|
);
|
665
678
|
this.tmpTeleport = false;
|
666
679
|
if (lastPlot.equals(BukkitUtil.adapt(from).getPlot())) {
|
@@ -678,7 +691,7 @@ public class PlayerEventListener implements Listener {
|
|
678
691
|
} else if (!plotListener.plotEntry(pp, plot) && this.tmpTeleport) {
|
679
692
|
pp.sendMessage(
|
680
693
|
TranslatableCaption.of("deny.no_enter"),
|
681
|
-
|
694
|
+
TagResolver.resolver("plot", Tag.inserting(Component.text(plot.toString())))
|
682
695
|
);
|
683
696
|
this.tmpTeleport = false;
|
684
697
|
player.teleport(from);
|
@@ -762,46 +775,34 @@ public class PlayerEventListener implements Listener {
|
|
762
775
|
PlotId id = plot.getId();
|
763
776
|
String worldName = plot.getWorldName();
|
764
777
|
Caption msg = TranslatableCaption.of("chat.plot_chat_format");
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
// If we do/don't want colour, we need to be careful about how to go about it, as players could attempt either <gold></gold> or &6 etc.
|
770
|
-
// In both cases, we want to use a Component Template to ensure that the player cannot use any placeholders in their message on purpose
|
771
|
-
// or accidentally, as component templates are done at the end. We also need to deserialize from legacy color codes to a Component if
|
772
|
-
// allowing colour.
|
778
|
+
TagResolver.Builder builder = TagResolver.builder();
|
779
|
+
builder.tag("world", Tag.inserting(Component.text(worldName)));
|
780
|
+
builder.tag("plot_id", Tag.inserting(Component.text(id.toString())));
|
781
|
+
builder.tag("sender", Tag.inserting(Component.text(sender)));
|
773
782
|
if (plotPlayer.hasPermission("plots.chat.color")) {
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
))
|
781
|
-
);
|
783
|
+
builder.tag("msg", Tag.inserting(MiniMessage.miniMessage().deserialize(
|
784
|
+
message,
|
785
|
+
TagResolver.resolver(StandardTags.color(), StandardTags.gradient(),
|
786
|
+
StandardTags.rainbow(), StandardTags.decorations()
|
787
|
+
)
|
788
|
+
)));
|
782
789
|
} else {
|
783
|
-
|
784
|
-
ChatColor.stripColor(BukkitUtil.LEGACY_COMPONENT_SERIALIZER.serialize(Component.text(message)))));
|
790
|
+
builder.tag("msg", Tag.inserting(Component.text(message)));
|
785
791
|
}
|
786
792
|
for (PlotPlayer<?> receiver : plotRecipients) {
|
787
|
-
receiver.sendMessage(msg,
|
793
|
+
receiver.sendMessage(msg, builder.build());
|
788
794
|
}
|
789
795
|
if (!spies.isEmpty()) {
|
790
796
|
Caption spymsg = TranslatableCaption.of("chat.plot_chat_spy_format");
|
791
|
-
Template plotidTemplate = Template.of("plot_id", id.getX() + ";" + id.getY());
|
792
|
-
Template spysenderTemplate = Template.of("sender", sender);
|
793
|
-
Template spymessageTemplate = Template.of("msg", Component.text(message));
|
794
797
|
for (PlotPlayer<?> player : spies) {
|
795
|
-
player.sendMessage(spymsg,
|
798
|
+
player.sendMessage(spymsg, builder.tag("message", Tag.inserting(Component.text(message))).build());
|
796
799
|
}
|
797
800
|
}
|
798
801
|
if (Settings.Chat.LOG_PLOTCHAT_TO_CONSOLE) {
|
799
802
|
Caption spymsg = TranslatableCaption.of("chat.plot_chat_spy_format");
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
ConsolePlayer.getConsole().sendMessage(spymsg, worldNameTemplate, plotidTemplate, spysenderTemplate,
|
804
|
-
spymessageTemplate
|
803
|
+
ConsolePlayer.getConsole().sendMessage(
|
804
|
+
spymsg,
|
805
|
+
builder.tag("message", Tag.inserting(Component.text(message))).build()
|
805
806
|
);
|
806
807
|
}
|
807
808
|
}
|
@@ -945,7 +946,10 @@ public class PlayerEventListener implements Listener {
|
|
945
946
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_INTERACT_ROAD)) {
|
946
947
|
pp.sendMessage(
|
947
948
|
TranslatableCaption.of("permission.no_permission_event"),
|
948
|
-
|
949
|
+
TagResolver.resolver(
|
950
|
+
"node",
|
951
|
+
Tag.inserting(Permission.PERMISSION_ADMIN_INTERACT_ROAD)
|
952
|
+
)
|
949
953
|
);
|
950
954
|
cancelled = true;
|
951
955
|
}
|
@@ -953,7 +957,10 @@ public class PlayerEventListener implements Listener {
|
|
953
957
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_INTERACT_UNOWNED)) {
|
954
958
|
pp.sendMessage(
|
955
959
|
TranslatableCaption.of("permission.no_permission_event"),
|
956
|
-
|
960
|
+
TagResolver.resolver(
|
961
|
+
"node",
|
962
|
+
Tag.inserting(Permission.PERMISSION_ADMIN_INTERACT_UNOWNED)
|
963
|
+
)
|
957
964
|
);
|
958
965
|
cancelled = true;
|
959
966
|
}
|
@@ -963,7 +970,10 @@ public class PlayerEventListener implements Listener {
|
|
963
970
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_INTERACT_OTHER)) {
|
964
971
|
pp.sendMessage(
|
965
972
|
TranslatableCaption.of("permission.no_permission_event"),
|
966
|
-
|
973
|
+
TagResolver.resolver(
|
974
|
+
"node",
|
975
|
+
Tag.inserting(Permission.PERMISSION_ADMIN_INTERACT_OTHER)
|
976
|
+
)
|
967
977
|
);
|
968
978
|
cancelled = true;
|
969
979
|
}
|
@@ -1002,7 +1012,10 @@ public class PlayerEventListener implements Listener {
|
|
1002
1012
|
)) {
|
1003
1013
|
pp.sendMessage(
|
1004
1014
|
TranslatableCaption.of("permission.no_permission_event"),
|
1005
|
-
|
1015
|
+
TagResolver.resolver(
|
1016
|
+
"node",
|
1017
|
+
Tag.inserting(Permission.PERMISSION_ADMIN_INTERACT_ROAD)
|
1018
|
+
)
|
1006
1019
|
);
|
1007
1020
|
e.setCancelled(true);
|
1008
1021
|
}
|
@@ -1018,7 +1031,10 @@ public class PlayerEventListener implements Listener {
|
|
1018
1031
|
if (!pp.hasPermission("plots.admin.interact.unowned")) {
|
1019
1032
|
pp.sendMessage(
|
1020
1033
|
TranslatableCaption.of("permission.no_permission_event"),
|
1021
|
-
|
1034
|
+
TagResolver.resolver(
|
1035
|
+
"node",
|
1036
|
+
Tag.inserting(Permission.PERMISSION_ADMIN_INTERACT_UNOWNED)
|
1037
|
+
)
|
1022
1038
|
);
|
1023
1039
|
e.setCancelled(true);
|
1024
1040
|
}
|
@@ -1033,7 +1049,10 @@ public class PlayerEventListener implements Listener {
|
|
1033
1049
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_INTERACT_OTHER)) {
|
1034
1050
|
pp.sendMessage(
|
1035
1051
|
TranslatableCaption.of("permission.no_permission_event"),
|
1036
|
-
|
1052
|
+
TagResolver.resolver(
|
1053
|
+
"node",
|
1054
|
+
Tag.inserting(Permission.PERMISSION_ADMIN_INTERACT_OTHER)
|
1055
|
+
)
|
1037
1056
|
);
|
1038
1057
|
e.setCancelled(true);
|
1039
1058
|
plot.debug(pp.getName() + " could not interact with " + entity.getType()
|
@@ -1097,13 +1116,13 @@ public class PlayerEventListener implements Listener {
|
|
1097
1116
|
Location location = BukkitUtil.adapt(block.getLocation());
|
1098
1117
|
Action action = event.getAction();
|
1099
1118
|
switch (action) {
|
1100
|
-
case PHYSICAL
|
1119
|
+
case PHYSICAL -> {
|
1101
1120
|
eventType = PlayerBlockEventType.TRIGGER_PHYSICAL;
|
1102
1121
|
blocktype1 = BukkitAdapter.asBlockType(block.getType());
|
1103
|
-
break;
|
1104
1122
|
}
|
1123
|
+
|
1105
1124
|
//todo rearrange the right click code. it is all over the place.
|
1106
|
-
case RIGHT_CLICK_BLOCK
|
1125
|
+
case RIGHT_CLICK_BLOCK -> {
|
1107
1126
|
Material blockType = block.getType();
|
1108
1127
|
eventType = PlayerBlockEventType.INTERACT_BLOCK;
|
1109
1128
|
blocktype1 = BukkitAdapter.asBlockType(block.getType());
|
@@ -1125,21 +1144,16 @@ public class PlayerEventListener implements Listener {
|
|
1125
1144
|
|
1126
1145
|
// in the following, lb needs to have the material of the item in hand i.e. type
|
1127
1146
|
switch (type.toString()) {
|
1128
|
-
case "REDSTONE"
|
1129
|
-
|
1130
|
-
case "PUMPKIN_SEEDS":
|
1131
|
-
case "MELON_SEEDS":
|
1132
|
-
case "COCOA_BEANS":
|
1133
|
-
case "WHEAT_SEEDS":
|
1134
|
-
case "BEETROOT_SEEDS":
|
1135
|
-
case "SWEET_BERRIES":
|
1136
|
-
case "GLOW_BERRIES":
|
1147
|
+
case "REDSTONE", "STRING", "PUMPKIN_SEEDS", "MELON_SEEDS", "COCOA_BEANS", "WHEAT_SEEDS", "BEETROOT_SEEDS",
|
1148
|
+
"SWEET_BERRIES", "GLOW_BERRIES" -> {
|
1137
1149
|
return;
|
1138
|
-
|
1150
|
+
}
|
1151
|
+
default -> {
|
1139
1152
|
//eventType = PlayerBlockEventType.PLACE_BLOCK;
|
1140
1153
|
if (type.isBlock()) {
|
1141
1154
|
return;
|
1142
1155
|
}
|
1156
|
+
}
|
1143
1157
|
}
|
1144
1158
|
if (PaperLib.isPaper()) {
|
1145
1159
|
if (MaterialTags.SPAWN_EGGS.isTagged(type) || Material.EGG.equals(type)) {
|
@@ -1153,14 +1167,14 @@ public class PlayerEventListener implements Listener {
|
|
1153
1167
|
}
|
1154
1168
|
}
|
1155
1169
|
if (type.isEdible()) {
|
1156
|
-
//Allow all players to eat while also allowing the block place event
|
1170
|
+
//Allow all players to eat while also allowing the block place event to be fired
|
1157
1171
|
return;
|
1158
1172
|
}
|
1159
1173
|
if (type == Material.ARMOR_STAND) {
|
1160
1174
|
location = BukkitUtil.adapt(block.getRelative(event.getBlockFace()).getLocation());
|
1161
1175
|
eventType = PlayerBlockEventType.PLACE_MISC;
|
1162
1176
|
}
|
1163
|
-
if (Tag.ITEMS_BOATS.isTagged(type) || MINECARTS.contains(type)) {
|
1177
|
+
if (org.bukkit.Tag.ITEMS_BOATS.isTagged(type) || MINECARTS.contains(type)) {
|
1164
1178
|
eventType = PlayerBlockEventType.PLACE_VEHICLE;
|
1165
1179
|
break;
|
1166
1180
|
}
|
@@ -1172,9 +1186,8 @@ public class PlayerEventListener implements Listener {
|
|
1172
1186
|
eventType = PlayerBlockEventType.READ;
|
1173
1187
|
break;
|
1174
1188
|
}
|
1175
|
-
break;
|
1176
1189
|
}
|
1177
|
-
case LEFT_CLICK_BLOCK
|
1190
|
+
case LEFT_CLICK_BLOCK -> {
|
1178
1191
|
Material blockType = block.getType();
|
1179
1192
|
|
1180
1193
|
// todo: when the code above is rearranged, it would be great to beautify this as well.
|
@@ -1185,10 +1198,10 @@ public class PlayerEventListener implements Listener {
|
|
1185
1198
|
|
1186
1199
|
eventType = PlayerBlockEventType.INTERACT_BLOCK;
|
1187
1200
|
blocktype1 = BukkitAdapter.asBlockType(block.getType());
|
1188
|
-
break;
|
1189
1201
|
}
|
1190
|
-
default
|
1202
|
+
default -> {
|
1191
1203
|
return;
|
1204
|
+
}
|
1192
1205
|
}
|
1193
1206
|
if (this.worldEdit != null && pp.getAttribute("worldedit")) {
|
1194
1207
|
if (event.getMaterial() == Material.getMaterial(this.worldEdit.getConfiguration().wandItem)) {
|
@@ -1260,7 +1273,7 @@ public class PlayerEventListener implements Listener {
|
|
1260
1273
|
}
|
1261
1274
|
pp.sendMessage(
|
1262
1275
|
TranslatableCaption.of("permission.no_permission_event"),
|
1263
|
-
|
1276
|
+
TagResolver.resolver("node", Tag.inserting(Permission.PERMISSION_ADMIN_BUILD_ROAD))
|
1264
1277
|
);
|
1265
1278
|
event.setCancelled(true);
|
1266
1279
|
} else if (!plot.hasOwner()) {
|
@@ -1269,7 +1282,10 @@ public class PlayerEventListener implements Listener {
|
|
1269
1282
|
}
|
1270
1283
|
pp.sendMessage(
|
1271
1284
|
TranslatableCaption.of("permission.no_permission_event"),
|
1272
|
-
|
1285
|
+
TagResolver.resolver(
|
1286
|
+
"node",
|
1287
|
+
Tag.inserting(Permission.PERMISSION_ADMIN_BUILD_UNOWNED)
|
1288
|
+
)
|
1273
1289
|
);
|
1274
1290
|
event.setCancelled(true);
|
1275
1291
|
} else if (!plot.isAdded(pp.getUUID())) {
|
@@ -1278,7 +1294,10 @@ public class PlayerEventListener implements Listener {
|
|
1278
1294
|
}
|
1279
1295
|
pp.sendMessage(
|
1280
1296
|
TranslatableCaption.of("permission.no_permission_event"),
|
1281
|
-
|
1297
|
+
TagResolver.resolver(
|
1298
|
+
"node",
|
1299
|
+
Tag.inserting(Permission.PERMISSION_ADMIN_BUILD_OTHER)
|
1300
|
+
)
|
1282
1301
|
);
|
1283
1302
|
event.setCancelled(true);
|
1284
1303
|
} else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
|
@@ -1325,7 +1344,7 @@ public class PlayerEventListener implements Listener {
|
|
1325
1344
|
}
|
1326
1345
|
plotPlayer.sendMessage(
|
1327
1346
|
TranslatableCaption.of("permission.no_permission_event"),
|
1328
|
-
|
1347
|
+
TagResolver.resolver("node", Tag.inserting(Permission.PERMISSION_ADMIN_BUILD_ROAD))
|
1329
1348
|
);
|
1330
1349
|
event.setCancelled(true);
|
1331
1350
|
} else if (!plot.hasOwner()) {
|
@@ -1334,7 +1353,10 @@ public class PlayerEventListener implements Listener {
|
|
1334
1353
|
}
|
1335
1354
|
plotPlayer.sendMessage(
|
1336
1355
|
TranslatableCaption.of("permission.no_permission_event"),
|
1337
|
-
|
1356
|
+
TagResolver.resolver(
|
1357
|
+
"node",
|
1358
|
+
Tag.inserting(Permission.PERMISSION_ADMIN_BUILD_UNOWNED)
|
1359
|
+
)
|
1338
1360
|
);
|
1339
1361
|
event.setCancelled(true);
|
1340
1362
|
} else if (!plot.isAdded(plotPlayer.getUUID())) {
|
@@ -1343,7 +1365,10 @@ public class PlayerEventListener implements Listener {
|
|
1343
1365
|
}
|
1344
1366
|
plotPlayer.sendMessage(
|
1345
1367
|
TranslatableCaption.of("permission.no_permission_event"),
|
1346
|
-
|
1368
|
+
TagResolver.resolver(
|
1369
|
+
"node",
|
1370
|
+
Tag.inserting(Permission.PERMISSION_ADMIN_BUILD_OTHER)
|
1371
|
+
)
|
1347
1372
|
);
|
1348
1373
|
event.setCancelled(true);
|
1349
1374
|
} else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
|
@@ -1375,7 +1400,10 @@ public class PlayerEventListener implements Listener {
|
|
1375
1400
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_BUILD_ROAD)) {
|
1376
1401
|
pp.sendMessage(
|
1377
1402
|
TranslatableCaption.of("permission.no_permission_event"),
|
1378
|
-
|
1403
|
+
TagResolver.resolver(
|
1404
|
+
"node",
|
1405
|
+
Tag.inserting(Permission.PERMISSION_ADMIN_BUILD_ROAD)
|
1406
|
+
)
|
1379
1407
|
);
|
1380
1408
|
event.setCancelled(true);
|
1381
1409
|
}
|
@@ -1384,7 +1412,10 @@ public class PlayerEventListener implements Listener {
|
|
1384
1412
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_BUILD_UNOWNED)) {
|
1385
1413
|
pp.sendMessage(
|
1386
1414
|
TranslatableCaption.of("permission.no_permission_event"),
|
1387
|
-
|
1415
|
+
TagResolver.resolver(
|
1416
|
+
"node",
|
1417
|
+
Tag.inserting(Permission.PERMISSION_ADMIN_BUILD_UNOWNED)
|
1418
|
+
)
|
1388
1419
|
);
|
1389
1420
|
event.setCancelled(true);
|
1390
1421
|
}
|
@@ -1395,7 +1426,10 @@ public class PlayerEventListener implements Listener {
|
|
1395
1426
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
|
1396
1427
|
pp.sendMessage(
|
1397
1428
|
TranslatableCaption.of("permission.no_permission_event"),
|
1398
|
-
|
1429
|
+
TagResolver.resolver(
|
1430
|
+
"node",
|
1431
|
+
Tag.inserting(Permission.PERMISSION_ADMIN_BUILD_OTHER)
|
1432
|
+
)
|
1399
1433
|
);
|
1400
1434
|
event.setCancelled(true);
|
1401
1435
|
}
|
@@ -1424,7 +1458,10 @@ public class PlayerEventListener implements Listener {
|
|
1424
1458
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_DESTROY_ROAD)) {
|
1425
1459
|
pp.sendMessage(
|
1426
1460
|
TranslatableCaption.of("permission.no_permission_event"),
|
1427
|
-
|
1461
|
+
TagResolver.resolver(
|
1462
|
+
"node",
|
1463
|
+
Tag.inserting(Permission.PERMISSION_ADMIN_DESTROY_ROAD)
|
1464
|
+
)
|
1428
1465
|
);
|
1429
1466
|
event.setCancelled(true);
|
1430
1467
|
}
|
@@ -1432,7 +1469,10 @@ public class PlayerEventListener implements Listener {
|
|
1432
1469
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_DESTROY_UNOWNED)) {
|
1433
1470
|
pp.sendMessage(
|
1434
1471
|
TranslatableCaption.of("permission.no_permission_event"),
|
1435
|
-
|
1472
|
+
TagResolver.resolver(
|
1473
|
+
"node",
|
1474
|
+
Tag.inserting(Permission.PERMISSION_ADMIN_DESTROY_UNOWNED)
|
1475
|
+
)
|
1436
1476
|
);
|
1437
1477
|
event.setCancelled(true);
|
1438
1478
|
}
|
@@ -1443,7 +1483,10 @@ public class PlayerEventListener implements Listener {
|
|
1443
1483
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_DESTROY_OTHER)) {
|
1444
1484
|
pp.sendMessage(
|
1445
1485
|
TranslatableCaption.of("permission.no_permission_event"),
|
1446
|
-
|
1486
|
+
TagResolver.resolver(
|
1487
|
+
"node",
|
1488
|
+
Tag.inserting(Permission.PERMISSION_ADMIN_DESTROY_OTHER)
|
1489
|
+
)
|
1447
1490
|
);
|
1448
1491
|
event.setCancelled(true);
|
1449
1492
|
plot.debug(p.getName()
|
@@ -1464,7 +1507,10 @@ public class PlayerEventListener implements Listener {
|
|
1464
1507
|
if (!player.hasPermission(Permission.PERMISSION_ADMIN_DESTROY_UNOWNED)) {
|
1465
1508
|
player.sendMessage(
|
1466
1509
|
TranslatableCaption.of("permission.no_permission_event"),
|
1467
|
-
|
1510
|
+
TagResolver.resolver(
|
1511
|
+
"node",
|
1512
|
+
Tag.inserting(Permission.PERMISSION_ADMIN_DESTROY_UNOWNED)
|
1513
|
+
)
|
1468
1514
|
);
|
1469
1515
|
event.setCancelled(true);
|
1470
1516
|
}
|
@@ -1473,7 +1519,10 @@ public class PlayerEventListener implements Listener {
|
|
1473
1519
|
if (!player.hasPermission(Permission.PERMISSION_ADMIN_DESTROY_OTHER)) {
|
1474
1520
|
player.sendMessage(
|
1475
1521
|
TranslatableCaption.of("permission.no_permission_event"),
|
1476
|
-
|
1522
|
+
TagResolver.resolver(
|
1523
|
+
"node",
|
1524
|
+
Tag.inserting(Permission.PERMISSION_ADMIN_DESTROY_OTHER)
|
1525
|
+
)
|
1477
1526
|
);
|
1478
1527
|
event.setCancelled(true);
|
1479
1528
|
plot.debug(player.getName()
|
@@ -1505,7 +1554,10 @@ public class PlayerEventListener implements Listener {
|
|
1505
1554
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_INTERACT_ROAD)) {
|
1506
1555
|
pp.sendMessage(
|
1507
1556
|
TranslatableCaption.of("permission.no_permission_event"),
|
1508
|
-
|
1557
|
+
TagResolver.resolver(
|
1558
|
+
"node",
|
1559
|
+
Tag.inserting(Permission.PERMISSION_ADMIN_INTERACT_ROAD)
|
1560
|
+
)
|
1509
1561
|
);
|
1510
1562
|
event.setCancelled(true);
|
1511
1563
|
}
|
@@ -1513,7 +1565,10 @@ public class PlayerEventListener implements Listener {
|
|
1513
1565
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_INTERACT_UNOWNED)) {
|
1514
1566
|
pp.sendMessage(
|
1515
1567
|
TranslatableCaption.of("permission.no_permission_event"),
|
1516
|
-
|
1568
|
+
TagResolver.resolver(
|
1569
|
+
"node",
|
1570
|
+
Tag.inserting(Permission.PERMISSION_ADMIN_INTERACT_UNOWNED)
|
1571
|
+
)
|
1517
1572
|
);
|
1518
1573
|
event.setCancelled(true);
|
1519
1574
|
}
|
@@ -1571,7 +1626,10 @@ public class PlayerEventListener implements Listener {
|
|
1571
1626
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_INTERACT_OTHER)) {
|
1572
1627
|
pp.sendMessage(
|
1573
1628
|
TranslatableCaption.of("permission.no_permission_event"),
|
1574
|
-
|
1629
|
+
TagResolver.resolver(
|
1630
|
+
"node",
|
1631
|
+
Tag.inserting(Permission.PERMISSION_ADMIN_INTERACT_OTHER)
|
1632
|
+
)
|
1575
1633
|
);
|
1576
1634
|
event.setCancelled(true);
|
1577
1635
|
}
|
@@ -1595,7 +1653,10 @@ public class PlayerEventListener implements Listener {
|
|
1595
1653
|
)) {
|
1596
1654
|
pp.sendMessage(
|
1597
1655
|
TranslatableCaption.of("permission.no_permission_event"),
|
1598
|
-
|
1656
|
+
TagResolver.resolver(
|
1657
|
+
"node",
|
1658
|
+
Tag.inserting(Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_ROAD)
|
1659
|
+
)
|
1599
1660
|
);
|
1600
1661
|
event.setCancelled(true);
|
1601
1662
|
}
|
@@ -1604,7 +1665,10 @@ public class PlayerEventListener implements Listener {
|
|
1604
1665
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_UNOWNED)) {
|
1605
1666
|
pp.sendMessage(
|
1606
1667
|
TranslatableCaption.of("permission.no_permission_event"),
|
1607
|
-
|
1668
|
+
TagResolver.resolver(
|
1669
|
+
"node",
|
1670
|
+
Tag.inserting(Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_UNOWNED)
|
1671
|
+
)
|
1608
1672
|
);
|
1609
1673
|
event.setCancelled(true);
|
1610
1674
|
return;
|
@@ -1618,7 +1682,10 @@ public class PlayerEventListener implements Listener {
|
|
1618
1682
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_OTHER)) {
|
1619
1683
|
pp.sendMessage(
|
1620
1684
|
TranslatableCaption.of("permission.no_permission_event"),
|
1621
|
-
|
1685
|
+
TagResolver.resolver(
|
1686
|
+
"node",
|
1687
|
+
Tag.inserting(Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_OTHER)
|
1688
|
+
)
|
1622
1689
|
);
|
1623
1690
|
event.setCancelled(true);
|
1624
1691
|
plot.debug(pp.getName()
|
@@ -31,7 +31,8 @@ import com.plotsquared.core.plot.PlotHandler;
|
|
31
31
|
import com.plotsquared.core.plot.flag.implementations.ProjectilesFlag;
|
32
32
|
import com.plotsquared.core.plot.world.PlotAreaManager;
|
33
33
|
import com.plotsquared.core.util.PlotFlagUtil;
|
34
|
-
import net.kyori.adventure.text.minimessage.
|
34
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
35
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
35
36
|
import org.bukkit.entity.Entity;
|
36
37
|
import org.bukkit.entity.LivingEntity;
|
37
38
|
import org.bukkit.entity.Player;
|
@@ -110,7 +111,10 @@ public class ProjectileEventListener implements Listener {
|
|
110
111
|
)) {
|
111
112
|
pp.sendMessage(
|
112
113
|
TranslatableCaption.of("permission.no_permission_event"),
|
113
|
-
|
114
|
+
TagResolver.resolver(
|
115
|
+
"node",
|
116
|
+
Tag.inserting(Permission.PERMISSION_ADMIN_PROJECTILE_ROAD)
|
117
|
+
)
|
114
118
|
);
|
115
119
|
entity.remove();
|
116
120
|
event.setCancelled(true);
|
@@ -119,7 +123,10 @@ public class ProjectileEventListener implements Listener {
|
|
119
123
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED)) {
|
120
124
|
pp.sendMessage(
|
121
125
|
TranslatableCaption.of("permission.no_permission_event"),
|
122
|
-
|
126
|
+
TagResolver.resolver(
|
127
|
+
"node",
|
128
|
+
Tag.inserting(Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED)
|
129
|
+
)
|
123
130
|
);
|
124
131
|
entity.remove();
|
125
132
|
event.setCancelled(true);
|
@@ -129,7 +136,10 @@ public class ProjectileEventListener implements Listener {
|
|
129
136
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_PROJECTILE_OTHER)) {
|
130
137
|
pp.sendMessage(
|
131
138
|
TranslatableCaption.of("permission.no_permission_event"),
|
132
|
-
|
139
|
+
TagResolver.resolver(
|
140
|
+
"node",
|
141
|
+
Tag.inserting(Permission.PERMISSION_ADMIN_PROJECTILE_OTHER)
|
142
|
+
)
|
133
143
|
);
|
134
144
|
entity.remove();
|
135
145
|
event.setCancelled(true);
|
@@ -31,45 +31,39 @@ import org.bukkit.event.Listener;
|
|
31
31
|
import org.bukkit.event.world.ChunkEvent;
|
32
32
|
import org.bukkit.event.world.ChunkLoadEvent;
|
33
33
|
|
34
|
-
import java.lang.reflect.Field;
|
35
34
|
import java.lang.reflect.Method;
|
36
35
|
|
37
36
|
import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
|
38
37
|
|
39
38
|
public class SingleWorldListener implements Listener {
|
40
39
|
|
41
|
-
private final Method
|
42
|
-
private
|
40
|
+
private final Method methodSetUnsaved;
|
41
|
+
private Method methodGetHandleChunk;
|
42
|
+
private Object objChunkStatusFull = null;
|
43
43
|
|
44
44
|
public SingleWorldListener() throws Exception {
|
45
45
|
ReflectionUtils.RefClass classCraftChunk = getRefClass("{cb}.CraftChunk");
|
46
|
-
|
46
|
+
ReflectionUtils.RefClass classChunkAccess = getRefClass("net.minecraft.world.level.chunk.IChunkAccess");
|
47
|
+
this.methodSetUnsaved = classChunkAccess.getMethod("a", boolean.class).getRealMethod();
|
47
48
|
try {
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
ReflectionUtils.RefClass classChunk = getRefClass("net.minecraft.world.level.chunk.Chunk");
|
57
|
-
this.shouldSave = classChunk.getField("r").getRealField();
|
58
|
-
} else if (PlotSquared.platform().serverVersion()[1] == 18) {
|
59
|
-
ReflectionUtils.RefClass classChunk = getRefClass("net.minecraft.world.level.chunk.IChunkAccess");
|
60
|
-
this.shouldSave = classChunk.getField("b").getRealField();
|
49
|
+
this.methodGetHandleChunk = classCraftChunk.getMethod("getHandle").getRealMethod();
|
50
|
+
} catch (NoSuchMethodException ignored) {
|
51
|
+
try {
|
52
|
+
ReflectionUtils.RefClass classChunkStatus = getRefClass("net.minecraft.world.level.chunk.ChunkStatus");
|
53
|
+
this.objChunkStatusFull = classChunkStatus.getRealClass().getField("n").get(null);
|
54
|
+
this.methodGetHandleChunk = classCraftChunk.getMethod("getHandle", classChunkStatus.getRealClass()).getRealMethod();
|
55
|
+
} catch (NoSuchMethodException ex) {
|
56
|
+
throw new RuntimeException(ex);
|
61
57
|
}
|
62
|
-
} catch (NoSuchFieldException e) {
|
63
|
-
e.printStackTrace();
|
64
58
|
}
|
65
59
|
}
|
66
60
|
|
67
61
|
public void markChunkAsClean(Chunk chunk) {
|
68
62
|
try {
|
69
|
-
Object nmsChunk =
|
70
|
-
|
71
|
-
|
72
|
-
|
63
|
+
Object nmsChunk = objChunkStatusFull != null
|
64
|
+
? this.methodGetHandleChunk.invoke(chunk, objChunkStatusFull)
|
65
|
+
: this.methodGetHandleChunk.invoke(chunk);
|
66
|
+
methodSetUnsaved.invoke(nmsChunk, false);
|
73
67
|
} catch (Throwable e) {
|
74
68
|
e.printStackTrace();
|
75
69
|
}
|
@@ -85,7 +79,12 @@ public class SingleWorldListener implements Listener {
|
|
85
79
|
if (!SinglePlotArea.isSinglePlotWorld(name)) {
|
86
80
|
return;
|
87
81
|
}
|
88
|
-
|
82
|
+
int x = event.getChunk().getX();
|
83
|
+
int z = event.getChunk().getZ();
|
84
|
+
if (x < 16 && x > -16 && z < 16 && z > -16) {
|
85
|
+
// Allow spawn to generate
|
86
|
+
return;
|
87
|
+
}
|
89
88
|
markChunkAsClean(event.getChunk());
|
90
89
|
}
|
91
90
|
|
@@ -1,63 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* PlotSquared, a land and world management plugin for Minecraft.
|
3
|
-
* Copyright (C) IntellectualSites <https://intellectualsites.com>
|
4
|
-
* Copyright (C) IntellectualSites team and contributors
|
5
|
-
*
|
6
|
-
* This program is free software: you can redistribute it and/or modify
|
7
|
-
* it under the terms of the GNU General Public License as published by
|
8
|
-
* the Free Software Foundation, either version 3 of the License, or
|
9
|
-
* (at your option) any later version.
|
10
|
-
*
|
11
|
-
* This program is distributed in the hope that it will be useful,
|
12
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
-
* GNU General Public License for more details.
|
15
|
-
*
|
16
|
-
* You should have received a copy of the GNU General Public License
|
17
|
-
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
18
|
-
*/
|
19
|
-
package com.plotsquared.bukkit.managers;
|
20
|
-
|
21
|
-
/*
|
22
|
-
import com.google.inject.Singleton;
|
23
|
-
import org.bukkit.World;
|
24
|
-
import org.checkerframework.checker.nullness.qual.NonNull;
|
25
|
-
import org.checkerframework.checker.nullness.qual.Nullable;
|
26
|
-
import se.hyperver.hyperverse.Hyperverse;
|
27
|
-
import se.hyperver.hyperverse.world.WorldConfiguration;
|
28
|
-
import se.hyperver.hyperverse.world.WorldConfigurationBuilder;
|
29
|
-
import se.hyperver.hyperverse.world.WorldFeatures;
|
30
|
-
import se.hyperver.hyperverse.world.WorldType;
|
31
|
-
|
32
|
-
Hyperverse implementation is currently put on ice until Hyperverse is released on a stable line and deployed to the central
|
33
|
-
repository.
|
34
|
-
|
35
|
-
@Singleton
|
36
|
-
public class HyperverseWorldManager extends BukkitWorldManager {
|
37
|
-
|
38
|
-
@Override
|
39
|
-
public @Nullable World handleWorldCreation(@NonNull String worldName, @Nullable String generator) {
|
40
|
-
// First let Bukkit register the world
|
41
|
-
this.setGenerator(worldName, generator);
|
42
|
-
// Create the world
|
43
|
-
final WorldConfigurationBuilder worldConfigurationBuilder = WorldConfiguration.builder()
|
44
|
-
.setName(worldName).setType(WorldType.OVER_WORLD);
|
45
|
-
if (generator != null) {
|
46
|
-
worldConfigurationBuilder.setGenerator(generator).setWorldFeatures(WorldFeatures.FLATLAND);
|
47
|
-
}
|
48
|
-
try {
|
49
|
-
return Hyperverse.getApi().createWorld(worldConfigurationBuilder.createWorldConfiguration())
|
50
|
-
.getBukkitWorld();
|
51
|
-
} catch (final Exception e) {
|
52
|
-
e.printStackTrace();
|
53
|
-
}
|
54
|
-
return null;
|
55
|
-
}
|
56
|
-
|
57
|
-
@Override
|
58
|
-
public String getName() {
|
59
|
-
return "bukkit-hyperverse";
|
60
|
-
}
|
61
|
-
|
62
|
-
}
|
63
|
-
*/
|
@@ -52,7 +52,7 @@ public class MVdWPlaceholders {
|
|
52
52
|
|
53
53
|
@Subscribe
|
54
54
|
public void onNewPlaceholder(final PlaceholderRegistry.@NonNull PlaceholderAddedEvent event) {
|
55
|
-
this.addPlaceholder(event.
|
55
|
+
this.addPlaceholder(event.placeholder());
|
56
56
|
}
|
57
57
|
|
58
58
|
private void addPlaceholder(final @NonNull Placeholder placeholder) {
|
@@ -43,7 +43,7 @@ public class BukkitOfflinePlayer implements OfflinePlotPlayer {
|
|
43
43
|
*/
|
44
44
|
public BukkitOfflinePlayer(
|
45
45
|
final @NonNull OfflinePlayer player, final @NonNull
|
46
|
-
|
46
|
+
PermissionHandler permissionHandler
|
47
47
|
) {
|
48
48
|
this.player = player;
|
49
49
|
this.permissionProfile = permissionHandler.getPermissionProfile(this)
|
@@ -71,31 +71,11 @@ public class BukkitPlayer extends PlotPlayer<Player> {
|
|
71
71
|
* @param eventDispatcher EventDispatcher instance
|
72
72
|
* @param player Bukkit player instance
|
73
73
|
* @param permissionHandler PermissionHandler instance
|
74
|
-
*
|
75
|
-
* @deprecated Please do not use this method. Instead use {@link BukkitUtil#adapt(Player)}, as it caches player objects.
|
76
|
-
* This method will be made private in a future release.
|
77
|
-
*/
|
78
|
-
@Deprecated(forRemoval = true, since = "6.10.9")
|
79
|
-
public BukkitPlayer(
|
80
|
-
final @NonNull PlotAreaManager plotAreaManager, final @NonNull EventDispatcher eventDispatcher,
|
81
|
-
final @NonNull Player player, final @NonNull PermissionHandler permissionHandler
|
82
|
-
) {
|
83
|
-
this(plotAreaManager, eventDispatcher, player, false, permissionHandler);
|
84
|
-
}
|
85
|
-
|
86
|
-
/**
|
87
|
-
* @param plotAreaManager PlotAreaManager instance
|
88
|
-
* @param eventDispatcher EventDispatcher instance
|
89
|
-
* @param player Bukkit player instance
|
90
|
-
* @param permissionHandler PermissionHandler instance
|
91
|
-
*
|
92
|
-
* @deprecated Please do not use this method. Instead use {@link BukkitUtil#adapt(Player)}, as it caches player objects.
|
93
|
-
* This method will be made private in a future release.
|
94
74
|
*/
|
95
|
-
|
96
|
-
|
97
|
-
final @NonNull
|
98
|
-
|
75
|
+
BukkitPlayer(
|
76
|
+
final @NonNull PlotAreaManager plotAreaManager,
|
77
|
+
final @NonNull EventDispatcher eventDispatcher,
|
78
|
+
final @NonNull Player player,
|
99
79
|
final boolean realPlayer,
|
100
80
|
final @NonNull PermissionHandler permissionHandler
|
101
81
|
) {
|
@@ -196,6 +176,10 @@ public class BukkitPlayer extends PlotPlayer<Player> {
|
|
196
176
|
final Set<PermissionAttachmentInfo> effective = player.getEffectivePermissions();
|
197
177
|
if (!effective.isEmpty()) {
|
198
178
|
for (PermissionAttachmentInfo attach : effective) {
|
179
|
+
// Ignore all "false" permissions
|
180
|
+
if (!attach.getValue()) {
|
181
|
+
continue;
|
182
|
+
}
|
199
183
|
String permStr = attach.getPermission();
|
200
184
|
if (permStr.startsWith(stubPlus)) {
|
201
185
|
hasAny = true;
|
@@ -54,7 +54,6 @@ public class BukkitPlayerManager extends PlayerManager<BukkitPlayer, Player> {
|
|
54
54
|
|
55
55
|
@NonNull
|
56
56
|
@Override
|
57
|
-
@SuppressWarnings("deprecation")
|
58
57
|
public BukkitPlayer getPlayer(final @NonNull Player object) {
|
59
58
|
if (object.getUniqueId().version() == 2) { // not a real player
|
60
59
|
return new BukkitPlayer(this.plotAreaManager, this.eventDispatcher, object, false, this.permissionHandler);
|
@@ -66,13 +65,12 @@ public class BukkitPlayerManager extends PlayerManager<BukkitPlayer, Player> {
|
|
66
65
|
}
|
67
66
|
|
68
67
|
@Override
|
69
|
-
@SuppressWarnings("deprecation")
|
70
68
|
public @NonNull BukkitPlayer createPlayer(final @NonNull UUID uuid) {
|
71
69
|
final Player player = Bukkit.getPlayer(uuid);
|
72
70
|
if (player == null || !player.isOnline()) {
|
73
71
|
throw new NoSuchPlayerException(uuid);
|
74
72
|
}
|
75
|
-
return new BukkitPlayer(this.plotAreaManager, this.eventDispatcher, player, this.permissionHandler);
|
73
|
+
return new BukkitPlayer(this.plotAreaManager, this.eventDispatcher, player, false, this.permissionHandler);
|
76
74
|
}
|
77
75
|
|
78
76
|
@Nullable
|
@@ -270,7 +270,7 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator {
|
|
270
270
|
if (getChunkObject() instanceof Chunk chunkObject) {
|
271
271
|
existing = chunkObject.getBlock(x & 15, y, z & 15);
|
272
272
|
} else {
|
273
|
-
|
273
|
+
existing = getBukkitWorld().getBlockAt(x, y, z);
|
274
274
|
}
|
275
275
|
final BlockState existingBaseBlock = BukkitAdapter.adapt(existing.getBlockData());
|
276
276
|
if (BukkitBlockUtil.get(existing).equals(existingBaseBlock) && existing.getBlockData().matches(blockData)) {
|
@@ -24,7 +24,7 @@ import com.plotsquared.bukkit.util.BukkitBlockUtil;
|
|
24
24
|
import com.plotsquared.bukkit.util.BukkitUtil;
|
25
25
|
import com.plotsquared.core.location.ChunkWrapper;
|
26
26
|
import com.plotsquared.core.location.Location;
|
27
|
-
import com.plotsquared.core.queue.
|
27
|
+
import com.plotsquared.core.queue.ZeroedDelegateScopedQueueCoordinator;
|
28
28
|
import com.plotsquared.core.util.ChunkUtil;
|
29
29
|
import com.plotsquared.core.util.PatternUtil;
|
30
30
|
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
@@ -44,8 +44,11 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
|
44
44
|
|
45
45
|
import java.util.Arrays;
|
46
46
|
|
47
|
+
/**
|
48
|
+
* Internal use only. Subject to changes at any time.
|
49
|
+
*/
|
47
50
|
@DoNotUse
|
48
|
-
public class GenChunk extends
|
51
|
+
public class GenChunk extends ZeroedDelegateScopedQueueCoordinator {
|
49
52
|
|
50
53
|
public final Biome[] biomes;
|
51
54
|
public BlockState[][] result;
|
@@ -59,7 +62,6 @@ public class GenChunk extends ScopedQueueCoordinator {
|
|
59
62
|
/**
|
60
63
|
* @param minY minimum world Y, inclusive
|
61
64
|
* @param maxY maximum world Y, inclusive
|
62
|
-
*
|
63
65
|
* @since 6.6.0
|
64
66
|
*/
|
65
67
|
public GenChunk(int minY, int maxY) {
|
@@ -107,9 +109,9 @@ public class GenChunk extends ScopedQueueCoordinator {
|
|
107
109
|
*/
|
108
110
|
public void setChunk(@NonNull ChunkWrapper wrap) {
|
109
111
|
chunk = null;
|
110
|
-
world = wrap.world;
|
111
|
-
chunkX = wrap.x;
|
112
|
-
chunkZ = wrap.z;
|
112
|
+
world = wrap.world();
|
113
|
+
chunkX = wrap.x();
|
114
|
+
chunkZ = wrap.z();
|
113
115
|
}
|
114
116
|
|
115
117
|
@Override
|
@@ -18,6 +18,8 @@
|
|
18
18
|
*/
|
19
19
|
package com.plotsquared.bukkit.schematic;
|
20
20
|
|
21
|
+
import com.destroystokyo.paper.profile.PlayerProfile;
|
22
|
+
import com.destroystokyo.paper.profile.ProfileProperty;
|
21
23
|
import com.plotsquared.bukkit.util.BukkitUtil;
|
22
24
|
import com.sk89q.jnbt.ByteTag;
|
23
25
|
import com.sk89q.jnbt.CompoundTag;
|
@@ -28,16 +30,22 @@ import com.sk89q.jnbt.Tag;
|
|
28
30
|
import com.sk89q.worldedit.blocks.BaseItemStack;
|
29
31
|
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
30
32
|
import com.sk89q.worldedit.world.item.ItemType;
|
33
|
+
import io.papermc.lib.PaperLib;
|
34
|
+
import org.apache.logging.log4j.LogManager;
|
35
|
+
import org.apache.logging.log4j.Logger;
|
31
36
|
import org.bukkit.Bukkit;
|
32
37
|
import org.bukkit.ChatColor;
|
38
|
+
import org.bukkit.DyeColor;
|
33
39
|
import org.bukkit.World;
|
40
|
+
import org.bukkit.block.Banner;
|
34
41
|
import org.bukkit.block.Block;
|
35
42
|
import org.bukkit.block.Container;
|
36
43
|
import org.bukkit.block.Sign;
|
37
44
|
import org.bukkit.block.Skull;
|
45
|
+
import org.bukkit.block.banner.Pattern;
|
46
|
+
import org.bukkit.block.banner.PatternType;
|
38
47
|
import org.bukkit.enchantments.Enchantment;
|
39
48
|
import org.bukkit.inventory.Inventory;
|
40
|
-
import org.bukkit.inventory.InventoryHolder;
|
41
49
|
import org.bukkit.inventory.ItemStack;
|
42
50
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
43
51
|
|
@@ -46,20 +54,15 @@ import java.util.HashMap;
|
|
46
54
|
import java.util.List;
|
47
55
|
import java.util.Map;
|
48
56
|
import java.util.Map.Entry;
|
57
|
+
import java.util.Objects;
|
58
|
+
import java.util.UUID;
|
49
59
|
|
50
60
|
public class StateWrapper {
|
51
61
|
|
52
|
-
public
|
53
|
-
public CompoundTag tag = null;
|
62
|
+
public CompoundTag tag;
|
54
63
|
|
55
|
-
|
56
|
-
|
57
|
-
* {@link com.sk89q.worldedit.world.block.BaseBlock} and then using {@link com.sk89q.worldedit.world.block.BaseBlock#getNbtData()}
|
58
|
-
*/
|
59
|
-
@Deprecated(forRemoval = true, since = "6.9.0")
|
60
|
-
public StateWrapper(org.bukkit.block.BlockState state) {
|
61
|
-
this.state = state;
|
62
|
-
}
|
64
|
+
private boolean paperErrorTextureSent = false;
|
65
|
+
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + StateWrapper.class.getSimpleName());
|
63
66
|
|
64
67
|
public StateWrapper(CompoundTag tag) {
|
65
68
|
this.tag = tag;
|
@@ -237,15 +240,64 @@ public class StateWrapper {
|
|
237
240
|
return true;
|
238
241
|
}
|
239
242
|
String player = skullOwner.getString("Name");
|
240
|
-
|
243
|
+
|
244
|
+
if (player != null && !player.isEmpty()) {
|
245
|
+
try {
|
246
|
+
skull.setOwningPlayer(Bukkit.getOfflinePlayer(player));
|
247
|
+
skull.update(true);
|
248
|
+
} catch (Exception e) {
|
249
|
+
e.printStackTrace();
|
250
|
+
}
|
251
|
+
return true;
|
252
|
+
}
|
253
|
+
|
254
|
+
final CompoundTag properties = (CompoundTag) skullOwner.getValue().get("Properties");
|
255
|
+
if (properties == null) {
|
256
|
+
return false;
|
257
|
+
}
|
258
|
+
final ListTag textures = properties.getListTag("textures");
|
259
|
+
if (textures.getValue().isEmpty()) {
|
260
|
+
return false;
|
261
|
+
}
|
262
|
+
final CompoundTag textureCompound = (CompoundTag) textures.getValue().get(0);
|
263
|
+
if (textureCompound == null) {
|
264
|
+
return false;
|
265
|
+
}
|
266
|
+
String textureValue = textureCompound.getString("Value");
|
267
|
+
if (textureValue == null) {
|
268
|
+
return false;
|
269
|
+
}
|
270
|
+
if (!PaperLib.isPaper()) {
|
271
|
+
if (!paperErrorTextureSent) {
|
272
|
+
paperErrorTextureSent = true;
|
273
|
+
LOGGER.error("Failed to populate skull data in your road schematic - This is a Spigot limitation.");
|
274
|
+
}
|
241
275
|
return false;
|
242
276
|
}
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
277
|
+
final PlayerProfile profile = Bukkit.createProfile(UUID.randomUUID());
|
278
|
+
profile.setProperty(new ProfileProperty("textures", textureValue));
|
279
|
+
skull.setPlayerProfile(profile);
|
280
|
+
skull.update(true);
|
281
|
+
return true;
|
282
|
+
|
283
|
+
}
|
284
|
+
return false;
|
285
|
+
}
|
286
|
+
case "banner" -> {
|
287
|
+
if (state instanceof Banner banner) {
|
288
|
+
List<Tag> patterns = this.tag.getListTag("Patterns").getValue();
|
289
|
+
if (patterns == null || patterns.isEmpty()) {
|
290
|
+
return false;
|
248
291
|
}
|
292
|
+
banner.setPatterns(patterns.stream().map(t -> (CompoundTag) t).map(compoundTag -> {
|
293
|
+
DyeColor color = DyeColor.getByWoolData((byte) compoundTag.getInt("Color"));
|
294
|
+
PatternType patternType = PatternType.getByIdentifier(compoundTag.getString("Pattern"));
|
295
|
+
if (color == null || patternType == null) {
|
296
|
+
return null;
|
297
|
+
}
|
298
|
+
return new Pattern(color, patternType);
|
299
|
+
}).filter(Objects::nonNull).toList());
|
300
|
+
banner.update(true);
|
249
301
|
return true;
|
250
302
|
}
|
251
303
|
return false;
|
@@ -254,26 +306,6 @@ public class StateWrapper {
|
|
254
306
|
return false;
|
255
307
|
}
|
256
308
|
|
257
|
-
/**
|
258
|
-
* Get a CompoundTag of the contents of a block's inventory (chest, furnace, etc.).
|
259
|
-
*
|
260
|
-
* @deprecated in favour of using WorldEdit methods for obtaining NBT, specifically by obtaining a
|
261
|
-
* {@link com.sk89q.worldedit.world.block.BaseBlock} and then using {@link com.sk89q.worldedit.world.block.BaseBlock#getNbtData()}
|
262
|
-
*/
|
263
|
-
@Deprecated(forRemoval = true, since = "6.9.0")
|
264
|
-
public CompoundTag getTag() {
|
265
|
-
if (this.tag != null) {
|
266
|
-
return this.tag;
|
267
|
-
}
|
268
|
-
if (this.state instanceof InventoryHolder inv) {
|
269
|
-
ItemStack[] contents = inv.getInventory().getContents();
|
270
|
-
Map<String, Tag> values = new HashMap<>();
|
271
|
-
values.put("Items", new ListTag(CompoundTag.class, serializeInventory(contents)));
|
272
|
-
return new CompoundTag(values);
|
273
|
-
}
|
274
|
-
return null;
|
275
|
-
}
|
276
|
-
|
277
309
|
public String getId() {
|
278
310
|
String tileid = this.tag.getString("id").toLowerCase();
|
279
311
|
if (tileid.startsWith("minecraft:")) {
|
@@ -42,7 +42,9 @@ import com.plotsquared.core.plot.flag.implementations.VehicleCapFlag;
|
|
42
42
|
import com.plotsquared.core.util.EntityUtil;
|
43
43
|
import com.plotsquared.core.util.entity.EntityCategories;
|
44
44
|
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
45
|
-
import net.kyori.adventure.text.
|
45
|
+
import net.kyori.adventure.text.Component;
|
46
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
47
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
46
48
|
import org.bukkit.entity.Arrow;
|
47
49
|
import org.bukkit.entity.Creature;
|
48
50
|
import org.bukkit.entity.Entity;
|
@@ -179,7 +181,10 @@ public class BukkitEntityUtil {
|
|
179
181
|
if (!plotPlayer.hasPermission(Permission.PERMISSION_ADMIN_DESTROY + "." + stub)) {
|
180
182
|
plotPlayer.sendMessage(
|
181
183
|
TranslatableCaption.of("permission.no_permission_event"),
|
182
|
-
|
184
|
+
TagResolver.resolver(
|
185
|
+
"node",
|
186
|
+
Tag.inserting(Component.text(Permission.PERMISSION_ADMIN_DESTROY + "." + stub))
|
187
|
+
)
|
183
188
|
);
|
184
189
|
return false;
|
185
190
|
}
|
@@ -191,7 +196,10 @@ public class BukkitEntityUtil {
|
|
191
196
|
if (!plotPlayer.hasPermission(Permission.PERMISSION_ADMIN_DESTROY + "." + stub)) {
|
192
197
|
plotPlayer.sendMessage(
|
193
198
|
TranslatableCaption.of("permission.no_permission_event"),
|
194
|
-
|
199
|
+
TagResolver.resolver(
|
200
|
+
"node",
|
201
|
+
Tag.inserting(Component.text(Permission.PERMISSION_ADMIN_DESTROY + "." + stub))
|
202
|
+
)
|
195
203
|
);
|
196
204
|
if (plot != null) {
|
197
205
|
plot.debug(player.getName()
|
@@ -212,7 +220,10 @@ public class BukkitEntityUtil {
|
|
212
220
|
if (!plotPlayer.hasPermission(Permission.PERMISSION_ADMIN_PVE + "." + stub)) {
|
213
221
|
plotPlayer.sendMessage(
|
214
222
|
TranslatableCaption.of("permission.no_permission_event"),
|
215
|
-
|
223
|
+
TagResolver.resolver(
|
224
|
+
"node",
|
225
|
+
Tag.inserting(Component.text(Permission.PERMISSION_ADMIN_PVE + "." + stub))
|
226
|
+
)
|
216
227
|
);
|
217
228
|
if (plot != null) {
|
218
229
|
plot.debug(player.getName() + " could not attack " + entityType
|
@@ -233,7 +244,10 @@ public class BukkitEntityUtil {
|
|
233
244
|
if (!plotPlayer.hasPermission(Permission.PERMISSION_ADMIN_PVE + "." + stub)) {
|
234
245
|
plotPlayer.sendMessage(
|
235
246
|
TranslatableCaption.of("permission.no_permission_event"),
|
236
|
-
|
247
|
+
TagResolver.resolver(
|
248
|
+
"node",
|
249
|
+
Tag.inserting(Component.text(Permission.PERMISSION_ADMIN_PVE + "." + stub))
|
250
|
+
)
|
237
251
|
);
|
238
252
|
if (plot != null) {
|
239
253
|
plot.debug(player.getName() + " could not attack " + entityType
|
@@ -246,7 +260,10 @@ public class BukkitEntityUtil {
|
|
246
260
|
if (!plot.getFlag(PvpFlag.class) && !plotPlayer.hasPermission(Permission.PERMISSION_ADMIN_PVP + "." + stub)) {
|
247
261
|
plotPlayer.sendMessage(
|
248
262
|
TranslatableCaption.of("permission.no_permission_event"),
|
249
|
-
|
263
|
+
TagResolver.resolver(
|
264
|
+
"node",
|
265
|
+
Tag.inserting(Component.text(Permission.PERMISSION_ADMIN_PVP + "." + stub))
|
266
|
+
)
|
250
267
|
);
|
251
268
|
plot.debug(player.getName() + " could not attack " + entityType
|
252
269
|
+ " because pve = false");
|
@@ -260,7 +277,10 @@ public class BukkitEntityUtil {
|
|
260
277
|
if (!plotPlayer.hasPermission(Permission.PERMISSION_ADMIN_PVP + "." + stub)) {
|
261
278
|
plotPlayer.sendMessage(
|
262
279
|
TranslatableCaption.of("permission.no_permission_event"),
|
263
|
-
|
280
|
+
TagResolver.resolver(
|
281
|
+
"node",
|
282
|
+
Tag.inserting(Component.text(Permission.PERMISSION_ADMIN_PVP + "." + stub))
|
283
|
+
)
|
264
284
|
);
|
265
285
|
return false;
|
266
286
|
}
|
@@ -277,7 +297,10 @@ public class BukkitEntityUtil {
|
|
277
297
|
if (!plotPlayer.hasPermission(Permission.PERMISSION_ADMIN_PVE + "." + stub)) {
|
278
298
|
plotPlayer.sendMessage(
|
279
299
|
TranslatableCaption.of("permission.no_permission_event"),
|
280
|
-
|
300
|
+
TagResolver.resolver(
|
301
|
+
"node",
|
302
|
+
Tag.inserting(Component.text(Permission.PERMISSION_ADMIN_PVE + "." + stub))
|
303
|
+
)
|
281
304
|
);
|
282
305
|
if (plot != null) {
|
283
306
|
plot.debug(player.getName() + " could not attack " + entityType
|
@@ -299,7 +322,10 @@ public class BukkitEntityUtil {
|
|
299
322
|
if (!plotPlayer.hasPermission(Permission.PERMISSION_ADMIN_PVE + "." + stub)) {
|
300
323
|
plotPlayer.sendMessage(
|
301
324
|
TranslatableCaption.of("permission.no_permission_event"),
|
302
|
-
|
325
|
+
TagResolver.resolver(
|
326
|
+
"node",
|
327
|
+
Tag.inserting(Component.text(Permission.PERMISSION_ADMIN_PVE + "." + stub))
|
328
|
+
)
|
303
329
|
);
|
304
330
|
if (plot != null) {
|
305
331
|
plot.debug(player.getName() + " could not attack " + entityType
|
@@ -56,7 +56,7 @@ public class BukkitInventoryUtil extends InventoryUtil {
|
|
56
56
|
ItemMeta meta = null;
|
57
57
|
if (item.getName() != null) {
|
58
58
|
meta = stack.getItemMeta();
|
59
|
-
Component nameComponent = BukkitUtil.MINI_MESSAGE.
|
59
|
+
Component nameComponent = BukkitUtil.MINI_MESSAGE.deserialize(item.getName());
|
60
60
|
meta.setDisplayName(BukkitUtil.LEGACY_COMPONENT_SERIALIZER.serialize(nameComponent));
|
61
61
|
}
|
62
62
|
if (item.getLore() != null) {
|
@@ -30,7 +30,7 @@ import com.plotsquared.core.plot.PlotArea;
|
|
30
30
|
import com.plotsquared.core.plot.PlotManager;
|
31
31
|
import com.plotsquared.core.queue.GlobalBlockQueue;
|
32
32
|
import com.plotsquared.core.queue.QueueCoordinator;
|
33
|
-
import com.plotsquared.core.queue.
|
33
|
+
import com.plotsquared.core.queue.ZeroedDelegateScopedQueueCoordinator;
|
34
34
|
import com.plotsquared.core.util.ChunkManager;
|
35
35
|
import com.plotsquared.core.util.RegionManager;
|
36
36
|
import com.plotsquared.core.util.WorldUtil;
|
@@ -70,7 +70,7 @@ public class BukkitRegionManager extends RegionManager {
|
|
70
70
|
@Inject
|
71
71
|
public BukkitRegionManager(
|
72
72
|
@NonNull WorldUtil worldUtil, @NonNull GlobalBlockQueue blockQueue, @NonNull
|
73
|
-
|
73
|
+
ProgressSubscriberFactory subscriberFactory
|
74
74
|
) {
|
75
75
|
super(worldUtil, blockQueue, subscriberFactory);
|
76
76
|
this.blockQueue = blockQueue;
|
@@ -257,9 +257,9 @@ public class BukkitRegionManager extends RegionManager {
|
|
257
257
|
map.saveEntitiesOut(Bukkit.getWorld(world.getName()).getChunkAt(x, z), currentPlotClear);
|
258
258
|
AugmentedUtils.bypass(
|
259
259
|
ignoreAugment,
|
260
|
-
() -> ChunkManager.setChunkInPlotArea(null, new RunnableVal<
|
260
|
+
() -> ChunkManager.setChunkInPlotArea(null, new RunnableVal<ZeroedDelegateScopedQueueCoordinator>() {
|
261
261
|
@Override
|
262
|
-
public void run(
|
262
|
+
public void run(ZeroedDelegateScopedQueueCoordinator value) {
|
263
263
|
Location min = value.getMin();
|
264
264
|
int bx = min.getX();
|
265
265
|
int bz = min.getZ();
|
@@ -124,7 +124,7 @@ public class BukkitSetupUtils extends SetupUtils {
|
|
124
124
|
public String setupWorld(PlotAreaBuilder builder) {
|
125
125
|
this.updateGenerators(false);
|
126
126
|
ConfigurationNode[] steps = builder.settingsNodesWrapper() == null ?
|
127
|
-
new ConfigurationNode[0] : builder.settingsNodesWrapper().
|
127
|
+
new ConfigurationNode[0] : builder.settingsNodesWrapper().settingsNodes();
|
128
128
|
String world = builder.worldName();
|
129
129
|
PlotAreaType type = builder.plotAreaType();
|
130
130
|
String worldPath = "worlds." + builder.worldName();
|
@@ -45,7 +45,7 @@ import com.sk89q.worldedit.world.block.BlockTypes;
|
|
45
45
|
import io.papermc.lib.PaperLib;
|
46
46
|
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
47
47
|
import net.kyori.adventure.text.minimessage.MiniMessage;
|
48
|
-
import net.kyori.adventure.text.minimessage.
|
48
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
49
49
|
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
50
50
|
import org.apache.logging.log4j.LogManager;
|
51
51
|
import org.apache.logging.log4j.Logger;
|
@@ -333,7 +333,7 @@ public class BukkitUtil extends WorldUtil {
|
|
333
333
|
@SuppressWarnings("deprecation")
|
334
334
|
public void setSign(
|
335
335
|
final @NonNull Location location, final @NonNull Caption[] lines,
|
336
|
-
final @NonNull
|
336
|
+
final @NonNull TagResolver... replacements
|
337
337
|
) {
|
338
338
|
ensureLoaded(location.getWorldName(), location.getX(), location.getZ(), chunk -> {
|
339
339
|
PlotArea area = location.getPlotArea();
|
@@ -366,8 +366,9 @@ public class BukkitUtil extends WorldUtil {
|
|
366
366
|
final org.bukkit.block.BlockState blockstate = block.getState();
|
367
367
|
if (blockstate instanceof final Sign sign) {
|
368
368
|
for (int i = 0; i < lines.length; i++) {
|
369
|
-
sign.setLine(i, LEGACY_COMPONENT_SERIALIZER
|
370
|
-
|
369
|
+
sign.setLine(i, LEGACY_COMPONENT_SERIALIZER.serialize(
|
370
|
+
MINI_MESSAGE.deserialize(lines[i].getComponent(LocaleHolder.console()), replacements)
|
371
|
+
));
|
371
372
|
}
|
372
373
|
sign.update(true, false);
|
373
374
|
}
|
@@ -132,14 +132,6 @@ public class BukkitWorld implements World<org.bukkit.World> {
|
|
132
132
|
return world.hashCode();
|
133
133
|
}
|
134
134
|
|
135
|
-
/**
|
136
|
-
* @deprecated This method is not meant to be invoked or overridden, with no replacement.
|
137
|
-
*/
|
138
|
-
@Deprecated(forRemoval = true, since = "6.6.0")
|
139
|
-
protected boolean canEqual(final Object other) {
|
140
|
-
return other instanceof BukkitWorld;
|
141
|
-
}
|
142
|
-
|
143
135
|
public String toString() {
|
144
136
|
return "BukkitWorld(world=" + this.world + ")";
|
145
137
|
}
|
@@ -0,0 +1,78 @@
|
|
1
|
+
/*
|
2
|
+
* PlotSquared, a land and world management plugin for Minecraft.
|
3
|
+
* Copyright (C) IntellectualSites <https://intellectualsites.com>
|
4
|
+
* Copyright (C) IntellectualSites team and contributors
|
5
|
+
*
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
7
|
+
* it under the terms of the GNU General Public License as published by
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
9
|
+
* (at your option) any later version.
|
10
|
+
*
|
11
|
+
* This program is distributed in the hope that it will be useful,
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
* GNU General Public License for more details.
|
15
|
+
*
|
16
|
+
* You should have received a copy of the GNU General Public License
|
17
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
18
|
+
*/
|
19
|
+
package com.plotsquared.bukkit.util;
|
20
|
+
|
21
|
+
import com.intellectualsites.annotations.NotPublic;
|
22
|
+
import com.plotsquared.core.PlotSquared;
|
23
|
+
|
24
|
+
import java.io.IOException;
|
25
|
+
import java.nio.file.Files;
|
26
|
+
import java.nio.file.Path;
|
27
|
+
import java.nio.file.Paths;
|
28
|
+
import java.util.stream.Stream;
|
29
|
+
|
30
|
+
/**
|
31
|
+
* This is a helper class which replaces older syntax no longer supported by MiniMessage with replacements in messages_%.json.
|
32
|
+
* MiniMessage changed the syntax between major releases. To warrant a smooth upgrade, we attempt to replace any occurrences
|
33
|
+
* while loading PlotSquared.
|
34
|
+
*
|
35
|
+
* @since 7.0.0
|
36
|
+
*/
|
37
|
+
@NotPublic
|
38
|
+
public class TranslationUpdateManager {
|
39
|
+
|
40
|
+
public static void upgradeTranslationFile() throws IOException {
|
41
|
+
String suggestCommand = "suggest_command";
|
42
|
+
String suggestCommandReplacement = "run_command";
|
43
|
+
String minHeight = "minHeight";
|
44
|
+
String minheightReplacement = "minheight";
|
45
|
+
String maxHeight = "maxHeight";
|
46
|
+
String maxheightReplacement = "maxheight";
|
47
|
+
String usedGrants = "usedGrants";
|
48
|
+
String usedGrantsReplacement = "used_grants";
|
49
|
+
String remainingGrants = "remainingGrants";
|
50
|
+
String rremainingGrantsReplacement = "remaining_grants";
|
51
|
+
|
52
|
+
try (Stream<Path> paths = Files.walk(Paths.get(PlotSquared.platform().getDirectory().toPath().resolve("lang").toUri()))) {
|
53
|
+
paths
|
54
|
+
.filter(Files::isRegularFile)
|
55
|
+
.filter(p -> p.getFileName().toString().matches("messages_[a-z]{2}\\.json"))
|
56
|
+
.forEach(p -> {
|
57
|
+
replaceInFile(p, suggestCommand, suggestCommandReplacement);
|
58
|
+
replaceInFile(p, minHeight, minheightReplacement);
|
59
|
+
replaceInFile(p, maxHeight, maxheightReplacement);
|
60
|
+
replaceInFile(p, usedGrants, usedGrantsReplacement);
|
61
|
+
replaceInFile(p, remainingGrants, rremainingGrantsReplacement);
|
62
|
+
});
|
63
|
+
}
|
64
|
+
}
|
65
|
+
|
66
|
+
private static void replaceInFile(Path path, String searchText, String replacementText) {
|
67
|
+
try {
|
68
|
+
String content = Files.readString(path);
|
69
|
+
if (content.contains(searchText)) {
|
70
|
+
content = content.replaceAll(searchText, replacementText);
|
71
|
+
Files.writeString(path, content);
|
72
|
+
}
|
73
|
+
} catch (IOException e) {
|
74
|
+
e.printStackTrace();
|
75
|
+
}
|
76
|
+
}
|
77
|
+
|
78
|
+
}
|
@@ -54,7 +54,8 @@ public class UpdateUtility implements Listener {
|
|
54
54
|
internalVersion = PlotSquared.get().getVersion();
|
55
55
|
}
|
56
56
|
|
57
|
-
@SuppressWarnings({"deprecation", "DefaultCharset"})
|
57
|
+
@SuppressWarnings({"deprecation", "DefaultCharset"})
|
58
|
+
// Suppress Json deprecation, we can't use features from gson 2.8.1 and newer yet
|
58
59
|
public void updateChecker() {
|
59
60
|
task = Bukkit.getScheduler().runTaskTimerAsynchronously(this.javaPlugin, () -> {
|
60
61
|
try {
|
@@ -94,11 +94,6 @@ public class FaweRegionManager extends BukkitRegionManager {
|
|
94
94
|
delegate.swap(pos1, pos2, swapPos, whenDone);
|
95
95
|
}
|
96
96
|
|
97
|
-
@Override
|
98
|
-
public void setBiome(CuboidRegion region, int extendBiome, BiomeType biome, String world, Runnable whenDone) {
|
99
|
-
delegate.setBiome(region, extendBiome, biome, world, whenDone);
|
100
|
-
}
|
101
|
-
|
102
97
|
@Override
|
103
98
|
public void setBiome(CuboidRegion region, int extendBiome, BiomeType biome, PlotArea area, Runnable whenDone) {
|
104
99
|
delegate.setBiome(region, extendBiome, biome, area.getWorldName(), whenDone);
|
@@ -111,8 +111,8 @@ public class SQLiteUUIDService implements UUIDService, Consumer<List<UUIDMapping
|
|
111
111
|
try (final PreparedStatement statement = getConnection()
|
112
112
|
.prepareStatement("INSERT OR REPLACE INTO `usercache` (`uuid`, `username`) VALUES(?, ?)")) {
|
113
113
|
for (final UUIDMapping mapping : uuidWrappers) {
|
114
|
-
statement.setString(1, mapping.
|
115
|
-
statement.setString(2, mapping.
|
114
|
+
statement.setString(1, mapping.uuid().toString());
|
115
|
+
statement.setString(2, mapping.username());
|
116
116
|
statement.executeUpdate();
|
117
117
|
}
|
118
118
|
} catch (SQLException e) {
|
@@ -4,16 +4,16 @@ api-version: "1.13"
|
|
4
4
|
version: "${version}"
|
5
5
|
load: STARTUP
|
6
6
|
description: "Easy, yet powerful Plot World generation and management."
|
7
|
-
authors: [Citymonstret, Empire92, MattBDev, dordsor21, NotMyFault, SirYwell]
|
7
|
+
authors: [ Citymonstret, Empire92, MattBDev, dordsor21, NotMyFault, SirYwell ]
|
8
8
|
website: https://www.spigotmc.org/resources/77506/
|
9
|
-
softdepend: [Vault, PlaceholderAPI, Essentials, LuckPerms, BungeePerms, MVdWPlaceholderAPI]
|
10
|
-
loadbefore: [MultiWorld, Multiverse-Core]
|
11
|
-
depend: [WorldEdit]
|
9
|
+
softdepend: [ Vault, PlaceholderAPI, Essentials, LuckPerms, BungeePerms, MVdWPlaceholderAPI ]
|
10
|
+
loadbefore: [ MultiWorld, Multiverse-Core ]
|
11
|
+
depend: [ WorldEdit ]
|
12
12
|
database: false
|
13
13
|
commands:
|
14
14
|
plots:
|
15
15
|
description: Plot command.
|
16
|
-
aliases: [p,plot,ps,plotsquared,p2,2,plotme]
|
16
|
+
aliases: [ p,plot,ps,plotsquared,p2,2,plotme ]
|
17
17
|
permission: plots.use
|
18
18
|
permission-message: "You are lacking the permission node 'plots.use'"
|
19
19
|
permissions:
|
@@ -23,13 +23,13 @@ include:
|
|
23
23
|
Examples of unacceptable behavior by participants include:
|
24
24
|
|
25
25
|
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
-
|
26
|
+
advances
|
27
27
|
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
28
|
* Public or private harassment
|
29
29
|
* Publishing others' private information, such as a physical or electronic
|
30
|
-
|
30
|
+
address, without explicit permission
|
31
31
|
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
-
|
32
|
+
professional setting
|
33
33
|
|
34
34
|
## Our Responsibilities
|
35
35
|
|
@@ -2,18 +2,18 @@ import java.time.format.DateTimeFormatter
|
|
2
2
|
|
3
3
|
dependencies {
|
4
4
|
// Expected everywhere.
|
5
|
-
compileOnlyApi(
|
5
|
+
compileOnlyApi(libs.checkerqual)
|
6
6
|
|
7
7
|
// Minecraft expectations
|
8
|
-
compileOnlyApi(
|
9
|
-
compileOnly(
|
8
|
+
compileOnlyApi(libs.gson)
|
9
|
+
compileOnly(libs.guava)
|
10
10
|
|
11
11
|
// Platform expectations
|
12
|
-
compileOnlyApi(
|
12
|
+
compileOnlyApi(libs.snakeyaml)
|
13
13
|
|
14
14
|
// Adventure
|
15
|
-
api(
|
16
|
-
api(
|
15
|
+
api(libs.adventureApi)
|
16
|
+
api(libs.adventureMiniMessage)
|
17
17
|
|
18
18
|
// Guice
|
19
19
|
api(libs.guice) {
|
@@ -31,19 +31,19 @@ dependencies {
|
|
31
31
|
exclude(group = "dummypermscompat")
|
32
32
|
}
|
33
33
|
testImplementation(libs.worldeditCore)
|
34
|
-
compileOnly(
|
35
|
-
testImplementation(
|
34
|
+
compileOnly(libs.faweBukkit) { isTransitive = false }
|
35
|
+
testImplementation(libs.faweCore) { isTransitive = false }
|
36
36
|
|
37
37
|
// Logging
|
38
|
-
compileOnlyApi(
|
38
|
+
compileOnlyApi(libs.log4j)
|
39
39
|
|
40
40
|
// Other libraries
|
41
41
|
api(libs.prtree)
|
42
42
|
api(libs.aopalliance)
|
43
43
|
api(libs.cloudServices)
|
44
44
|
api(libs.arkitektonika)
|
45
|
-
api(
|
46
|
-
api(
|
45
|
+
api(libs.paster)
|
46
|
+
api(libs.informativeAnnotations)
|
47
47
|
}
|
48
48
|
|
49
49
|
tasks.processResources {
|
@@ -68,7 +68,8 @@ tasks {
|
|
68
68
|
val isRelease = if (rootProject.version.toString().endsWith("-SNAPSHOT")) "TODO" else rootProject.version.toString()
|
69
69
|
val opt = options as StandardJavadocDocletOptions
|
70
70
|
opt.links("https://docs.enginehub.org/javadoc/com.sk89q.worldedit/worldedit-core/" + libs.worldeditCore.get().versionConstraint.toString())
|
71
|
-
opt.links("https://jd.
|
71
|
+
opt.links("https://jd.advntr.dev/api/4.14.0/")
|
72
|
+
opt.links("https://jd.advntr.dev/text-minimessage/4.14.0/")
|
72
73
|
opt.links("https://google.github.io/guice/api-docs/" + libs.guice.get().versionConstraint.toString() + "/javadoc/")
|
73
74
|
opt.links("https://checkerframework.org/api/")
|
74
75
|
opt.links("https://javadoc.io/doc/com.intellectualsites.informative-annotations/informative-annotations/latest/")
|
@@ -30,7 +30,7 @@ import com.plotsquared.core.util.ChunkManager;
|
|
30
30
|
import com.plotsquared.core.util.EventDispatcher;
|
31
31
|
import com.plotsquared.core.util.SchematicHandler;
|
32
32
|
import com.plotsquared.core.util.query.PlotQuery;
|
33
|
-
import net.kyori.adventure.text.minimessage.
|
33
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
34
34
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
35
35
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
36
36
|
|
@@ -145,7 +145,7 @@ public class PlotAPI {
|
|
145
145
|
*/
|
146
146
|
public void sendConsoleMessage(
|
147
147
|
final @NonNull String message,
|
148
|
-
final @NonNull
|
148
|
+
final @NonNull TagResolver @NonNull ... replacements
|
149
149
|
) {
|
150
150
|
ConsolePlayer.getConsole().sendMessage(StaticCaption.of(message), replacements);
|
151
151
|
}
|
@@ -158,7 +158,7 @@ public class PlotAPI {
|
|
158
158
|
*/
|
159
159
|
public void sendConsoleMessage(
|
160
160
|
final @NonNull Caption caption,
|
161
|
-
final @NonNull
|
161
|
+
final @NonNull TagResolver @NonNull ... replacements
|
162
162
|
) {
|
163
163
|
ConsolePlayer.getConsole().sendMessage(caption, replacements);
|
164
164
|
}
|
@@ -270,7 +270,11 @@ public class PlotSquared {
|
|
270
270
|
captionMap = this.captionLoader.loadAll(this.platform.getDirectory().toPath().resolve("lang"));
|
271
271
|
} else {
|
272
272
|
String fileName = "messages_" + Settings.Enabled_Components.DEFAULT_LOCALE + ".json";
|
273
|
-
captionMap = this.captionLoader.loadOrCreateSingle(this.platform
|
273
|
+
captionMap = this.captionLoader.loadOrCreateSingle(this.platform
|
274
|
+
.getDirectory()
|
275
|
+
.toPath()
|
276
|
+
.resolve("lang")
|
277
|
+
.resolve(fileName));
|
274
278
|
}
|
275
279
|
this.captionMaps.put(TranslatableCaption.DEFAULT_NAMESPACE, captionMap);
|
276
280
|
LOGGER.info(
|
@@ -790,7 +794,9 @@ public class PlotSquared {
|
|
790
794
|
if (world.equals("CheckingPlotSquaredGenerator")) {
|
791
795
|
return;
|
792
796
|
}
|
793
|
-
this.getPlotAreaManager().addWorld(world)
|
797
|
+
if (!this.getPlotAreaManager().addWorld(world)) {
|
798
|
+
return;
|
799
|
+
}
|
794
800
|
Set<String> worlds;
|
795
801
|
if (this.worldConfiguration.contains("worlds")) {
|
796
802
|
worlds = this.worldConfiguration.getConfigurationSection("worlds").getKeys(false);
|
@@ -1009,7 +1015,7 @@ public class PlotSquared {
|
|
1009
1015
|
|
1010
1016
|
/**
|
1011
1017
|
* Setup the configuration for a plot world based on world arguments.
|
1012
|
-
*
|
1018
|
+
* <p>
|
1013
1019
|
*
|
1014
1020
|
* <i>e.g. /mv create <world> normal -g PlotSquared:<args></i>
|
1015
1021
|
*
|
@@ -1275,7 +1281,7 @@ public class PlotSquared {
|
|
1275
1281
|
}
|
1276
1282
|
|
1277
1283
|
/**
|
1278
|
-
*
|
1284
|
+
* Set up the database connection.
|
1279
1285
|
*/
|
1280
1286
|
public void setupDatabase() {
|
1281
1287
|
try {
|
@@ -200,7 +200,7 @@ public class PlayerBackupProfile implements BackupProfile {
|
|
200
200
|
if (value) {
|
201
201
|
future.complete(null);
|
202
202
|
} else {
|
203
|
-
future.completeExceptionally(new RuntimeException(MINI_MESSAGE.
|
203
|
+
future.completeExceptionally(new RuntimeException(MINI_MESSAGE.escapeTags(
|
204
204
|
TranslatableCaption
|
205
205
|
.of("schematics.schematic_paste_failed")
|
206
206
|
.getComponent(ConsolePlayer.getConsole()))));
|
@@ -24,13 +24,14 @@ import com.google.inject.Inject;
|
|
24
24
|
import com.google.inject.Singleton;
|
25
25
|
import com.plotsquared.core.PlotSquared;
|
26
26
|
import com.plotsquared.core.configuration.Settings;
|
27
|
-
import com.plotsquared.core.configuration.caption.Templates;
|
28
27
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
29
28
|
import com.plotsquared.core.inject.factory.PlayerBackupProfileFactory;
|
30
29
|
import com.plotsquared.core.player.PlotPlayer;
|
31
30
|
import com.plotsquared.core.plot.Plot;
|
32
31
|
import com.plotsquared.core.util.task.TaskManager;
|
33
|
-
import net.kyori.adventure.text.
|
32
|
+
import net.kyori.adventure.text.Component;
|
33
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
34
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
34
35
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
35
36
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
36
37
|
|
@@ -100,7 +101,7 @@ public class SimpleBackupManager implements BackupManager {
|
|
100
101
|
if (player != null) {
|
101
102
|
player.sendMessage(
|
102
103
|
TranslatableCaption.of("backups.backup_automatic_started"),
|
103
|
-
|
104
|
+
TagResolver.resolver("plot", Tag.inserting(Component.text(plot.getId().toString())))
|
104
105
|
);
|
105
106
|
}
|
106
107
|
profile.createBackup().whenComplete((backup, throwable) -> {
|
@@ -108,7 +109,7 @@ public class SimpleBackupManager implements BackupManager {
|
|
108
109
|
if (player != null) {
|
109
110
|
player.sendMessage(
|
110
111
|
TranslatableCaption.of("backups.backup_automatic_failure"),
|
111
|
-
|
112
|
+
TagResolver.resolver("reason", Tag.inserting(Component.text(throwable.getMessage())))
|
112
113
|
);
|
113
114
|
}
|
114
115
|
throwable.printStackTrace();
|
@@ -135,13 +136,9 @@ public class SimpleBackupManager implements BackupManager {
|
|
135
136
|
return this.backupLimit;
|
136
137
|
}
|
137
138
|
|
138
|
-
private
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
private PlotCacheKey(Plot plot) {
|
143
|
-
this.plot = plot;
|
144
|
-
}
|
139
|
+
private record PlotCacheKey(
|
140
|
+
Plot plot
|
141
|
+
) {
|
145
142
|
|
146
143
|
@Override
|
147
144
|
public boolean equals(final Object o) {
|
@@ -30,7 +30,9 @@ import com.plotsquared.core.util.PlayerManager;
|
|
30
30
|
import com.plotsquared.core.util.TabCompletions;
|
31
31
|
import com.plotsquared.core.util.task.RunnableVal2;
|
32
32
|
import com.plotsquared.core.util.task.RunnableVal3;
|
33
|
-
import net.kyori.adventure.text.
|
33
|
+
import net.kyori.adventure.text.Component;
|
34
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
35
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
34
36
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
35
37
|
|
36
38
|
import java.util.Collection;
|
@@ -71,7 +73,7 @@ public class Add extends Command {
|
|
71
73
|
checkTrue(
|
72
74
|
args.length == 1,
|
73
75
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
74
|
-
|
76
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("/plot add <player | *>")))
|
75
77
|
);
|
76
78
|
final CompletableFuture<Boolean> future = new CompletableFuture<>();
|
77
79
|
PlayerManager.getUUIDsFromString(args[0], (uuids, throwable) -> {
|
@@ -81,7 +83,7 @@ public class Add extends Command {
|
|
81
83
|
} else {
|
82
84
|
player.sendMessage(
|
83
85
|
TranslatableCaption.of("errors.invalid_player"),
|
84
|
-
|
86
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(args[0])))
|
85
87
|
);
|
86
88
|
}
|
87
89
|
future.completeExceptionally(throwable);
|
@@ -89,7 +91,7 @@ public class Add extends Command {
|
|
89
91
|
} else {
|
90
92
|
try {
|
91
93
|
checkTrue(!uuids.isEmpty(), TranslatableCaption.of("errors.invalid_player"),
|
92
|
-
|
94
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(args[0])))
|
93
95
|
);
|
94
96
|
Iterator<UUID> iterator = uuids.iterator();
|
95
97
|
int size = plot.getTrusted().size() + plot.getMembers().size();
|
@@ -99,7 +101,9 @@ public class Add extends Command {
|
|
99
101
|
Permission.PERMISSION_ADMIN_COMMAND_TRUST))) {
|
100
102
|
player.sendMessage(
|
101
103
|
TranslatableCaption.of("errors.invalid_player"),
|
102
|
-
|
104
|
+
TagResolver.resolver("value", Tag.inserting(
|
105
|
+
PlayerManager.resolveName(uuid).toComponent(player)
|
106
|
+
))
|
103
107
|
);
|
104
108
|
iterator.remove();
|
105
109
|
continue;
|
@@ -107,7 +111,9 @@ public class Add extends Command {
|
|
107
111
|
if (plot.isOwner(uuid)) {
|
108
112
|
player.sendMessage(
|
109
113
|
TranslatableCaption.of("member.already_added"),
|
110
|
-
|
114
|
+
TagResolver.resolver("player", Tag.inserting(
|
115
|
+
PlayerManager.resolveName(uuid).toComponent(player)
|
116
|
+
))
|
111
117
|
);
|
112
118
|
iterator.remove();
|
113
119
|
continue;
|
@@ -115,7 +121,9 @@ public class Add extends Command {
|
|
115
121
|
if (plot.getMembers().contains(uuid)) {
|
116
122
|
player.sendMessage(
|
117
123
|
TranslatableCaption.of("member.already_added"),
|
118
|
-
|
124
|
+
TagResolver.resolver("player", Tag.inserting(
|
125
|
+
PlayerManager.resolveName(uuid).toComponent(player)
|
126
|
+
))
|
119
127
|
);
|
120
128
|
iterator.remove();
|
121
129
|
continue;
|
@@ -128,7 +136,7 @@ public class Add extends Command {
|
|
128
136
|
if (localAddSize >= maxAddSize) {
|
129
137
|
player.sendMessage(
|
130
138
|
TranslatableCaption.of("members.plot_max_members_added"),
|
131
|
-
|
139
|
+
TagResolver.resolver("amount", Tag.inserting(Component.text(localAddSize)))
|
132
140
|
);
|
133
141
|
return;
|
134
142
|
}
|
@@ -27,7 +27,9 @@ import com.plotsquared.core.player.PlotPlayer;
|
|
27
27
|
import com.plotsquared.core.plot.Plot;
|
28
28
|
import com.plotsquared.core.util.MathMan;
|
29
29
|
import com.plotsquared.core.util.query.PlotQuery;
|
30
|
-
import net.kyori.adventure.text.
|
30
|
+
import net.kyori.adventure.text.Component;
|
31
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
32
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
31
33
|
|
32
34
|
import java.util.ArrayList;
|
33
35
|
import java.util.Collection;
|
@@ -91,7 +93,10 @@ public class Alias extends SubCommand {
|
|
91
93
|
} else {
|
92
94
|
player.sendMessage(
|
93
95
|
TranslatableCaption.of("permission.no_permission"),
|
94
|
-
|
96
|
+
TagResolver.resolver(
|
97
|
+
"node",
|
98
|
+
Tag.inserting(Permission.PERMISSION_ALIAS_SET)
|
99
|
+
)
|
95
100
|
);
|
96
101
|
}
|
97
102
|
}
|
@@ -107,7 +112,10 @@ public class Alias extends SubCommand {
|
|
107
112
|
} else {
|
108
113
|
player.sendMessage(
|
109
114
|
TranslatableCaption.of("permission.no_permission"),
|
110
|
-
|
115
|
+
TagResolver.resolver(
|
116
|
+
"node",
|
117
|
+
Tag.inserting(Permission.PERMISSION_ALIAS_REMOVE)
|
118
|
+
)
|
111
119
|
);
|
112
120
|
}
|
113
121
|
}
|
@@ -148,13 +156,16 @@ public class Alias extends SubCommand {
|
|
148
156
|
.anyMatch()) {
|
149
157
|
player.sendMessage(
|
150
158
|
TranslatableCaption.of("alias.alias_is_taken"),
|
151
|
-
|
159
|
+
TagResolver.resolver("alias", Tag.inserting(Component.text(alias)))
|
152
160
|
);
|
153
161
|
return;
|
154
162
|
}
|
155
163
|
if (Settings.UUID.OFFLINE) {
|
156
164
|
plot.setAlias(alias);
|
157
|
-
player.sendMessage(
|
165
|
+
player.sendMessage(
|
166
|
+
TranslatableCaption.of("alias.alias_set_to"),
|
167
|
+
TagResolver.resolver("alias", Tag.inserting(Component.text(alias)))
|
168
|
+
);
|
158
169
|
return;
|
159
170
|
}
|
160
171
|
PlotSquared.get().getImpromptuUUIDPipeline().getSingle(alias, ((uuid, throwable) -> {
|
@@ -163,13 +174,13 @@ public class Alias extends SubCommand {
|
|
163
174
|
} else if (uuid != null) {
|
164
175
|
player.sendMessage(
|
165
176
|
TranslatableCaption.of("alias.alias_is_taken"),
|
166
|
-
|
177
|
+
TagResolver.resolver("alias", Tag.inserting(Component.text(alias)))
|
167
178
|
);
|
168
179
|
} else {
|
169
180
|
plot.setAlias(alias);
|
170
181
|
player.sendMessage(
|
171
182
|
TranslatableCaption.of("alias.alias_set_to"),
|
172
|
-
|
183
|
+
TagResolver.resolver("alias", Tag.inserting(Component.text(alias)))
|
173
184
|
);
|
174
185
|
}
|
175
186
|
}));
|
@@ -181,7 +192,7 @@ public class Alias extends SubCommand {
|
|
181
192
|
if (!plot.getAlias().isEmpty()) {
|
182
193
|
player.sendMessage(
|
183
194
|
TranslatableCaption.of("alias.alias_removed"),
|
184
|
-
|
195
|
+
TagResolver.resolver("alias", Tag.inserting(Component.text(alias)))
|
185
196
|
);
|
186
197
|
} else {
|
187
198
|
player.sendMessage(
|
@@ -24,7 +24,6 @@ import com.plotsquared.core.configuration.ConfigurationSection;
|
|
24
24
|
import com.plotsquared.core.configuration.ConfigurationUtil;
|
25
25
|
import com.plotsquared.core.configuration.Settings;
|
26
26
|
import com.plotsquared.core.configuration.caption.CaptionHolder;
|
27
|
-
import com.plotsquared.core.configuration.caption.Templates;
|
28
27
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
29
28
|
import com.plotsquared.core.configuration.file.YamlConfiguration;
|
30
29
|
import com.plotsquared.core.events.TeleportCause;
|
@@ -69,7 +68,9 @@ import com.sk89q.worldedit.math.BlockVector3;
|
|
69
68
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
70
69
|
import com.sk89q.worldedit.regions.Region;
|
71
70
|
import com.sk89q.worldedit.world.World;
|
72
|
-
import net.kyori.adventure.text.
|
71
|
+
import net.kyori.adventure.text.Component;
|
72
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
73
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
73
74
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
74
75
|
|
75
76
|
import java.io.File;
|
@@ -141,14 +142,17 @@ public class Area extends SubCommand {
|
|
141
142
|
if (!player.hasPermission(Permission.PERMISSION_AREA_CREATE)) {
|
142
143
|
player.sendMessage(
|
143
144
|
TranslatableCaption.of("permission.no_permission"),
|
144
|
-
|
145
|
+
TagResolver.resolver(
|
146
|
+
"node",
|
147
|
+
Tag.inserting(Permission.PERMISSION_AREA_CREATE)
|
148
|
+
)
|
145
149
|
);
|
146
150
|
return false;
|
147
151
|
}
|
148
152
|
if (args.length < 2) {
|
149
153
|
player.sendMessage(
|
150
154
|
TranslatableCaption.of("single.single_area_needs_name"),
|
151
|
-
|
155
|
+
TagResolver.resolver("command", Tag.inserting(Component.text("/plot area single <name>")))
|
152
156
|
);
|
153
157
|
return false;
|
154
158
|
}
|
@@ -279,7 +283,7 @@ public class Area extends SubCommand {
|
|
279
283
|
} else {
|
280
284
|
player.sendMessage(
|
281
285
|
TranslatableCaption.of("errors.error_create"),
|
282
|
-
|
286
|
+
TagResolver.resolver("world", Tag.inserting(Component.text(hybridPlotWorld.getWorldName())))
|
283
287
|
);
|
284
288
|
}
|
285
289
|
};
|
@@ -290,7 +294,10 @@ public class Area extends SubCommand {
|
|
290
294
|
if (!player.hasPermission(Permission.PERMISSION_AREA_CREATE)) {
|
291
295
|
player.sendMessage(
|
292
296
|
TranslatableCaption.of("permission.no_permission"),
|
293
|
-
|
297
|
+
TagResolver.resolver(
|
298
|
+
"node",
|
299
|
+
Tag.inserting(Permission.PERMISSION_AREA_CREATE)
|
300
|
+
)
|
294
301
|
);
|
295
302
|
return false;
|
296
303
|
}
|
@@ -298,7 +305,10 @@ public class Area extends SubCommand {
|
|
298
305
|
case 1:
|
299
306
|
player.sendMessage(
|
300
307
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
301
|
-
|
308
|
+
TagResolver.resolver(
|
309
|
+
"value",
|
310
|
+
Tag.inserting(Component.text("/plot area create [world[:id]] [<modifier>=<value>]..."))
|
311
|
+
)
|
302
312
|
);
|
303
313
|
return false;
|
304
314
|
case 2:
|
@@ -312,7 +322,11 @@ public class Area extends SubCommand {
|
|
312
322
|
if (area == null) {
|
313
323
|
player.sendMessage(
|
314
324
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
315
|
-
|
325
|
+
TagResolver.resolver(
|
326
|
+
"value",
|
327
|
+
Tag.inserting(Component.text(
|
328
|
+
"/plot area create [world[:id]] [<modifier>=<value>]..."))
|
329
|
+
)
|
316
330
|
);
|
317
331
|
return false;
|
318
332
|
}
|
@@ -323,12 +337,18 @@ public class Area extends SubCommand {
|
|
323
337
|
);
|
324
338
|
player.sendMessage(
|
325
339
|
TranslatableCaption.of("set.set_attribute"),
|
326
|
-
|
327
|
-
|
340
|
+
TagResolver.builder()
|
341
|
+
.tag("attribute", Tag.inserting(Component.text("area_pos1")))
|
342
|
+
.tag("value", Tag.inserting(
|
343
|
+
Component.text(location.getX())
|
344
|
+
.append(Component.text(","))
|
345
|
+
.append(Component.text(location.getZ()))
|
346
|
+
))
|
347
|
+
.build()
|
328
348
|
);
|
329
349
|
player.sendMessage(
|
330
350
|
TranslatableCaption.of("area.set_pos2"),
|
331
|
-
|
351
|
+
TagResolver.resolver("command", Tag.inserting(Component.text("/plot area create pos2")))
|
332
352
|
);
|
333
353
|
return true;
|
334
354
|
}
|
@@ -342,7 +362,11 @@ public class Area extends SubCommand {
|
|
342
362
|
if (area == null) {
|
343
363
|
player.sendMessage(
|
344
364
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
345
|
-
|
365
|
+
TagResolver.resolver(
|
366
|
+
"value",
|
367
|
+
Tag.inserting(Component.text(
|
368
|
+
"/plot area create [world[:id]] [<modifier>=<value>]..."))
|
369
|
+
)
|
346
370
|
);
|
347
371
|
return false;
|
348
372
|
}
|
@@ -369,7 +393,10 @@ public class Area extends SubCommand {
|
|
369
393
|
if (!areas.isEmpty()) {
|
370
394
|
player.sendMessage(
|
371
395
|
TranslatableCaption.of("cluster.cluster_intersection"),
|
372
|
-
|
396
|
+
TagResolver.resolver(
|
397
|
+
"cluster",
|
398
|
+
Tag.inserting(areas.iterator().next())
|
399
|
+
)
|
373
400
|
);
|
374
401
|
return false;
|
375
402
|
}
|
@@ -395,8 +422,7 @@ public class Area extends SubCommand {
|
|
395
422
|
player.sendMessage(TranslatableCaption.of("setup.setup_finished"));
|
396
423
|
if (area.getTerrain() != PlotAreaTerrainType.ALL) {
|
397
424
|
QueueCoordinator queue = blockQueue.getNewQueue(worldUtil.getWeWorld(world));
|
398
|
-
queue.setChunkConsumer(chunk -> AugmentedUtils.
|
399
|
-
null,
|
425
|
+
queue.setChunkConsumer(chunk -> AugmentedUtils.generateChunk(
|
400
426
|
world,
|
401
427
|
chunk.getX(),
|
402
428
|
chunk.getZ(),
|
@@ -408,7 +434,7 @@ public class Area extends SubCommand {
|
|
408
434
|
} else {
|
409
435
|
player.sendMessage(
|
410
436
|
TranslatableCaption.of("errors.error_create"),
|
411
|
-
|
437
|
+
TagResolver.resolver("world", Tag.inserting(Component.text(area.getWorldName())))
|
412
438
|
);
|
413
439
|
}
|
414
440
|
};
|
@@ -442,7 +468,7 @@ public class Area extends SubCommand {
|
|
442
468
|
if (other != null && Objects.equals(pa.getId(), other.getId())) {
|
443
469
|
player.sendMessage(
|
444
470
|
TranslatableCaption.of("setup.setup_world_taken"),
|
445
|
-
|
471
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(pa.getId())))
|
446
472
|
);
|
447
473
|
return false;
|
448
474
|
}
|
@@ -457,8 +483,13 @@ public class Area extends SubCommand {
|
|
457
483
|
if (pair.length != 2) {
|
458
484
|
player.sendMessage(
|
459
485
|
TranslatableCaption.of("commandconfig.command_syntax_extended"),
|
460
|
-
|
461
|
-
|
486
|
+
TagResolver.builder()
|
487
|
+
.tag("value1", Tag.inserting(Component.text(getCommandString())))
|
488
|
+
.tag(
|
489
|
+
"value2",
|
490
|
+
Tag.inserting(Component.text("create [world[:id]] [<modifier>=<value>]..."))
|
491
|
+
)
|
492
|
+
.build()
|
462
493
|
);
|
463
494
|
return false;
|
464
495
|
}
|
@@ -494,8 +525,14 @@ public class Area extends SubCommand {
|
|
494
525
|
default -> {
|
495
526
|
player.sendMessage(
|
496
527
|
TranslatableCaption.of("commandconfig.command_syntax_extended"),
|
497
|
-
|
498
|
-
|
528
|
+
TagResolver.builder()
|
529
|
+
.tag("value1", Tag.inserting(Component.text(getCommandString())))
|
530
|
+
.tag(
|
531
|
+
"value2",
|
532
|
+
Tag.inserting(Component.text(
|
533
|
+
" create [world[:id]] [<modifier>=<value>]..."))
|
534
|
+
)
|
535
|
+
.build()
|
499
536
|
);
|
500
537
|
return false;
|
501
538
|
}
|
@@ -505,7 +542,7 @@ public class Area extends SubCommand {
|
|
505
542
|
if (this.worldUtil.isWorld(pa.getWorldName())) {
|
506
543
|
player.sendMessage(
|
507
544
|
TranslatableCaption.of("setup.setup_world_taken"),
|
508
|
-
|
545
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(pa.getWorldName())))
|
509
546
|
);
|
510
547
|
return false;
|
511
548
|
}
|
@@ -526,7 +563,7 @@ public class Area extends SubCommand {
|
|
526
563
|
} else {
|
527
564
|
player.sendMessage(
|
528
565
|
TranslatableCaption.of("errors.error_create"),
|
529
|
-
|
566
|
+
TagResolver.resolver("world", Tag.inserting(Component.text(pa.getWorldName())))
|
530
567
|
);
|
531
568
|
}
|
532
569
|
try {
|
@@ -545,12 +582,18 @@ public class Area extends SubCommand {
|
|
545
582
|
if (pa.getId() == null) {
|
546
583
|
player.sendMessage(
|
547
584
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
548
|
-
|
585
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(getUsage())))
|
549
586
|
);
|
550
587
|
player.sendMessage(
|
551
588
|
TranslatableCaption.of("commandconfig.command_syntax_extended"),
|
552
|
-
|
553
|
-
|
589
|
+
TagResolver.builder()
|
590
|
+
.tag("value1", Tag.inserting(Component.text(getCommandString())))
|
591
|
+
.tag(
|
592
|
+
"value2",
|
593
|
+
Tag.inserting(Component.text(
|
594
|
+
" create [world[:id]] [<modifier>=<value>]..."))
|
595
|
+
)
|
596
|
+
.build()
|
554
597
|
);
|
555
598
|
return false;
|
556
599
|
}
|
@@ -567,7 +610,7 @@ public class Area extends SubCommand {
|
|
567
610
|
metaData.computeIfAbsent(player.getUUID(), missingUUID -> new HashMap<>()).put("area_create_area", pa);
|
568
611
|
player.sendMessage(
|
569
612
|
TranslatableCaption.of("single.get_position"),
|
570
|
-
|
613
|
+
TagResolver.resolver("command", Tag.inserting(Component.text(getCommandString())))
|
571
614
|
);
|
572
615
|
break;
|
573
616
|
}
|
@@ -577,7 +620,10 @@ public class Area extends SubCommand {
|
|
577
620
|
if (!player.hasPermission(Permission.PERMISSION_AREA_INFO)) {
|
578
621
|
player.sendMessage(
|
579
622
|
TranslatableCaption.of("permission.no_permission"),
|
580
|
-
|
623
|
+
TagResolver.resolver(
|
624
|
+
"node",
|
625
|
+
Tag.inserting(Permission.PERMISSION_AREA_INFO)
|
626
|
+
)
|
581
627
|
);
|
582
628
|
return false;
|
583
629
|
}
|
@@ -588,15 +634,20 @@ public class Area extends SubCommand {
|
|
588
634
|
default -> {
|
589
635
|
player.sendMessage(
|
590
636
|
TranslatableCaption.of("commandconfig.command_syntax_extended"),
|
591
|
-
|
592
|
-
|
637
|
+
TagResolver.builder()
|
638
|
+
.tag("value1", Tag.inserting(Component.text(getCommandString())))
|
639
|
+
.tag("value2", Tag.inserting(Component.text(" info [area]")))
|
640
|
+
.build()
|
593
641
|
);
|
594
642
|
return false;
|
595
643
|
}
|
596
644
|
}
|
597
645
|
if (area == null) {
|
598
646
|
if (args.length == 2) {
|
599
|
-
player.sendMessage(
|
647
|
+
player.sendMessage(
|
648
|
+
TranslatableCaption.of("errors.not_valid_plot_world"),
|
649
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(args[1])))
|
650
|
+
);
|
600
651
|
} else {
|
601
652
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world"));
|
602
653
|
}
|
@@ -620,42 +671,35 @@ public class Area extends SubCommand {
|
|
620
671
|
percent = claimed == 0 ? 0 : 100d * claimed / Integer.MAX_VALUE;
|
621
672
|
region = "N/A";
|
622
673
|
}
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
nameTemplate,
|
643
|
-
typeTemplate,
|
644
|
-
terrainTemplate,
|
645
|
-
usageTemplate,
|
646
|
-
claimedTemplate,
|
647
|
-
clustersTemplate,
|
648
|
-
regionTemplate,
|
649
|
-
generatorTemplate,
|
650
|
-
footerTemplate
|
651
|
-
);
|
674
|
+
TagResolver resolver = TagResolver.builder()
|
675
|
+
.tag(
|
676
|
+
"header",
|
677
|
+
Tag.inserting(TranslatableCaption.of("info.plot_info_header").toComponent(player))
|
678
|
+
)
|
679
|
+
.tag("name", Tag.inserting(Component.text(name)))
|
680
|
+
.tag("type", Tag.inserting(Component.text(area.getType().name())))
|
681
|
+
.tag("terrain", Tag.inserting(Component.text(area.getTerrain().name())))
|
682
|
+
.tag("usage", Tag.inserting(Component.text(String.format("%.2f", percent))))
|
683
|
+
.tag("claimed", Tag.inserting(Component.text(claimed)))
|
684
|
+
.tag("clusters", Tag.inserting(Component.text(clusters)))
|
685
|
+
.tag("region", Tag.inserting(Component.text(region)))
|
686
|
+
.tag("generator", Tag.inserting(Component.text(generator)))
|
687
|
+
.tag(
|
688
|
+
"footer",
|
689
|
+
Tag.inserting(TranslatableCaption.of("info.plot_info_footer").toComponent(player))
|
690
|
+
)
|
691
|
+
.build();
|
692
|
+
player.sendMessage(TranslatableCaption.of("info.area_info_format"), resolver);
|
652
693
|
return true;
|
653
694
|
}
|
654
695
|
case "l", "list" -> {
|
655
696
|
if (!player.hasPermission(Permission.PERMISSION_AREA_LIST)) {
|
656
697
|
player.sendMessage(
|
657
698
|
TranslatableCaption.of("permission.no_permission"),
|
658
|
-
|
699
|
+
TagResolver.resolver(
|
700
|
+
"node",
|
701
|
+
Tag.inserting(Permission.PERMISSION_AREA_LIST)
|
702
|
+
)
|
659
703
|
);
|
660
704
|
return false;
|
661
705
|
}
|
@@ -672,8 +716,10 @@ public class Area extends SubCommand {
|
|
672
716
|
default:
|
673
717
|
player.sendMessage(
|
674
718
|
TranslatableCaption.of("commandconfig.command_syntax_extended"),
|
675
|
-
|
676
|
-
|
719
|
+
TagResolver.builder()
|
720
|
+
.tag("value1", Tag.inserting(Component.text(getCommandString())))
|
721
|
+
.tag("value2", Tag.inserting(Component.text(" list [#]")))
|
722
|
+
.build()
|
677
723
|
);
|
678
724
|
return false;
|
679
725
|
}
|
@@ -699,37 +745,27 @@ public class Area extends SubCommand {
|
|
699
745
|
percent = claimed == 0 ? 0 : (double) claimed / Short.MAX_VALUE * Short.MAX_VALUE;
|
700
746
|
region = "N/A";
|
701
747
|
}
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
usageTemplate,
|
712
|
-
clustersTemplate,
|
713
|
-
regionTemplate,
|
714
|
-
generatorTemplate
|
715
|
-
));
|
716
|
-
Template tooltipTemplate = Template.of("hover_info", tooltip);
|
717
|
-
Template visitcmdTemplate = Template.of("command_tp", "/plot area tp " + area);
|
718
|
-
Template infocmdTemplate = Template.of("command_info", "/plot area info " + area);
|
719
|
-
Template numberTemplate = Template.of("number", String.valueOf(i));
|
720
|
-
Template nameTemplate = Template.of("area_name", name);
|
721
|
-
Template typeTemplate = Template.of("area_type", area.getType().name());
|
722
|
-
Template terrainTemplate = Template.of("area_terrain", area.getTerrain().name());
|
723
|
-
caption.set(TranslatableCaption.of("info.area_list_item"));
|
724
|
-
caption.setTemplates(
|
725
|
-
tooltipTemplate,
|
726
|
-
visitcmdTemplate,
|
727
|
-
numberTemplate,
|
728
|
-
nameTemplate,
|
729
|
-
typeTemplate,
|
730
|
-
terrainTemplate,
|
731
|
-
infocmdTemplate
|
748
|
+
Component tooltip = MINI_MESSAGE.deserialize(
|
749
|
+
TranslatableCaption.of("info.area_list_tooltip").getComponent(player),
|
750
|
+
TagResolver.builder()
|
751
|
+
.tag("claimed", Tag.inserting(Component.text(claimed)))
|
752
|
+
.tag("usage", Tag.inserting(Component.text(String.format("%.2f", percent) + "%")))
|
753
|
+
.tag("clusters", Tag.inserting(Component.text(clusters)))
|
754
|
+
.tag("region", Tag.inserting(Component.text(region)))
|
755
|
+
.tag("generator", Tag.inserting(Component.text(generator)))
|
756
|
+
.build()
|
732
757
|
);
|
758
|
+
TagResolver resolver = TagResolver.builder()
|
759
|
+
.tag("hover_info", Tag.inserting(tooltip))
|
760
|
+
.tag("command_tp", Tag.preProcessParsed("/plot area tp " + name))
|
761
|
+
.tag("command_info", Tag.preProcessParsed("/plot area info " + name))
|
762
|
+
.tag("number", Tag.inserting(Component.text(i)))
|
763
|
+
.tag("area_name", Tag.inserting(Component.text(name)))
|
764
|
+
.tag("area_type", Tag.inserting(Component.text(area.getType().name())))
|
765
|
+
.tag("area_terrain", Tag.inserting(Component.text(area.getTerrain().name())))
|
766
|
+
.build();
|
767
|
+
caption.set(TranslatableCaption.of("info.area_list_item"));
|
768
|
+
caption.setTagResolvers(resolver);
|
733
769
|
}
|
734
770
|
}, "/plot area list", TranslatableCaption.of("list.area_list_header_paged"));
|
735
771
|
return true;
|
@@ -738,7 +774,10 @@ public class Area extends SubCommand {
|
|
738
774
|
if (!player.hasPermission(Permission.PERMISSION_AREA_REGEN)) {
|
739
775
|
player.sendMessage(
|
740
776
|
TranslatableCaption.of("permission.no_permission"),
|
741
|
-
|
777
|
+
TagResolver.resolver(
|
778
|
+
"node",
|
779
|
+
Tag.inserting(Permission.PERMISSION_AREA_REGEN)
|
780
|
+
)
|
742
781
|
);
|
743
782
|
return false;
|
744
783
|
}
|
@@ -750,13 +789,12 @@ public class Area extends SubCommand {
|
|
750
789
|
if (area.getType() != PlotAreaType.PARTIAL) {
|
751
790
|
player.sendMessage(
|
752
791
|
TranslatableCaption.of("single.delete_world_region"),
|
753
|
-
|
792
|
+
TagResolver.resolver("world", Tag.inserting(Component.text(area.getWorldName())))
|
754
793
|
);
|
755
794
|
return false;
|
756
795
|
}
|
757
796
|
QueueCoordinator queue = blockQueue.getNewQueue(worldUtil.getWeWorld(area.getWorldName()));
|
758
|
-
queue.setChunkConsumer(chunk -> AugmentedUtils.
|
759
|
-
null,
|
797
|
+
queue.setChunkConsumer(chunk -> AugmentedUtils.generateChunk(
|
760
798
|
area.getWorldName(),
|
761
799
|
chunk.getX(),
|
762
800
|
chunk.getZ(),
|
@@ -771,20 +809,23 @@ public class Area extends SubCommand {
|
|
771
809
|
if (!player.hasPermission(Permission.PERMISSION_AREA_TP)) {
|
772
810
|
player.sendMessage(
|
773
811
|
TranslatableCaption.of("permission.no_permission"),
|
774
|
-
|
812
|
+
TagResolver.resolver("node", Tag.inserting(Permission.PERMISSION_AREA_TP))
|
775
813
|
);
|
776
814
|
return false;
|
777
815
|
}
|
778
816
|
if (args.length != 2) {
|
779
817
|
player.sendMessage(
|
780
818
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
781
|
-
|
819
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("/plot area tp [area]")))
|
782
820
|
);
|
783
821
|
return false;
|
784
822
|
}
|
785
823
|
PlotArea area = this.plotAreaManager.getPlotAreaByString(args[1]);
|
786
824
|
if (area == null) {
|
787
|
-
player.sendMessage(
|
825
|
+
player.sendMessage(
|
826
|
+
TranslatableCaption.of("errors.not_valid_plot_world"),
|
827
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(args[1])))
|
828
|
+
);
|
788
829
|
return false;
|
789
830
|
}
|
790
831
|
Location center;
|
@@ -35,6 +35,7 @@ import com.plotsquared.core.player.PlotPlayer;
|
|
35
35
|
import com.plotsquared.core.plot.Plot;
|
36
36
|
import com.plotsquared.core.plot.PlotArea;
|
37
37
|
import com.plotsquared.core.plot.world.PlotAreaManager;
|
38
|
+
import com.plotsquared.core.services.plots.AutoQuery;
|
38
39
|
import com.plotsquared.core.services.plots.AutoService;
|
39
40
|
import com.plotsquared.core.util.EconHandler;
|
40
41
|
import com.plotsquared.core.util.EventDispatcher;
|
@@ -43,7 +44,9 @@ import com.plotsquared.core.util.task.AutoClaimFinishTask;
|
|
43
44
|
import com.plotsquared.core.util.task.RunnableVal;
|
44
45
|
import com.plotsquared.core.util.task.TaskManager;
|
45
46
|
import io.leangen.geantyref.TypeToken;
|
46
|
-
import net.kyori.adventure.text.
|
47
|
+
import net.kyori.adventure.text.Component;
|
48
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
49
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
47
50
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
48
51
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
49
52
|
|
@@ -109,13 +112,13 @@ public class Auto extends SubCommand {
|
|
109
112
|
if (diff < 0 && grantedPlots < sizeX * sizeZ) {
|
110
113
|
player.sendMessage(
|
111
114
|
TranslatableCaption.of("permission.cant_claim_more_plots"),
|
112
|
-
|
115
|
+
TagResolver.resolver("amount", Tag.inserting(Component.text(diff + grantedPlots)))
|
113
116
|
);
|
114
117
|
return false;
|
115
118
|
} else if (diff >= 0 && grantedPlots + diff < sizeX * sizeZ) {
|
116
119
|
player.sendMessage(
|
117
120
|
TranslatableCaption.of("permission.cant_claim_more_plots"),
|
118
|
-
|
121
|
+
TagResolver.resolver("amount", Tag.inserting(Component.text(diff + grantedPlots)))
|
119
122
|
);
|
120
123
|
return false;
|
121
124
|
} else {
|
@@ -127,15 +130,16 @@ public class Auto extends SubCommand {
|
|
127
130
|
}
|
128
131
|
player.sendMessage(
|
129
132
|
TranslatableCaption.of("economy.removed_granted_plot"),
|
130
|
-
|
131
|
-
|
133
|
+
TagResolver.builder()
|
134
|
+
.tag("used_grants", Tag.inserting(Component.text(grantedPlots - left)))
|
135
|
+
.tag("remaining_grants", Tag.inserting(Component.text(left)))
|
136
|
+
.build()
|
132
137
|
);
|
133
138
|
}
|
134
139
|
} else {
|
135
140
|
player.sendMessage(
|
136
141
|
TranslatableCaption.of("permission.cant_claim_more_plots"),
|
137
|
-
|
138
|
-
)
|
142
|
+
TagResolver.resolver("amount", Tag.inserting(Component.text(player.getAllowedPlots())))
|
139
143
|
);
|
140
144
|
return false;
|
141
145
|
}
|
@@ -214,7 +218,7 @@ public class Auto extends SubCommand {
|
|
214
218
|
} else {
|
215
219
|
player.sendMessage(
|
216
220
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
217
|
-
|
221
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(getUsage())))
|
218
222
|
);
|
219
223
|
return true;
|
220
224
|
}
|
@@ -237,7 +241,7 @@ public class Auto extends SubCommand {
|
|
237
241
|
if (event.getEventResult() == Result.DENY) {
|
238
242
|
player.sendMessage(
|
239
243
|
TranslatableCaption.of("events.event_denied"),
|
240
|
-
|
244
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("Auto claim")))
|
241
245
|
);
|
242
246
|
return true;
|
243
247
|
}
|
@@ -248,14 +252,14 @@ public class Auto extends SubCommand {
|
|
248
252
|
if (!force && mega && !player.hasPermission(Permission.PERMISSION_AUTO_MEGA)) {
|
249
253
|
player.sendMessage(
|
250
254
|
TranslatableCaption.of("permission.no_permission"),
|
251
|
-
|
255
|
+
TagResolver.resolver("node", Tag.inserting(Permission.PERMISSION_AUTO_MEGA))
|
252
256
|
);
|
253
257
|
return false;
|
254
258
|
}
|
255
259
|
if (!force && sizeX * sizeZ > Settings.Claim.MAX_AUTO_AREA) {
|
256
260
|
player.sendMessage(
|
257
261
|
TranslatableCaption.of("permission.cant_claim_more_plots_num"),
|
258
|
-
|
262
|
+
TagResolver.resolver("amount", Tag.inserting(Component.text(Settings.Claim.MAX_AUTO_AREA)))
|
259
263
|
);
|
260
264
|
return false;
|
261
265
|
}
|
@@ -273,8 +277,10 @@ public class Auto extends SubCommand {
|
|
273
277
|
if (!plotarea.hasSchematic(schematic)) {
|
274
278
|
player.sendMessage(
|
275
279
|
TranslatableCaption.of("schematics.schematic_invalid_named"),
|
276
|
-
|
277
|
-
|
280
|
+
TagResolver.builder()
|
281
|
+
.tag("schemname", Tag.inserting(Component.text(schematic)))
|
282
|
+
.tag("reason", Tag.inserting(Component.text("non-existent")))
|
283
|
+
.build()
|
278
284
|
);
|
279
285
|
return true;
|
280
286
|
}
|
@@ -283,17 +289,20 @@ public class Auto extends SubCommand {
|
|
283
289
|
) && !player.hasPermission("plots.admin.command.schematic")) {
|
284
290
|
player.sendMessage(
|
285
291
|
TranslatableCaption.of("permission.no_permission"),
|
286
|
-
|
292
|
+
TagResolver.resolver("node", Tag.inserting(Component.text("plots.claim.%s0")))
|
287
293
|
);
|
288
294
|
return true;
|
289
295
|
}
|
290
296
|
}
|
291
|
-
if (this.econHandler != null && plotarea.useEconomy()) {
|
297
|
+
if (this.econHandler != null && plotarea.useEconomy() && !player.hasPermission(Permission.PERMISSION_ADMIN_BYPASS_ECON)) {
|
292
298
|
PlotExpression costExp = plotarea.getPrices().get("claim");
|
299
|
+
PlotExpression mergeCostExp = plotarea.getPrices().get("merge");
|
300
|
+
int size = sizeX * sizeZ;
|
301
|
+
double mergeCost = size <= 1 || mergeCostExp == null ? 0d : mergeCostExp.evaluate(size);
|
293
302
|
double cost = costExp.evaluate(Settings.Limit.GLOBAL ?
|
294
303
|
player.getPlotCount() :
|
295
304
|
player.getPlotCount(plotarea.getWorldName()));
|
296
|
-
cost =
|
305
|
+
cost = size * cost + mergeCost;
|
297
306
|
if (cost > 0d) {
|
298
307
|
if (!this.econHandler.isSupported()) {
|
299
308
|
player.sendMessage(TranslatableCaption.of("economy.vault_or_consumer_null"));
|
@@ -302,21 +311,26 @@ public class Auto extends SubCommand {
|
|
302
311
|
if (!force && this.econHandler.getMoney(player) < cost) {
|
303
312
|
player.sendMessage(
|
304
313
|
TranslatableCaption.of("economy.cannot_afford_plot"),
|
305
|
-
|
306
|
-
|
314
|
+
TagResolver.builder()
|
315
|
+
.tag("money", Tag.inserting(Component.text(this.econHandler.format(cost))))
|
316
|
+
.tag(
|
317
|
+
"balance",
|
318
|
+
Tag.inserting(Component.text(this.econHandler.format(this.econHandler.getMoney(player))))
|
319
|
+
)
|
320
|
+
.build()
|
307
321
|
);
|
308
322
|
return false;
|
309
323
|
}
|
310
324
|
this.econHandler.withdrawMoney(player, cost);
|
311
325
|
player.sendMessage(
|
312
326
|
TranslatableCaption.of("economy.removed_balance"),
|
313
|
-
|
327
|
+
TagResolver.resolver("money", Tag.inserting(Component.text(this.econHandler.format(cost))))
|
314
328
|
);
|
315
329
|
}
|
316
330
|
}
|
317
331
|
|
318
332
|
List<Plot> plots = this.servicePipeline
|
319
|
-
.pump(new
|
333
|
+
.pump(new AutoQuery(player, null, sizeX, sizeZ, plotarea))
|
320
334
|
.through(AutoService.class)
|
321
335
|
.getResult();
|
322
336
|
|
@@ -344,7 +358,7 @@ public class Auto extends SubCommand {
|
|
344
358
|
if (!force && mergeEvent.getEventResult() == Result.DENY) {
|
345
359
|
player.sendMessage(
|
346
360
|
TranslatableCaption.of("events.event_denied"),
|
347
|
-
|
361
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("Auto merge")))
|
348
362
|
);
|
349
363
|
return false;
|
350
364
|
}
|
@@ -29,7 +29,9 @@ import com.plotsquared.core.player.PlotPlayer;
|
|
29
29
|
import com.plotsquared.core.plot.Plot;
|
30
30
|
import com.plotsquared.core.util.task.RunnableVal2;
|
31
31
|
import com.plotsquared.core.util.task.RunnableVal3;
|
32
|
-
import net.kyori.adventure.text.
|
32
|
+
import net.kyori.adventure.text.Component;
|
33
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
34
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
33
35
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
34
36
|
|
35
37
|
import java.nio.file.Files;
|
@@ -66,7 +68,7 @@ public final class Backup extends Command {
|
|
66
68
|
private static boolean sendMessage(PlotPlayer<?> player) {
|
67
69
|
player.sendMessage(
|
68
70
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
69
|
-
|
71
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("/plot backup <save | list | load>")))
|
70
72
|
);
|
71
73
|
return true;
|
72
74
|
}
|
@@ -134,33 +136,44 @@ public final class Backup extends Command {
|
|
134
136
|
} else if (!plot.hasOwner()) {
|
135
137
|
player.sendMessage(
|
136
138
|
TranslatableCaption.of("backups.backup_impossible"),
|
137
|
-
|
139
|
+
TagResolver.resolver("plot", Tag.inserting(
|
140
|
+
TranslatableCaption.of("generic.generic_unowned").toComponent(player)
|
141
|
+
))
|
138
142
|
);
|
139
143
|
} else if (plot.getVolume() > Integer.MAX_VALUE) {
|
140
144
|
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large"));
|
141
145
|
} else if (plot.isMerged()) {
|
142
146
|
player.sendMessage(
|
143
147
|
TranslatableCaption.of("backups.backup_impossible"),
|
144
|
-
|
148
|
+
TagResolver.resolver("plot", Tag.inserting(
|
149
|
+
TranslatableCaption.of("generic.generic_merged").toComponent(player)
|
150
|
+
))
|
145
151
|
);
|
146
152
|
} else if (!plot.isOwner(player.getUUID()) && !player.hasPermission(Permission.PERMISSION_ADMIN_BACKUP_OTHER)) {
|
147
153
|
player.sendMessage(
|
148
154
|
TranslatableCaption.of("permission.no_permission"),
|
149
|
-
|
155
|
+
TagResolver.resolver(
|
156
|
+
"node",
|
157
|
+
Tag.inserting(Permission.PERMISSION_ADMIN_BACKUP_OTHER)
|
158
|
+
)
|
150
159
|
);
|
151
160
|
} else {
|
152
161
|
final BackupProfile backupProfile = Objects.requireNonNull(this.backupManager.getProfile(plot));
|
153
162
|
if (backupProfile instanceof NullBackupProfile) {
|
154
163
|
player.sendMessage(
|
155
164
|
TranslatableCaption.of("backups.backup_impossible"),
|
156
|
-
|
165
|
+
TagResolver.resolver(
|
166
|
+
"plot", Tag.inserting(TranslatableCaption
|
167
|
+
.of("generic.generic_other")
|
168
|
+
.toComponent(player))
|
169
|
+
)
|
157
170
|
);
|
158
171
|
} else {
|
159
172
|
backupProfile.createBackup().whenComplete((backup, throwable) -> {
|
160
173
|
if (throwable != null) {
|
161
174
|
player.sendMessage(
|
162
175
|
TranslatableCaption.of("backups.backup_save_failed"),
|
163
|
-
|
176
|
+
TagResolver.resolver("reason", Tag.inserting(Component.text(throwable.getMessage())))
|
164
177
|
);
|
165
178
|
throwable.printStackTrace();
|
166
179
|
} else {
|
@@ -187,49 +200,64 @@ public final class Backup extends Command {
|
|
187
200
|
} else if (!plot.hasOwner()) {
|
188
201
|
player.sendMessage(
|
189
202
|
TranslatableCaption.of("backups.backup_impossible"),
|
190
|
-
|
203
|
+
TagResolver.resolver("plot", Tag.inserting(
|
204
|
+
TranslatableCaption.of("generic.generic_unowned").toComponent(player)
|
205
|
+
))
|
191
206
|
);
|
192
207
|
} else if (plot.isMerged()) {
|
193
208
|
player.sendMessage(
|
194
209
|
TranslatableCaption.of("backups.backup_impossible"),
|
195
|
-
|
210
|
+
TagResolver.resolver("plot", Tag.inserting(
|
211
|
+
TranslatableCaption.of("generic.generic_merged").toComponent(player)
|
212
|
+
))
|
196
213
|
);
|
197
214
|
} else if (plot.getVolume() > Integer.MAX_VALUE) {
|
198
215
|
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large"));
|
199
216
|
} else if (!plot.isOwner(player.getUUID()) && !player.hasPermission(Permission.PERMISSION_ADMIN_BACKUP_OTHER)) {
|
200
217
|
player.sendMessage(
|
201
218
|
TranslatableCaption.of("permission.no_permission"),
|
202
|
-
|
219
|
+
TagResolver.resolver(
|
220
|
+
"node",
|
221
|
+
Tag.inserting(Permission.PERMISSION_ADMIN_BACKUP_OTHER)
|
222
|
+
)
|
203
223
|
);
|
204
224
|
} else {
|
205
225
|
final BackupProfile backupProfile = Objects.requireNonNull(this.backupManager.getProfile(plot));
|
206
226
|
if (backupProfile instanceof NullBackupProfile) {
|
207
227
|
player.sendMessage(
|
208
228
|
TranslatableCaption.of("backups.backup_impossible"),
|
209
|
-
|
229
|
+
TagResolver.resolver("plot", Tag.inserting(
|
230
|
+
TranslatableCaption.of("generic.generic_other").toComponent(player)
|
231
|
+
))
|
210
232
|
);
|
211
233
|
} else {
|
212
234
|
backupProfile.listBackups().whenComplete((backups, throwable) -> {
|
213
235
|
if (throwable != null) {
|
214
236
|
player.sendMessage(
|
215
237
|
TranslatableCaption.of("backups.backup_list_failed"),
|
216
|
-
|
238
|
+
TagResolver.resolver("reason", Tag.inserting(Component.text(throwable.getMessage())))
|
217
239
|
);
|
218
240
|
throwable.printStackTrace();
|
219
241
|
} else {
|
220
242
|
player.sendMessage(
|
221
243
|
TranslatableCaption.of("backups.backup_list_header"),
|
222
|
-
|
244
|
+
TagResolver.resolver("plot", Tag.inserting(Component.text(plot.getId().toCommaSeparatedString())))
|
223
245
|
);
|
224
246
|
try {
|
225
247
|
for (int i = 0; i < backups.size(); i++) {
|
226
248
|
player.sendMessage(
|
227
249
|
TranslatableCaption.of("backups.backup_list_entry"),
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
250
|
+
TagResolver.builder()
|
251
|
+
.tag("number", Tag.inserting(Component.text(i + 1)))
|
252
|
+
.tag(
|
253
|
+
"value",
|
254
|
+
Tag.inserting(Component.text(DateTimeFormatter.RFC_1123_DATE_TIME.format(
|
255
|
+
ZonedDateTime.ofInstant(
|
256
|
+
Instant.ofEpochMilli(backups.get(i).getCreationTime()),
|
257
|
+
ZoneId.systemDefault()
|
258
|
+
))))
|
259
|
+
)
|
260
|
+
.build()
|
233
261
|
);
|
234
262
|
}
|
235
263
|
} catch (final Exception e) {
|
@@ -257,24 +285,31 @@ public final class Backup extends Command {
|
|
257
285
|
} else if (!plot.hasOwner()) {
|
258
286
|
player.sendMessage(
|
259
287
|
TranslatableCaption.of("backups.backup_impossible"),
|
260
|
-
|
288
|
+
TagResolver.resolver("plot", Tag.inserting(
|
289
|
+
TranslatableCaption.of("generic.generic_unowned").toComponent(player)
|
290
|
+
))
|
261
291
|
);
|
262
292
|
} else if (plot.isMerged()) {
|
263
293
|
player.sendMessage(
|
264
294
|
TranslatableCaption.of("backups.backup_impossible"),
|
265
|
-
|
295
|
+
TagResolver.resolver("plot", Tag.inserting(
|
296
|
+
TranslatableCaption.of("generic.generic_merged").toComponent(player)
|
297
|
+
))
|
266
298
|
);
|
267
299
|
} else if (plot.getVolume() > Integer.MAX_VALUE) {
|
268
300
|
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large"));
|
269
301
|
} else if (!plot.isOwner(player.getUUID()) && !player.hasPermission(Permission.PERMISSION_ADMIN_BACKUP_OTHER)) {
|
270
302
|
player.sendMessage(
|
271
303
|
TranslatableCaption.of("permission.no_permission"),
|
272
|
-
|
304
|
+
TagResolver.resolver(
|
305
|
+
"node",
|
306
|
+
Tag.inserting(Permission.PERMISSION_ADMIN_BACKUP_OTHER)
|
307
|
+
)
|
273
308
|
);
|
274
309
|
} else if (args.length == 0) {
|
275
310
|
player.sendMessage(
|
276
311
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
277
|
-
|
312
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("Usage: /plot backup save/list/load")))
|
278
313
|
);
|
279
314
|
} else {
|
280
315
|
final int number;
|
@@ -283,7 +318,7 @@ public final class Backup extends Command {
|
|
283
318
|
} catch (final Exception e) {
|
284
319
|
player.sendMessage(
|
285
320
|
TranslatableCaption.of("invalid.not_a_number"),
|
286
|
-
|
321
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(args[0])))
|
287
322
|
);
|
288
323
|
return;
|
289
324
|
}
|
@@ -291,23 +326,27 @@ public final class Backup extends Command {
|
|
291
326
|
if (backupProfile instanceof NullBackupProfile) {
|
292
327
|
player.sendMessage(
|
293
328
|
TranslatableCaption.of("backups.backup_impossible"),
|
294
|
-
|
329
|
+
TagResolver.resolver("plot", Tag.inserting(
|
330
|
+
TranslatableCaption.of("generic.generic_other").toComponent(player)
|
331
|
+
))
|
295
332
|
);
|
296
333
|
} else {
|
297
334
|
backupProfile.listBackups().whenComplete((backups, throwable) -> {
|
298
335
|
if (throwable != null) {
|
299
336
|
player.sendMessage(
|
300
337
|
TranslatableCaption.of("backups.backup_load_failure"),
|
301
|
-
|
338
|
+
TagResolver.resolver("reason", Tag.inserting(Component.text(throwable.getMessage())))
|
302
339
|
);
|
303
340
|
throwable.printStackTrace();
|
304
341
|
} else {
|
305
342
|
if (number < 1 || number > backups.size()) {
|
306
343
|
player.sendMessage(
|
307
344
|
TranslatableCaption.of("backups.backup_impossible"),
|
308
|
-
|
345
|
+
TagResolver.resolver(
|
309
346
|
"plot",
|
310
|
-
|
347
|
+
Tag.inserting(TranslatableCaption
|
348
|
+
.of("generic.generic_invalid_choice")
|
349
|
+
.toComponent(player))
|
311
350
|
)
|
312
351
|
);
|
313
352
|
} else {
|
@@ -317,9 +356,11 @@ public final class Backup extends Command {
|
|
317
356
|
.exists(backup.getFile())) {
|
318
357
|
player.sendMessage(
|
319
358
|
TranslatableCaption.of("backups.backup_impossible"),
|
320
|
-
|
359
|
+
TagResolver.resolver(
|
321
360
|
"plot",
|
322
|
-
|
361
|
+
Tag.inserting(TranslatableCaption
|
362
|
+
.of("generic.generic_invalid_choice")
|
363
|
+
.toComponent(player))
|
323
364
|
)
|
324
365
|
);
|
325
366
|
} else {
|
@@ -329,7 +370,10 @@ public final class Backup extends Command {
|
|
329
370
|
if (error != null) {
|
330
371
|
player.sendMessage(
|
331
372
|
TranslatableCaption.of("backups.backup_load_failure"),
|
332
|
-
|
373
|
+
TagResolver.resolver(
|
374
|
+
"reason",
|
375
|
+
Tag.inserting(Component.text(error.getMessage()))
|
376
|
+
)
|
333
377
|
);
|
334
378
|
} else {
|
335
379
|
player.sendMessage(TranslatableCaption.of("backups.backup_load_success"));
|
@@ -18,6 +18,7 @@
|
|
18
18
|
*/
|
19
19
|
package com.plotsquared.core.command;
|
20
20
|
|
21
|
+
import com.plotsquared.core.configuration.caption.StaticCaption;
|
21
22
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
22
23
|
import com.plotsquared.core.player.PlotPlayer;
|
23
24
|
import com.plotsquared.core.plot.Plot;
|
@@ -25,7 +26,9 @@ import com.plotsquared.core.util.StringMan;
|
|
25
26
|
import com.sk89q.worldedit.command.util.SuggestionHelper;
|
26
27
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
27
28
|
import com.sk89q.worldedit.world.biome.BiomeTypes;
|
28
|
-
import net.kyori.adventure.text.
|
29
|
+
import net.kyori.adventure.text.Component;
|
30
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
31
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
29
32
|
|
30
33
|
import java.util.Collection;
|
31
34
|
import java.util.Locale;
|
@@ -47,16 +50,13 @@ public class Biome extends SetCommand {
|
|
47
50
|
} catch (final Exception ignore) {
|
48
51
|
}
|
49
52
|
if (biome == null) {
|
50
|
-
String
|
51
|
-
BiomeType.REGISTRY.values(),
|
52
|
-
MINI_MESSAGE.serialize(MINI_MESSAGE.parse(TranslatableCaption
|
53
|
-
.of("blocklist.block_list_separator")
|
54
|
-
.getComponent(player)))
|
55
|
-
);
|
53
|
+
String separator = TranslatableCaption.of("blocklist.block_list_separator").getComponent(player);
|
56
54
|
player.sendMessage(TranslatableCaption.of("biome.need_biome"));
|
57
55
|
player.sendMessage(
|
58
|
-
|
59
|
-
|
56
|
+
StaticCaption.of(
|
57
|
+
TranslatableCaption.of("commandconfig.subcommand_set_options_header_only").getComponent(player)
|
58
|
+
+ StringMan.join(BiomeType.REGISTRY.values(), separator)
|
59
|
+
)
|
60
60
|
);
|
61
61
|
return false;
|
62
62
|
}
|
@@ -73,7 +73,7 @@ public class Biome extends SetCommand {
|
|
73
73
|
plot.removeRunning();
|
74
74
|
player.sendMessage(
|
75
75
|
TranslatableCaption.of("biome.biome_set_to"),
|
76
|
-
|
76
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(value.toLowerCase())))
|
77
77
|
);
|
78
78
|
});
|
79
79
|
return true;
|
@@ -32,7 +32,9 @@ import com.plotsquared.core.util.EconHandler;
|
|
32
32
|
import com.plotsquared.core.util.EventDispatcher;
|
33
33
|
import com.plotsquared.core.util.task.RunnableVal2;
|
34
34
|
import com.plotsquared.core.util.task.RunnableVal3;
|
35
|
-
import net.kyori.adventure.text.
|
35
|
+
import net.kyori.adventure.text.Component;
|
36
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
37
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
36
38
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
37
39
|
|
38
40
|
import java.util.Set;
|
@@ -84,7 +86,7 @@ public class Buy extends Command {
|
|
84
86
|
checkTrue(
|
85
87
|
player.getPlotCount() + plots.size() <= player.getAllowedPlots(),
|
86
88
|
TranslatableCaption.of("permission.cant_claim_more_plots"),
|
87
|
-
|
89
|
+
TagResolver.resolver("amount", Tag.inserting(Component.text(player.getAllowedPlots())))
|
88
90
|
);
|
89
91
|
double price = plot.getFlag(PriceFlag.class);
|
90
92
|
if (price <= 0) {
|
@@ -97,8 +99,10 @@ public class Buy extends Command {
|
|
97
99
|
checkTrue(
|
98
100
|
this.econHandler.getMoney(player) >= price,
|
99
101
|
TranslatableCaption.of("economy.cannot_afford_plot"),
|
100
|
-
|
101
|
-
|
102
|
+
TagResolver.builder()
|
103
|
+
.tag("money", Tag.inserting(Component.text(this.econHandler.format(price))))
|
104
|
+
.tag("balance", Tag.inserting(Component.text(this.econHandler.format(this.econHandler.getMoney(player)))))
|
105
|
+
.build()
|
102
106
|
);
|
103
107
|
this.econHandler.withdrawMoney(player, price);
|
104
108
|
// Failure
|
@@ -106,7 +110,7 @@ public class Buy extends Command {
|
|
106
110
|
confirm.run(this, () -> {
|
107
111
|
player.sendMessage(
|
108
112
|
TranslatableCaption.of("economy.removed_balance"),
|
109
|
-
|
113
|
+
TagResolver.resolver("money", Tag.inserting(Component.text(this.econHandler.format(price))))
|
110
114
|
);
|
111
115
|
|
112
116
|
this.econHandler.depositMoney(PlotSquared.platform().playerManager().getOfflinePlayer(plot.getOwnerAbs()), price);
|
@@ -115,9 +119,11 @@ public class Buy extends Command {
|
|
115
119
|
if (owner != null) {
|
116
120
|
owner.sendMessage(
|
117
121
|
TranslatableCaption.of("economy.plot_sold"),
|
118
|
-
|
119
|
-
|
120
|
-
|
122
|
+
TagResolver.builder()
|
123
|
+
.tag("plot", Tag.inserting(Component.text(plot.getId().toString())))
|
124
|
+
.tag("player", Tag.inserting(Component.text(player.getName())))
|
125
|
+
.tag("price", Tag.inserting(Component.text(this.econHandler.format(price))))
|
126
|
+
.build()
|
121
127
|
);
|
122
128
|
}
|
123
129
|
PlotFlag<?, ?> plotFlag = plot.getFlagContainer().getFlag(PriceFlag.class);
|
@@ -129,7 +135,7 @@ public class Buy extends Command {
|
|
129
135
|
plot.getPlotModificationManager().setSign(player.getName());
|
130
136
|
player.sendMessage(
|
131
137
|
TranslatableCaption.of("working.claimed"),
|
132
|
-
|
138
|
+
TagResolver.resolver("plot", Tag.inserting(Component.text(plot.getId().toString())))
|
133
139
|
);
|
134
140
|
whenDone.run(Buy.this, CommandResult.SUCCESS);
|
135
141
|
}, () -> {
|
@@ -29,7 +29,10 @@ import com.plotsquared.core.plot.flag.implementations.HostileCapFlag;
|
|
29
29
|
import com.plotsquared.core.plot.flag.implementations.MiscCapFlag;
|
30
30
|
import com.plotsquared.core.plot.flag.implementations.MobCapFlag;
|
31
31
|
import com.plotsquared.core.plot.flag.implementations.VehicleCapFlag;
|
32
|
-
import net.kyori.adventure.text.
|
32
|
+
import net.kyori.adventure.text.Component;
|
33
|
+
import net.kyori.adventure.text.ComponentLike;
|
34
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
35
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
33
36
|
|
34
37
|
import static com.plotsquared.core.util.entity.EntityCategories.CAP_ANIMAL;
|
35
38
|
import static com.plotsquared.core.util.entity.EntityCategories.CAP_ENTITY;
|
@@ -53,7 +56,7 @@ public class Caps extends SubCommand {
|
|
53
56
|
if (!plot.isAdded(player.getUUID()) && !player.hasPermission(Permission.PERMISSION_ADMIN_CAPS_OTHER)) {
|
54
57
|
player.sendMessage(
|
55
58
|
TranslatableCaption.of("permission.no_permission"),
|
56
|
-
|
59
|
+
TagResolver.resolver("node", Tag.inserting(Permission.PERMISSION_ADMIN_CAPS_OTHER))
|
57
60
|
);
|
58
61
|
return false;
|
59
62
|
}
|
@@ -80,15 +83,17 @@ public class Caps extends SubCommand {
|
|
80
83
|
final int current = countedEntities[type];
|
81
84
|
final int max = plot.getFlag(capFlag);
|
82
85
|
final String percentage = String.format("%.1f", 100 * ((float) current / max));
|
83
|
-
|
84
|
-
? TranslatableCaption.of("info.infinite").
|
85
|
-
:
|
86
|
+
ComponentLike maxBeautified = max >= Integer.MAX_VALUE
|
87
|
+
? TranslatableCaption.of("info.infinite").toComponent(player)
|
88
|
+
: Component.text(max);
|
86
89
|
player.sendMessage(
|
87
90
|
TranslatableCaption.of("info.plot_caps_format"),
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
91
|
+
TagResolver.builder()
|
92
|
+
.tag("cap", Tag.inserting(Component.text(name)))
|
93
|
+
.tag("current", Tag.inserting(Component.text(current)))
|
94
|
+
.tag("limit", Tag.inserting(maxBeautified))
|
95
|
+
.tag("percentage", Tag.inserting(Component.text(percentage)))
|
96
|
+
.build()
|
92
97
|
);
|
93
98
|
}
|
94
99
|
|
@@ -1,54 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* PlotSquared, a land and world management plugin for Minecraft.
|
3
|
-
* Copyright (C) IntellectualSites <https://intellectualsites.com>
|
4
|
-
* Copyright (C) IntellectualSites team and contributors
|
5
|
-
*
|
6
|
-
* This program is free software: you can redistribute it and/or modify
|
7
|
-
* it under the terms of the GNU General Public License as published by
|
8
|
-
* the Free Software Foundation, either version 3 of the License, or
|
9
|
-
* (at your option) any later version.
|
10
|
-
*
|
11
|
-
* This program is distributed in the hope that it will be useful,
|
12
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
-
* GNU General Public License for more details.
|
15
|
-
*
|
16
|
-
* You should have received a copy of the GNU General Public License
|
17
|
-
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
18
|
-
*/
|
19
|
-
package com.plotsquared.core.command;
|
20
|
-
|
21
|
-
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
22
|
-
import com.plotsquared.core.player.PlotPlayer;
|
23
|
-
import com.plotsquared.core.plot.PlotArea;
|
24
|
-
import net.kyori.adventure.text.minimessage.Template;
|
25
|
-
|
26
|
-
/**
|
27
|
-
* @deprecated In favor of "/plot toggle chat" and
|
28
|
-
* scheduled for removal within the next major release.
|
29
|
-
*/
|
30
|
-
@Deprecated(forRemoval = true, since = "6.0.0")
|
31
|
-
@CommandDeclaration(command = "chat",
|
32
|
-
usage = "/plot chat",
|
33
|
-
permission = "plots.chat",
|
34
|
-
category = CommandCategory.CHAT,
|
35
|
-
requiredType = RequiredType.PLAYER)
|
36
|
-
public class Chat extends SubCommand {
|
37
|
-
|
38
|
-
@Override
|
39
|
-
public boolean onCommand(PlotPlayer<?> player, String[] args) {
|
40
|
-
PlotArea area = player.getPlotAreaAbs();
|
41
|
-
check(area, TranslatableCaption.of("errors.not_in_plot_world"));
|
42
|
-
player.sendMessage(
|
43
|
-
TranslatableCaption.of("errors.deprecated_commands"),
|
44
|
-
Template.of("replacement", "/plot toggle chat")
|
45
|
-
);
|
46
|
-
if (player.getPlotAreaAbs().isForcingPlotChat()) {
|
47
|
-
player.sendMessage(TranslatableCaption.of("chat.plot_chat_forced"));
|
48
|
-
return true;
|
49
|
-
}
|
50
|
-
MainCommand.getInstance().toggle.chat(this, player, args, null, null);
|
51
|
-
return true;
|
52
|
-
}
|
53
|
-
|
54
|
-
}
|
@@ -37,7 +37,9 @@ import com.plotsquared.core.util.EconHandler;
|
|
37
37
|
import com.plotsquared.core.util.EventDispatcher;
|
38
38
|
import com.plotsquared.core.util.PlotExpression;
|
39
39
|
import com.plotsquared.core.util.task.TaskManager;
|
40
|
-
import net.kyori.adventure.text.
|
40
|
+
import net.kyori.adventure.text.Component;
|
41
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
42
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
41
43
|
import org.apache.logging.log4j.LogManager;
|
42
44
|
import org.apache.logging.log4j.Logger;
|
43
45
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
@@ -81,7 +83,7 @@ public class Claim extends SubCommand {
|
|
81
83
|
if (event.getEventResult() == Result.DENY) {
|
82
84
|
player.sendMessage(
|
83
85
|
TranslatableCaption.of("events.event_denied"),
|
84
|
-
|
86
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("Claim")))
|
85
87
|
);
|
86
88
|
return true;
|
87
89
|
}
|
@@ -100,14 +102,14 @@ public class Claim extends SubCommand {
|
|
100
102
|
if (grants <= 0) {
|
101
103
|
player.sendMessage(
|
102
104
|
TranslatableCaption.of("permission.cant_claim_more_plots"),
|
103
|
-
|
105
|
+
TagResolver.resolver("amount", Tag.inserting(Component.text(grants)))
|
104
106
|
);
|
105
107
|
metaDataAccess.remove();
|
106
108
|
}
|
107
109
|
} else {
|
108
110
|
player.sendMessage(
|
109
111
|
TranslatableCaption.of("permission.cant_claim_more_plots"),
|
110
|
-
|
112
|
+
TagResolver.resolver("amount", Tag.inserting(Component.text(player.getAllowedPlots())))
|
111
113
|
);
|
112
114
|
return false;
|
113
115
|
}
|
@@ -122,8 +124,10 @@ public class Claim extends SubCommand {
|
|
122
124
|
if (!area.hasSchematic(schematic)) {
|
123
125
|
player.sendMessage(
|
124
126
|
TranslatableCaption.of("schematics.schematic_invalid_named"),
|
125
|
-
|
126
|
-
|
127
|
+
TagResolver.builder()
|
128
|
+
.tag("schemname", Tag.inserting(Component.text(schematic)))
|
129
|
+
.tag("reason", Tag.inserting(Component.text("non-existent")))
|
130
|
+
.build()
|
127
131
|
);
|
128
132
|
}
|
129
133
|
if (!player.hasPermission(Permission.PERMISSION_CLAIM_SCHEMATIC
|
@@ -132,12 +136,12 @@ public class Claim extends SubCommand {
|
|
132
136
|
) && !force) {
|
133
137
|
player.sendMessage(
|
134
138
|
TranslatableCaption.of("permission.no_schematic_permission"),
|
135
|
-
|
139
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(schematic)))
|
136
140
|
);
|
137
141
|
}
|
138
142
|
}
|
139
143
|
}
|
140
|
-
if (this.econHandler.isEnabled(area) && !force) {
|
144
|
+
if (this.econHandler.isEnabled(area) && !force && !player.hasPermission(Permission.PERMISSION_ADMIN_BYPASS_ECON)) {
|
141
145
|
PlotExpression costExr = area.getPrices().get("claim");
|
142
146
|
double cost = costExr.evaluate(currentPlots);
|
143
147
|
if (cost > 0d) {
|
@@ -148,16 +152,28 @@ public class Claim extends SubCommand {
|
|
148
152
|
if (this.econHandler.getMoney(player) < cost) {
|
149
153
|
player.sendMessage(
|
150
154
|
TranslatableCaption.of("economy.cannot_afford_plot"),
|
151
|
-
|
152
|
-
|
155
|
+
TagResolver.builder()
|
156
|
+
.tag("money", Tag.inserting(Component.text(this.econHandler.format(cost))))
|
157
|
+
.tag(
|
158
|
+
"balance",
|
159
|
+
Tag.inserting(Component.text(this.econHandler.format(this.econHandler.getMoney(
|
160
|
+
player))))
|
161
|
+
)
|
162
|
+
.build()
|
153
163
|
);
|
154
164
|
return false;
|
155
165
|
}
|
156
166
|
this.econHandler.withdrawMoney(player, cost);
|
157
167
|
player.sendMessage(
|
158
168
|
TranslatableCaption.of("economy.removed_balance"),
|
159
|
-
|
160
|
-
|
169
|
+
TagResolver.builder()
|
170
|
+
.tag("money", Tag.inserting(Component.text(this.econHandler.format(cost))))
|
171
|
+
.tag(
|
172
|
+
"balance",
|
173
|
+
Tag.inserting(Component.text(this.econHandler.format(this.econHandler.getMoney(
|
174
|
+
player))))
|
175
|
+
)
|
176
|
+
.build()
|
161
177
|
);
|
162
178
|
}
|
163
179
|
}
|
@@ -169,8 +185,10 @@ public class Claim extends SubCommand {
|
|
169
185
|
}
|
170
186
|
player.sendMessage(
|
171
187
|
TranslatableCaption.of("economy.removed_granted_plot"),
|
172
|
-
|
173
|
-
|
188
|
+
TagResolver.builder()
|
189
|
+
.tag("used_grants", Tag.inserting(Component.text(grants - 1)))
|
190
|
+
.tag("remaining_grants", Tag.inserting(Component.text(grants)))
|
191
|
+
.build()
|
174
192
|
);
|
175
193
|
}
|
176
194
|
}
|
@@ -196,7 +214,7 @@ public class Claim extends SubCommand {
|
|
196
214
|
if (mergeEvent.getEventResult() == Result.DENY) {
|
197
215
|
player.sendMessage(
|
198
216
|
TranslatableCaption.of("events.event_denied"),
|
199
|
-
|
217
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("Auto merge on claim")))
|
200
218
|
);
|
201
219
|
} else {
|
202
220
|
if (plot.getPlotModificationManager().autoMerge(
|
@@ -35,7 +35,9 @@ import com.plotsquared.core.util.EventDispatcher;
|
|
35
35
|
import com.plotsquared.core.util.task.RunnableVal2;
|
36
36
|
import com.plotsquared.core.util.task.RunnableVal3;
|
37
37
|
import com.plotsquared.core.util.task.TaskManager;
|
38
|
-
import net.kyori.adventure.text.
|
38
|
+
import net.kyori.adventure.text.Component;
|
39
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
40
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
39
41
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
40
42
|
|
41
43
|
import java.util.concurrent.CompletableFuture;
|
@@ -78,7 +80,7 @@ public class Clear extends Command {
|
|
78
80
|
if (eventResult == Result.DENY) {
|
79
81
|
player.sendMessage(
|
80
82
|
TranslatableCaption.of("events.event_denied"),
|
81
|
-
|
83
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("Clear")))
|
82
84
|
);
|
83
85
|
return CompletableFuture.completedFuture(true);
|
84
86
|
}
|
@@ -105,35 +107,35 @@ public class Clear extends Command {
|
|
105
107
|
}
|
106
108
|
BackupManager.backup(player, plot, () -> {
|
107
109
|
final long start = System.currentTimeMillis();
|
108
|
-
boolean result = plot.getPlotModificationManager().clear(true, false, player, () -> {
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
plot.removeFlag(event.getFlag());
|
119
|
-
}
|
110
|
+
boolean result = plot.getPlotModificationManager().clear(true, false, player, () -> TaskManager.runTask(() -> {
|
111
|
+
plot.removeRunning();
|
112
|
+
// If the state changes, then mark it as no longer done
|
113
|
+
if (DoneFlag.isDone(plot)) {
|
114
|
+
PlotFlag<?, ?> plotFlag =
|
115
|
+
plot.getFlagContainer().getFlag(DoneFlag.class);
|
116
|
+
PlotFlagRemoveEvent event = this.eventDispatcher
|
117
|
+
.callFlagRemove(plotFlag, plot);
|
118
|
+
if (event.getEventResult() != Result.DENY) {
|
119
|
+
plot.removeFlag(event.getFlag());
|
120
120
|
}
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
121
|
+
}
|
122
|
+
if (!plot.getFlag(AnalysisFlag.class).isEmpty()) {
|
123
|
+
PlotFlag<?, ?> plotFlag =
|
124
|
+
plot.getFlagContainer().getFlag(AnalysisFlag.class);
|
125
|
+
PlotFlagRemoveEvent event = this.eventDispatcher
|
126
|
+
.callFlagRemove(plotFlag, plot);
|
127
|
+
if (event.getEventResult() != Result.DENY) {
|
128
|
+
plot.removeFlag(event.getFlag());
|
129
129
|
}
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
130
|
+
}
|
131
|
+
player.sendMessage(
|
132
|
+
TranslatableCaption.of("working.clearing_done"),
|
133
|
+
TagResolver.builder()
|
134
|
+
.tag("amount", Tag.inserting(Component.text(System.currentTimeMillis() - start)))
|
135
|
+
.tag("plot", Tag.inserting(Component.text(plot.getId().toString())))
|
136
|
+
.build()
|
137
|
+
);
|
138
|
+
}));
|
137
139
|
if (!result) {
|
138
140
|
player.sendMessage(TranslatableCaption.of("errors.wait_for_timer"));
|
139
141
|
} else {
|
@@ -32,19 +32,26 @@ import com.plotsquared.core.plot.Plot;
|
|
32
32
|
import com.plotsquared.core.plot.PlotArea;
|
33
33
|
import com.plotsquared.core.plot.PlotCluster;
|
34
34
|
import com.plotsquared.core.plot.PlotId;
|
35
|
+
import com.plotsquared.core.util.ComponentHelper;
|
35
36
|
import com.plotsquared.core.util.TabCompletions;
|
36
37
|
import com.plotsquared.core.util.query.PlotQuery;
|
37
|
-
import net.kyori.adventure.text.
|
38
|
+
import net.kyori.adventure.text.Component;
|
39
|
+
import net.kyori.adventure.text.format.NamedTextColor;
|
40
|
+
import net.kyori.adventure.text.format.Style;
|
41
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
42
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
38
43
|
|
39
44
|
import java.util.Collection;
|
40
45
|
import java.util.Collections;
|
41
46
|
import java.util.HashSet;
|
42
47
|
import java.util.LinkedList;
|
43
48
|
import java.util.List;
|
49
|
+
import java.util.Objects;
|
44
50
|
import java.util.Set;
|
45
51
|
import java.util.UUID;
|
46
52
|
import java.util.concurrent.TimeoutException;
|
47
53
|
import java.util.stream.Collectors;
|
54
|
+
import java.util.stream.Stream;
|
48
55
|
|
49
56
|
@CommandDeclaration(command = "cluster",
|
50
57
|
aliases = "clusters",
|
@@ -53,36 +60,39 @@ import java.util.stream.Collectors;
|
|
53
60
|
permission = "plots.cluster")
|
54
61
|
public class Cluster extends SubCommand {
|
55
62
|
|
63
|
+
private static final Component[] AVAILABLE_ARGS = Stream.of(
|
64
|
+
"list", "create", "delete", "resize", "invite", "kick", "leave", "helpers", "tp", "sethome"
|
65
|
+
).map(s -> Component.text(s).style(Style.style(NamedTextColor.DARK_AQUA))).toArray(Component[]::new);
|
66
|
+
private static final Component SEPARATOR = Component.text(", ").style(Style.style(NamedTextColor.GRAY));
|
67
|
+
|
68
|
+
// list, create, delete, resize, invite, kick, leave, helpers, tp, sethome
|
56
69
|
@Override
|
57
70
|
public boolean onCommand(PlotPlayer<?> player, String[] args) {
|
58
|
-
|
59
|
-
// list, create, delete, resize, invite, kick, leave, helpers, tp, sethome
|
60
71
|
if (args.length == 0) {
|
61
72
|
// return arguments
|
62
73
|
player.sendMessage(
|
63
74
|
TranslatableCaption.of("cluster.cluster_available_args"),
|
64
|
-
|
65
|
-
"list",
|
66
|
-
"<dark_aqua>list</dark_aqua><gray>, </gray><dark_aqua>create</dark_aqua><gray>, </gray><dark_aqua>delete</dark_aqua><gray>, </gray><dark_aqua>resize</dark_aqua><gray>, </gray><dark_aqua>invite</dark_aqua><gray>, </gray><dark_aqua>kick</dark_aqua><gray>, </gray><dark_aqua>leave</dark_aqua><gray>, </gray><dark_aqua>members</dark_aqua><gray>, </gray><dark_aqua>info</dark_aqua><gray>, </gray><dark_aqua>tp</dark_aqua><gray>, </gray><dark_aqua>sethome</dark_aqua>"
|
67
|
-
)
|
75
|
+
TagResolver.resolver("list", Tag.inserting(ComponentHelper.join(AVAILABLE_ARGS, SEPARATOR)))
|
68
76
|
);
|
69
77
|
return false;
|
70
78
|
}
|
71
79
|
String sub = args[0].toLowerCase();
|
72
80
|
switch (sub) {
|
73
|
-
case "l"
|
74
|
-
case "list": {
|
81
|
+
case "l", "list" -> {
|
75
82
|
if (!player.hasPermission(Permission.PERMISSION_CLUSTER_LIST)) {
|
76
83
|
player.sendMessage(
|
77
84
|
TranslatableCaption.of("permission.no_permission"),
|
78
|
-
|
85
|
+
TagResolver.resolver(
|
86
|
+
"node",
|
87
|
+
Tag.inserting(Permission.PERMISSION_CLUSTER_LIST)
|
88
|
+
)
|
79
89
|
);
|
80
90
|
return false;
|
81
91
|
}
|
82
92
|
if (args.length != 1) {
|
83
93
|
player.sendMessage(
|
84
94
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
85
|
-
|
95
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("/plot cluster list")))
|
86
96
|
);
|
87
97
|
return false;
|
88
98
|
}
|
@@ -94,7 +104,7 @@ public class Cluster extends SubCommand {
|
|
94
104
|
Set<PlotCluster> clusters = area.getClusters();
|
95
105
|
player.sendMessage(
|
96
106
|
TranslatableCaption.of("cluster.cluster_list_heading"),
|
97
|
-
|
107
|
+
TagResolver.resolver("amount", Tag.inserting(Component.text(clusters.size())))
|
98
108
|
);
|
99
109
|
for (PlotCluster cluster : clusters) {
|
100
110
|
// Ignore unmanaged clusters
|
@@ -102,33 +112,35 @@ public class Cluster extends SubCommand {
|
|
102
112
|
if (player.getUUID().equals(cluster.owner)) {
|
103
113
|
player.sendMessage(
|
104
114
|
TranslatableCaption.of("cluster.cluster_list_element_owner"),
|
105
|
-
|
115
|
+
TagResolver.resolver("cluster", Tag.inserting(Component.text(name)))
|
106
116
|
);
|
107
117
|
} else if (cluster.helpers.contains(player.getUUID())) {
|
108
118
|
player.sendMessage(
|
109
119
|
TranslatableCaption.of("cluster.cluster_list_element_helpers"),
|
110
|
-
|
120
|
+
TagResolver.resolver("cluster", Tag.inserting(Component.text(name)))
|
111
121
|
);
|
112
122
|
} else if (cluster.invited.contains(player.getUUID())) {
|
113
123
|
player.sendMessage(
|
114
124
|
TranslatableCaption.of("cluster.cluster_list_element_invited"),
|
115
|
-
|
125
|
+
TagResolver.resolver("cluster", Tag.inserting(Component.text(name)))
|
116
126
|
);
|
117
127
|
} else {
|
118
128
|
player.sendMessage(
|
119
129
|
TranslatableCaption.of("cluster.cluster_list_element"),
|
120
|
-
|
130
|
+
TagResolver.resolver("cluster", Tag.inserting(Component.text(cluster.toString())))
|
121
131
|
);
|
122
132
|
}
|
123
133
|
}
|
124
134
|
return true;
|
125
135
|
}
|
126
|
-
case "c"
|
127
|
-
case "create": {
|
136
|
+
case "c", "create" -> {
|
128
137
|
if (!player.hasPermission(Permission.PERMISSION_CLUSTER_CREATE)) {
|
129
138
|
player.sendMessage(
|
130
139
|
TranslatableCaption.of("permission.no_permission"),
|
131
|
-
|
140
|
+
TagResolver.resolver(
|
141
|
+
"node",
|
142
|
+
Tag.inserting(Permission.PERMISSION_CLUSTER_CREATE)
|
143
|
+
)
|
132
144
|
);
|
133
145
|
return false;
|
134
146
|
}
|
@@ -140,7 +152,10 @@ public class Cluster extends SubCommand {
|
|
140
152
|
if (args.length != 4) {
|
141
153
|
player.sendMessage(
|
142
154
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
143
|
-
|
155
|
+
TagResolver.resolver(
|
156
|
+
"value",
|
157
|
+
Tag.inserting(Component.text("/plot cluster create <name> <id-bot> <id-top>"))
|
158
|
+
)
|
144
159
|
);
|
145
160
|
return false;
|
146
161
|
}
|
@@ -150,7 +165,7 @@ public class Cluster extends SubCommand {
|
|
150
165
|
if (currentClusters >= player.getAllowedPlots()) {
|
151
166
|
player.sendMessage(
|
152
167
|
TranslatableCaption.of("permission.cant_claim_more_clusters"),
|
153
|
-
|
168
|
+
TagResolver.resolver("amount", Tag.inserting(Component.text(player.getAllowedPlots())))
|
154
169
|
);
|
155
170
|
}
|
156
171
|
PlotId pos1;
|
@@ -168,7 +183,7 @@ public class Cluster extends SubCommand {
|
|
168
183
|
if (area.getCluster(name) != null) {
|
169
184
|
player.sendMessage(
|
170
185
|
TranslatableCaption.of("alias.alias_is_taken"),
|
171
|
-
|
186
|
+
TagResolver.resolver("alias", Tag.inserting(Component.text(name)))
|
172
187
|
);
|
173
188
|
return false;
|
174
189
|
}
|
@@ -182,7 +197,7 @@ public class Cluster extends SubCommand {
|
|
182
197
|
if (cluster != null) {
|
183
198
|
player.sendMessage(
|
184
199
|
TranslatableCaption.of("cluster.cluster_intersection"),
|
185
|
-
|
200
|
+
TagResolver.resolver("cluster", Tag.inserting(Component.text(cluster.getName())))
|
186
201
|
);
|
187
202
|
return false;
|
188
203
|
}
|
@@ -190,7 +205,7 @@ public class Cluster extends SubCommand {
|
|
190
205
|
if (!area.contains(pos1) || !area.contains(pos2)) {
|
191
206
|
player.sendMessage(
|
192
207
|
TranslatableCaption.of("cluster.cluster_outside"),
|
193
|
-
|
208
|
+
TagResolver.resolver("area", Tag.inserting(Component.text(area.toString())))
|
194
209
|
);
|
195
210
|
return false;
|
196
211
|
}
|
@@ -202,7 +217,10 @@ public class Cluster extends SubCommand {
|
|
202
217
|
if (!plot.isOwner(uuid)) {
|
203
218
|
player.sendMessage(
|
204
219
|
TranslatableCaption.of("permission.no_permission"),
|
205
|
-
|
220
|
+
TagResolver.resolver(
|
221
|
+
"node",
|
222
|
+
Tag.inserting(Permission.PERMISSION_CLUSTER_CREATE_OTHER)
|
223
|
+
)
|
206
224
|
);
|
207
225
|
return false;
|
208
226
|
}
|
@@ -224,7 +242,10 @@ public class Cluster extends SubCommand {
|
|
224
242
|
if (current + cluster.getArea() > allowed) {
|
225
243
|
player.sendMessage(
|
226
244
|
TranslatableCaption.of("permission.no_permission"),
|
227
|
-
|
245
|
+
TagResolver.resolver(
|
246
|
+
"node",
|
247
|
+
Tag.inserting(Component.text(Permission.PERMISSION_CLUSTER_SIZE + "." + (current + cluster.getArea())))
|
248
|
+
)
|
228
249
|
);
|
229
250
|
return false;
|
230
251
|
}
|
@@ -243,24 +264,25 @@ public class Cluster extends SubCommand {
|
|
243
264
|
}
|
244
265
|
player.sendMessage(
|
245
266
|
TranslatableCaption.of("cluster.cluster_created"),
|
246
|
-
|
267
|
+
TagResolver.resolver("name", Tag.inserting(Component.text(name)))
|
247
268
|
);
|
248
269
|
return true;
|
249
270
|
}
|
250
|
-
case "disband"
|
251
|
-
case "del":
|
252
|
-
case "delete": {
|
271
|
+
case "disband", "del", "delete" -> {
|
253
272
|
if (!player.hasPermission(Permission.PERMISSION_CLUSTER_DELETE)) {
|
254
273
|
player.sendMessage(
|
255
274
|
TranslatableCaption.of("permission.no_permission"),
|
256
|
-
|
275
|
+
TagResolver.resolver(
|
276
|
+
"node",
|
277
|
+
Tag.inserting(Permission.PERMISSION_CLUSTER_DELETE)
|
278
|
+
)
|
257
279
|
);
|
258
280
|
return false;
|
259
281
|
}
|
260
282
|
if (args.length != 1 && args.length != 2) {
|
261
283
|
player.sendMessage(
|
262
284
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
263
|
-
|
285
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("/plot cluster delete [name]")))
|
264
286
|
);
|
265
287
|
return false;
|
266
288
|
}
|
@@ -275,7 +297,7 @@ public class Cluster extends SubCommand {
|
|
275
297
|
if (cluster == null) {
|
276
298
|
player.sendMessage(
|
277
299
|
TranslatableCaption.of("cluster.invalid_cluster_name"),
|
278
|
-
|
300
|
+
TagResolver.resolver("cluster", Tag.inserting(Component.text(args[1])))
|
279
301
|
);
|
280
302
|
return false;
|
281
303
|
}
|
@@ -290,31 +312,36 @@ public class Cluster extends SubCommand {
|
|
290
312
|
if (!player.hasPermission(Permission.PERMISSION_CLUSTER_DELETE_OTHER)) {
|
291
313
|
player.sendMessage(
|
292
314
|
TranslatableCaption.of("permission.no_permission"),
|
293
|
-
|
315
|
+
TagResolver.resolver(
|
316
|
+
"node",
|
317
|
+
Tag.inserting(Permission.PERMISSION_CLUSTER_DELETE_OTHER)
|
318
|
+
)
|
294
319
|
);
|
295
320
|
return false;
|
296
321
|
}
|
297
322
|
}
|
298
323
|
DBFunc.delete(cluster);
|
299
|
-
player.sendMessage(TranslatableCaption.of("cluster.cluster_deleted"),
|
324
|
+
player.sendMessage(TranslatableCaption.of("cluster.cluster_deleted"), TagResolver.resolver(
|
300
325
|
"cluster",
|
301
|
-
|
326
|
+
Tag.inserting(Component.text(cluster.toString()))
|
302
327
|
));
|
303
328
|
return true;
|
304
329
|
}
|
305
|
-
case "res"
|
306
|
-
case "resize": {
|
330
|
+
case "res", "resize" -> {
|
307
331
|
if (!player.hasPermission(Permission.PERMISSION_CLUSTER_RESIZE)) {
|
308
332
|
player.sendMessage(
|
309
333
|
TranslatableCaption.of("permission.no_permission"),
|
310
|
-
|
334
|
+
TagResolver.resolver(
|
335
|
+
"node",
|
336
|
+
Tag.inserting(Permission.PERMISSION_CLUSTER_RESIZE)
|
337
|
+
)
|
311
338
|
);
|
312
339
|
return false;
|
313
340
|
}
|
314
341
|
if (args.length != 3) {
|
315
342
|
player.sendMessage(
|
316
343
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
317
|
-
|
344
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("/plot cluster resize [name]")))
|
318
345
|
);
|
319
346
|
return false;
|
320
347
|
}
|
@@ -347,7 +374,10 @@ public class Cluster extends SubCommand {
|
|
347
374
|
if (!player.hasPermission(Permission.PERMISSION_CLUSTER_RESIZE_OTHER)) {
|
348
375
|
player.sendMessage(
|
349
376
|
TranslatableCaption.of("permission.no_permission"),
|
350
|
-
|
377
|
+
TagResolver.resolver(
|
378
|
+
"node",
|
379
|
+
Tag.inserting(Permission.PERMISSION_CLUSTER_RESIZE_OTHER)
|
380
|
+
)
|
351
381
|
);
|
352
382
|
return false;
|
353
383
|
}
|
@@ -357,13 +387,12 @@ public class Cluster extends SubCommand {
|
|
357
387
|
if (intersect != null) {
|
358
388
|
player.sendMessage(
|
359
389
|
TranslatableCaption.of("cluster.cluster_intersection"),
|
360
|
-
|
390
|
+
TagResolver.resolver("cluster", Tag.inserting(Component.text(intersect.getName())))
|
361
391
|
);
|
362
392
|
return false;
|
363
393
|
}
|
364
394
|
Set<Plot> existing = area.getPlotSelectionOwned(cluster.getP1(), cluster.getP2());
|
365
395
|
Set<Plot> newPlots = area.getPlotSelectionOwned(pos1, pos2);
|
366
|
-
// Set<Plot> removed = (HashSet<Plot>) existing.clone();
|
367
396
|
Set<Plot> removed = new HashSet<>(existing);
|
368
397
|
|
369
398
|
removed.removeAll(newPlots);
|
@@ -372,7 +401,10 @@ public class Cluster extends SubCommand {
|
|
372
401
|
if (!player.hasPermission(Permission.PERMISSION_CLUSTER_RESIZE_SHRINK)) {
|
373
402
|
player.sendMessage(
|
374
403
|
TranslatableCaption.of("permission.no_permission"),
|
375
|
-
|
404
|
+
TagResolver.resolver(
|
405
|
+
"node",
|
406
|
+
Tag.inserting(Permission.PERMISSION_CLUSTER_RESIZE_SHRINK)
|
407
|
+
)
|
376
408
|
);
|
377
409
|
return false;
|
378
410
|
}
|
@@ -382,7 +414,10 @@ public class Cluster extends SubCommand {
|
|
382
414
|
if (!player.hasPermission(Permission.PERMISSION_CLUSTER_RESIZE_EXPAND)) {
|
383
415
|
player.sendMessage(
|
384
416
|
TranslatableCaption.of("permission.no_permission"),
|
385
|
-
|
417
|
+
TagResolver.resolver(
|
418
|
+
"node",
|
419
|
+
Tag.inserting(Permission.PERMISSION_CLUSTER_RESIZE_EXPAND)
|
420
|
+
)
|
386
421
|
);
|
387
422
|
return false;
|
388
423
|
}
|
@@ -402,7 +437,9 @@ public class Cluster extends SubCommand {
|
|
402
437
|
if (current + cluster.getArea() > allowed) {
|
403
438
|
player.sendMessage(
|
404
439
|
TranslatableCaption.of("permission.no_permission"),
|
405
|
-
|
440
|
+
TagResolver.resolver("node", Tag.inserting(Component.text(
|
441
|
+
Permission.PERMISSION_CLUSTER + "." + (current + cluster.getArea())
|
442
|
+
)))
|
406
443
|
);
|
407
444
|
return false;
|
408
445
|
}
|
@@ -411,20 +448,21 @@ public class Cluster extends SubCommand {
|
|
411
448
|
player.sendMessage(TranslatableCaption.of("cluster.cluster_resized"));
|
412
449
|
return true;
|
413
450
|
}
|
414
|
-
case "add"
|
415
|
-
case "inv":
|
416
|
-
case "invite": {
|
451
|
+
case "add", "inv", "invite" -> {
|
417
452
|
if (!player.hasPermission(Permission.PERMISSION_CLUSTER_INVITE)) {
|
418
453
|
player.sendMessage(
|
419
454
|
TranslatableCaption.of("permission.no_permission"),
|
420
|
-
|
455
|
+
TagResolver.resolver(
|
456
|
+
"node",
|
457
|
+
Tag.inserting(Permission.PERMISSION_CLUSTER_INVITE)
|
458
|
+
)
|
421
459
|
);
|
422
460
|
return false;
|
423
461
|
}
|
424
462
|
if (args.length != 2) {
|
425
463
|
player.sendMessage(
|
426
464
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
427
|
-
|
465
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("/plot cluster invite <player>")))
|
428
466
|
);
|
429
467
|
return false;
|
430
468
|
}
|
@@ -442,7 +480,10 @@ public class Cluster extends SubCommand {
|
|
442
480
|
if (!player.hasPermission(Permission.PERMISSION_CLUSTER_INVITE_OTHER)) {
|
443
481
|
player.sendMessage(
|
444
482
|
TranslatableCaption.of("permission.no_permission"),
|
445
|
-
|
483
|
+
TagResolver.resolver(
|
484
|
+
"node",
|
485
|
+
Tag.inserting(Permission.PERMISSION_CLUSTER_INVITE_OTHER)
|
486
|
+
)
|
446
487
|
);
|
447
488
|
return false;
|
448
489
|
}
|
@@ -455,7 +496,7 @@ public class Cluster extends SubCommand {
|
|
455
496
|
} else if (throwable != null) {
|
456
497
|
player.sendMessage(
|
457
498
|
TranslatableCaption.of("errors.invalid_player"),
|
458
|
-
|
499
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(args[1])))
|
459
500
|
);
|
460
501
|
} else {
|
461
502
|
if (!cluster.isAdded(uuid)) {
|
@@ -467,7 +508,7 @@ public class Cluster extends SubCommand {
|
|
467
508
|
if (otherPlayer != null) {
|
468
509
|
player.sendMessage(
|
469
510
|
TranslatableCaption.of("cluster.cluster_invited"),
|
470
|
-
|
511
|
+
TagResolver.resolver("cluster", Tag.inserting(Component.text(cluster.getName())))
|
471
512
|
);
|
472
513
|
}
|
473
514
|
}
|
@@ -476,20 +517,21 @@ public class Cluster extends SubCommand {
|
|
476
517
|
});
|
477
518
|
return true;
|
478
519
|
}
|
479
|
-
case "k"
|
480
|
-
case "remove":
|
481
|
-
case "kick": {
|
520
|
+
case "k", "remove", "kick" -> {
|
482
521
|
if (!player.hasPermission(Permission.PERMISSION_CLUSTER_KICK)) {
|
483
522
|
player.sendMessage(
|
484
523
|
TranslatableCaption.of("permission.no_permission"),
|
485
|
-
|
524
|
+
TagResolver.resolver(
|
525
|
+
"node",
|
526
|
+
Tag.inserting(Permission.PERMISSION_CLUSTER_KICK)
|
527
|
+
)
|
486
528
|
);
|
487
529
|
return false;
|
488
530
|
}
|
489
531
|
if (args.length != 2) {
|
490
532
|
player.sendMessage(
|
491
533
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
492
|
-
|
534
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("/plot cluster kick <player>")))
|
493
535
|
);
|
494
536
|
return false;
|
495
537
|
}
|
@@ -506,7 +548,10 @@ public class Cluster extends SubCommand {
|
|
506
548
|
if (!player.hasPermission(Permission.PERMISSION_CLUSTER_KICK_OTHER)) {
|
507
549
|
player.sendMessage(
|
508
550
|
TranslatableCaption.of("permission.no_permission"),
|
509
|
-
|
551
|
+
TagResolver.resolver(
|
552
|
+
"node",
|
553
|
+
Tag.inserting(Permission.PERMISSION_CLUSTER_KICK_OTHER)
|
554
|
+
)
|
510
555
|
);
|
511
556
|
return false;
|
512
557
|
}
|
@@ -519,7 +564,7 @@ public class Cluster extends SubCommand {
|
|
519
564
|
} else if (throwable != null) {
|
520
565
|
player.sendMessage(
|
521
566
|
TranslatableCaption.of("errors.invalid_player"),
|
522
|
-
|
567
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(args[1])))
|
523
568
|
);
|
524
569
|
} else {
|
525
570
|
// Can't kick if the player is yourself, the owner, or not added to the cluster
|
@@ -527,7 +572,7 @@ public class Cluster extends SubCommand {
|
|
527
572
|
|| !cluster.isAdded(uuid)) {
|
528
573
|
player.sendMessage(
|
529
574
|
TranslatableCaption.of("cluster.cannot_kick_player"),
|
530
|
-
|
575
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(cluster.getName())))
|
531
576
|
);
|
532
577
|
} else {
|
533
578
|
if (cluster.helpers.contains(uuid)) {
|
@@ -542,7 +587,7 @@ public class Cluster extends SubCommand {
|
|
542
587
|
if (player2 != null) {
|
543
588
|
player.sendMessage(
|
544
589
|
TranslatableCaption.of("cluster.cluster_removed"),
|
545
|
-
|
590
|
+
TagResolver.resolver("cluster", Tag.inserting(Component.text(cluster.getName())))
|
546
591
|
);
|
547
592
|
}
|
548
593
|
removePlayerPlots(cluster, uuid, player2.getLocation().getWorldName());
|
@@ -552,19 +597,21 @@ public class Cluster extends SubCommand {
|
|
552
597
|
});
|
553
598
|
return true;
|
554
599
|
}
|
555
|
-
case "quit"
|
556
|
-
case "leave": {
|
600
|
+
case "quit", "leave" -> {
|
557
601
|
if (!player.hasPermission(Permission.PERMISSION_CLUSTER_LEAVE)) {
|
558
602
|
player.sendMessage(
|
559
603
|
TranslatableCaption.of("permission.no_permission"),
|
560
|
-
|
604
|
+
TagResolver.resolver(
|
605
|
+
"node",
|
606
|
+
Tag.inserting(Permission.PERMISSION_CLUSTER_LEAVE)
|
607
|
+
)
|
561
608
|
);
|
562
609
|
return false;
|
563
610
|
}
|
564
611
|
if (args.length != 1 && args.length != 2) {
|
565
612
|
player.sendMessage(
|
566
613
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
567
|
-
|
614
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("/plot cluster leave [name]")))
|
568
615
|
);
|
569
616
|
return false;
|
570
617
|
}
|
@@ -578,7 +625,7 @@ public class Cluster extends SubCommand {
|
|
578
625
|
if (cluster == null) {
|
579
626
|
player.sendMessage(
|
580
627
|
TranslatableCaption.of("cluster.invalid_cluster_name"),
|
581
|
-
|
628
|
+
TagResolver.resolver("cluster", Tag.inserting(Component.text(args[1])))
|
582
629
|
);
|
583
630
|
return false;
|
584
631
|
}
|
@@ -606,23 +653,29 @@ public class Cluster extends SubCommand {
|
|
606
653
|
DBFunc.removeInvited(cluster, uuid);
|
607
654
|
player.sendMessage(
|
608
655
|
TranslatableCaption.of("cluster.cluster_removed"),
|
609
|
-
|
656
|
+
TagResolver.resolver("cluster", Tag.inserting(Component.text(cluster.getName())))
|
610
657
|
);
|
611
658
|
removePlayerPlots(cluster, uuid, player.getLocation().getWorldName());
|
612
659
|
return true;
|
613
660
|
}
|
614
|
-
case "members"
|
661
|
+
case "members" -> {
|
615
662
|
if (!player.hasPermission(Permission.PERMISSION_CLUSTER_HELPERS)) {
|
616
663
|
player.sendMessage(
|
617
664
|
TranslatableCaption.of("permission.no_permission"),
|
618
|
-
|
665
|
+
TagResolver.resolver(
|
666
|
+
"node",
|
667
|
+
Tag.inserting(Component.text(Permission.PERMISSION_CLUSTER_HELPERS.toString()))
|
668
|
+
)
|
619
669
|
);
|
620
670
|
return false;
|
621
671
|
}
|
622
672
|
if (args.length != 3) {
|
623
673
|
player.sendMessage(
|
624
674
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
625
|
-
|
675
|
+
TagResolver.resolver(
|
676
|
+
"value",
|
677
|
+
Tag.inserting(Component.text("/plot cluster members <add | remove> <player>"))
|
678
|
+
)
|
626
679
|
);
|
627
680
|
return false;
|
628
681
|
}
|
@@ -643,7 +696,7 @@ public class Cluster extends SubCommand {
|
|
643
696
|
} else if (throwable != null) {
|
644
697
|
player.sendMessage(
|
645
698
|
TranslatableCaption.of("errors.invalid_player"),
|
646
|
-
|
699
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(args[2])))
|
647
700
|
);
|
648
701
|
} else {
|
649
702
|
if (args[1].equalsIgnoreCase("add")) {
|
@@ -657,27 +710,30 @@ public class Cluster extends SubCommand {
|
|
657
710
|
} else {
|
658
711
|
player.sendMessage(
|
659
712
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
660
|
-
|
713
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(
|
714
|
+
"/plot cluster members <add | remove> <player>"
|
715
|
+
)))
|
661
716
|
);
|
662
717
|
}
|
663
718
|
}
|
664
719
|
});
|
665
720
|
return true;
|
666
721
|
}
|
667
|
-
case "spawn"
|
668
|
-
case "home":
|
669
|
-
case "tp": {
|
722
|
+
case "spawn", "home", "tp" -> {
|
670
723
|
if (!player.hasPermission(Permission.PERMISSION_CLUSTER_TP)) {
|
671
724
|
player.sendMessage(
|
672
725
|
TranslatableCaption.of("permission.no_permission"),
|
673
|
-
|
726
|
+
TagResolver.resolver(
|
727
|
+
"node",
|
728
|
+
Tag.inserting(Permission.PERMISSION_CLUSTER_TP)
|
729
|
+
)
|
674
730
|
);
|
675
731
|
return false;
|
676
732
|
}
|
677
733
|
if (args.length != 2) {
|
678
734
|
player.sendMessage(
|
679
735
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
680
|
-
|
736
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("/plot cluster tp <name>")))
|
681
737
|
);
|
682
738
|
return false;
|
683
739
|
}
|
@@ -690,7 +746,7 @@ public class Cluster extends SubCommand {
|
|
690
746
|
if (cluster == null) {
|
691
747
|
player.sendMessage(
|
692
748
|
TranslatableCaption.of("cluster.invalid_cluster_name"),
|
693
|
-
|
749
|
+
TagResolver.resolver("cluster", Tag.inserting(Component.text(args[1])))
|
694
750
|
);
|
695
751
|
return false;
|
696
752
|
}
|
@@ -699,7 +755,10 @@ public class Cluster extends SubCommand {
|
|
699
755
|
if (!player.hasPermission(Permission.PERMISSION_CLUSTER_TP_OTHER)) {
|
700
756
|
player.sendMessage(
|
701
757
|
TranslatableCaption.of("permission.no_permission"),
|
702
|
-
|
758
|
+
TagResolver.resolver(
|
759
|
+
"node",
|
760
|
+
Tag.inserting(Permission.PERMISSION_CLUSTER_TP_OTHER)
|
761
|
+
)
|
703
762
|
);
|
704
763
|
return false;
|
705
764
|
}
|
@@ -708,21 +767,21 @@ public class Cluster extends SubCommand {
|
|
708
767
|
player.sendMessage(TranslatableCaption.of("cluster.cluster_teleporting"));
|
709
768
|
return true;
|
710
769
|
}
|
711
|
-
case "i"
|
712
|
-
case "info":
|
713
|
-
case "show":
|
714
|
-
case "information": {
|
770
|
+
case "i", "info", "show", "information" -> {
|
715
771
|
if (!player.hasPermission(Permission.PERMISSION_CLUSTER_INFO)) {
|
716
772
|
player.sendMessage(
|
717
773
|
TranslatableCaption.of("permission.no_permission"),
|
718
|
-
|
774
|
+
TagResolver.resolver(
|
775
|
+
"node",
|
776
|
+
Tag.inserting(Permission.PERMISSION_CLUSTER_TP)
|
777
|
+
)
|
719
778
|
);
|
720
779
|
return false;
|
721
780
|
}
|
722
781
|
if (args.length != 1 && args.length != 2) {
|
723
782
|
player.sendMessage(
|
724
783
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
725
|
-
|
784
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("/plot cluster info [name]")))
|
726
785
|
);
|
727
786
|
}
|
728
787
|
PlotArea area = player.getApplicablePlotArea();
|
@@ -736,7 +795,7 @@ public class Cluster extends SubCommand {
|
|
736
795
|
if (cluster == null) {
|
737
796
|
player.sendMessage(
|
738
797
|
TranslatableCaption.of("cluster.invalid_cluster_name"),
|
739
|
-
|
798
|
+
TagResolver.resolver("cluster", Tag.inserting(Component.text(args[1])))
|
740
799
|
);
|
741
800
|
return false;
|
742
801
|
}
|
@@ -755,47 +814,36 @@ public class Cluster extends SubCommand {
|
|
755
814
|
player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout"));
|
756
815
|
} else {
|
757
816
|
final String owner;
|
758
|
-
|
759
|
-
owner = "unknown";
|
760
|
-
} else {
|
761
|
-
owner = username;
|
762
|
-
}
|
817
|
+
owner = Objects.requireNonNullElse(username, "unknown");
|
763
818
|
String name = cluster.getName();
|
764
819
|
String size = (cluster.getP2().getX() - cluster.getP1().getX() + 1) + "x" + (
|
765
820
|
cluster.getP2().getY() - cluster.getP1().getY() + 1);
|
766
821
|
String rights = cluster.isAdded(player.getUUID()) + "";
|
767
822
|
Caption message = TranslatableCaption.of("cluster.cluster_info");
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
ownerTemplate,
|
777
|
-
nameTemplate,
|
778
|
-
sizeTemplate,
|
779
|
-
rightsTemplate
|
780
|
-
);
|
823
|
+
TagResolver resolver = TagResolver.builder()
|
824
|
+
.tag("id", Tag.inserting(Component.text(id)))
|
825
|
+
.tag("owner", Tag.inserting(Component.text(owner)))
|
826
|
+
.tag("name", Tag.inserting(Component.text(name)))
|
827
|
+
.tag("size", Tag.inserting(Component.text(size)))
|
828
|
+
.tag("rights", Tag.inserting(Component.text(rights)))
|
829
|
+
.build();
|
830
|
+
player.sendMessage(message, resolver);
|
781
831
|
}
|
782
832
|
});
|
783
833
|
return true;
|
784
834
|
}
|
785
|
-
case "sh"
|
786
|
-
case "setspawn":
|
787
|
-
case "sethome": {
|
835
|
+
case "sh", "setspawn", "sethome" -> {
|
788
836
|
if (!player.hasPermission(Permission.PERMISSION_CLUSTER_SETHOME)) {
|
789
837
|
player.sendMessage(
|
790
838
|
TranslatableCaption.of("permission.no_permission"),
|
791
|
-
|
839
|
+
TagResolver.resolver("node", Tag.inserting(Permission.PERMISSION_CLUSTER_SETHOME))
|
792
840
|
);
|
793
841
|
return false;
|
794
842
|
}
|
795
843
|
if (args.length != 1 && args.length != 2) {
|
796
844
|
player.sendMessage(
|
797
845
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
798
|
-
|
846
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("/plot cluster sethome")))
|
799
847
|
);
|
800
848
|
return false;
|
801
849
|
}
|
@@ -812,7 +860,10 @@ public class Cluster extends SubCommand {
|
|
812
860
|
if (!player.hasPermission(Permission.PERMISSION_CLUSTER_SETHOME_OTHER)) {
|
813
861
|
player.sendMessage(
|
814
862
|
TranslatableCaption.of("permission.no_permission"),
|
815
|
-
|
863
|
+
TagResolver.resolver(
|
864
|
+
"node",
|
865
|
+
Tag.inserting(Permission.PERMISSION_CLUSTER_SETHOME_OTHER)
|
866
|
+
)
|
816
867
|
);
|
817
868
|
return false;
|
818
869
|
}
|
@@ -831,10 +882,7 @@ public class Cluster extends SubCommand {
|
|
831
882
|
}
|
832
883
|
player.sendMessage(
|
833
884
|
TranslatableCaption.of("cluster.cluster_available_args"),
|
834
|
-
|
835
|
-
"list",
|
836
|
-
"<dark_aqua>list</dark_aqua><gray>, </gray><dark_aqua>create</dark_aqua><gray>, </gray><dark_aqua>delete</dark_aqua><gray>, </gray><dark_aqua>resize</dark_aqua><gray>, </gray><dark_aqua>invite</dark_aqua><gray>, </gray><dark_aqua>kick</dark_aqua><gray>, </gray><dark_aqua>leave</dark_aqua><gray>, </gray><dark_aqua>members</dark_aqua><gray>, </gray><dark_aqua>info</dark_aqua><gray>, </gray><dark_aqua>tp</dark_aqua><gray>, </gray><dark_aqua>sethome</dark_aqua>"
|
837
|
-
)
|
885
|
+
TagResolver.resolver("list", Tag.inserting(ComponentHelper.join(AVAILABLE_ARGS, SEPARATOR)))
|
838
886
|
);
|
839
887
|
return false;
|
840
888
|
}
|
@@ -25,7 +25,9 @@ import com.plotsquared.core.player.PlayerMetaDataKeys;
|
|
25
25
|
import com.plotsquared.core.player.PlotPlayer;
|
26
26
|
import com.plotsquared.core.util.task.TaskManager;
|
27
27
|
import com.plotsquared.core.util.task.TaskTime;
|
28
|
-
import net.kyori.adventure.text.
|
28
|
+
import net.kyori.adventure.text.Component;
|
29
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
30
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
29
31
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
30
32
|
|
31
33
|
public class CmdConfirm {
|
@@ -52,9 +54,11 @@ public class CmdConfirm {
|
|
52
54
|
if (commandStr != null) {
|
53
55
|
player.sendMessage(
|
54
56
|
TranslatableCaption.of("confirm.requires_confirm"),
|
55
|
-
|
56
|
-
|
57
|
-
|
57
|
+
TagResolver.builder()
|
58
|
+
.tag("command", Tag.inserting(Component.text(commandStr)))
|
59
|
+
.tag("timeout", Tag.inserting(Component.text(Settings.Confirmation.CONFIRMATION_TIMEOUT_SECONDS)))
|
60
|
+
.tag("value", Tag.inserting(Component.text("/plot confirm")))
|
61
|
+
.build()
|
58
62
|
);
|
59
63
|
}
|
60
64
|
TaskManager.runTaskLater(() -> {
|
@@ -29,8 +29,10 @@ import com.plotsquared.core.util.StringComparison;
|
|
29
29
|
import com.plotsquared.core.util.StringMan;
|
30
30
|
import com.plotsquared.core.util.task.RunnableVal2;
|
31
31
|
import com.plotsquared.core.util.task.RunnableVal3;
|
32
|
+
import net.kyori.adventure.text.Component;
|
32
33
|
import net.kyori.adventure.text.minimessage.MiniMessage;
|
33
|
-
import net.kyori.adventure.text.minimessage.
|
34
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
35
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
34
36
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
35
37
|
|
36
38
|
import java.lang.reflect.InvocationTargetException;
|
@@ -255,10 +257,14 @@ public abstract class Command {
|
|
255
257
|
max = c.size();
|
256
258
|
}
|
257
259
|
// Send the header
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
260
|
+
player.sendMessage(
|
261
|
+
header,
|
262
|
+
TagResolver.builder()
|
263
|
+
.tag("cur", Tag.inserting(Component.text(page + 1)))
|
264
|
+
.tag("max", Tag.inserting(Component.text(totalPages + 1)))
|
265
|
+
.tag("amount", Tag.inserting(Component.text(c.size())))
|
266
|
+
.build()
|
267
|
+
);
|
262
268
|
// Send the page content
|
263
269
|
List<T> subList = c.subList(page * size, max);
|
264
270
|
int i = page * size;
|
@@ -266,13 +272,24 @@ public abstract class Command {
|
|
266
272
|
i++;
|
267
273
|
final CaptionHolder msg = new CaptionHolder();
|
268
274
|
add.run(i, obj, msg);
|
269
|
-
player.sendMessage(msg.get(), msg.
|
275
|
+
player.sendMessage(msg.get(), msg.getTagResolvers());
|
270
276
|
}
|
271
277
|
// Send the footer
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
278
|
+
player.sendMessage(
|
279
|
+
TranslatableCaption.of("list.page_turn"),
|
280
|
+
TagResolver.builder()
|
281
|
+
.tag("cur", Tag.inserting(Component.text(page + 1)))
|
282
|
+
.tag(
|
283
|
+
"command1",
|
284
|
+
Tag.preProcessParsed(baseCommand + " " + page)
|
285
|
+
)
|
286
|
+
.tag("command2", Tag.preProcessParsed(baseCommand + " " + (page + 2)))
|
287
|
+
.tag(
|
288
|
+
"clickable",
|
289
|
+
Tag.inserting(TranslatableCaption.of("list.clickable").toComponent(player))
|
290
|
+
)
|
291
|
+
.build()
|
292
|
+
);
|
276
293
|
}
|
277
294
|
|
278
295
|
/**
|
@@ -324,7 +341,7 @@ public abstract class Command {
|
|
324
341
|
if (commands.isEmpty()) {
|
325
342
|
player.sendMessage(
|
326
343
|
TranslatableCaption.of("commandconfig.did_you_mean"),
|
327
|
-
|
344
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(MainCommand.getInstance().help.getUsage())))
|
328
345
|
);
|
329
346
|
return CompletableFuture.completedFuture(false);
|
330
347
|
}
|
@@ -345,7 +362,7 @@ public abstract class Command {
|
|
345
362
|
}
|
346
363
|
player.sendMessage(
|
347
364
|
TranslatableCaption.of("commandconfig.did_you_mean"),
|
348
|
-
|
365
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(cmd.getUsage())))
|
349
366
|
);
|
350
367
|
return CompletableFuture.completedFuture(false);
|
351
368
|
}
|
@@ -380,7 +397,7 @@ public abstract class Command {
|
|
380
397
|
// TODO improve or remove the Argument system
|
381
398
|
player.sendMessage(
|
382
399
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
383
|
-
|
400
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(StringMan.join(fullSplit, " "))))
|
384
401
|
);
|
385
402
|
return false;
|
386
403
|
}
|
@@ -469,7 +486,7 @@ public abstract class Command {
|
|
469
486
|
if (message) {
|
470
487
|
player.sendMessage(
|
471
488
|
TranslatableCaption.of("permission.no_permission"),
|
472
|
-
|
489
|
+
TagResolver.resolver("node", Tag.inserting(Component.text(getPermission())))
|
473
490
|
);
|
474
491
|
}
|
475
492
|
} else {
|
@@ -494,7 +511,7 @@ public abstract class Command {
|
|
494
511
|
public void sendUsage(PlotPlayer<?> player) {
|
495
512
|
player.sendMessage(
|
496
513
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
497
|
-
|
514
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(getUsage())))
|
498
515
|
);
|
499
516
|
}
|
500
517
|
|
@@ -542,9 +559,10 @@ public abstract class Command {
|
|
542
559
|
|
543
560
|
public Collection<Command> tab(PlotPlayer<?> player, String[] args, boolean space) {
|
544
561
|
switch (args.length) {
|
545
|
-
case 0
|
562
|
+
case 0 -> {
|
546
563
|
return this.allCommands;
|
547
|
-
|
564
|
+
}
|
565
|
+
case 1 -> {
|
548
566
|
String arg = args[0].toLowerCase();
|
549
567
|
if (space) {
|
550
568
|
Command cmd = getCommand(arg);
|
@@ -563,13 +581,15 @@ public abstract class Command {
|
|
563
581
|
}
|
564
582
|
return commands;
|
565
583
|
}
|
566
|
-
|
584
|
+
}
|
585
|
+
default -> {
|
567
586
|
Command cmd = getCommand(args[0]);
|
568
587
|
if (cmd != null) {
|
569
588
|
return cmd.tab(player, Arrays.copyOfRange(args, 1, args.length), space);
|
570
589
|
} else {
|
571
590
|
return null;
|
572
591
|
}
|
592
|
+
}
|
573
593
|
}
|
574
594
|
}
|
575
595
|
|
@@ -598,13 +618,13 @@ public abstract class Command {
|
|
598
618
|
return this.getFullId().hashCode();
|
599
619
|
}
|
600
620
|
|
601
|
-
public void checkTrue(boolean mustBeTrue, Caption message,
|
621
|
+
public void checkTrue(boolean mustBeTrue, Caption message, TagResolver... args) {
|
602
622
|
if (!mustBeTrue) {
|
603
623
|
throw new CommandException(message, args);
|
604
624
|
}
|
605
625
|
}
|
606
626
|
|
607
|
-
public <T> T check(T object, Caption message,
|
627
|
+
public <T> T check(T object, Caption message, TagResolver... args) {
|
608
628
|
if (object == null) {
|
609
629
|
throw new CommandException(message, args);
|
610
630
|
}
|
@@ -620,10 +640,10 @@ public abstract class Command {
|
|
620
640
|
|
621
641
|
public static class CommandException extends RuntimeException {
|
622
642
|
|
623
|
-
private final Template[] args;
|
624
643
|
private final Caption message;
|
644
|
+
private final TagResolver[] args;
|
625
645
|
|
626
|
-
public CommandException(final @Nullable Caption message, final
|
646
|
+
public CommandException(final @Nullable Caption message, final TagResolver... args) {
|
627
647
|
this.message = message;
|
628
648
|
this.args = args;
|
629
649
|
}
|
@@ -19,7 +19,7 @@
|
|
19
19
|
package com.plotsquared.core.command;
|
20
20
|
|
21
21
|
import com.plotsquared.core.configuration.caption.Caption;
|
22
|
-
import net.kyori.adventure.text.minimessage.
|
22
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
23
23
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
24
24
|
|
25
25
|
/**
|
@@ -34,7 +34,7 @@ public interface CommandCaller {
|
|
34
34
|
* @param caption Caption to send
|
35
35
|
* @param replacements Variable replacements
|
36
36
|
*/
|
37
|
-
void sendMessage(@NonNull Caption caption, @NonNull
|
37
|
+
void sendMessage(@NonNull Caption caption, @NonNull TagResolver... replacements);
|
38
38
|
|
39
39
|
/**
|
40
40
|
* Check the player's permissions. <i>Will be cached if permission caching is enabled.</i>
|
@@ -22,6 +22,8 @@ import com.plotsquared.core.configuration.caption.Caption;
|
|
22
22
|
import com.plotsquared.core.configuration.caption.LocaleHolder;
|
23
23
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
24
24
|
import com.plotsquared.core.player.PlotPlayer;
|
25
|
+
import net.kyori.adventure.text.Component;
|
26
|
+
import net.kyori.adventure.text.minimessage.MiniMessage;
|
25
27
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
26
28
|
|
27
29
|
/**
|
@@ -90,6 +92,11 @@ public enum CommandCategory implements Caption {
|
|
90
92
|
return this.caption.getComponent(localeHolder);
|
91
93
|
}
|
92
94
|
|
95
|
+
@Override
|
96
|
+
public @NonNull Component toComponent(@NonNull final LocaleHolder localeHolder) {
|
97
|
+
return MiniMessage.miniMessage().deserialize(getComponent(localeHolder));
|
98
|
+
}
|
99
|
+
|
93
100
|
/**
|
94
101
|
* Checks if a player has access to this command category
|
95
102
|
*
|
@@ -27,7 +27,9 @@ import com.plotsquared.core.plot.comment.CommentInbox;
|
|
27
27
|
import com.plotsquared.core.plot.comment.CommentManager;
|
28
28
|
import com.plotsquared.core.plot.comment.PlotComment;
|
29
29
|
import com.plotsquared.core.util.StringMan;
|
30
|
-
import net.kyori.adventure.text.
|
30
|
+
import net.kyori.adventure.text.Component;
|
31
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
32
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
31
33
|
|
32
34
|
import java.util.Arrays;
|
33
35
|
import java.util.Locale;
|
@@ -44,8 +46,10 @@ public class Comment extends SubCommand {
|
|
44
46
|
if (args.length < 2) {
|
45
47
|
player.sendMessage(
|
46
48
|
TranslatableCaption.of("comment.comment_syntax"),
|
47
|
-
|
48
|
-
|
49
|
+
TagResolver.builder()
|
50
|
+
.tag("command", Tag.inserting(Component.text("/plot comment [X;Z]")))
|
51
|
+
.tag("list", Tag.inserting(Component.text(StringMan.join(CommentManager.inboxes.keySet(), "|"))))
|
52
|
+
.build()
|
49
53
|
);
|
50
54
|
return false;
|
51
55
|
}
|
@@ -64,8 +68,10 @@ public class Comment extends SubCommand {
|
|
64
68
|
if (args.length < 3) {
|
65
69
|
player.sendMessage(
|
66
70
|
TranslatableCaption.of("comment.comment_syntax"),
|
67
|
-
|
68
|
-
|
71
|
+
TagResolver.builder()
|
72
|
+
.tag("command", Tag.inserting(Component.text("/plot comment [X;Z]")))
|
73
|
+
.tag("list", Tag.inserting(Component.text(StringMan.join(CommentManager.inboxes.keySet(), "|"))))
|
74
|
+
.build()
|
69
75
|
);
|
70
76
|
return false;
|
71
77
|
}
|
@@ -76,8 +82,10 @@ public class Comment extends SubCommand {
|
|
76
82
|
if (inbox == null) {
|
77
83
|
player.sendMessage(
|
78
84
|
TranslatableCaption.of("comment.comment_syntax"),
|
79
|
-
|
80
|
-
|
85
|
+
TagResolver.builder()
|
86
|
+
.tag("command", Tag.inserting(Component.text("/plot comment [X;Z]")))
|
87
|
+
.tag("list", Tag.inserting(Component.text(StringMan.join(CommentManager.inboxes.keySet(), "|"))))
|
88
|
+
.build()
|
81
89
|
);
|
82
90
|
return false;
|
83
91
|
}
|
@@ -97,8 +105,10 @@ public class Comment extends SubCommand {
|
|
97
105
|
player.sendMessage(TranslatableCaption.of("comment.no_plot_inbox"));
|
98
106
|
player.sendMessage(
|
99
107
|
TranslatableCaption.of("comment.comment_syntax"),
|
100
|
-
|
101
|
-
|
108
|
+
TagResolver.builder()
|
109
|
+
.tag("command", Tag.inserting(Component.text("/plot comment [X;Z]")))
|
110
|
+
.tag("list", Tag.inserting(Component.text(StringMan.join(CommentManager.inboxes.keySet(), "|"))))
|
111
|
+
.build()
|
102
112
|
);
|
103
113
|
return false;
|
104
114
|
}
|
@@ -29,7 +29,9 @@ import com.plotsquared.core.util.MathMan;
|
|
29
29
|
import com.plotsquared.core.util.WorldUtil;
|
30
30
|
import com.plotsquared.core.util.task.TaskManager;
|
31
31
|
import com.plotsquared.core.util.task.TaskTime;
|
32
|
-
import net.kyori.adventure.text.
|
32
|
+
import net.kyori.adventure.text.Component;
|
33
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
34
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
33
35
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
34
36
|
|
35
37
|
import java.util.ArrayList;
|
@@ -68,7 +70,9 @@ public class Condense extends SubCommand {
|
|
68
70
|
if (args.length != 2 && args.length != 3) {
|
69
71
|
player.sendMessage(
|
70
72
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
71
|
-
|
73
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(
|
74
|
+
"/plot condense <area> <start | stop | info> [radius]"
|
75
|
+
)))
|
72
76
|
);
|
73
77
|
return false;
|
74
78
|
}
|
@@ -82,7 +86,10 @@ public class Condense extends SubCommand {
|
|
82
86
|
if (args.length == 2) {
|
83
87
|
player.sendMessage(
|
84
88
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
85
|
-
|
89
|
+
TagResolver.resolver(
|
90
|
+
"value",
|
91
|
+
Tag.inserting(Component.text("/plot condense" + area + " start " + "<radius>"))
|
92
|
+
)
|
86
93
|
);
|
87
94
|
return false;
|
88
95
|
}
|
@@ -181,8 +188,10 @@ public class Condense extends SubCommand {
|
|
181
188
|
if (result.get()) {
|
182
189
|
player.sendMessage(
|
183
190
|
TranslatableCaption.of("condense.moving"),
|
184
|
-
|
185
|
-
|
191
|
+
TagResolver.builder()
|
192
|
+
.tag("origin", Tag.inserting(Component.text(origin.toString())))
|
193
|
+
.tag("possible", Tag.inserting(Component.text(possible.toString())))
|
194
|
+
.build()
|
186
195
|
);
|
187
196
|
TaskManager.runTaskLater(task, TaskTime.ticks(1L));
|
188
197
|
}
|
@@ -202,7 +211,7 @@ public class Condense extends SubCommand {
|
|
202
211
|
if (i >= free.size()) {
|
203
212
|
player.sendMessage(
|
204
213
|
TranslatableCaption.of("condense.skipping"),
|
205
|
-
|
214
|
+
TagResolver.resolver("plot", Tag.inserting(Component.text(origin.toString())))
|
206
215
|
);
|
207
216
|
}
|
208
217
|
}
|
@@ -223,7 +232,10 @@ public class Condense extends SubCommand {
|
|
223
232
|
if (args.length == 2) {
|
224
233
|
player.sendMessage(
|
225
234
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
226
|
-
|
235
|
+
TagResolver.resolver(
|
236
|
+
"value",
|
237
|
+
Tag.inserting(Component.text("/plot condense " + area + " info <radius>"))
|
238
|
+
)
|
227
239
|
);
|
228
240
|
return false;
|
229
241
|
}
|
@@ -244,20 +256,20 @@ public class Condense extends SubCommand {
|
|
244
256
|
player.sendMessage(TranslatableCaption.of("condense.default_eval"));
|
245
257
|
player.sendMessage(
|
246
258
|
TranslatableCaption.of("condense.minimum_radius"),
|
247
|
-
|
259
|
+
TagResolver.resolver("minimumRadius", Tag.inserting(Component.text(minimumRadius)))
|
248
260
|
);
|
249
261
|
player.sendMessage(
|
250
|
-
TranslatableCaption.of("condense.
|
251
|
-
|
262
|
+
TranslatableCaption.of("condense.maximum_moved"),
|
263
|
+
TagResolver.resolver("maxMove", Tag.inserting(Component.text(maxMove)))
|
252
264
|
);
|
253
265
|
player.sendMessage(TranslatableCaption.of("condense.input_eval"));
|
254
266
|
player.sendMessage(
|
255
267
|
TranslatableCaption.of("condense.input_radius"),
|
256
|
-
|
268
|
+
TagResolver.resolver("radius", Tag.inserting(Component.text(radius)))
|
257
269
|
);
|
258
270
|
player.sendMessage(
|
259
271
|
TranslatableCaption.of("condense.estimated_moves"),
|
260
|
-
|
272
|
+
TagResolver.resolver("userMove", Tag.inserting(Component.text(userMove)))
|
261
273
|
);
|
262
274
|
player.sendMessage(TranslatableCaption.of("condense.eta"));
|
263
275
|
player.sendMessage(TranslatableCaption.of("condense.radius_measured"));
|
@@ -266,7 +278,10 @@ public class Condense extends SubCommand {
|
|
266
278
|
}
|
267
279
|
player.sendMessage(
|
268
280
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
269
|
-
|
281
|
+
TagResolver.resolver(
|
282
|
+
"value",
|
283
|
+
Tag.inserting(Component.text("/plot condense " + area.getWorldName() + " <start | stop | info> [radius]"))
|
284
|
+
)
|
270
285
|
);
|
271
286
|
return false;
|
272
287
|
}
|
@@ -29,7 +29,9 @@ import com.plotsquared.core.plot.Plot;
|
|
29
29
|
import com.plotsquared.core.plot.flag.PlotFlag;
|
30
30
|
import com.plotsquared.core.plot.flag.implementations.DoneFlag;
|
31
31
|
import com.plotsquared.core.util.EventDispatcher;
|
32
|
-
import net.kyori.adventure.text.
|
32
|
+
import net.kyori.adventure.text.Component;
|
33
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
34
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
33
35
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
34
36
|
|
35
37
|
@CommandDeclaration(command = "continue",
|
@@ -55,7 +57,9 @@ public class Continue extends SubCommand {
|
|
55
57
|
if (!plot.isOwner(player.getUUID()) && !player.hasPermission(Permission.PERMISSION_ADMIN_COMMAND_CONTINUE)) {
|
56
58
|
player.sendMessage(
|
57
59
|
TranslatableCaption.of("permission.no_permission"),
|
58
|
-
|
60
|
+
TagResolver.resolver("node", Tag.inserting(
|
61
|
+
TranslatableCaption.of("permission.no_plot_perms").toComponent(player)
|
62
|
+
))
|
59
63
|
);
|
60
64
|
return false;
|
61
65
|
}
|
@@ -68,7 +72,7 @@ public class Continue extends SubCommand {
|
|
68
72
|
< player.getPlotCount() + size)) {
|
69
73
|
player.sendMessage(
|
70
74
|
TranslatableCaption.of("permission.cant_claim_more_plots"),
|
71
|
-
|
75
|
+
TagResolver.resolver("amount", Tag.inserting(Component.text(player.getAllowedPlots())))
|
72
76
|
);
|
73
77
|
return false;
|
74
78
|
}
|
@@ -82,7 +86,7 @@ public class Continue extends SubCommand {
|
|
82
86
|
if (event.getEventResult() == Result.DENY) {
|
83
87
|
player.sendMessage(
|
84
88
|
TranslatableCaption.of("events.event_denied"),
|
85
|
-
|
89
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("Done flag removal")))
|
86
90
|
);
|
87
91
|
return true;
|
88
92
|
}
|
@@ -23,7 +23,9 @@ import com.plotsquared.core.location.Location;
|
|
23
23
|
import com.plotsquared.core.permissions.Permission;
|
24
24
|
import com.plotsquared.core.player.PlotPlayer;
|
25
25
|
import com.plotsquared.core.plot.Plot;
|
26
|
-
import net.kyori.adventure.text.
|
26
|
+
import net.kyori.adventure.text.Component;
|
27
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
28
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
27
29
|
|
28
30
|
@CommandDeclaration(command = "copy",
|
29
31
|
permission = "plots.copy",
|
@@ -48,7 +50,7 @@ public class Copy extends SubCommand {
|
|
48
50
|
if (args.length != 1) {
|
49
51
|
player.sendMessage(
|
50
52
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
51
|
-
|
53
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("/plot copy <X;Z>")))
|
52
54
|
);
|
53
55
|
return false;
|
54
56
|
}
|
@@ -67,8 +69,12 @@ public class Copy extends SubCommand {
|
|
67
69
|
|
68
70
|
plot1.getPlotModificationManager().copy(plot2, player).thenAccept(result -> {
|
69
71
|
if (result) {
|
70
|
-
player.sendMessage(
|
71
|
-
|
72
|
+
player.sendMessage(
|
73
|
+
TranslatableCaption.of("move.copy_success"),
|
74
|
+
TagResolver.builder()
|
75
|
+
.tag("origin", Tag.inserting(Component.text(plot1.toString())))
|
76
|
+
.tag("target", Tag.inserting(Component.text(plot2.toString())))
|
77
|
+
.build()
|
72
78
|
);
|
73
79
|
} else {
|
74
80
|
player.sendMessage(TranslatableCaption.of("move.requires_unowned"));
|
@@ -25,7 +25,9 @@ import com.plotsquared.core.generator.HybridUtils;
|
|
25
25
|
import com.plotsquared.core.location.Location;
|
26
26
|
import com.plotsquared.core.player.PlotPlayer;
|
27
27
|
import com.plotsquared.core.plot.Plot;
|
28
|
-
import net.kyori.adventure.text.
|
28
|
+
import net.kyori.adventure.text.Component;
|
29
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
30
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
29
31
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
30
32
|
|
31
33
|
@CommandDeclaration(command = "createroadschematic",
|
@@ -61,7 +63,7 @@ public class CreateRoadSchematic extends SubCommand {
|
|
61
63
|
this.hybridUtils.setupRoadSchematic(plot);
|
62
64
|
player.sendMessage(
|
63
65
|
TranslatableCaption.of("schematics.schematic_road_created"),
|
64
|
-
|
66
|
+
TagResolver.resolver("command", Tag.inserting(Component.text("/plot debugroadregen")))
|
65
67
|
);
|
66
68
|
return true;
|
67
69
|
}
|
@@ -40,7 +40,9 @@ import com.plotsquared.core.util.EventDispatcher;
|
|
40
40
|
import com.plotsquared.core.util.FileUtils;
|
41
41
|
import com.plotsquared.core.util.query.PlotQuery;
|
42
42
|
import com.plotsquared.core.util.task.TaskManager;
|
43
|
-
import net.kyori.adventure.text.
|
43
|
+
import net.kyori.adventure.text.Component;
|
44
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
45
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
44
46
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
45
47
|
|
46
48
|
import java.io.File;
|
@@ -101,7 +103,10 @@ public class DatabaseCommand extends SubCommand {
|
|
101
103
|
if (args.length < 1) {
|
102
104
|
player.sendMessage(
|
103
105
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
104
|
-
|
106
|
+
TagResolver.resolver(
|
107
|
+
"value",
|
108
|
+
Tag.inserting(Component.text("/plot database [area] <sqlite | mysql | import>"))
|
109
|
+
)
|
105
110
|
);
|
106
111
|
return false;
|
107
112
|
}
|
@@ -116,7 +121,7 @@ public class DatabaseCommand extends SubCommand {
|
|
116
121
|
if (args.length < 1) {
|
117
122
|
player.sendMessage(
|
118
123
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
119
|
-
|
124
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("/plot database [area] <sqlite|mysql|import>")))
|
120
125
|
);
|
121
126
|
player.sendMessage(TranslatableCaption.of("database.arg"));
|
122
127
|
return false;
|
@@ -129,7 +134,10 @@ public class DatabaseCommand extends SubCommand {
|
|
129
134
|
if (args.length < 2) {
|
130
135
|
player.sendMessage(
|
131
136
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
132
|
-
|
137
|
+
TagResolver.resolver(
|
138
|
+
"value",
|
139
|
+
Tag.inserting(Component.text("/plot database import <sqlite file> [prefix]"))
|
140
|
+
)
|
133
141
|
);
|
134
142
|
return false;
|
135
143
|
}
|
@@ -140,7 +148,7 @@ public class DatabaseCommand extends SubCommand {
|
|
140
148
|
if (!file.exists()) {
|
141
149
|
player.sendMessage(
|
142
150
|
TranslatableCaption.of("database.does_not_exist"),
|
143
|
-
|
151
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(file.toString())))
|
144
152
|
);
|
145
153
|
return false;
|
146
154
|
}
|
@@ -184,8 +192,10 @@ public class DatabaseCommand extends SubCommand {
|
|
184
192
|
}
|
185
193
|
player.sendMessage(
|
186
194
|
TranslatableCaption.of("database.skipping_duplicated_plot"),
|
187
|
-
|
188
|
-
|
195
|
+
TagResolver.builder()
|
196
|
+
.tag("plot", Tag.inserting(Component.text(plot.toString())))
|
197
|
+
.tag("id", Tag.inserting(Component.text(plot.temp)))
|
198
|
+
.build()
|
189
199
|
);
|
190
200
|
continue;
|
191
201
|
}
|
@@ -34,7 +34,8 @@ import com.plotsquared.core.uuid.UUIDMapping;
|
|
34
34
|
import com.sk89q.worldedit.world.entity.EntityType;
|
35
35
|
import net.kyori.adventure.text.Component;
|
36
36
|
import net.kyori.adventure.text.TextComponent;
|
37
|
-
import net.kyori.adventure.text.minimessage.
|
37
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
38
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
38
39
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
39
40
|
|
40
41
|
import java.util.Collection;
|
@@ -68,7 +69,10 @@ public class Debug extends SubCommand {
|
|
68
69
|
if (args.length == 0) {
|
69
70
|
player.sendMessage(
|
70
71
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
71
|
-
|
72
|
+
TagResolver.resolver(
|
73
|
+
"value",
|
74
|
+
Tag.inserting(Component.text("/plot debug <loadedchunks | player | debug-players | entitytypes | msg>"))
|
75
|
+
)
|
72
76
|
);
|
73
77
|
}
|
74
78
|
if (args.length > 0) {
|
@@ -95,7 +99,7 @@ public class Debug extends SubCommand {
|
|
95
99
|
final Collection<UUIDMapping> mappings = PlotSquared.get().getImpromptuUUIDPipeline().getAllImmediately();
|
96
100
|
player.sendMessage(
|
97
101
|
TranslatableCaption.of("debug.cached_uuids"),
|
98
|
-
|
102
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(mappings.size())))
|
99
103
|
);
|
100
104
|
return true;
|
101
105
|
}
|
@@ -104,7 +108,7 @@ public class Debug extends SubCommand {
|
|
104
108
|
for (final PlotPlayer<?> pp : PlotPlayer.getDebugModePlayers()) {
|
105
109
|
player.sendMessage(
|
106
110
|
TranslatableCaption.of("debug.player_in_debugmode_list"),
|
107
|
-
|
111
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(pp.getName())))
|
108
112
|
);
|
109
113
|
}
|
110
114
|
return true;
|
@@ -114,10 +118,11 @@ public class Debug extends SubCommand {
|
|
114
118
|
player.sendMessage(TranslatableCaption.of("debug.entity_categories"));
|
115
119
|
EntityCategory.REGISTRY.forEach(category -> {
|
116
120
|
final StringBuilder builder =
|
117
|
-
new StringBuilder("
|
121
|
+
new StringBuilder("<gray>-</gray> <gold>").append(category.getId()).append("</gold><gray>: <gold>");
|
118
122
|
for (final EntityType entityType : category.getAll()) {
|
119
123
|
builder.append(entityType.getId()).append(" ");
|
120
124
|
}
|
125
|
+
builder.append("</gold>");
|
121
126
|
player.sendMessage(StaticCaption.of("<prefix>" + builder));
|
122
127
|
});
|
123
128
|
EntityType.REGISTRY.values().stream().sorted(Comparator.comparing(EntityType::getId))
|
@@ -137,28 +142,53 @@ public class Debug extends SubCommand {
|
|
137
142
|
.getCaptionMap(TranslatableCaption.DEFAULT_NAMESPACE)
|
138
143
|
.getCaptions();
|
139
144
|
TextComponent.Builder information = Component.text();
|
140
|
-
Component header =
|
145
|
+
Component header = TranslatableCaption.of("debug.debug_header").toComponent(player)
|
146
|
+
.append(Component.newline());
|
141
147
|
String line = TranslatableCaption.of("debug.debug_line").getComponent(player) + "\n";
|
142
148
|
String section = TranslatableCaption.of("debug.debug_section").getComponent(player) + "\n";
|
143
149
|
information.append(header);
|
144
|
-
information.append(MINI_MESSAGE.
|
150
|
+
information.append(MINI_MESSAGE.deserialize(
|
151
|
+
section,
|
152
|
+
TagResolver.resolver("val", Tag.inserting(Component.text("PlotArea")))
|
153
|
+
));
|
145
154
|
information.append(MINI_MESSAGE
|
146
|
-
.
|
155
|
+
.deserialize(
|
147
156
|
line,
|
148
|
-
|
149
|
-
|
157
|
+
TagResolver.builder()
|
158
|
+
.tag("var", Tag.inserting(Component.text("Plot Worlds")))
|
159
|
+
.tag(
|
160
|
+
"val",
|
161
|
+
Tag.inserting(Component.text(StringMan.join(
|
162
|
+
this.plotAreaManager.getAllPlotAreas(),
|
163
|
+
", "
|
164
|
+
)))
|
165
|
+
)
|
166
|
+
.build()
|
150
167
|
));
|
151
168
|
information.append(
|
152
|
-
MINI_MESSAGE.
|
169
|
+
MINI_MESSAGE.deserialize(
|
153
170
|
line,
|
154
|
-
|
155
|
-
|
171
|
+
TagResolver.builder()
|
172
|
+
.tag("var", Tag.inserting(Component.text("Owned Plots")))
|
173
|
+
.tag(
|
174
|
+
"val",
|
175
|
+
Tag.inserting(Component.text(PlotQuery.newQuery().allPlots().count()))
|
176
|
+
)
|
177
|
+
.build()
|
156
178
|
));
|
157
|
-
information.append(MINI_MESSAGE.
|
158
|
-
|
179
|
+
information.append(MINI_MESSAGE.deserialize(
|
180
|
+
section,
|
181
|
+
TagResolver.resolver("val", Tag.inserting(Component.text("Messages")))
|
182
|
+
));
|
183
|
+
information.append(MINI_MESSAGE.deserialize(
|
159
184
|
line,
|
160
|
-
|
161
|
-
|
185
|
+
TagResolver.builder()
|
186
|
+
.tag("var", Tag.inserting(Component.text("Total Messages")))
|
187
|
+
.tag(
|
188
|
+
"val",
|
189
|
+
Tag.inserting(Component.text(captions.size()))
|
190
|
+
)
|
191
|
+
.build()
|
162
192
|
));
|
163
193
|
player.sendMessage(StaticCaption.of(MINI_MESSAGE.serialize(information.build())));
|
164
194
|
return true;
|
@@ -36,7 +36,9 @@ import com.plotsquared.core.util.EventDispatcher;
|
|
36
36
|
import com.plotsquared.core.util.StringMan;
|
37
37
|
import com.plotsquared.core.util.query.PlotQuery;
|
38
38
|
import com.plotsquared.core.util.task.RunnableVal;
|
39
|
-
import net.kyori.adventure.text.
|
39
|
+
import net.kyori.adventure.text.Component;
|
40
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
41
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
40
42
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
41
43
|
|
42
44
|
import java.util.Arrays;
|
@@ -95,7 +97,7 @@ public class DebugExec extends SubCommand {
|
|
95
97
|
if (analysis != null) {
|
96
98
|
player.sendMessage(
|
97
99
|
TranslatableCaption.of("debugexec.changes_column"),
|
98
|
-
|
100
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(analysis.changes)))
|
99
101
|
);
|
100
102
|
return true;
|
101
103
|
}
|
@@ -105,7 +107,7 @@ public class DebugExec extends SubCommand {
|
|
105
107
|
public void run(PlotAnalysis value) {
|
106
108
|
player.sendMessage(
|
107
109
|
TranslatableCaption.of("debugexec.analyze_done"),
|
108
|
-
|
110
|
+
TagResolver.resolver("command", Tag.inserting(Component.text("/plot debugexec analyze")))
|
109
111
|
);
|
110
112
|
}
|
111
113
|
});
|
@@ -115,7 +117,10 @@ public class DebugExec extends SubCommand {
|
|
115
117
|
if (args.length != 2) {
|
116
118
|
player.sendMessage(
|
117
119
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
118
|
-
|
120
|
+
TagResolver.resolver(
|
121
|
+
"value",
|
122
|
+
Tag.inserting(Component.text("/plot debugexec analyze <threshold>"))
|
123
|
+
)
|
119
124
|
);
|
120
125
|
player.sendMessage(TranslatableCaption.of("debugexec.threshold_default"));
|
121
126
|
return false;
|
@@ -126,7 +131,7 @@ public class DebugExec extends SubCommand {
|
|
126
131
|
} catch (NumberFormatException ignored) {
|
127
132
|
player.sendMessage(
|
128
133
|
TranslatableCaption.of("debugexec.invalid_threshold"),
|
129
|
-
|
134
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(args[1])))
|
130
135
|
);
|
131
136
|
player.sendMessage(TranslatableCaption.of("debugexec.threshold_default_double"));
|
132
137
|
return false;
|
@@ -157,7 +162,7 @@ public class DebugExec extends SubCommand {
|
|
157
162
|
if (args.length != 2) {
|
158
163
|
player.sendMessage(
|
159
164
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
160
|
-
|
165
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("/plot debugexec remove-flag <flag>")))
|
161
166
|
);
|
162
167
|
return false;
|
163
168
|
}
|
@@ -175,7 +180,7 @@ public class DebugExec extends SubCommand {
|
|
175
180
|
}
|
176
181
|
player.sendMessage(
|
177
182
|
TranslatableCaption.of("debugexec.cleared_flag"),
|
178
|
-
|
183
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(flag)))
|
179
184
|
);
|
180
185
|
return true;
|
181
186
|
}
|
@@ -183,7 +188,10 @@ public class DebugExec extends SubCommand {
|
|
183
188
|
if (args.length != 2) {
|
184
189
|
player.sendMessage(
|
185
190
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
186
|
-
|
191
|
+
TagResolver.resolver(
|
192
|
+
"value",
|
193
|
+
Tag.inserting(Component.text("Invalid syntax: /plot debugexec start-rgar <world>"))
|
194
|
+
)
|
187
195
|
);
|
188
196
|
return false;
|
189
197
|
}
|
@@ -191,7 +199,7 @@ public class DebugExec extends SubCommand {
|
|
191
199
|
if (area == null) {
|
192
200
|
player.sendMessage(
|
193
201
|
TranslatableCaption.of("errors.not_valid_plot_world"),
|
194
|
-
|
202
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(args[1])))
|
195
203
|
);
|
196
204
|
return false;
|
197
205
|
}
|
@@ -31,7 +31,9 @@ import com.plotsquared.core.inject.annotations.WorldFile;
|
|
31
31
|
import com.plotsquared.core.player.PlotPlayer;
|
32
32
|
import com.plotsquared.core.util.PremiumVerification;
|
33
33
|
import com.plotsquared.core.util.task.TaskManager;
|
34
|
-
import net.kyori.adventure.text.
|
34
|
+
import net.kyori.adventure.text.Component;
|
35
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
36
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
35
37
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
36
38
|
|
37
39
|
import java.io.File;
|
@@ -69,9 +71,9 @@ public class DebugPaste extends SubCommand {
|
|
69
71
|
StringBuilder b = new StringBuilder();
|
70
72
|
b.append(
|
71
73
|
"""
|
72
|
-
|
73
|
-
|
74
|
-
|
74
|
+
# Welcome to this paste
|
75
|
+
# It is meant to provide us at IntellectualSites with better information about your problem
|
76
|
+
"""
|
75
77
|
);
|
76
78
|
b.append("# PlotSquared Information\n");
|
77
79
|
b.append("PlotSquared Version: ").append(PlotSquared.get().getVersion())
|
@@ -131,8 +133,10 @@ public class DebugPaste extends SubCommand {
|
|
131
133
|
} catch (IOException ignored) {
|
132
134
|
player.sendMessage(
|
133
135
|
TranslatableCaption.of("debugpaste.latest_log"),
|
134
|
-
|
135
|
-
|
136
|
+
TagResolver.builder()
|
137
|
+
.tag("file", Tag.inserting(Component.text("latest.log")))
|
138
|
+
.tag("size", Tag.inserting(Component.text("14MB")))
|
139
|
+
.build()
|
136
140
|
);
|
137
141
|
}
|
138
142
|
|
@@ -141,7 +145,7 @@ public class DebugPaste extends SubCommand {
|
|
141
145
|
} catch (final IllegalArgumentException ignored) {
|
142
146
|
player.sendMessage(
|
143
147
|
TranslatableCaption.of("debugpaste.empty_file"),
|
144
|
-
|
148
|
+
TagResolver.resolver("file", Tag.inserting(Component.text("settings.yml")))
|
145
149
|
);
|
146
150
|
}
|
147
151
|
try {
|
@@ -149,7 +153,7 @@ public class DebugPaste extends SubCommand {
|
|
149
153
|
} catch (final IllegalArgumentException ignored) {
|
150
154
|
player.sendMessage(
|
151
155
|
TranslatableCaption.of("debugpaste.empty_file"),
|
152
|
-
|
156
|
+
TagResolver.resolver("file", Tag.inserting(Component.text("worlds.yml")))
|
153
157
|
);
|
154
158
|
}
|
155
159
|
|
@@ -162,7 +166,7 @@ public class DebugPaste extends SubCommand {
|
|
162
166
|
} catch (final IOException ignored) {
|
163
167
|
player.sendMessage(
|
164
168
|
TranslatableCaption.of("debugpaste.skip_multiverse"),
|
165
|
-
|
169
|
+
TagResolver.resolver("file", Tag.inserting(Component.text("worlds.yml")))
|
166
170
|
);
|
167
171
|
}
|
168
172
|
|
@@ -177,20 +181,20 @@ public class DebugPaste extends SubCommand {
|
|
177
181
|
String.format("https://athion.net/ISPaster/paste/view/%s", pasteId);
|
178
182
|
player.sendMessage(
|
179
183
|
TranslatableCaption.of("debugpaste.debug_report_created"),
|
180
|
-
|
184
|
+
TagResolver.resolver("url", Tag.preProcessParsed(link))
|
181
185
|
);
|
182
186
|
} else {
|
183
187
|
final String responseMessage = jsonObject.get("response").getAsString();
|
184
188
|
player.sendMessage(
|
185
189
|
TranslatableCaption.of("debugpaste.creation_failed"),
|
186
|
-
|
190
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(responseMessage)))
|
187
191
|
);
|
188
192
|
}
|
189
193
|
} catch (final Throwable throwable) {
|
190
194
|
throwable.printStackTrace();
|
191
195
|
player.sendMessage(
|
192
196
|
TranslatableCaption.of("debugpaste.creation_failed"),
|
193
|
-
|
197
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(throwable.getMessage())))
|
194
198
|
);
|
195
199
|
}
|
196
200
|
} catch (IOException e) {
|
@@ -28,7 +28,9 @@ import com.plotsquared.core.plot.Plot;
|
|
28
28
|
import com.plotsquared.core.plot.PlotArea;
|
29
29
|
import com.plotsquared.core.plot.PlotManager;
|
30
30
|
import com.plotsquared.core.queue.QueueCoordinator;
|
31
|
-
import net.kyori.adventure.text.
|
31
|
+
import net.kyori.adventure.text.Component;
|
32
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
33
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
32
34
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
33
35
|
|
34
36
|
import java.util.Arrays;
|
@@ -60,7 +62,7 @@ public class DebugRoadRegen extends SubCommand {
|
|
60
62
|
if (args.length < 1) {
|
61
63
|
player.sendMessage(
|
62
64
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
63
|
-
|
65
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(DebugRoadRegen.USAGE)))
|
64
66
|
);
|
65
67
|
return false;
|
66
68
|
}
|
@@ -73,16 +75,19 @@ public class DebugRoadRegen extends SubCommand {
|
|
73
75
|
}
|
74
76
|
String kind = args[0].toLowerCase();
|
75
77
|
switch (kind) {
|
76
|
-
case "plot"
|
78
|
+
case "plot" -> {
|
77
79
|
return regenPlot(player);
|
78
|
-
|
80
|
+
}
|
81
|
+
case "region" -> {
|
79
82
|
return regenRegion(player, Arrays.copyOfRange(args, 1, args.length));
|
80
|
-
|
83
|
+
}
|
84
|
+
default -> {
|
81
85
|
player.sendMessage(
|
82
86
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
83
|
-
|
87
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(DebugRoadRegen.USAGE)))
|
84
88
|
);
|
85
89
|
return false;
|
90
|
+
}
|
86
91
|
}
|
87
92
|
}
|
88
93
|
|
@@ -91,6 +96,7 @@ public class DebugRoadRegen extends SubCommand {
|
|
91
96
|
PlotArea area = location.getPlotArea();
|
92
97
|
if (area == null) {
|
93
98
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world"));
|
99
|
+
return false;
|
94
100
|
}
|
95
101
|
Plot plot = player.getCurrentPlot();
|
96
102
|
if (plot == null) {
|
@@ -103,11 +109,11 @@ public class DebugRoadRegen extends SubCommand {
|
|
103
109
|
queue.setCompleteTask(() -> {
|
104
110
|
player.sendMessage(
|
105
111
|
TranslatableCaption.of("debugroadregen.regen_done"),
|
106
|
-
|
112
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(plot.getId().toString())))
|
107
113
|
);
|
108
114
|
player.sendMessage(
|
109
115
|
TranslatableCaption.of("debugroadregen.regen_all"),
|
110
|
-
|
116
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("/plot regenallroads")))
|
111
117
|
);
|
112
118
|
});
|
113
119
|
manager.createRoadEast(plot, queue);
|
@@ -126,18 +132,18 @@ public class DebugRoadRegen extends SubCommand {
|
|
126
132
|
} catch (NumberFormatException ignored) {
|
127
133
|
player.sendMessage(
|
128
134
|
TranslatableCaption.of("invalid.not_valid_number"),
|
129
|
-
|
135
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("0, 256")))
|
130
136
|
);
|
131
137
|
player.sendMessage(
|
132
138
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
133
|
-
|
139
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(DebugRoadRegen.USAGE)))
|
134
140
|
);
|
135
141
|
return false;
|
136
142
|
}
|
137
143
|
} else if (args.length != 0) {
|
138
144
|
player.sendMessage(
|
139
145
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
140
|
-
|
146
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(DebugRoadRegen.USAGE)))
|
141
147
|
);
|
142
148
|
return false;
|
143
149
|
}
|
@@ -155,11 +161,11 @@ public class DebugRoadRegen extends SubCommand {
|
|
155
161
|
}
|
156
162
|
player.sendMessage(
|
157
163
|
TranslatableCaption.of("debugroadregen.schematic"),
|
158
|
-
|
164
|
+
TagResolver.resolver("command", Tag.inserting(Component.text("/plot createroadschematic")))
|
159
165
|
);
|
160
166
|
player.sendMessage(
|
161
167
|
TranslatableCaption.of("debugroadregen.regenallroads"),
|
162
|
-
|
168
|
+
TagResolver.resolver("command", Tag.inserting(Component.text("/plot regenallroads")))
|
163
169
|
);
|
164
170
|
boolean result = this.hybridUtils.scheduleSingleRegionRoadUpdate(plot, height);
|
165
171
|
if (!result) {
|
@@ -32,7 +32,9 @@ import com.plotsquared.core.util.EconHandler;
|
|
32
32
|
import com.plotsquared.core.util.EventDispatcher;
|
33
33
|
import com.plotsquared.core.util.PlotExpression;
|
34
34
|
import com.plotsquared.core.util.task.TaskManager;
|
35
|
-
import net.kyori.adventure.text.
|
35
|
+
import net.kyori.adventure.text.Component;
|
36
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
37
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
36
38
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
37
39
|
|
38
40
|
|
@@ -77,7 +79,7 @@ public class Delete extends SubCommand {
|
|
77
79
|
if (eventResult == Result.DENY) {
|
78
80
|
player.sendMessage(
|
79
81
|
TranslatableCaption.of("events.event_denied"),
|
80
|
-
|
82
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("Delete")))
|
81
83
|
);
|
82
84
|
return true;
|
83
85
|
}
|
@@ -112,14 +114,17 @@ public class Delete extends SubCommand {
|
|
112
114
|
this.econHandler.depositMoney(player, value);
|
113
115
|
player.sendMessage(
|
114
116
|
TranslatableCaption.of("economy.added_balance"),
|
115
|
-
|
117
|
+
TagResolver.resolver("money", Tag.inserting(Component.text(this.econHandler.format(value))))
|
116
118
|
);
|
117
119
|
}
|
118
120
|
}
|
119
121
|
player.sendMessage(
|
120
122
|
TranslatableCaption.of("working.deleting_done"),
|
121
|
-
|
122
|
-
|
123
|
+
TagResolver.resolver(
|
124
|
+
"amount",
|
125
|
+
Tag.inserting(Component.text(String.valueOf(System.currentTimeMillis() - start)))
|
126
|
+
),
|
127
|
+
TagResolver.resolver("plot", Tag.inserting(Component.text(plot.getId().toString())))
|
123
128
|
);
|
124
129
|
eventDispatcher.callPostDelete(plot);
|
125
130
|
});
|
@@ -34,7 +34,9 @@ import com.plotsquared.core.util.PlayerManager;
|
|
34
34
|
import com.plotsquared.core.util.TabCompletions;
|
35
35
|
import com.plotsquared.core.util.WorldUtil;
|
36
36
|
import com.sk89q.worldedit.world.gamemode.GameModes;
|
37
|
-
import net.kyori.adventure.text.
|
37
|
+
import net.kyori.adventure.text.Component;
|
38
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
39
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
38
40
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
39
41
|
|
40
42
|
import java.util.Collection;
|
@@ -88,7 +90,7 @@ public class Deny extends SubCommand {
|
|
88
90
|
if (size >= maxDenySize) {
|
89
91
|
player.sendMessage(
|
90
92
|
TranslatableCaption.of("members.plot_max_members_denied"),
|
91
|
-
|
93
|
+
TagResolver.resolver("amount", Tag.inserting(Component.text(size)))
|
92
94
|
);
|
93
95
|
return false;
|
94
96
|
}
|
@@ -99,7 +101,7 @@ public class Deny extends SubCommand {
|
|
99
101
|
} else if (throwable != null || uuids.isEmpty()) {
|
100
102
|
player.sendMessage(
|
101
103
|
TranslatableCaption.of("errors.invalid_player"),
|
102
|
-
|
104
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(args[0])))
|
103
105
|
);
|
104
106
|
} else {
|
105
107
|
for (UUID uuid : uuids) {
|
@@ -107,7 +109,7 @@ public class Deny extends SubCommand {
|
|
107
109
|
player.hasPermission(Permission.PERMISSION_DENY_EVERYONE) || player.hasPermission(Permission.PERMISSION_ADMIN_COMMAND_DENY))) {
|
108
110
|
player.sendMessage(
|
109
111
|
TranslatableCaption.of("errors.invalid_player"),
|
110
|
-
|
112
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(args[0])))
|
111
113
|
);
|
112
114
|
} else if (plot.isOwner(uuid)) {
|
113
115
|
player.sendMessage(TranslatableCaption.of("deny.cant_remove_owner"));
|
@@ -115,7 +117,10 @@ public class Deny extends SubCommand {
|
|
115
117
|
} else if (plot.getDenied().contains(uuid)) {
|
116
118
|
player.sendMessage(
|
117
119
|
TranslatableCaption.of("member.already_added"),
|
118
|
-
|
120
|
+
TagResolver.resolver(
|
121
|
+
"player",
|
122
|
+
Tag.inserting(PlayerManager.resolveName(uuid).toComponent(player))
|
123
|
+
)
|
119
124
|
);
|
120
125
|
return;
|
121
126
|
} else {
|
@@ -27,7 +27,9 @@ import com.plotsquared.core.player.PlotPlayer;
|
|
27
27
|
import com.plotsquared.core.plot.Plot;
|
28
28
|
import com.plotsquared.core.plot.flag.implementations.DescriptionFlag;
|
29
29
|
import com.plotsquared.core.util.EventDispatcher;
|
30
|
-
import net.kyori.adventure.text.
|
30
|
+
import net.kyori.adventure.text.Component;
|
31
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
32
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
31
33
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
32
34
|
|
33
35
|
@CommandDeclaration(command = "setdescription",
|
@@ -54,7 +56,7 @@ public class Desc extends SetCommand {
|
|
54
56
|
if (event.getEventResult() == Result.DENY) {
|
55
57
|
player.sendMessage(
|
56
58
|
TranslatableCaption.of("events.event_denied"),
|
57
|
-
|
59
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("Description removal")))
|
58
60
|
);
|
59
61
|
return false;
|
60
62
|
}
|
@@ -69,7 +71,7 @@ public class Desc extends SetCommand {
|
|
69
71
|
if (event.getEventResult() == Result.DENY) {
|
70
72
|
player.sendMessage(
|
71
73
|
TranslatableCaption.of("events.event_denied"),
|
72
|
-
|
74
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("Description set")))
|
73
75
|
);
|
74
76
|
return false;
|
75
77
|
}
|
@@ -35,7 +35,9 @@ import com.plotsquared.core.plot.flag.PlotFlag;
|
|
35
35
|
import com.plotsquared.core.plot.flag.implementations.DoneFlag;
|
36
36
|
import com.plotsquared.core.util.EventDispatcher;
|
37
37
|
import com.plotsquared.core.util.task.RunnableVal;
|
38
|
-
import net.kyori.adventure.text.
|
38
|
+
import net.kyori.adventure.text.Component;
|
39
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
40
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
39
41
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
40
42
|
|
41
43
|
@CommandDeclaration(command = "done",
|
@@ -69,7 +71,7 @@ public class Done extends SubCommand {
|
|
69
71
|
if (event.getEventResult() == Result.DENY) {
|
70
72
|
player.sendMessage(
|
71
73
|
TranslatableCaption.of("events.event_denied"),
|
72
|
-
|
74
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("Done")))
|
73
75
|
);
|
74
76
|
return true;
|
75
77
|
}
|
@@ -89,7 +91,7 @@ public class Done extends SubCommand {
|
|
89
91
|
plot.addRunning();
|
90
92
|
player.sendMessage(
|
91
93
|
TranslatableCaption.of("web.generating_link"),
|
92
|
-
|
94
|
+
TagResolver.resolver("plot", Tag.inserting(Component.text(plot.getId().toString())))
|
93
95
|
);
|
94
96
|
final Settings.Auto_Clear doneRequirements = Settings.AUTO_CLEAR.get("done");
|
95
97
|
if (PlotSquared.platform().expireManager() == null || doneRequirements == null) {
|
@@ -101,7 +103,7 @@ public class Done extends SubCommand {
|
|
101
103
|
public void run(PlotAnalysis value) {
|
102
104
|
plot.removeRunning();
|
103
105
|
boolean result =
|
104
|
-
value.getComplexity(doneRequirements)
|
106
|
+
value.getComplexity(doneRequirements) >= doneRequirements.THRESHOLD;
|
105
107
|
finish(plot, player, result);
|
106
108
|
}
|
107
109
|
});
|
@@ -33,7 +33,9 @@ import com.plotsquared.core.util.StringMan;
|
|
33
33
|
import com.plotsquared.core.util.TabCompletions;
|
34
34
|
import com.plotsquared.core.util.WorldUtil;
|
35
35
|
import com.plotsquared.core.util.task.RunnableVal;
|
36
|
-
import net.kyori.adventure.text.
|
36
|
+
import net.kyori.adventure.text.Component;
|
37
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
38
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
37
39
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
38
40
|
|
39
41
|
import java.net.URL;
|
@@ -111,7 +113,10 @@ public class Download extends SubCommand {
|
|
111
113
|
if (!player.hasPermission(Permission.PERMISSION_DOWNLOAD_WORLD)) {
|
112
114
|
player.sendMessage(
|
113
115
|
TranslatableCaption.of("permission.no_permission"),
|
114
|
-
|
116
|
+
TagResolver.resolver(
|
117
|
+
"node",
|
118
|
+
Tag.inserting(Permission.PERMISSION_DOWNLOAD_WORLD)
|
119
|
+
)
|
115
120
|
);
|
116
121
|
return false;
|
117
122
|
}
|
@@ -125,18 +130,24 @@ public class Download extends SubCommand {
|
|
125
130
|
if (url == null) {
|
126
131
|
player.sendMessage(
|
127
132
|
TranslatableCaption.of("web.generating_link_failed"),
|
128
|
-
|
133
|
+
TagResolver.resolver("plot", Tag.inserting(Component.text(plot.getId().toString())))
|
129
134
|
);
|
130
135
|
return;
|
131
136
|
}
|
132
|
-
player.sendMessage(
|
137
|
+
player.sendMessage(
|
138
|
+
TranslatableCaption.of("web.generation_link_success_legacy_world"),
|
139
|
+
TagResolver.resolver("url", Tag.inserting(Component.text(url.toString())))
|
140
|
+
);
|
133
141
|
}
|
134
142
|
});
|
135
143
|
} else {
|
136
144
|
sendUsage(player);
|
137
145
|
return false;
|
138
146
|
}
|
139
|
-
player.sendMessage(
|
147
|
+
player.sendMessage(
|
148
|
+
TranslatableCaption.of("web.generating_link"),
|
149
|
+
TagResolver.resolver("plot", Tag.inserting(Component.text(plot.getId().toString())))
|
150
|
+
);
|
140
151
|
return true;
|
141
152
|
}
|
142
153
|
|
@@ -174,20 +185,25 @@ public class Download extends SubCommand {
|
|
174
185
|
if (Settings.Web.LEGACY_WEBINTERFACE) {
|
175
186
|
schematicHandler
|
176
187
|
.getCompoundTag(plot)
|
177
|
-
.whenComplete((compoundTag, throwable) ->
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
+
.whenComplete((compoundTag, throwable) -> schematicHandler.upload(
|
189
|
+
compoundTag,
|
190
|
+
null,
|
191
|
+
null,
|
192
|
+
new RunnableVal<>() {
|
193
|
+
@Override
|
194
|
+
public void run(URL value) {
|
195
|
+
plot.removeRunning();
|
196
|
+
player.sendMessage(
|
197
|
+
TranslatableCaption.of("web.generation_link_success"),
|
198
|
+
TagResolver.builder()
|
199
|
+
.tag("download", Tag.preProcessParsed(value.toString()))
|
200
|
+
.tag("delete", Tag.preProcessParsed("Not available"))
|
201
|
+
.build()
|
202
|
+
);
|
203
|
+
player.sendMessage(StaticCaption.of(value.toString()));
|
204
|
+
}
|
188
205
|
}
|
189
|
-
|
190
|
-
});
|
206
|
+
));
|
191
207
|
return;
|
192
208
|
}
|
193
209
|
// TODO legacy support
|
@@ -196,13 +212,15 @@ public class Download extends SubCommand {
|
|
196
212
|
if (throwable != null || !result.isSuccess()) {
|
197
213
|
player.sendMessage(
|
198
214
|
TranslatableCaption.of("web.generating_link_failed"),
|
199
|
-
|
215
|
+
TagResolver.resolver("plot", Tag.inserting(Component.text(plot.getId().toString())))
|
200
216
|
);
|
201
217
|
} else {
|
202
218
|
player.sendMessage(
|
203
219
|
TranslatableCaption.of("web.generation_link_success"),
|
204
|
-
|
205
|
-
|
220
|
+
TagResolver.builder()
|
221
|
+
.tag("download", Tag.preProcessParsed(result.getDownloadUrl()))
|
222
|
+
.tag("delete", Tag.preProcessParsed(result.getDeletionUrl()))
|
223
|
+
.build()
|
206
224
|
);
|
207
225
|
}
|
208
226
|
});
|
@@ -23,7 +23,6 @@ import com.plotsquared.core.PlotSquared;
|
|
23
23
|
import com.plotsquared.core.configuration.Settings;
|
24
24
|
import com.plotsquared.core.configuration.caption.CaptionUtility;
|
25
25
|
import com.plotsquared.core.configuration.caption.StaticCaption;
|
26
|
-
import com.plotsquared.core.configuration.caption.Templates;
|
27
26
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
28
27
|
import com.plotsquared.core.events.PlotFlagAddEvent;
|
29
28
|
import com.plotsquared.core.events.PlotFlagRemoveEvent;
|
@@ -47,7 +46,9 @@ import com.plotsquared.core.util.task.RunnableVal2;
|
|
47
46
|
import com.plotsquared.core.util.task.RunnableVal3;
|
48
47
|
import net.kyori.adventure.text.Component;
|
49
48
|
import net.kyori.adventure.text.TextComponent;
|
50
|
-
import net.kyori.adventure.text.
|
49
|
+
import net.kyori.adventure.text.format.Style;
|
50
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
51
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
51
52
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
52
53
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
53
54
|
|
@@ -84,7 +85,10 @@ public final class FlagCommand extends Command {
|
|
84
85
|
private static boolean sendMessage(PlotPlayer<?> player) {
|
85
86
|
player.sendMessage(
|
86
87
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
87
|
-
|
88
|
+
TagResolver.resolver(
|
89
|
+
"value",
|
90
|
+
Tag.inserting(Component.text("/plot flag <set | remove | add | list | info> <flag> <value>"))
|
91
|
+
)
|
88
92
|
);
|
89
93
|
return true;
|
90
94
|
}
|
@@ -110,9 +114,9 @@ public final class FlagCommand extends Command {
|
|
110
114
|
if (!result) {
|
111
115
|
player.sendMessage(
|
112
116
|
TranslatableCaption.of("permission.no_permission"),
|
113
|
-
|
117
|
+
TagResolver.resolver(
|
114
118
|
"node",
|
115
|
-
perm + "." + numeric
|
119
|
+
Tag.inserting(Component.text(perm + "." + numeric))
|
116
120
|
)
|
117
121
|
);
|
118
122
|
}
|
@@ -129,16 +133,21 @@ public final class FlagCommand extends Command {
|
|
129
133
|
);
|
130
134
|
final boolean result = player.hasPermission(permission);
|
131
135
|
if (!result) {
|
132
|
-
player.sendMessage(
|
136
|
+
player.sendMessage(
|
137
|
+
TranslatableCaption.of("permission.no_permission"),
|
138
|
+
TagResolver.resolver("node", Tag.inserting(Component.text(permission)))
|
139
|
+
);
|
133
140
|
return false;
|
134
141
|
}
|
135
142
|
}
|
136
143
|
} catch (final FlagParseException e) {
|
137
144
|
player.sendMessage(
|
138
145
|
TranslatableCaption.of("flag.flag_parse_error"),
|
139
|
-
|
140
|
-
|
141
|
-
|
146
|
+
TagResolver.builder()
|
147
|
+
.tag("flag_name", Tag.inserting(Component.text(flag.getName())))
|
148
|
+
.tag("flag_value", Tag.inserting(Component.text(e.getValue())))
|
149
|
+
.tag("error", Tag.inserting(e.getErrorMessage().toComponent(player)))
|
150
|
+
.build()
|
142
151
|
);
|
143
152
|
return false;
|
144
153
|
} catch (final Exception e) {
|
@@ -155,7 +164,10 @@ public final class FlagCommand extends Command {
|
|
155
164
|
perm = basePerm;
|
156
165
|
}
|
157
166
|
if (!result) {
|
158
|
-
player.sendMessage(
|
167
|
+
player.sendMessage(
|
168
|
+
TranslatableCaption.of("permission.no_permission"),
|
169
|
+
TagResolver.resolver("node", Tag.inserting(Component.text(perm)))
|
170
|
+
);
|
159
171
|
}
|
160
172
|
return result;
|
161
173
|
}
|
@@ -179,7 +191,7 @@ public final class FlagCommand extends Command {
|
|
179
191
|
if (!plot.isOwner(player.getUUID()) && !player.hasPermission(Permission.PERMISSION_SET_FLAG_OTHER)) {
|
180
192
|
player.sendMessage(
|
181
193
|
TranslatableCaption.of("permission.no_permission"),
|
182
|
-
|
194
|
+
TagResolver.resolver("node", Tag.inserting(Permission.PERMISSION_SET_FLAG_OTHER))
|
183
195
|
);
|
184
196
|
return false;
|
185
197
|
}
|
@@ -214,7 +226,7 @@ public final class FlagCommand extends Command {
|
|
214
226
|
if (best != null) {
|
215
227
|
player.sendMessage(
|
216
228
|
TranslatableCaption.of("flag.not_valid_flag_suggested"),
|
217
|
-
|
229
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(best)))
|
218
230
|
);
|
219
231
|
suggested = true;
|
220
232
|
}
|
@@ -323,7 +335,7 @@ public final class FlagCommand extends Command {
|
|
323
335
|
if (args.length < 2) {
|
324
336
|
player.sendMessage(
|
325
337
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
326
|
-
|
338
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("/plot flag set <flag> <value>")))
|
327
339
|
);
|
328
340
|
return;
|
329
341
|
}
|
@@ -336,7 +348,7 @@ public final class FlagCommand extends Command {
|
|
336
348
|
if (event.getEventResult() == Result.DENY) {
|
337
349
|
player.sendMessage(
|
338
350
|
TranslatableCaption.of("events.event_denied"),
|
339
|
-
|
351
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("Flag set")))
|
340
352
|
);
|
341
353
|
return;
|
342
354
|
}
|
@@ -352,15 +364,21 @@ public final class FlagCommand extends Command {
|
|
352
364
|
} catch (final FlagParseException e) {
|
353
365
|
player.sendMessage(
|
354
366
|
TranslatableCaption.of("flag.flag_parse_error"),
|
355
|
-
|
356
|
-
|
357
|
-
|
367
|
+
TagResolver.builder()
|
368
|
+
.tag("flag_name", Tag.inserting(Component.text(plotFlag.getName())))
|
369
|
+
.tag("flag_value", Tag.inserting(Component.text(e.getValue())))
|
370
|
+
.tag("error", Tag.inserting(e.getErrorMessage().toComponent(player)))
|
371
|
+
.build()
|
358
372
|
);
|
359
373
|
return;
|
360
374
|
}
|
361
375
|
plot.setFlag(parsed);
|
362
|
-
player.sendMessage(
|
363
|
-
|
376
|
+
player.sendMessage(
|
377
|
+
TranslatableCaption.of("flag.flag_added"),
|
378
|
+
TagResolver.builder()
|
379
|
+
.tag("flag", Tag.inserting(Component.text(args[0])))
|
380
|
+
.tag("value", Tag.inserting(Component.text(parsed.toString())))
|
381
|
+
.build()
|
364
382
|
);
|
365
383
|
}
|
366
384
|
|
@@ -382,7 +400,7 @@ public final class FlagCommand extends Command {
|
|
382
400
|
if (args.length < 2) {
|
383
401
|
player.sendMessage(
|
384
402
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
385
|
-
|
403
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("/plot flag add <flag> <values>")))
|
386
404
|
);
|
387
405
|
return;
|
388
406
|
}
|
@@ -395,7 +413,7 @@ public final class FlagCommand extends Command {
|
|
395
413
|
if (event.getEventResult() == Result.DENY) {
|
396
414
|
player.sendMessage(
|
397
415
|
TranslatableCaption.of("events.event_denied"),
|
398
|
-
|
416
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("Flag add")))
|
399
417
|
);
|
400
418
|
return;
|
401
419
|
}
|
@@ -416,9 +434,11 @@ public final class FlagCommand extends Command {
|
|
416
434
|
} catch (FlagParseException e) {
|
417
435
|
player.sendMessage(
|
418
436
|
TranslatableCaption.of("flag.flag_parse_error"),
|
419
|
-
|
420
|
-
|
421
|
-
|
437
|
+
TagResolver.builder()
|
438
|
+
.tag("flag_name", Tag.inserting(Component.text(plotFlag.getName())))
|
439
|
+
.tag("flag_value", Tag.inserting(Component.text(e.getValue())))
|
440
|
+
.tag("error", Tag.inserting(e.getErrorMessage().toComponent(player)))
|
441
|
+
.build()
|
422
442
|
);
|
423
443
|
return;
|
424
444
|
}
|
@@ -428,8 +448,12 @@ public final class FlagCommand extends Command {
|
|
428
448
|
player.sendMessage(TranslatableCaption.of("flag.flag_not_added"));
|
429
449
|
return;
|
430
450
|
}
|
431
|
-
player.sendMessage(
|
432
|
-
|
451
|
+
player.sendMessage(
|
452
|
+
TranslatableCaption.of("flag.flag_added"),
|
453
|
+
TagResolver.builder()
|
454
|
+
.tag("flag", Tag.inserting(Component.text(args[0])))
|
455
|
+
.tag("value", Tag.inserting(Component.text(parsed.toString())))
|
456
|
+
.build()
|
433
457
|
);
|
434
458
|
}
|
435
459
|
|
@@ -451,7 +475,7 @@ public final class FlagCommand extends Command {
|
|
451
475
|
if (args.length != 1 && args.length != 2) {
|
452
476
|
player.sendMessage(
|
453
477
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
454
|
-
|
478
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("/plot flag remove <flag> [values]")))
|
455
479
|
);
|
456
480
|
return;
|
457
481
|
}
|
@@ -465,7 +489,7 @@ public final class FlagCommand extends Command {
|
|
465
489
|
if (event.getEventResult() == Result.DENY) {
|
466
490
|
player.sendMessage(
|
467
491
|
TranslatableCaption.of("events.event_denied"),
|
468
|
-
|
492
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("Flag remove")))
|
469
493
|
);
|
470
494
|
return;
|
471
495
|
}
|
@@ -475,7 +499,10 @@ public final class FlagCommand extends Command {
|
|
475
499
|
if (args.length != 2) {
|
476
500
|
player.sendMessage(
|
477
501
|
TranslatableCaption.of("permission.no_permission"),
|
478
|
-
|
502
|
+
TagResolver.resolver(
|
503
|
+
"node",
|
504
|
+
Tag.inserting(Component.text(Permission.PERMISSION_SET_FLAG_KEY.format(args[0].toLowerCase())))
|
505
|
+
)
|
479
506
|
);
|
480
507
|
return;
|
481
508
|
}
|
@@ -490,9 +517,11 @@ public final class FlagCommand extends Command {
|
|
490
517
|
} catch (final FlagParseException e) {
|
491
518
|
player.sendMessage(
|
492
519
|
TranslatableCaption.of("flag.flag_parse_error"),
|
493
|
-
|
494
|
-
|
495
|
-
|
520
|
+
TagResolver.builder()
|
521
|
+
.tag("flag_name", Tag.inserting(Component.text(flag.getName())))
|
522
|
+
.tag("flag_value", Tag.inserting(Component.text(e.getValue())))
|
523
|
+
.tag("error", Tag.inserting(e.getErrorMessage().toComponent(player)))
|
524
|
+
.build()
|
496
525
|
);
|
497
526
|
return;
|
498
527
|
}
|
@@ -503,10 +532,13 @@ public final class FlagCommand extends Command {
|
|
503
532
|
if (list.removeAll((List) parsedFlag.getValue())) {
|
504
533
|
if (list.isEmpty()) {
|
505
534
|
if (plot.removeFlag(flag)) {
|
506
|
-
player.sendMessage(
|
507
|
-
"
|
508
|
-
|
509
|
-
|
535
|
+
player.sendMessage(
|
536
|
+
TranslatableCaption.of("flag.flag_removed"),
|
537
|
+
TagResolver.builder()
|
538
|
+
.tag("flag", Tag.inserting(Component.text(args[0])))
|
539
|
+
.tag("value", Tag.inserting(Component.text(flag.toString())))
|
540
|
+
.build()
|
541
|
+
);
|
510
542
|
return;
|
511
543
|
} else {
|
512
544
|
player.sendMessage(TranslatableCaption.of("flag.flag_not_removed"));
|
@@ -518,7 +550,10 @@ public final class FlagCommand extends Command {
|
|
518
550
|
if (addEvent.getEventResult() == Result.DENY) {
|
519
551
|
player.sendMessage(
|
520
552
|
TranslatableCaption.of("events.event_denied"),
|
521
|
-
|
553
|
+
TagResolver.resolver(
|
554
|
+
"value",
|
555
|
+
Tag.inserting(Component.text("Re-addition of " + plotFlag.getName()))
|
556
|
+
)
|
522
557
|
);
|
523
558
|
return;
|
524
559
|
}
|
@@ -541,10 +576,13 @@ public final class FlagCommand extends Command {
|
|
541
576
|
return;
|
542
577
|
}
|
543
578
|
}
|
544
|
-
player.sendMessage(
|
545
|
-
"
|
546
|
-
|
547
|
-
|
579
|
+
player.sendMessage(
|
580
|
+
TranslatableCaption.of("flag.flag_removed"),
|
581
|
+
TagResolver.builder()
|
582
|
+
.tag("flag", Tag.inserting(Component.text(args[0])))
|
583
|
+
.tag("value", Tag.inserting(Component.text(flag.toString())))
|
584
|
+
.build()
|
585
|
+
);
|
548
586
|
}
|
549
587
|
|
550
588
|
@CommandDeclaration(command = "list",
|
@@ -562,34 +600,35 @@ public final class FlagCommand extends Command {
|
|
562
600
|
return;
|
563
601
|
}
|
564
602
|
|
565
|
-
final Map<
|
603
|
+
final Map<Component, ArrayList<String>> flags = new HashMap<>();
|
566
604
|
for (PlotFlag<?, ?> plotFlag : GlobalFlagContainer.getInstance().getRecognizedPlotFlags()) {
|
567
605
|
if (plotFlag instanceof InternalFlag) {
|
568
606
|
continue;
|
569
607
|
}
|
570
|
-
final
|
571
|
-
final Collection<String> flagList =
|
572
|
-
flags.computeIfAbsent(category, k -> new ArrayList<>());
|
608
|
+
final Component category = plotFlag.getFlagCategory().toComponent(player);
|
609
|
+
final Collection<String> flagList = flags.computeIfAbsent(category, k -> new ArrayList<>());
|
573
610
|
flagList.add(plotFlag.getName());
|
574
611
|
}
|
575
612
|
|
576
|
-
for (final Map.Entry<
|
613
|
+
for (final Map.Entry<Component, ArrayList<String>> entry : flags.entrySet()) {
|
577
614
|
Collections.sort(entry.getValue());
|
578
615
|
Component category =
|
579
|
-
MINI_MESSAGE.
|
616
|
+
MINI_MESSAGE.deserialize(
|
580
617
|
TranslatableCaption.of("flag.flag_list_categories").getComponent(player),
|
581
|
-
|
618
|
+
TagResolver.resolver("category", Tag.inserting(entry.getKey().style(Style.empty())))
|
582
619
|
);
|
583
620
|
TextComponent.Builder builder = Component.text().append(category);
|
584
621
|
final Iterator<String> flagIterator = entry.getValue().iterator();
|
585
622
|
while (flagIterator.hasNext()) {
|
586
623
|
final String flag = flagIterator.next();
|
587
624
|
builder.append(MINI_MESSAGE
|
588
|
-
.
|
625
|
+
.deserialize(
|
589
626
|
TranslatableCaption.of("flag.flag_list_flag").getComponent(player),
|
590
|
-
|
591
|
-
|
592
|
-
|
627
|
+
TagResolver.builder()
|
628
|
+
.tag("command", Tag.preProcessParsed("/plot flag info " + flag))
|
629
|
+
.tag("flag", Tag.inserting(Component.text(flag)))
|
630
|
+
.tag("suffix", Tag.inserting(Component.text(flagIterator.hasNext() ? ", " : "")))
|
631
|
+
.build()
|
593
632
|
));
|
594
633
|
}
|
595
634
|
player.sendMessage(StaticCaption.of(MINI_MESSAGE.serialize(builder.build())));
|
@@ -613,7 +652,7 @@ public final class FlagCommand extends Command {
|
|
613
652
|
if (args.length < 1) {
|
614
653
|
player.sendMessage(
|
615
654
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
616
|
-
|
655
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("/plot flag info <flag>")))
|
617
656
|
);
|
618
657
|
return;
|
619
658
|
}
|
@@ -621,11 +660,17 @@ public final class FlagCommand extends Command {
|
|
621
660
|
if (plotFlag != null) {
|
622
661
|
player.sendMessage(TranslatableCaption.of("flag.flag_info_header"));
|
623
662
|
// Flag name
|
624
|
-
player.sendMessage(
|
663
|
+
player.sendMessage(
|
664
|
+
TranslatableCaption.of("flag.flag_info_name"),
|
665
|
+
TagResolver.resolver("flag", Tag.inserting(Component.text(plotFlag.getName())))
|
666
|
+
);
|
625
667
|
// Flag category
|
626
668
|
player.sendMessage(
|
627
669
|
TranslatableCaption.of("flag.flag_info_category"),
|
628
|
-
|
670
|
+
TagResolver.resolver(
|
671
|
+
"value",
|
672
|
+
Tag.inserting(plotFlag.getFlagCategory().toComponent(player))
|
673
|
+
)
|
629
674
|
);
|
630
675
|
// Flag description
|
631
676
|
// TODO maybe merge and \n instead?
|
@@ -634,16 +679,18 @@ public final class FlagCommand extends Command {
|
|
634
679
|
// Flag example
|
635
680
|
player.sendMessage(
|
636
681
|
TranslatableCaption.of("flag.flag_info_example"),
|
637
|
-
|
638
|
-
|
639
|
-
|
682
|
+
TagResolver.builder()
|
683
|
+
.tag("command", Tag.preProcessParsed("/plot flag set"))
|
684
|
+
.tag("flag", Tag.preProcessParsed(plotFlag.getName()))
|
685
|
+
.tag("value", Tag.preProcessParsed(plotFlag.getExample()))
|
686
|
+
.build()
|
640
687
|
);
|
641
688
|
// Default value
|
642
689
|
final String defaultValue = player.getLocation().getPlotArea().getFlagContainer()
|
643
690
|
.getFlagErased(plotFlag.getClass()).toString();
|
644
691
|
player.sendMessage(
|
645
692
|
TranslatableCaption.of("flag.flag_info_default_value"),
|
646
|
-
|
693
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(defaultValue)))
|
647
694
|
);
|
648
695
|
// Footer. Done this way to prevent the duplicate-message-thingy from catching it
|
649
696
|
player.sendMessage(TranslatableCaption.of("flag.flag_info_footer"));
|
@@ -31,7 +31,9 @@ import com.plotsquared.core.util.TabCompletions;
|
|
31
31
|
import com.plotsquared.core.util.task.RunnableVal;
|
32
32
|
import com.plotsquared.core.util.task.RunnableVal2;
|
33
33
|
import com.plotsquared.core.util.task.RunnableVal3;
|
34
|
-
import net.kyori.adventure.text.
|
34
|
+
import net.kyori.adventure.text.Component;
|
35
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
36
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
35
37
|
|
36
38
|
import java.util.Collection;
|
37
39
|
import java.util.Collections;
|
@@ -63,7 +65,7 @@ public class Grant extends Command {
|
|
63
65
|
checkTrue(
|
64
66
|
args.length >= 1 && args.length <= 2,
|
65
67
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
66
|
-
|
68
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("/plot grant <check | add> [player]")))
|
67
69
|
);
|
68
70
|
final String arg0 = args[0].toLowerCase();
|
69
71
|
switch (arg0) {
|
@@ -71,7 +73,7 @@ public class Grant extends Command {
|
|
71
73
|
if (!player.hasPermission(Permission.PERMISSION_GRANT.format(arg0))) {
|
72
74
|
player.sendMessage(
|
73
75
|
TranslatableCaption.of("permission.no_permission"),
|
74
|
-
|
76
|
+
TagResolver.resolver("node", Tag.inserting(Component.text(Permission.PERMISSION_GRANT.format(arg0))))
|
75
77
|
);
|
76
78
|
return CompletableFuture.completedFuture(false);
|
77
79
|
}
|
@@ -84,7 +86,7 @@ public class Grant extends Command {
|
|
84
86
|
} else if (throwable != null || uuids.size() != 1) {
|
85
87
|
player.sendMessage(
|
86
88
|
TranslatableCaption.of("errors.invalid_player"),
|
87
|
-
|
89
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(String.valueOf(uuids))))
|
88
90
|
);
|
89
91
|
} else {
|
90
92
|
final UUID uuid = uuids.iterator().next();
|
@@ -95,7 +97,7 @@ public class Grant extends Command {
|
|
95
97
|
if (args[0].equalsIgnoreCase("check")) {
|
96
98
|
player.sendMessage(
|
97
99
|
TranslatableCaption.of("grants.granted_plots"),
|
98
|
-
|
100
|
+
TagResolver.resolver("amount", Tag.inserting(Component.text(access.get().orElse(0))))
|
99
101
|
);
|
100
102
|
} else {
|
101
103
|
access.set(access.get().orElse(0) + 1);
|
@@ -115,7 +117,7 @@ public class Grant extends Command {
|
|
115
117
|
}
|
116
118
|
player.sendMessage(
|
117
119
|
TranslatableCaption.of("grants.granted_plots"),
|
118
|
-
|
120
|
+
TagResolver.resolver("amount", Tag.inserting(Component.text(granted)))
|
119
121
|
);
|
120
122
|
} else { // add
|
121
123
|
int amount;
|
@@ -130,7 +132,7 @@ public class Grant extends Command {
|
|
130
132
|
DBFunc.addPersistentMeta(uuid, key, rawData, replace);
|
131
133
|
player.sendMessage(
|
132
134
|
TranslatableCaption.of("grants.added"),
|
133
|
-
|
135
|
+
TagResolver.resolver("grants", Tag.inserting(Component.text(amount)))
|
134
136
|
);
|
135
137
|
}
|
136
138
|
}
|
@@ -28,7 +28,8 @@ import com.plotsquared.core.util.task.RunnableVal2;
|
|
28
28
|
import com.plotsquared.core.util.task.RunnableVal3;
|
29
29
|
import net.kyori.adventure.text.Component;
|
30
30
|
import net.kyori.adventure.text.TextComponent;
|
31
|
-
import net.kyori.adventure.text.minimessage.
|
31
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
32
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
32
33
|
|
33
34
|
import java.util.ArrayList;
|
34
35
|
import java.util.Collection;
|
@@ -59,9 +60,10 @@ public class Help extends Command {
|
|
59
60
|
RunnableVal2<Command, CommandResult> whenDone
|
60
61
|
) {
|
61
62
|
switch (args.length) {
|
62
|
-
case 0
|
63
|
+
case 0 -> {
|
63
64
|
return displayHelp(player, null, 0);
|
64
|
-
|
65
|
+
}
|
66
|
+
case 1 -> {
|
65
67
|
if (MathMan.isInteger(args[0])) {
|
66
68
|
try {
|
67
69
|
return displayHelp(player, null, Integer.parseInt(args[0]));
|
@@ -71,7 +73,8 @@ public class Help extends Command {
|
|
71
73
|
} else {
|
72
74
|
return displayHelp(player, args[0], 1);
|
73
75
|
}
|
74
|
-
|
76
|
+
}
|
77
|
+
case 2 -> {
|
75
78
|
if (MathMan.isInteger(args[1])) {
|
76
79
|
try {
|
77
80
|
return displayHelp(player, args[0], Integer.parseInt(args[1]));
|
@@ -80,8 +83,8 @@ public class Help extends Command {
|
|
80
83
|
}
|
81
84
|
}
|
82
85
|
return CompletableFuture.completedFuture(false);
|
83
|
-
|
84
|
-
|
86
|
+
}
|
87
|
+
default -> sendUsage(player);
|
85
88
|
}
|
86
89
|
return CompletableFuture.completedFuture(true);
|
87
90
|
}
|
@@ -110,27 +113,36 @@ public class Help extends Command {
|
|
110
113
|
}
|
111
114
|
if (cat == null && page == 0) {
|
112
115
|
TextComponent.Builder builder = Component.text();
|
113
|
-
builder.append(MINI_MESSAGE.
|
116
|
+
builder.append(MINI_MESSAGE.deserialize(TranslatableCaption.of("help.help_header").getComponent(player)));
|
114
117
|
for (CommandCategory c : CommandCategory.values()) {
|
115
118
|
if (!c.canAccess(player)) {
|
116
119
|
continue;
|
117
120
|
}
|
118
121
|
builder.append(Component.newline()).append(MINI_MESSAGE
|
119
|
-
.
|
122
|
+
.deserialize(
|
120
123
|
TranslatableCaption.of("help.help_info_item").getComponent(player),
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
+
TagResolver.builder()
|
125
|
+
.tag("command", Tag.inserting(Component.text("/plot help")))
|
126
|
+
.tag("category", Tag.inserting(Component.text(c.name().toLowerCase())))
|
127
|
+
.tag("category_desc", Tag.inserting(c.toComponent(player)))
|
128
|
+
.build()
|
124
129
|
));
|
125
130
|
}
|
126
131
|
builder.append(Component.newline()).append(MINI_MESSAGE
|
127
|
-
.
|
132
|
+
.deserialize(
|
128
133
|
TranslatableCaption.of("help.help_info_item").getComponent(player),
|
129
|
-
|
130
|
-
|
131
|
-
|
134
|
+
TagResolver.builder()
|
135
|
+
.tag("command", Tag.inserting(Component.text("/plot help")))
|
136
|
+
.tag("category", Tag.inserting(Component.text("all")))
|
137
|
+
.tag(
|
138
|
+
"category_desc",
|
139
|
+
Tag.inserting(TranslatableCaption
|
140
|
+
.of("help.help_display_all_commands")
|
141
|
+
.toComponent(player))
|
142
|
+
)
|
143
|
+
.build()
|
132
144
|
));
|
133
|
-
builder.append(Component.newline()).append(MINI_MESSAGE.
|
145
|
+
builder.append(Component.newline()).append(MINI_MESSAGE.deserialize(TranslatableCaption
|
134
146
|
.of("help.help_footer")
|
135
147
|
.getComponent(player)));
|
136
148
|
player.sendMessage(StaticCaption.of(MINI_MESSAGE.serialize(builder.asComponent())));
|
@@ -34,7 +34,9 @@ import com.plotsquared.core.util.query.PlotQuery;
|
|
34
34
|
import com.plotsquared.core.util.query.SortingStrategy;
|
35
35
|
import com.plotsquared.core.util.task.RunnableVal2;
|
36
36
|
import com.plotsquared.core.util.task.RunnableVal3;
|
37
|
-
import net.kyori.adventure.text.
|
37
|
+
import net.kyori.adventure.text.Component;
|
38
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
39
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
38
40
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
39
41
|
|
40
42
|
import java.util.ArrayList;
|
@@ -71,8 +73,10 @@ public class HomeCommand extends Command {
|
|
71
73
|
} else if (plots.size() < page || page < 1) {
|
72
74
|
player.sendMessage(
|
73
75
|
TranslatableCaption.of("invalid.number_not_in_range"),
|
74
|
-
|
75
|
-
|
76
|
+
TagResolver.builder()
|
77
|
+
.tag("min", Tag.inserting(Component.text(1)))
|
78
|
+
.tag("max", Tag.inserting(Component.text(plots.size())))
|
79
|
+
.build()
|
76
80
|
);
|
77
81
|
return;
|
78
82
|
}
|
@@ -106,7 +110,7 @@ public class HomeCommand extends Command {
|
|
106
110
|
if (!player.hasPermission(Permission.PERMISSION_VISIT_OWNED) && !player.hasPermission(Permission.PERMISSION_HOME)) {
|
107
111
|
player.sendMessage(
|
108
112
|
TranslatableCaption.of("permission.no_permission"),
|
109
|
-
|
113
|
+
TagResolver.resolver("node", Tag.inserting(Component.text(Permission.PERMISSION_VISIT_OWNED.toString())))
|
110
114
|
);
|
111
115
|
return CompletableFuture.completedFuture(false);
|
112
116
|
}
|
@@ -128,7 +132,7 @@ public class HomeCommand extends Command {
|
|
128
132
|
} catch (NumberFormatException ignored) {
|
129
133
|
player.sendMessage(
|
130
134
|
TranslatableCaption.of("invalid.not_a_number"),
|
131
|
-
|
135
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(identifier)))
|
132
136
|
);
|
133
137
|
return CompletableFuture.completedFuture(false);
|
134
138
|
}
|
@@ -169,7 +173,7 @@ public class HomeCommand extends Command {
|
|
169
173
|
} catch (NumberFormatException ignored) {
|
170
174
|
player.sendMessage(
|
171
175
|
TranslatableCaption.of("invalid.not_a_number"),
|
172
|
-
|
176
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(identifier)))
|
173
177
|
);
|
174
178
|
return CompletableFuture.completedFuture(false);
|
175
179
|
}
|
@@ -20,7 +20,6 @@ package com.plotsquared.core.command;
|
|
20
20
|
|
21
21
|
import com.google.inject.TypeLiteral;
|
22
22
|
import com.plotsquared.core.configuration.caption.StaticCaption;
|
23
|
-
import com.plotsquared.core.configuration.caption.Templates;
|
24
23
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
25
24
|
import com.plotsquared.core.permissions.Permission;
|
26
25
|
import com.plotsquared.core.player.MetaDataAccess;
|
@@ -35,7 +34,8 @@ import com.plotsquared.core.util.TabCompletions;
|
|
35
34
|
import com.plotsquared.core.util.task.RunnableVal;
|
36
35
|
import net.kyori.adventure.text.Component;
|
37
36
|
import net.kyori.adventure.text.TextComponent;
|
38
|
-
import net.kyori.adventure.text.minimessage.
|
37
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
38
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
39
39
|
|
40
40
|
import java.util.Collection;
|
41
41
|
import java.util.Collections;
|
@@ -71,41 +71,44 @@ public class Inbox extends SubCommand {
|
|
71
71
|
max = comments.length;
|
72
72
|
}
|
73
73
|
TextComponent.Builder builder = Component.text();
|
74
|
-
builder.append(MINI_MESSAGE.
|
75
|
-
|
76
|
-
|
74
|
+
builder.append(MINI_MESSAGE.deserialize(
|
75
|
+
TranslatableCaption.of("list.comment_list_header_paged").getComponent(player) + '\n',
|
76
|
+
TagResolver.builder()
|
77
|
+
.tag("amount", Tag.inserting(Component.text(comments.length)))
|
78
|
+
.tag("cur", Tag.inserting(Component.text(page + 1)))
|
79
|
+
.tag("max", Tag.inserting(Component.text(totalPages + 1)))
|
80
|
+
.tag("word", Tag.inserting(Component.text("all")))
|
81
|
+
.build()
|
77
82
|
));
|
78
83
|
|
79
84
|
// This might work xD
|
80
85
|
for (int x = page * 12; x < max; x++) {
|
81
86
|
PlotComment comment = comments[x];
|
82
87
|
Component commentColored;
|
83
|
-
if (player.getName().equals(comment.senderName)) {
|
88
|
+
if (player.getName().equals(comment.senderName())) {
|
84
89
|
commentColored = MINI_MESSAGE
|
85
|
-
.
|
90
|
+
.deserialize(
|
86
91
|
TranslatableCaption.of("list.comment_list_by_lister").getComponent(player),
|
87
|
-
|
92
|
+
TagResolver.resolver("comment", Tag.inserting(Component.text(comment.comment())))
|
88
93
|
);
|
89
94
|
} else {
|
90
95
|
commentColored = MINI_MESSAGE
|
91
|
-
.
|
96
|
+
.deserialize(
|
92
97
|
TranslatableCaption.of("list.comment_list_by_other").getComponent(player),
|
93
|
-
|
98
|
+
TagResolver.resolver("comment", Tag.inserting(Component.text(comment.comment())))
|
94
99
|
);
|
95
100
|
}
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
+
TagResolver resolver = TagResolver.builder()
|
102
|
+
.tag("number", Tag.inserting(Component.text(x)))
|
103
|
+
.tag("world", Tag.inserting(Component.text(comment.world())))
|
104
|
+
.tag("plot_id", Tag.inserting(Component.text(comment.id().getX() + ";" + comment.id().getY())))
|
105
|
+
.tag("commenter", Tag.inserting(Component.text(comment.senderName())))
|
106
|
+
.tag("comment", Tag.inserting(commentColored))
|
107
|
+
.build();
|
101
108
|
builder.append(MINI_MESSAGE
|
102
|
-
.
|
109
|
+
.deserialize(
|
103
110
|
TranslatableCaption.of("list.comment_list_comment").getComponent(player),
|
104
|
-
|
105
|
-
world,
|
106
|
-
plot_id,
|
107
|
-
commenter,
|
108
|
-
commentTemplate
|
111
|
+
resolver
|
109
112
|
));
|
110
113
|
}
|
111
114
|
player.sendMessage(StaticCaption.of(MINI_MESSAGE.serialize(builder.build())));
|
@@ -134,7 +137,7 @@ public class Inbox extends SubCommand {
|
|
134
137
|
int unread = 0;
|
135
138
|
for (PlotComment comment : value) {
|
136
139
|
total++;
|
137
|
-
if (comment.timestamp > CommentManager
|
140
|
+
if (comment.timestamp() > CommentManager
|
138
141
|
.getTimestamp(player, inbox.toString())) {
|
139
142
|
unread++;
|
140
143
|
}
|
@@ -142,20 +145,23 @@ public class Inbox extends SubCommand {
|
|
142
145
|
if (total != 0) {
|
143
146
|
player.sendMessage(
|
144
147
|
TranslatableCaption.of("comment.inbox_item"),
|
145
|
-
|
148
|
+
TagResolver.resolver(
|
149
|
+
"value",
|
150
|
+
Tag.inserting(Component.text(inbox + " (" + total + '/' + unread + ')'))
|
151
|
+
)
|
146
152
|
);
|
147
153
|
return;
|
148
154
|
}
|
149
155
|
}
|
150
156
|
player.sendMessage(
|
151
157
|
TranslatableCaption.of("comment.inbox_item"),
|
152
|
-
|
158
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(inbox.toString())))
|
153
159
|
);
|
154
160
|
}
|
155
161
|
})) {
|
156
162
|
player.sendMessage(
|
157
163
|
TranslatableCaption.of("comment.inbox_item"),
|
158
|
-
|
164
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(inbox.toString())))
|
159
165
|
);
|
160
166
|
}
|
161
167
|
}
|
@@ -166,7 +172,10 @@ public class Inbox extends SubCommand {
|
|
166
172
|
if (inbox == null) {
|
167
173
|
player.sendMessage(
|
168
174
|
TranslatableCaption.of("comment.invalid_inbox"),
|
169
|
-
|
175
|
+
TagResolver.resolver(
|
176
|
+
"list",
|
177
|
+
Tag.inserting(Component.text(StringMan.join(CommentManager.inboxes.keySet(), ", ")))
|
178
|
+
)
|
170
179
|
);
|
171
180
|
return false;
|
172
181
|
}
|
@@ -181,7 +190,7 @@ public class Inbox extends SubCommand {
|
|
181
190
|
final int page;
|
182
191
|
if (args.length > 1) {
|
183
192
|
switch (args[1].toLowerCase()) {
|
184
|
-
case "delete"
|
193
|
+
case "delete" -> {
|
185
194
|
if (!inbox.canModify(plot, player)) {
|
186
195
|
player.sendMessage(TranslatableCaption.of("comment.no_perm_inbox_modify"));
|
187
196
|
return false;
|
@@ -189,7 +198,10 @@ public class Inbox extends SubCommand {
|
|
189
198
|
if (args.length != 3) {
|
190
199
|
player.sendMessage(
|
191
200
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
192
|
-
|
201
|
+
TagResolver.resolver(
|
202
|
+
"value",
|
203
|
+
Tag.inserting(Component.text("/plot inbox " + inbox + " delete <index>"))
|
204
|
+
)
|
193
205
|
);
|
194
206
|
return true;
|
195
207
|
}
|
@@ -199,25 +211,27 @@ public class Inbox extends SubCommand {
|
|
199
211
|
if (index < 1) {
|
200
212
|
player.sendMessage(
|
201
213
|
TranslatableCaption.of("comment.not_valid_inbox_index"),
|
202
|
-
|
214
|
+
TagResolver.resolver("number", Tag.inserting(Component.text(index)))
|
203
215
|
);
|
204
216
|
return false;
|
205
217
|
}
|
206
218
|
} catch (NumberFormatException ignored) {
|
207
219
|
player.sendMessage(
|
208
220
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
209
|
-
|
221
|
+
TagResolver.resolver(
|
222
|
+
"value",
|
223
|
+
Tag.inserting(Component.text("/plot inbox " + inbox + " delete <index>"))
|
224
|
+
)
|
210
225
|
);
|
211
226
|
return false;
|
212
227
|
}
|
213
|
-
|
214
228
|
if (!inbox.getComments(plot, new RunnableVal<>() {
|
215
229
|
@Override
|
216
230
|
public void run(List<PlotComment> value) {
|
217
231
|
if (index > value.size()) {
|
218
232
|
player.sendMessage(
|
219
233
|
TranslatableCaption.of("comment.not_valid_inbox_index"),
|
220
|
-
|
234
|
+
TagResolver.resolver("number", Tag.inserting(Component.text(index)))
|
221
235
|
);
|
222
236
|
return;
|
223
237
|
}
|
@@ -227,7 +241,7 @@ public class Inbox extends SubCommand {
|
|
227
241
|
if (success) {
|
228
242
|
player.sendMessage(
|
229
243
|
TranslatableCaption.of("comment.comment_removed_success"),
|
230
|
-
|
244
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(comment.comment())))
|
231
245
|
);
|
232
246
|
} else {
|
233
247
|
player.sendMessage(
|
@@ -239,7 +253,8 @@ public class Inbox extends SubCommand {
|
|
239
253
|
return false;
|
240
254
|
}
|
241
255
|
return true;
|
242
|
-
|
256
|
+
}
|
257
|
+
case "clear" -> {
|
243
258
|
if (!inbox.canModify(plot, player)) {
|
244
259
|
player.sendMessage(TranslatableCaption.of("comment.no_perm_inbox_modify"));
|
245
260
|
}
|
@@ -248,18 +263,20 @@ public class Inbox extends SubCommand {
|
|
248
263
|
if (!comments.isEmpty()) {
|
249
264
|
player.sendMessage(
|
250
265
|
TranslatableCaption.of("comment.comment_removed_success"),
|
251
|
-
|
266
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("*")))
|
252
267
|
);
|
253
268
|
plot.getPlotCommentContainer().removeComments(comments);
|
254
269
|
}
|
255
270
|
return true;
|
256
|
-
|
271
|
+
}
|
272
|
+
default -> {
|
257
273
|
try {
|
258
274
|
page = Integer.parseInt(args[1]);
|
259
275
|
} catch (NumberFormatException ignored) {
|
260
276
|
sendUsage(player);
|
261
277
|
return false;
|
262
278
|
}
|
279
|
+
}
|
263
280
|
}
|
264
281
|
} else {
|
265
282
|
page = 1;
|
@@ -28,7 +28,9 @@ import com.plotsquared.core.player.PlotPlayer;
|
|
28
28
|
import com.plotsquared.core.plot.Plot;
|
29
29
|
import com.plotsquared.core.plot.flag.implementations.HideInfoFlag;
|
30
30
|
import com.plotsquared.core.util.TabCompletions;
|
31
|
-
import net.kyori.adventure.text.
|
31
|
+
import net.kyori.adventure.text.Component;
|
32
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
33
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
32
34
|
|
33
35
|
import java.util.Collection;
|
34
36
|
import java.util.Collections;
|
@@ -50,8 +52,9 @@ public class Info extends SubCommand {
|
|
50
52
|
arg = args[0];
|
51
53
|
switch (arg) {
|
52
54
|
// TODO: (re?)implement /plot info inv. (it was never properly implemented)
|
53
|
-
case "trusted", "alias", "biome", "denied", "flags", "id", "size", "members", "creationdate", "seen", "owner", "rating", "likes" ->
|
54
|
-
|
55
|
+
case "trusted", "alias", "biome", "denied", "flags", "id", "size", "members", "creationdate", "seen", "owner", "rating", "likes" ->
|
56
|
+
plot = Plot
|
57
|
+
.getPlotFromString(player, null, false);
|
55
58
|
default -> {
|
56
59
|
plot = Plot.getPlotFromString(player, arg, false);
|
57
60
|
if (args.length == 2) {
|
@@ -90,7 +93,10 @@ public class Info extends SubCommand {
|
|
90
93
|
.hasPermission(Permission.PERMISSION_AREA_INFO_FORCE.toString())) {
|
91
94
|
player.sendMessage(
|
92
95
|
TranslatableCaption.of("permission.no_permission"),
|
93
|
-
|
96
|
+
TagResolver.resolver(
|
97
|
+
"node",
|
98
|
+
Tag.inserting(Permission.PERMISSION_AREA_INFO_FORCE)
|
99
|
+
)
|
94
100
|
);
|
95
101
|
return true;
|
96
102
|
}
|
@@ -112,7 +118,10 @@ public class Info extends SubCommand {
|
|
112
118
|
if (!hasOwner && !containsEveryone && !trustedEveryone) {
|
113
119
|
player.sendMessage(
|
114
120
|
TranslatableCaption.of("info.plot_info_unclaimed"),
|
115
|
-
|
121
|
+
TagResolver.resolver(
|
122
|
+
"plot",
|
123
|
+
Tag.inserting(Component.text(plot.getId().getX() + ";" + plot.getId().getY()))
|
124
|
+
)
|
116
125
|
);
|
117
126
|
return true;
|
118
127
|
}
|
@@ -30,7 +30,9 @@ import com.plotsquared.core.plot.world.PlotAreaManager;
|
|
30
30
|
import com.plotsquared.core.util.PlayerManager;
|
31
31
|
import com.plotsquared.core.util.TabCompletions;
|
32
32
|
import com.plotsquared.core.util.WorldUtil;
|
33
|
-
import net.kyori.adventure.text.
|
33
|
+
import net.kyori.adventure.text.Component;
|
34
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
35
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
34
36
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
35
37
|
|
36
38
|
import java.util.Collection;
|
@@ -80,7 +82,7 @@ public class Kick extends SubCommand {
|
|
80
82
|
} else if (throwable != null || uuids.isEmpty()) {
|
81
83
|
player.sendMessage(
|
82
84
|
TranslatableCaption.of("errors.invalid_player"),
|
83
|
-
|
85
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(args[0])))
|
84
86
|
);
|
85
87
|
} else {
|
86
88
|
Set<PlotPlayer<?>> players = new HashSet<>();
|
@@ -103,22 +105,22 @@ public class Kick extends SubCommand {
|
|
103
105
|
if (players.isEmpty()) {
|
104
106
|
player.sendMessage(
|
105
107
|
TranslatableCaption.of("errors.invalid_player"),
|
106
|
-
|
108
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(args[0])))
|
107
109
|
);
|
108
110
|
return;
|
109
111
|
}
|
110
112
|
for (PlotPlayer<?> player2 : players) {
|
111
113
|
if (!plot.equals(player2.getCurrentPlot())) {
|
112
114
|
player.sendMessage(
|
113
|
-
TranslatableCaption.of("
|
114
|
-
|
115
|
+
TranslatableCaption.of("kick.player_not_in_plot"),
|
116
|
+
TagResolver.resolver("player", Tag.inserting(Component.text(player2.getName())))
|
115
117
|
);
|
116
118
|
return;
|
117
119
|
}
|
118
120
|
if (player2.hasPermission(Permission.PERMISSION_ADMIN_ENTRY_DENIED)) {
|
119
121
|
player.sendMessage(
|
120
|
-
TranslatableCaption.of("
|
121
|
-
|
122
|
+
TranslatableCaption.of("kick.cannot_kick_player"),
|
123
|
+
TagResolver.resolver("player", Tag.inserting(Component.text(player2.getName())))
|
122
124
|
);
|
123
125
|
return;
|
124
126
|
}
|
@@ -25,7 +25,9 @@ import com.plotsquared.core.plot.Plot;
|
|
25
25
|
import com.plotsquared.core.util.EventDispatcher;
|
26
26
|
import com.plotsquared.core.util.task.RunnableVal2;
|
27
27
|
import com.plotsquared.core.util.task.RunnableVal3;
|
28
|
-
import net.kyori.adventure.text.
|
28
|
+
import net.kyori.adventure.text.Component;
|
29
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
30
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
29
31
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
30
32
|
|
31
33
|
import java.util.UUID;
|
@@ -67,7 +69,7 @@ public class Leave extends Command {
|
|
67
69
|
}
|
68
70
|
player.sendMessage(
|
69
71
|
TranslatableCaption.of("member.plot_left"),
|
70
|
-
|
72
|
+
TagResolver.resolver("player", Tag.inserting(Component.text(player.getName())))
|
71
73
|
);
|
72
74
|
} else {
|
73
75
|
player.sendMessage(
|
@@ -33,7 +33,9 @@ import com.plotsquared.core.util.EventDispatcher;
|
|
33
33
|
import com.plotsquared.core.util.TabCompletions;
|
34
34
|
import com.plotsquared.core.util.query.PlotQuery;
|
35
35
|
import com.plotsquared.core.util.task.TaskManager;
|
36
|
-
import net.kyori.adventure.text.
|
36
|
+
import net.kyori.adventure.text.Component;
|
37
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
38
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
37
39
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
38
40
|
|
39
41
|
import java.util.Collection;
|
@@ -151,7 +153,7 @@ public class Like extends SubCommand {
|
|
151
153
|
if (oldRating != null) {
|
152
154
|
player.sendMessage(
|
153
155
|
TranslatableCaption.of("ratings.rating_already_exists"),
|
154
|
-
|
156
|
+
TagResolver.resolver("plot", Tag.inserting(Component.text(plot.getId().toString())))
|
155
157
|
);
|
156
158
|
return;
|
157
159
|
}
|
@@ -169,12 +171,12 @@ public class Like extends SubCommand {
|
|
169
171
|
if (like) {
|
170
172
|
player.sendMessage(
|
171
173
|
TranslatableCaption.of("ratings.rating_liked"),
|
172
|
-
|
174
|
+
TagResolver.resolver("plot", Tag.inserting(Component.text(plot.getId().toString())))
|
173
175
|
);
|
174
176
|
} else {
|
175
177
|
player.sendMessage(
|
176
178
|
TranslatableCaption.of("ratings.rating_disliked"),
|
177
|
-
|
179
|
+
TagResolver.resolver("plot", Tag.inserting(Component.text(plot.getId().toString())))
|
178
180
|
);
|
179
181
|
}
|
180
182
|
}
|
@@ -23,7 +23,6 @@ import com.plotsquared.core.PlotSquared;
|
|
23
23
|
import com.plotsquared.core.configuration.Settings;
|
24
24
|
import com.plotsquared.core.configuration.caption.Caption;
|
25
25
|
import com.plotsquared.core.configuration.caption.CaptionHolder;
|
26
|
-
import com.plotsquared.core.configuration.caption.Templates;
|
27
26
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
28
27
|
import com.plotsquared.core.database.DBFunc;
|
29
28
|
import com.plotsquared.core.permissions.Permission;
|
@@ -46,7 +45,8 @@ import com.plotsquared.core.util.task.RunnableVal3;
|
|
46
45
|
import com.plotsquared.core.uuid.UUIDMapping;
|
47
46
|
import net.kyori.adventure.text.Component;
|
48
47
|
import net.kyori.adventure.text.TextComponent;
|
49
|
-
import net.kyori.adventure.text.minimessage.
|
48
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
49
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
50
50
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
51
51
|
|
52
52
|
import java.util.ArrayList;
|
@@ -123,7 +123,7 @@ public class ListCmd extends SubCommand {
|
|
123
123
|
public void noArgs(PlotPlayer<?> player) {
|
124
124
|
player.sendMessage(
|
125
125
|
TranslatableCaption.of("commandconfig.subcommand_set_options_header"),
|
126
|
-
|
126
|
+
TagResolver.resolver("values", Tag.inserting(Component.text(Arrays.toString(getArgumentList(player)))))
|
127
127
|
);
|
128
128
|
}
|
129
129
|
|
@@ -159,9 +159,14 @@ public class ListCmd extends SubCommand {
|
|
159
159
|
if (query == null) {
|
160
160
|
player.sendMessage(
|
161
161
|
TranslatableCaption.of("commandconfig.did_you_mean"),
|
162
|
-
|
162
|
+
TagResolver.resolver(
|
163
163
|
"value",
|
164
|
-
|
164
|
+
Tag.inserting(Component.text(
|
165
|
+
new StringComparison<>(
|
166
|
+
args[0],
|
167
|
+
new String[]{"mine", "shared", "world", "all"}
|
168
|
+
).getBestMatch()
|
169
|
+
))
|
165
170
|
)
|
166
171
|
);
|
167
172
|
return;
|
@@ -189,7 +194,7 @@ public class ListCmd extends SubCommand {
|
|
189
194
|
if (!player.hasPermission(Permission.PERMISSION_LIST_MINE)) {
|
190
195
|
player.sendMessage(
|
191
196
|
TranslatableCaption.of("permission.no_permission"),
|
192
|
-
|
197
|
+
TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.mine")))
|
193
198
|
);
|
194
199
|
return false;
|
195
200
|
}
|
@@ -204,7 +209,7 @@ public class ListCmd extends SubCommand {
|
|
204
209
|
if (!player.hasPermission(Permission.PERMISSION_LIST_SHARED)) {
|
205
210
|
player.sendMessage(
|
206
211
|
TranslatableCaption.of("permission.no_permission"),
|
207
|
-
|
212
|
+
TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.shared")))
|
208
213
|
);
|
209
214
|
return false;
|
210
215
|
}
|
@@ -217,14 +222,14 @@ public class ListCmd extends SubCommand {
|
|
217
222
|
if (!player.hasPermission(Permission.PERMISSION_LIST_WORLD)) {
|
218
223
|
player.sendMessage(
|
219
224
|
TranslatableCaption.of("permission.no_permission"),
|
220
|
-
|
225
|
+
TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.world")))
|
221
226
|
);
|
222
227
|
return false;
|
223
228
|
}
|
224
229
|
if (!player.hasPermission("plots.list.world." + world)) {
|
225
230
|
player.sendMessage(
|
226
231
|
TranslatableCaption.of("permission.no_permission"),
|
227
|
-
|
232
|
+
TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.world." + world)))
|
228
233
|
);
|
229
234
|
return false;
|
230
235
|
}
|
@@ -234,7 +239,7 @@ public class ListCmd extends SubCommand {
|
|
234
239
|
if (!player.hasPermission(Permission.PERMISSION_LIST_EXPIRED)) {
|
235
240
|
player.sendMessage(
|
236
241
|
TranslatableCaption.of("permission.no_permission"),
|
237
|
-
|
242
|
+
TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.expired")))
|
238
243
|
);
|
239
244
|
return false;
|
240
245
|
}
|
@@ -248,14 +253,14 @@ public class ListCmd extends SubCommand {
|
|
248
253
|
if (!player.hasPermission(Permission.PERMISSION_LIST_AREA)) {
|
249
254
|
player.sendMessage(
|
250
255
|
TranslatableCaption.of("permission.no_permission"),
|
251
|
-
|
256
|
+
TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.area")))
|
252
257
|
);
|
253
258
|
return false;
|
254
259
|
}
|
255
260
|
if (!player.hasPermission("plots.list.world." + world)) {
|
256
261
|
player.sendMessage(
|
257
262
|
TranslatableCaption.of("permission.no_permission"),
|
258
|
-
|
263
|
+
TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.world." + world)))
|
259
264
|
);
|
260
265
|
return false;
|
261
266
|
}
|
@@ -269,7 +274,7 @@ public class ListCmd extends SubCommand {
|
|
269
274
|
if (!player.hasPermission(Permission.PERMISSION_LIST_ALL)) {
|
270
275
|
player.sendMessage(
|
271
276
|
TranslatableCaption.of("permission.no_permission"),
|
272
|
-
|
277
|
+
TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.all")))
|
273
278
|
);
|
274
279
|
return false;
|
275
280
|
}
|
@@ -279,7 +284,7 @@ public class ListCmd extends SubCommand {
|
|
279
284
|
if (!player.hasPermission(Permission.PERMISSION_LIST_DONE)) {
|
280
285
|
player.sendMessage(
|
281
286
|
TranslatableCaption.of("permission.no_permission"),
|
282
|
-
|
287
|
+
TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.done")))
|
283
288
|
);
|
284
289
|
return false;
|
285
290
|
}
|
@@ -294,7 +299,7 @@ public class ListCmd extends SubCommand {
|
|
294
299
|
if (!player.hasPermission(Permission.PERMISSION_LIST_TOP)) {
|
295
300
|
player.sendMessage(
|
296
301
|
TranslatableCaption.of("permission.no_permission"),
|
297
|
-
|
302
|
+
TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.top")))
|
298
303
|
);
|
299
304
|
return false;
|
300
305
|
}
|
@@ -305,7 +310,7 @@ public class ListCmd extends SubCommand {
|
|
305
310
|
if (!player.hasPermission(Permission.PERMISSION_LIST_FOR_SALE)) {
|
306
311
|
player.sendMessage(
|
307
312
|
TranslatableCaption.of("permission.no_permission"),
|
308
|
-
|
313
|
+
TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.forsale")))
|
309
314
|
);
|
310
315
|
return false;
|
311
316
|
}
|
@@ -318,7 +323,7 @@ public class ListCmd extends SubCommand {
|
|
318
323
|
if (!player.hasPermission(Permission.PERMISSION_LIST_UNOWNED)) {
|
319
324
|
player.sendMessage(
|
320
325
|
TranslatableCaption.of("permission.no_permission"),
|
321
|
-
|
326
|
+
TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.unowned")))
|
322
327
|
);
|
323
328
|
return false;
|
324
329
|
}
|
@@ -328,14 +333,14 @@ public class ListCmd extends SubCommand {
|
|
328
333
|
if (!player.hasPermission(Permission.PERMISSION_LIST_FUZZY)) {
|
329
334
|
player.sendMessage(
|
330
335
|
TranslatableCaption.of("permission.no_permission"),
|
331
|
-
|
336
|
+
TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.fuzzy")))
|
332
337
|
);
|
333
338
|
return false;
|
334
339
|
}
|
335
340
|
if (args.length < (page == -1 ? 2 : 3)) {
|
336
341
|
player.sendMessage(
|
337
342
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
338
|
-
|
343
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("/plot list fuzzy <search...> [#]")))
|
339
344
|
);
|
340
345
|
return false;
|
341
346
|
}
|
@@ -353,14 +358,14 @@ public class ListCmd extends SubCommand {
|
|
353
358
|
if (!player.hasPermission(Permission.PERMISSION_LIST_WORLD)) {
|
354
359
|
player.sendMessage(
|
355
360
|
TranslatableCaption.of("permission.no_permission"),
|
356
|
-
|
361
|
+
TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.world")))
|
357
362
|
);
|
358
363
|
return false;
|
359
364
|
}
|
360
365
|
if (!player.hasPermission("plots.list.world." + args[0])) {
|
361
366
|
player.sendMessage(
|
362
367
|
TranslatableCaption.of("permission.no_permission"),
|
363
|
-
|
368
|
+
TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.world." + args[0])))
|
364
369
|
);
|
365
370
|
return false;
|
366
371
|
}
|
@@ -379,12 +384,15 @@ public class ListCmd extends SubCommand {
|
|
379
384
|
}
|
380
385
|
}
|
381
386
|
if (uuid == null) {
|
382
|
-
player.sendMessage(
|
387
|
+
player.sendMessage(
|
388
|
+
TranslatableCaption.of("errors.invalid_player"),
|
389
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(args[0])))
|
390
|
+
);
|
383
391
|
} else {
|
384
392
|
if (!player.hasPermission(Permission.PERMISSION_LIST_PLAYER)) {
|
385
393
|
player.sendMessage(
|
386
394
|
TranslatableCaption.of("permission.no_permission"),
|
387
|
-
|
395
|
+
TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.player")))
|
388
396
|
);
|
389
397
|
} else {
|
390
398
|
sort[0] = false;
|
@@ -420,32 +428,34 @@ public class ListCmd extends SubCommand {
|
|
420
428
|
} else {
|
421
429
|
color = TranslatableCaption.of("info.plot_list_default");
|
422
430
|
}
|
423
|
-
Component trusted = MINI_MESSAGE.
|
431
|
+
Component trusted = MINI_MESSAGE.deserialize(
|
424
432
|
TranslatableCaption.of("info.plot_info_trusted").getComponent(player),
|
425
|
-
|
433
|
+
TagResolver.resolver("trusted", Tag.inserting(PlayerManager.getPlayerList(plot.getTrusted(), player)))
|
426
434
|
);
|
427
|
-
Component members = MINI_MESSAGE.
|
435
|
+
Component members = MINI_MESSAGE.deserialize(
|
428
436
|
TranslatableCaption.of("info.plot_info_members").getComponent(player),
|
429
|
-
|
437
|
+
TagResolver.resolver("members", Tag.inserting(PlayerManager.getPlayerList(plot.getMembers(), player)))
|
430
438
|
);
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
"hover_info",
|
436
|
-
MINI_MESSAGE.serialize(Component
|
437
|
-
.text()
|
438
|
-
.append(trusted)
|
439
|
-
.append(Component.newline())
|
440
|
-
.append(members)
|
441
|
-
.asComponent())
|
442
|
-
);
|
443
|
-
Template numberTemplate = Template.of("number", String.valueOf(i));
|
444
|
-
Template plotTemplate = Template.of(
|
445
|
-
"plot",
|
446
|
-
MINI_MESSAGE.parse(color.getComponent(player), Template.of("plot", plot.toString()))
|
439
|
+
TagResolver.Builder finalResolver = TagResolver.builder();
|
440
|
+
finalResolver.tag(
|
441
|
+
"command_tp",
|
442
|
+
Tag.preProcessParsed("/plot visit " + plot.getArea() + ";" + plot.getId())
|
447
443
|
);
|
448
|
-
|
444
|
+
finalResolver.tag(
|
445
|
+
"command_info",
|
446
|
+
Tag.preProcessParsed("/plot info " + plot.getArea() + ";" + plot.getId())
|
447
|
+
);
|
448
|
+
finalResolver.tag("hover_info", Tag.inserting(
|
449
|
+
Component.text()
|
450
|
+
.append(trusted)
|
451
|
+
.append(Component.newline())
|
452
|
+
.append(members)
|
453
|
+
.asComponent()
|
454
|
+
));
|
455
|
+
finalResolver.tag("number", Tag.inserting(Component.text(i)));
|
456
|
+
finalResolver.tag("plot", Tag.inserting(MINI_MESSAGE.deserialize(
|
457
|
+
color.getComponent(player), TagResolver.resolver("plot", Tag.inserting(Component.text(plot.toString())))
|
458
|
+
)));
|
449
459
|
String prefix = "";
|
450
460
|
String online = TranslatableCaption.of("info.plot_list_player_online").getComponent(player);
|
451
461
|
String offline = TranslatableCaption.of("info.plot_list_player_offline").getComponent(player);
|
@@ -454,35 +464,37 @@ public class ListCmd extends SubCommand {
|
|
454
464
|
String everyone = TranslatableCaption.of("info.plot_list_player_everyone").getComponent(player);
|
455
465
|
TextComponent.Builder builder = Component.text();
|
456
466
|
if (plot.getFlag(ServerPlotFlag.class)) {
|
457
|
-
|
467
|
+
TagResolver serverResolver = TagResolver.resolver(
|
458
468
|
"info.server",
|
459
|
-
TranslatableCaption.of("info.server").
|
469
|
+
Tag.inserting(TranslatableCaption.of("info.server").toComponent(player))
|
460
470
|
);
|
461
|
-
builder.append(MINI_MESSAGE.
|
471
|
+
builder.append(MINI_MESSAGE.deserialize(server, serverResolver));
|
462
472
|
} else {
|
463
473
|
try {
|
464
474
|
final List<UUIDMapping> names = PlotSquared.get().getImpromptuUUIDPipeline().getNames(plot.getOwners())
|
465
475
|
.get(Settings.UUID.BLOCKING_TIMEOUT, TimeUnit.MILLISECONDS);
|
466
476
|
for (final UUIDMapping uuidMapping : names) {
|
467
|
-
PlotPlayer<?> pp = PlotSquared.platform().playerManager().getPlayerIfExists(uuidMapping.
|
468
|
-
|
469
|
-
|
477
|
+
PlotPlayer<?> pp = PlotSquared.platform().playerManager().getPlayerIfExists(uuidMapping.uuid());
|
478
|
+
TagResolver resolver = TagResolver.builder()
|
479
|
+
.tag("prefix", Tag.inserting(Component.text(prefix)))
|
480
|
+
.tag("player", Tag.inserting(Component.text(uuidMapping.username())))
|
481
|
+
.build();
|
470
482
|
if (pp != null) {
|
471
|
-
builder.append(MINI_MESSAGE.
|
472
|
-
} else if (uuidMapping.
|
473
|
-
|
483
|
+
builder.append(MINI_MESSAGE.deserialize(online, resolver));
|
484
|
+
} else if (uuidMapping.username().equalsIgnoreCase("unknown")) {
|
485
|
+
TagResolver unknownResolver = TagResolver.resolver(
|
474
486
|
"info.unknown",
|
475
|
-
TranslatableCaption.of("info.unknown").
|
487
|
+
Tag.inserting(TranslatableCaption.of("info.unknown").toComponent(player))
|
476
488
|
);
|
477
|
-
builder.append(MINI_MESSAGE.
|
478
|
-
} else if (uuidMapping.
|
479
|
-
|
489
|
+
builder.append(MINI_MESSAGE.deserialize(unknown, unknownResolver));
|
490
|
+
} else if (uuidMapping.uuid().equals(DBFunc.EVERYONE)) {
|
491
|
+
TagResolver everyoneResolver = TagResolver.resolver(
|
480
492
|
"info.everyone",
|
481
|
-
TranslatableCaption.of("info.everyone").
|
493
|
+
Tag.inserting(TranslatableCaption.of("info.everyone").toComponent(player))
|
482
494
|
);
|
483
|
-
builder.append(MINI_MESSAGE.
|
495
|
+
builder.append(MINI_MESSAGE.deserialize(everyone, everyoneResolver));
|
484
496
|
} else {
|
485
|
-
builder.append(MINI_MESSAGE.
|
497
|
+
builder.append(MINI_MESSAGE.deserialize(offline, resolver));
|
486
498
|
}
|
487
499
|
prefix = ", ";
|
488
500
|
}
|
@@ -498,15 +510,15 @@ public class ListCmd extends SubCommand {
|
|
498
510
|
}
|
499
511
|
player.sendMessage(
|
500
512
|
TranslatableCaption.of("errors.invalid_player"),
|
501
|
-
|
513
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(playerBuilder.toString())))
|
502
514
|
);
|
503
515
|
} catch (TimeoutException e) {
|
504
516
|
player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout"));
|
505
517
|
}
|
506
518
|
}
|
507
|
-
|
519
|
+
finalResolver.tag("players", Tag.inserting(builder.asComponent()));
|
508
520
|
caption.set(TranslatableCaption.of("info.plot_list_item"));
|
509
|
-
caption.
|
521
|
+
caption.setTagResolvers(finalResolver.build());
|
510
522
|
}
|
511
523
|
}, "/plot list " + args[0], TranslatableCaption.of("list.plot_list_header_paged"));
|
512
524
|
}
|
@@ -35,7 +35,9 @@ import com.plotsquared.core.util.SchematicHandler;
|
|
35
35
|
import com.plotsquared.core.util.TimeUtil;
|
36
36
|
import com.plotsquared.core.util.task.RunnableVal;
|
37
37
|
import com.plotsquared.core.util.task.TaskManager;
|
38
|
-
import net.kyori.adventure.text.
|
38
|
+
import net.kyori.adventure.text.Component;
|
39
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
40
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
39
41
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
40
42
|
|
41
43
|
import java.net.MalformedURLException;
|
@@ -97,7 +99,7 @@ public class Load extends SubCommand {
|
|
97
99
|
// No schematics found:
|
98
100
|
player.sendMessage(
|
99
101
|
TranslatableCaption.of("web.load_null"),
|
100
|
-
|
102
|
+
TagResolver.resolver("command", Tag.inserting(Component.text("/plot load")))
|
101
103
|
);
|
102
104
|
return false;
|
103
105
|
}
|
@@ -108,7 +110,7 @@ public class Load extends SubCommand {
|
|
108
110
|
// use /plot load <index>
|
109
111
|
player.sendMessage(
|
110
112
|
TranslatableCaption.of("invalid.not_valid_number"),
|
111
|
-
|
113
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("(1, " + schematics.size() + ')')))
|
112
114
|
);
|
113
115
|
return false;
|
114
116
|
}
|
@@ -128,7 +130,10 @@ public class Load extends SubCommand {
|
|
128
130
|
plot.removeRunning();
|
129
131
|
player.sendMessage(
|
130
132
|
TranslatableCaption.of("schematics.schematic_invalid"),
|
131
|
-
|
133
|
+
TagResolver.resolver(
|
134
|
+
"reason",
|
135
|
+
Tag.inserting(Component.text("non-existent or not in gzip format"))
|
136
|
+
)
|
132
137
|
);
|
133
138
|
return;
|
134
139
|
}
|
@@ -159,7 +164,7 @@ public class Load extends SubCommand {
|
|
159
164
|
plot.removeRunning();
|
160
165
|
player.sendMessage(
|
161
166
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
162
|
-
|
167
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("/plot load <index>")))
|
163
168
|
);
|
164
169
|
return false;
|
165
170
|
}
|
@@ -210,46 +215,9 @@ public class Load extends SubCommand {
|
|
210
215
|
}
|
211
216
|
player.sendMessage(
|
212
217
|
TranslatableCaption.of("web.load_list"),
|
213
|
-
|
218
|
+
TagResolver.resolver("command", Tag.inserting(Component.text("/plot load #")))
|
214
219
|
);
|
215
220
|
}
|
216
221
|
}
|
217
222
|
|
218
|
-
/**
|
219
|
-
* @deprecated Use {@link TimeUtil#secToTime(long)}
|
220
|
-
*/
|
221
|
-
@Deprecated(forRemoval = true, since = "6.6.2")
|
222
|
-
public String secToTime(long time) {
|
223
|
-
StringBuilder toreturn = new StringBuilder();
|
224
|
-
if (time >= 33868800) {
|
225
|
-
int years = (int) (time / 33868800);
|
226
|
-
time -= years * 33868800;
|
227
|
-
toreturn.append(years).append("y ");
|
228
|
-
}
|
229
|
-
if (time >= 604800) {
|
230
|
-
int weeks = (int) (time / 604800);
|
231
|
-
time -= weeks * 604800;
|
232
|
-
toreturn.append(weeks).append("w ");
|
233
|
-
}
|
234
|
-
if (time >= 86400) {
|
235
|
-
int days = (int) (time / 86400);
|
236
|
-
time -= days * 86400;
|
237
|
-
toreturn.append(days).append("d ");
|
238
|
-
}
|
239
|
-
if (time >= 3600) {
|
240
|
-
int hours = (int) (time / 3600);
|
241
|
-
time -= hours * 3600;
|
242
|
-
toreturn.append(hours).append("h ");
|
243
|
-
}
|
244
|
-
if (time >= 60) {
|
245
|
-
int minutes = (int) (time / 60);
|
246
|
-
time -= minutes * 60;
|
247
|
-
toreturn.append(minutes).append("m ");
|
248
|
-
}
|
249
|
-
if (toreturn.length() == 0 || (time > 0)) {
|
250
|
-
toreturn.append(time).append("s ");
|
251
|
-
}
|
252
|
-
return toreturn.toString().trim();
|
253
|
-
}
|
254
|
-
|
255
223
|
}
|
@@ -35,6 +35,9 @@ import com.plotsquared.core.util.EconHandler;
|
|
35
35
|
import com.plotsquared.core.util.PlotExpression;
|
36
36
|
import com.plotsquared.core.util.task.RunnableVal2;
|
37
37
|
import com.plotsquared.core.util.task.RunnableVal3;
|
38
|
+
import net.kyori.adventure.text.Component;
|
39
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
40
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
38
41
|
import org.apache.logging.log4j.LogManager;
|
39
42
|
import org.apache.logging.log4j.Logger;
|
40
43
|
|
@@ -71,7 +74,6 @@ public class MainCommand extends Command {
|
|
71
74
|
commands.add(Buy.class);
|
72
75
|
if (Settings.Web.LEGACY_WEBINTERFACE) {
|
73
76
|
LOGGER.warn("Legacy webinterface is used. Please note that it will be removed in future.");
|
74
|
-
commands.add(Save.class);
|
75
77
|
}
|
76
78
|
commands.add(Load.class);
|
77
79
|
commands.add(Confirm.class);
|
@@ -120,7 +122,6 @@ public class MainCommand extends Command {
|
|
120
122
|
commands.add(Move.class);
|
121
123
|
commands.add(Condense.class);
|
122
124
|
commands.add(Copy.class);
|
123
|
-
commands.add(Chat.class);
|
124
125
|
commands.add(Trim.class);
|
125
126
|
commands.add(Done.class);
|
126
127
|
commands.add(Continue.class);
|
@@ -182,7 +183,7 @@ public class MainCommand extends Command {
|
|
182
183
|
if (cmd.hasConfirmation(player)) {
|
183
184
|
CmdConfirm.addPending(player, cmd.getUsage(), () -> {
|
184
185
|
PlotArea area = player.getApplicablePlotArea();
|
185
|
-
if (area != null && econHandler.isEnabled(area)) {
|
186
|
+
if (area != null && econHandler.isEnabled(area) && !player.hasPermission(Permission.PERMISSION_ADMIN_BYPASS_ECON)) {
|
186
187
|
PlotExpression priceEval =
|
187
188
|
area.getPrices().get(cmd.getFullId());
|
188
189
|
double price = priceEval != null ? priceEval.evaluate(0d) : 0d;
|
@@ -200,7 +201,7 @@ public class MainCommand extends Command {
|
|
200
201
|
return;
|
201
202
|
}
|
202
203
|
PlotArea area = player.getApplicablePlotArea();
|
203
|
-
if (area != null && econHandler.isEnabled(area)) {
|
204
|
+
if (area != null && econHandler.isEnabled(area) && !player.hasPermission(Permission.PERMISSION_ADMIN_BYPASS_ECON)) {
|
204
205
|
PlotExpression priceEval = area.getPrices().get(cmd.getFullId());
|
205
206
|
double price = priceEval != null ? priceEval.evaluate(0d) : 0d;
|
206
207
|
if (price != 0d && econHandler.getMoney(player) < price) {
|
@@ -310,7 +311,7 @@ public class MainCommand extends Command {
|
|
310
311
|
if (message != null) {
|
311
312
|
player.sendMessage(
|
312
313
|
TranslatableCaption.of("errors.error"),
|
313
|
-
|
314
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(message)))
|
314
315
|
);
|
315
316
|
} else {
|
316
317
|
player.sendMessage(
|
@@ -34,7 +34,9 @@ import com.plotsquared.core.util.EconHandler;
|
|
34
34
|
import com.plotsquared.core.util.EventDispatcher;
|
35
35
|
import com.plotsquared.core.util.PlotExpression;
|
36
36
|
import com.plotsquared.core.util.StringMan;
|
37
|
-
import net.kyori.adventure.text.
|
37
|
+
import net.kyori.adventure.text.Component;
|
38
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
39
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
38
40
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
39
41
|
|
40
42
|
import java.util.UUID;
|
@@ -107,18 +109,20 @@ public class Merge extends SubCommand {
|
|
107
109
|
}
|
108
110
|
}
|
109
111
|
if (direction == null && (args[0].equalsIgnoreCase("all") || args[0]
|
110
|
-
.equalsIgnoreCase("auto"))) {
|
112
|
+
.equalsIgnoreCase("auto")) && player.hasPermission(Permission.PERMISSION_MERGE_ALL)) {
|
111
113
|
direction = Direction.ALL;
|
112
114
|
}
|
113
115
|
}
|
114
116
|
if (direction == null) {
|
115
117
|
player.sendMessage(
|
116
118
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
117
|
-
|
119
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(
|
120
|
+
"/plot merge <" + StringMan.join(values, " | ") + "> [removeroads]"
|
121
|
+
)))
|
118
122
|
);
|
119
123
|
player.sendMessage(
|
120
124
|
TranslatableCaption.of("help.direction"),
|
121
|
-
|
125
|
+
TagResolver.resolver("dir", Tag.inserting(Component.text(direction(location.getYaw()))))
|
122
126
|
);
|
123
127
|
return false;
|
124
128
|
}
|
@@ -129,7 +133,7 @@ public class Merge extends SubCommand {
|
|
129
133
|
if (event.getEventResult() == Result.DENY) {
|
130
134
|
player.sendMessage(
|
131
135
|
TranslatableCaption.of("events.event_denied"),
|
132
|
-
|
136
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("Merge")))
|
133
137
|
);
|
134
138
|
return false;
|
135
139
|
}
|
@@ -140,7 +144,7 @@ public class Merge extends SubCommand {
|
|
140
144
|
if (!force && size - 1 > maxSize) {
|
141
145
|
player.sendMessage(
|
142
146
|
TranslatableCaption.of("permission.no_permission"),
|
143
|
-
|
147
|
+
TagResolver.resolver("node", Tag.inserting(Component.text(Permission.PERMISSION_MERGE + "." + (size + 1))))
|
144
148
|
);
|
145
149
|
return false;
|
146
150
|
}
|
@@ -166,17 +170,23 @@ public class Merge extends SubCommand {
|
|
166
170
|
if (!force && !terrain && !player.hasPermission(Permission.PERMISSION_MERGE_KEEP_ROAD)) {
|
167
171
|
player.sendMessage(
|
168
172
|
TranslatableCaption.of("permission.no_permission"),
|
169
|
-
|
173
|
+
TagResolver.resolver(
|
174
|
+
"node",
|
175
|
+
Tag.inserting(Permission.PERMISSION_MERGE_KEEP_ROAD)
|
176
|
+
)
|
170
177
|
);
|
171
178
|
return true;
|
172
179
|
}
|
173
180
|
if (plot.getPlotModificationManager().autoMerge(Direction.ALL, maxSize, uuid, player, terrain)) {
|
174
|
-
if (this.econHandler.isEnabled(plotArea) && price > 0d) {
|
181
|
+
if (this.econHandler.isEnabled(plotArea) && !player.hasPermission(Permission.PERMISSION_ADMIN_BYPASS_ECON) && price > 0d) {
|
175
182
|
this.econHandler.withdrawMoney(player, price);
|
176
183
|
player.sendMessage(
|
177
184
|
TranslatableCaption.of("economy.removed_balance"),
|
178
|
-
|
179
|
-
|
185
|
+
TagResolver.resolver("money", Tag.inserting(Component.text(this.econHandler.format(price)))),
|
186
|
+
TagResolver.resolver(
|
187
|
+
"balance",
|
188
|
+
Tag.inserting(Component.text(this.econHandler.format(this.econHandler.getMoney(player))))
|
189
|
+
)
|
180
190
|
);
|
181
191
|
}
|
182
192
|
player.sendMessage(TranslatableCaption.of("merge.success_merge"));
|
@@ -186,11 +196,11 @@ public class Merge extends SubCommand {
|
|
186
196
|
player.sendMessage(TranslatableCaption.of("merge.no_available_automerge"));
|
187
197
|
return false;
|
188
198
|
}
|
189
|
-
if (!force && this.econHandler.isEnabled(plotArea) && price > 0d
|
190
|
-
|
199
|
+
if (!force && this.econHandler.isEnabled(plotArea) && !player.hasPermission(Permission.PERMISSION_ADMIN_BYPASS_ECON) && price > 0d && this.econHandler.getMoney(
|
200
|
+
player) < price) {
|
191
201
|
player.sendMessage(
|
192
202
|
TranslatableCaption.of("economy.cannot_afford_merge"),
|
193
|
-
|
203
|
+
TagResolver.resolver("money", Tag.inserting(Component.text(this.econHandler.format(price))))
|
194
204
|
);
|
195
205
|
return false;
|
196
206
|
}
|
@@ -203,16 +213,16 @@ public class Merge extends SubCommand {
|
|
203
213
|
if (!force && !terrain && !player.hasPermission(Permission.PERMISSION_MERGE_KEEP_ROAD)) {
|
204
214
|
player.sendMessage(
|
205
215
|
TranslatableCaption.of("permission.no_permission"),
|
206
|
-
|
216
|
+
TagResolver.resolver("node", Tag.inserting(Permission.PERMISSION_MERGE_KEEP_ROAD))
|
207
217
|
);
|
208
218
|
return true;
|
209
219
|
}
|
210
220
|
if (plot.getPlotModificationManager().autoMerge(direction, maxSize - size, uuid, player, terrain)) {
|
211
|
-
if (this.econHandler.isEnabled(plotArea) && price > 0d) {
|
221
|
+
if (this.econHandler.isEnabled(plotArea) && !player.hasPermission(Permission.PERMISSION_ADMIN_BYPASS_ECON) && price > 0d) {
|
212
222
|
this.econHandler.withdrawMoney(player, price);
|
213
223
|
player.sendMessage(
|
214
224
|
TranslatableCaption.of("economy.removed_balance"),
|
215
|
-
|
225
|
+
TagResolver.resolver("money", Tag.inserting(Component.text(this.econHandler.format(price))))
|
216
226
|
);
|
217
227
|
}
|
218
228
|
player.sendMessage(TranslatableCaption.of("merge.success_merge"));
|
@@ -228,7 +238,7 @@ public class Merge extends SubCommand {
|
|
228
238
|
if (!force && !player.hasPermission(Permission.PERMISSION_MERGE_OTHER)) {
|
229
239
|
player.sendMessage(
|
230
240
|
TranslatableCaption.of("permission.no_permission"),
|
231
|
-
|
241
|
+
TagResolver.resolver("node", Tag.inserting(Permission.PERMISSION_MERGE_OTHER))
|
232
242
|
);
|
233
243
|
return false;
|
234
244
|
}
|
@@ -249,18 +259,18 @@ public class Merge extends SubCommand {
|
|
249
259
|
accepter.sendMessage(TranslatableCaption.of("merge.merge_not_valid"));
|
250
260
|
return;
|
251
261
|
}
|
252
|
-
if (this.econHandler.isEnabled(plotArea) && price > 0d) {
|
262
|
+
if (this.econHandler.isEnabled(plotArea) && !player.hasPermission(Permission.PERMISSION_ADMIN_BYPASS_ECON) && price > 0d) {
|
253
263
|
if (!force && this.econHandler.getMoney(player) < price) {
|
254
264
|
player.sendMessage(
|
255
265
|
TranslatableCaption.of("economy.cannot_afford_merge"),
|
256
|
-
|
266
|
+
TagResolver.resolver("money", Tag.inserting(Component.text(this.econHandler.format(price))))
|
257
267
|
);
|
258
268
|
return;
|
259
269
|
}
|
260
270
|
this.econHandler.withdrawMoney(player, price);
|
261
271
|
player.sendMessage(
|
262
272
|
TranslatableCaption.of("economy.removed_balance"),
|
263
|
-
|
273
|
+
TagResolver.resolver("money", Tag.inserting(Component.text(this.econHandler.format(price))))
|
264
274
|
);
|
265
275
|
}
|
266
276
|
player.sendMessage(TranslatableCaption.of("merge.success_merge"));
|
@@ -268,10 +278,15 @@ public class Merge extends SubCommand {
|
|
268
278
|
};
|
269
279
|
if (!force && hasConfirmation(player)) {
|
270
280
|
CmdConfirm.addPending(accepter, MINI_MESSAGE.serialize(MINI_MESSAGE
|
271
|
-
.
|
281
|
+
.deserialize(
|
272
282
|
TranslatableCaption.of("merge.merge_request_confirm").getComponent(player),
|
273
|
-
|
274
|
-
|
283
|
+
TagResolver.builder()
|
284
|
+
.tag("player", Tag.inserting(Component.text(player.getName())))
|
285
|
+
.tag(
|
286
|
+
"location",
|
287
|
+
Tag.inserting(Component.text(plot.getWorldName() + " " + plot.getId()))
|
288
|
+
)
|
289
|
+
.build()
|
275
290
|
)),
|
276
291
|
run
|
277
292
|
);
|
@@ -288,18 +303,18 @@ public class Merge extends SubCommand {
|
|
288
303
|
player,
|
289
304
|
terrain
|
290
305
|
)) {
|
291
|
-
if (this.econHandler.isEnabled(plotArea) && price > 0d) {
|
306
|
+
if (this.econHandler.isEnabled(plotArea) && !player.hasPermission(Permission.PERMISSION_ADMIN_BYPASS_ECON) && price > 0d) {
|
292
307
|
if (!force && this.econHandler.getMoney(player) < price) {
|
293
308
|
player.sendMessage(
|
294
309
|
TranslatableCaption.of("economy.cannot_afford_merge"),
|
295
|
-
|
310
|
+
TagResolver.resolver("money", Tag.inserting(Component.text(this.econHandler.format(price))))
|
296
311
|
);
|
297
312
|
return false;
|
298
313
|
}
|
299
314
|
this.econHandler.withdrawMoney(player, price);
|
300
315
|
player.sendMessage(
|
301
316
|
TranslatableCaption.of("economy.removed_balance"),
|
302
|
-
|
317
|
+
TagResolver.resolver("money", Tag.inserting(Component.text(this.econHandler.format(price))))
|
303
318
|
);
|
304
319
|
}
|
305
320
|
player.sendMessage(TranslatableCaption.of("merge.success_merge"));
|
@@ -28,7 +28,9 @@ import com.plotsquared.core.plot.PlotArea;
|
|
28
28
|
import com.plotsquared.core.plot.world.PlotAreaManager;
|
29
29
|
import com.plotsquared.core.util.task.RunnableVal2;
|
30
30
|
import com.plotsquared.core.util.task.RunnableVal3;
|
31
|
-
import net.kyori.adventure.text.
|
31
|
+
import net.kyori.adventure.text.Component;
|
32
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
33
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
32
34
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
33
35
|
|
34
36
|
import java.util.concurrent.CompletableFuture;
|
@@ -104,8 +106,10 @@ public class Move extends SubCommand {
|
|
104
106
|
if (result) {
|
105
107
|
player.sendMessage(
|
106
108
|
TranslatableCaption.of("move.move_success"),
|
107
|
-
|
108
|
-
|
109
|
+
TagResolver.builder()
|
110
|
+
.tag("origin", Tag.inserting(Component.text(p1)))
|
111
|
+
.tag("target", Tag.inserting(Component.text(p2)))
|
112
|
+
.build()
|
109
113
|
);
|
110
114
|
return true;
|
111
115
|
} else {
|
@@ -35,7 +35,9 @@ import com.plotsquared.core.util.EventDispatcher;
|
|
35
35
|
import com.plotsquared.core.util.InventoryUtil;
|
36
36
|
import com.sk89q.worldedit.world.item.ItemType;
|
37
37
|
import com.sk89q.worldedit.world.item.ItemTypes;
|
38
|
-
import net.kyori.adventure.text.
|
38
|
+
import net.kyori.adventure.text.Component;
|
39
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
40
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
39
41
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
40
42
|
|
41
43
|
import javax.annotation.Nullable;
|
@@ -54,7 +56,7 @@ public class Music extends SubCommand {
|
|
54
56
|
.asList("music_disc_13", "music_disc_cat", "music_disc_blocks", "music_disc_chirp",
|
55
57
|
"music_disc_far", "music_disc_mall", "music_disc_mellohi", "music_disc_stal",
|
56
58
|
"music_disc_strad", "music_disc_ward", "music_disc_11", "music_disc_wait", "music_disc_otherside",
|
57
|
-
"music_disc_pigstep", "music_disc_5"
|
59
|
+
"music_disc_pigstep", "music_disc_5", "music_disc_relic"
|
58
60
|
);
|
59
61
|
|
60
62
|
private final InventoryUtil inventoryUtil;
|
@@ -81,7 +83,10 @@ public class Music extends SubCommand {
|
|
81
83
|
if (!plot.isAdded(player.getUUID()) && !player.hasPermission(Permission.PERMISSION_ADMIN_MUSIC_OTHER)) {
|
82
84
|
player.sendMessage(
|
83
85
|
TranslatableCaption.of("permission.no_permission"),
|
84
|
-
|
86
|
+
TagResolver.resolver(
|
87
|
+
"node",
|
88
|
+
Tag.inserting(Permission.PERMISSION_ADMIN_MUSIC_OTHER)
|
89
|
+
)
|
85
90
|
);
|
86
91
|
return true;
|
87
92
|
}
|
@@ -104,15 +109,17 @@ public class Music extends SubCommand {
|
|
104
109
|
if (event.getEventResult() == Result.DENY) {
|
105
110
|
getPlayer().sendMessage(
|
106
111
|
TranslatableCaption.of("events.event_denied"),
|
107
|
-
|
112
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("Music removal")))
|
108
113
|
);
|
109
114
|
return true;
|
110
115
|
}
|
111
116
|
plot.removeFlag(event.getFlag());
|
112
117
|
getPlayer().sendMessage(
|
113
118
|
TranslatableCaption.of("flag.flag_removed"),
|
114
|
-
|
115
|
-
|
119
|
+
TagResolver.builder()
|
120
|
+
.tag("flag", Tag.inserting(Component.text("music")))
|
121
|
+
.tag("value", Tag.inserting(Component.text("music_disc")))
|
122
|
+
.build()
|
116
123
|
);
|
117
124
|
} else if (item.getName().toLowerCase(Locale.ENGLISH).contains("disc")) {
|
118
125
|
PlotFlag<?, ?> plotFlag = plot.getFlagContainer().getFlag(MusicFlag.class)
|
@@ -121,13 +128,17 @@ public class Music extends SubCommand {
|
|
121
128
|
if (event.getEventResult() == Result.DENY) {
|
122
129
|
getPlayer().sendMessage(
|
123
130
|
TranslatableCaption.of("events.event_denied"),
|
124
|
-
|
131
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("Music addition")))
|
125
132
|
);
|
126
133
|
return true;
|
127
134
|
}
|
128
135
|
plot.setFlag(event.getFlag());
|
129
|
-
getPlayer().sendMessage(
|
130
|
-
|
136
|
+
getPlayer().sendMessage(
|
137
|
+
TranslatableCaption.of("flag.flag_added"),
|
138
|
+
TagResolver.builder()
|
139
|
+
.tag("flag", Tag.inserting(Component.text("music")))
|
140
|
+
.tag("value", Tag.inserting(Component.text(event.getFlag().getValue().toString())))
|
141
|
+
.build()
|
131
142
|
);
|
132
143
|
} else {
|
133
144
|
getPlayer().sendMessage(TranslatableCaption.of("flag.flag_not_added"));
|
@@ -24,7 +24,9 @@ import com.plotsquared.core.plot.Plot;
|
|
24
24
|
import com.plotsquared.core.util.StringMan;
|
25
25
|
import com.plotsquared.core.util.task.RunnableVal2;
|
26
26
|
import com.plotsquared.core.util.task.RunnableVal3;
|
27
|
-
import net.kyori.adventure.text.
|
27
|
+
import net.kyori.adventure.text.Component;
|
28
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
29
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
28
30
|
|
29
31
|
import java.util.List;
|
30
32
|
import java.util.concurrent.CompletableFuture;
|
@@ -49,7 +51,7 @@ public class Near extends Command {
|
|
49
51
|
final Plot plot = check(player.getCurrentPlot(), TranslatableCaption.of("errors.not_in_plot"));
|
50
52
|
player.sendMessage(
|
51
53
|
TranslatableCaption.of("near.plot_near"),
|
52
|
-
|
54
|
+
TagResolver.resolver("list", Tag.inserting(Component.text(StringMan.join(plot.getPlayersInPlot(), ", "))))
|
53
55
|
);
|
54
56
|
return CompletableFuture.completedFuture(true);
|
55
57
|
}
|
@@ -34,7 +34,9 @@ import com.plotsquared.core.util.EventDispatcher;
|
|
34
34
|
import com.plotsquared.core.util.PlayerManager;
|
35
35
|
import com.plotsquared.core.util.TabCompletions;
|
36
36
|
import com.plotsquared.core.util.task.TaskManager;
|
37
|
-
import net.kyori.adventure.text.
|
37
|
+
import net.kyori.adventure.text.Component;
|
38
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
39
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
38
40
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
39
41
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
40
42
|
|
@@ -65,7 +67,7 @@ public class Owner extends SetCommand {
|
|
65
67
|
if (value == null || value.isEmpty()) {
|
66
68
|
player.sendMessage(
|
67
69
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
68
|
-
|
70
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("/plot setowner <owner>")))
|
69
71
|
);
|
70
72
|
return false;
|
71
73
|
}
|
@@ -77,7 +79,7 @@ public class Owner extends SetCommand {
|
|
77
79
|
&& !value.equalsIgnoreCase("-")) {
|
78
80
|
player.sendMessage(
|
79
81
|
TranslatableCaption.of("errors.invalid_player"),
|
80
|
-
|
82
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(value)))
|
81
83
|
);
|
82
84
|
return;
|
83
85
|
}
|
@@ -91,7 +93,7 @@ public class Owner extends SetCommand {
|
|
91
93
|
if (event.getEventResult() == Result.DENY) {
|
92
94
|
player.sendMessage(
|
93
95
|
TranslatableCaption.of("events.event_denied"),
|
94
|
-
|
96
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("Owner change")))
|
95
97
|
);
|
96
98
|
return;
|
97
99
|
}
|
@@ -114,7 +116,7 @@ public class Owner extends SetCommand {
|
|
114
116
|
if (unlinkEvent.getEventResult() == Result.DENY) {
|
115
117
|
player.sendMessage(
|
116
118
|
TranslatableCaption.of("events.event_denied"),
|
117
|
-
|
119
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("Unlink on owner change")))
|
118
120
|
);
|
119
121
|
return;
|
120
122
|
}
|
@@ -134,7 +136,10 @@ public class Owner extends SetCommand {
|
|
134
136
|
if (plot.isOwner(uuid)) {
|
135
137
|
player.sendMessage(
|
136
138
|
TranslatableCaption.of("member.already_owner"),
|
137
|
-
|
139
|
+
TagResolver.resolver(
|
140
|
+
"player",
|
141
|
+
Tag.inserting(PlayerManager.resolveName(uuid, false).toComponent(player))
|
142
|
+
)
|
138
143
|
);
|
139
144
|
return;
|
140
145
|
}
|
@@ -142,7 +147,10 @@ public class Owner extends SetCommand {
|
|
142
147
|
if (other == null) {
|
143
148
|
player.sendMessage(
|
144
149
|
TranslatableCaption.of("errors.invalid_player_offline"),
|
145
|
-
|
150
|
+
TagResolver.resolver(
|
151
|
+
"player",
|
152
|
+
Tag.inserting(PlayerManager.resolveName(uuid).toComponent(player))
|
153
|
+
)
|
146
154
|
);
|
147
155
|
return;
|
148
156
|
}
|
@@ -178,7 +186,10 @@ public class Owner extends SetCommand {
|
|
178
186
|
if (other != null) {
|
179
187
|
other.sendMessage(
|
180
188
|
TranslatableCaption.of("owner.now_owner"),
|
181
|
-
|
189
|
+
TagResolver.resolver(
|
190
|
+
"plot",
|
191
|
+
Tag.inserting(Component.text(plot.getArea() + ";" + plot.getId()))
|
192
|
+
)
|
182
193
|
);
|
183
194
|
}
|
184
195
|
} else {
|
@@ -23,7 +23,9 @@ import com.plotsquared.core.configuration.caption.StaticCaption;
|
|
23
23
|
import com.plotsquared.core.player.PlotPlayer;
|
24
24
|
import com.plotsquared.core.util.PremiumVerification;
|
25
25
|
import com.plotsquared.core.util.task.TaskManager;
|
26
|
-
import net.kyori.adventure.text.
|
26
|
+
import net.kyori.adventure.text.Component;
|
27
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
28
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
27
29
|
|
28
30
|
@CommandDeclaration(command = "plugin",
|
29
31
|
permission = "plots.use",
|
@@ -39,17 +41,17 @@ public class PluginCmd extends SubCommand {
|
|
39
41
|
StaticCaption.of("<gray>>> </gray><gold><bold>" + PlotSquared
|
40
42
|
.platform()
|
41
43
|
.pluginName() + " <reset><gray>(<gold>Version</gold><gray>: </gray><gold><version></gold><gray>)</gray>"),
|
42
|
-
|
44
|
+
TagResolver.resolver("version", Tag.inserting(Component.text(String.valueOf(PlotSquared.get().getVersion()))))
|
43
45
|
);
|
44
46
|
player.sendMessage(StaticCaption.of(
|
45
47
|
"<gray>>> </gray><gold><bold>Authors<reset><gray>: </gray><gold>Citymonstret </gold><gray>& </gray><gold>Empire92 </gold><gray>& </gray><gold>MattBDev </gold><gray>& </gray><gold>dordsor21 </gold><gray>& </gray><gold>NotMyFault </gold><gray>& </gray><gold>SirYwell</gold>"));
|
46
48
|
player.sendMessage(StaticCaption.of(
|
47
|
-
"<gray>>> </gray><gold><bold>Wiki<reset><gray>: </gray><gold><click:open_url:https://intellectualsites.
|
49
|
+
"<gray>>> </gray><gold><bold>Wiki<reset><gray>: </gray><gold><click:open_url:https://intellectualsites.gitbook.io/plotsquared/>https://intellectualsites.gitbook.io/plotsquared/</gold>"));
|
48
50
|
player.sendMessage(StaticCaption.of(
|
49
51
|
"<gray>>> </gray><gold><bold>Discord<reset><gray>: </gray><gold><click:open_url:https://discord.gg/intellectualsites>https://discord.gg/intellectualsites</gold>"));
|
50
52
|
player.sendMessage(
|
51
53
|
StaticCaption.of("<gray>>> </gray><gold><bold>Premium<reset><gray>: <gold><value></gold>"),
|
52
|
-
|
54
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(PremiumVerification.isPremium())))
|
53
55
|
);
|
54
56
|
});
|
55
57
|
return true;
|
@@ -33,7 +33,9 @@ import com.plotsquared.core.util.StringMan;
|
|
33
33
|
import com.plotsquared.core.util.query.PlotQuery;
|
34
34
|
import com.plotsquared.core.util.task.TaskManager;
|
35
35
|
import com.plotsquared.core.uuid.UUIDMapping;
|
36
|
-
import net.kyori.adventure.text.
|
36
|
+
import net.kyori.adventure.text.Component;
|
37
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
38
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
37
39
|
import org.apache.logging.log4j.LogManager;
|
38
40
|
import org.apache.logging.log4j.Logger;
|
39
41
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
@@ -88,72 +90,56 @@ public class Purge extends SubCommand {
|
|
88
90
|
return false;
|
89
91
|
}
|
90
92
|
switch (split[0].toLowerCase()) {
|
91
|
-
case "world"
|
92
|
-
case "
|
93
|
-
world = split[1];
|
94
|
-
break;
|
95
|
-
case "area":
|
96
|
-
case "a":
|
93
|
+
case "world", "w" -> world = split[1];
|
94
|
+
case "area", "a" -> {
|
97
95
|
area = this.plotAreaManager.getPlotAreaByString(split[1]);
|
98
96
|
if (area == null) {
|
99
97
|
player.sendMessage(
|
100
98
|
TranslatableCaption.of("errors.not_valid_plot_world"),
|
101
|
-
|
99
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(split[1])))
|
102
100
|
);
|
103
101
|
return false;
|
104
102
|
}
|
105
|
-
|
106
|
-
case "plotid"
|
107
|
-
case "id":
|
103
|
+
}
|
104
|
+
case "plotid", "id" -> {
|
108
105
|
try {
|
109
106
|
id = PlotId.fromString(split[1]);
|
110
107
|
} catch (IllegalArgumentException ignored) {
|
111
108
|
player.sendMessage(
|
112
109
|
TranslatableCaption.of("invalid.not_valid_plot_id"),
|
113
|
-
|
110
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(split[1])))
|
114
111
|
);
|
115
112
|
return false;
|
116
113
|
}
|
117
|
-
|
118
|
-
case "owner"
|
119
|
-
case "o":
|
114
|
+
}
|
115
|
+
case "owner", "o" -> {
|
120
116
|
UUIDMapping ownerMapping = PlotSquared.get().getImpromptuUUIDPipeline().getImmediately(split[1]);
|
121
117
|
if (ownerMapping == null) {
|
122
118
|
player.sendMessage(
|
123
119
|
TranslatableCaption.of("errors.invalid_player"),
|
124
|
-
|
120
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(split[1])))
|
125
121
|
);
|
126
122
|
return false;
|
127
123
|
}
|
128
|
-
owner = ownerMapping.
|
129
|
-
|
130
|
-
case "shared"
|
131
|
-
case "s":
|
124
|
+
owner = ownerMapping.uuid();
|
125
|
+
}
|
126
|
+
case "shared", "s" -> {
|
132
127
|
UUIDMapping addedMapping = PlotSquared.get().getImpromptuUUIDPipeline().getImmediately(split[1]);
|
133
128
|
if (addedMapping == null) {
|
134
129
|
player.sendMessage(
|
135
130
|
TranslatableCaption.of("errors.invalid_player"),
|
136
|
-
|
131
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(split[1])))
|
137
132
|
);
|
138
133
|
return false;
|
139
134
|
}
|
140
|
-
added = addedMapping.
|
141
|
-
|
142
|
-
case "clear"
|
143
|
-
case "
|
144
|
-
|
145
|
-
case "d":
|
146
|
-
case "del":
|
147
|
-
clear = Boolean.parseBoolean(split[1]);
|
148
|
-
break;
|
149
|
-
case "unknown":
|
150
|
-
case "?":
|
151
|
-
case "u":
|
152
|
-
unknown = Boolean.parseBoolean(split[1]);
|
153
|
-
break;
|
154
|
-
default:
|
135
|
+
added = addedMapping.uuid();
|
136
|
+
}
|
137
|
+
case "clear", "c", "delete", "d", "del" -> clear = Boolean.parseBoolean(split[1]);
|
138
|
+
case "unknown", "?", "u" -> unknown = Boolean.parseBoolean(split[1]);
|
139
|
+
default -> {
|
155
140
|
sendUsage(player);
|
156
141
|
return false;
|
142
|
+
}
|
157
143
|
}
|
158
144
|
}
|
159
145
|
final HashSet<Plot> toDelete = new HashSet<>();
|
@@ -234,9 +220,9 @@ public class Purge extends SubCommand {
|
|
234
220
|
try {
|
235
221
|
ids.add(plot.temp);
|
236
222
|
if (finalClear) {
|
237
|
-
plot.getPlotModificationManager().clear(false, true, player,
|
238
|
-
|
239
|
-
|
223
|
+
plot.getPlotModificationManager().clear(false, true, player,
|
224
|
+
() -> LOGGER.info("Plot {} cleared by purge", plot.getId())
|
225
|
+
);
|
240
226
|
} else {
|
241
227
|
plot.getPlotModificationManager().removeSign();
|
242
228
|
}
|
@@ -258,7 +244,10 @@ public class Purge extends SubCommand {
|
|
258
244
|
DBFunc.purgeIds(ids);
|
259
245
|
player.sendMessage(
|
260
246
|
TranslatableCaption.of("purge.purge_success"),
|
261
|
-
|
247
|
+
TagResolver.resolver(
|
248
|
+
"amount",
|
249
|
+
Tag.inserting(Component.text(ids.size() + "/" + toDelete.size()))
|
250
|
+
)
|
262
251
|
);
|
263
252
|
});
|
264
253
|
}
|
@@ -37,7 +37,9 @@ import com.plotsquared.core.util.MathMan;
|
|
37
37
|
import com.plotsquared.core.util.TabCompletions;
|
38
38
|
import com.plotsquared.core.util.query.PlotQuery;
|
39
39
|
import com.plotsquared.core.util.task.TaskManager;
|
40
|
-
import net.kyori.adventure.text.
|
40
|
+
import net.kyori.adventure.text.Component;
|
41
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
42
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
41
43
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
42
44
|
|
43
45
|
import java.util.Collection;
|
@@ -146,7 +148,7 @@ public class Rate extends SubCommand {
|
|
146
148
|
if (plot.getRatings().containsKey(player.getUUID())) {
|
147
149
|
player.sendMessage(
|
148
150
|
TranslatableCaption.of("ratings.rating_already_exists"),
|
149
|
-
|
151
|
+
TagResolver.resolver("plot", Tag.inserting(Component.text(plot.getId().toString())))
|
150
152
|
);
|
151
153
|
return;
|
152
154
|
}
|
@@ -166,7 +168,7 @@ public class Rate extends SubCommand {
|
|
166
168
|
plot.addRating(this.getPlayer().getUUID(), event.getRating());
|
167
169
|
getPlayer().sendMessage(
|
168
170
|
TranslatableCaption.of("ratings.rating_applied"),
|
169
|
-
|
171
|
+
TagResolver.resolver("plot", Tag.inserting(Component.text(plot.getId().toString())))
|
170
172
|
);
|
171
173
|
}
|
172
174
|
return false;
|
@@ -239,7 +241,7 @@ public class Rate extends SubCommand {
|
|
239
241
|
if (plot.getRatings().containsKey(uuid)) {
|
240
242
|
player.sendMessage(
|
241
243
|
TranslatableCaption.of("ratings.rating_already_exists"),
|
242
|
-
|
244
|
+
TagResolver.resolver("plot", Tag.inserting(Component.text(plot.getId().toString())))
|
243
245
|
);
|
244
246
|
return;
|
245
247
|
}
|
@@ -249,7 +251,7 @@ public class Rate extends SubCommand {
|
|
249
251
|
plot.addRating(uuid, event.getRating());
|
250
252
|
player.sendMessage(
|
251
253
|
TranslatableCaption.of("ratings.rating_applied"),
|
252
|
-
|
254
|
+
TagResolver.resolver("plot", Tag.inserting(Component.text(plot.getId().toString())))
|
253
255
|
);
|
254
256
|
}
|
255
257
|
};
|
@@ -26,7 +26,9 @@ import com.plotsquared.core.player.PlotPlayer;
|
|
26
26
|
import com.plotsquared.core.plot.PlotArea;
|
27
27
|
import com.plotsquared.core.plot.PlotManager;
|
28
28
|
import com.plotsquared.core.plot.world.PlotAreaManager;
|
29
|
-
import net.kyori.adventure.text.
|
29
|
+
import net.kyori.adventure.text.Component;
|
30
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
31
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
30
32
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
31
33
|
|
32
34
|
@CommandDeclaration(command = "regenallroads",
|
@@ -58,18 +60,18 @@ public class RegenAllRoads extends SubCommand {
|
|
58
60
|
} catch (NumberFormatException ignored) {
|
59
61
|
player.sendMessage(
|
60
62
|
TranslatableCaption.of("invalid.not_valid_number"),
|
61
|
-
|
63
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("(0, 256)")))
|
62
64
|
);
|
63
65
|
player.sendMessage(
|
64
66
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
65
|
-
|
67
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("/plot regenallroads <world> [height]")))
|
66
68
|
);
|
67
69
|
return false;
|
68
70
|
}
|
69
71
|
} else if (args.length != 1) {
|
70
72
|
player.sendMessage(
|
71
73
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
72
|
-
|
74
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("/plot regenallroads <world> [height]")))
|
73
75
|
);
|
74
76
|
return false;
|
75
77
|
}
|
@@ -77,7 +79,7 @@ public class RegenAllRoads extends SubCommand {
|
|
77
79
|
if (area == null) {
|
78
80
|
player.sendMessage(
|
79
81
|
TranslatableCaption.of("errors.not_valid_plot_world"),
|
80
|
-
|
82
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(args[0])))
|
81
83
|
);
|
82
84
|
return false;
|
83
85
|
}
|
@@ -88,7 +90,7 @@ public class RegenAllRoads extends SubCommand {
|
|
88
90
|
}
|
89
91
|
player.sendMessage(
|
90
92
|
TranslatableCaption.of("debugroadregen.schematic"),
|
91
|
-
|
93
|
+
TagResolver.resolver("command", Tag.inserting(Component.text("/plot createroadschematic")))
|
92
94
|
);
|
93
95
|
player.sendMessage(TranslatableCaption.of("debugroadregen.regenallroads_started"));
|
94
96
|
boolean result = this.hybridUtils.scheduleRoadUpdate(area, height);
|
@@ -28,7 +28,9 @@ import com.plotsquared.core.plot.Plot;
|
|
28
28
|
import com.plotsquared.core.util.EventDispatcher;
|
29
29
|
import com.plotsquared.core.util.PlayerManager;
|
30
30
|
import com.plotsquared.core.util.TabCompletions;
|
31
|
-
import net.kyori.adventure.text.
|
31
|
+
import net.kyori.adventure.text.Component;
|
32
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
33
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
32
34
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
33
35
|
|
34
36
|
import java.util.Collection;
|
@@ -77,7 +79,7 @@ public class Remove extends SubCommand {
|
|
77
79
|
} else if (throwable != null) {
|
78
80
|
player.sendMessage(
|
79
81
|
TranslatableCaption.of("errors.invalid_player"),
|
80
|
-
|
82
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(args[0])))
|
81
83
|
);
|
82
84
|
return;
|
83
85
|
} else if (!uuids.isEmpty()) {
|
@@ -113,13 +115,13 @@ public class Remove extends SubCommand {
|
|
113
115
|
}
|
114
116
|
if (count == 0) {
|
115
117
|
player.sendMessage(
|
116
|
-
TranslatableCaption.of("
|
117
|
-
|
118
|
+
TranslatableCaption.of("errors.invalid_player"),
|
119
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(args[0])))
|
118
120
|
);
|
119
121
|
} else {
|
120
122
|
player.sendMessage(
|
121
123
|
TranslatableCaption.of("member.removed_players"),
|
122
|
-
|
124
|
+
TagResolver.resolver("amount", Tag.inserting(Component.text(count)))
|
123
125
|
);
|
124
126
|
}
|
125
127
|
});
|
@@ -1,130 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* PlotSquared, a land and world management plugin for Minecraft.
|
3
|
-
* Copyright (C) IntellectualSites <https://intellectualsites.com>
|
4
|
-
* Copyright (C) IntellectualSites team and contributors
|
5
|
-
*
|
6
|
-
* This program is free software: you can redistribute it and/or modify
|
7
|
-
* it under the terms of the GNU General Public License as published by
|
8
|
-
* the Free Software Foundation, either version 3 of the License, or
|
9
|
-
* (at your option) any later version.
|
10
|
-
*
|
11
|
-
* This program is distributed in the hope that it will be useful,
|
12
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
-
* GNU General Public License for more details.
|
15
|
-
*
|
16
|
-
* You should have received a copy of the GNU General Public License
|
17
|
-
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
18
|
-
*/
|
19
|
-
package com.plotsquared.core.command;
|
20
|
-
|
21
|
-
import com.google.inject.Inject;
|
22
|
-
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
23
|
-
import com.plotsquared.core.location.Location;
|
24
|
-
import com.plotsquared.core.permissions.Permission;
|
25
|
-
import com.plotsquared.core.player.MetaDataAccess;
|
26
|
-
import com.plotsquared.core.player.PlayerMetaDataKeys;
|
27
|
-
import com.plotsquared.core.player.PlotPlayer;
|
28
|
-
import com.plotsquared.core.plot.Plot;
|
29
|
-
import com.plotsquared.core.plot.PlotId;
|
30
|
-
import com.plotsquared.core.plot.world.PlotAreaManager;
|
31
|
-
import com.plotsquared.core.util.SchematicHandler;
|
32
|
-
import com.plotsquared.core.util.task.RunnableVal;
|
33
|
-
import com.plotsquared.core.util.task.TaskManager;
|
34
|
-
import net.kyori.adventure.text.minimessage.Template;
|
35
|
-
import org.checkerframework.checker.nullness.qual.NonNull;
|
36
|
-
|
37
|
-
import java.net.URL;
|
38
|
-
import java.util.List;
|
39
|
-
import java.util.UUID;
|
40
|
-
|
41
|
-
/**
|
42
|
-
* @deprecated In favor of "/plot download" (Arkitektonika) and scheduled
|
43
|
-
* for removal within the next major release.
|
44
|
-
*/
|
45
|
-
@Deprecated(forRemoval = true, since = "6.0.9")
|
46
|
-
@CommandDeclaration(command = "save",
|
47
|
-
category = CommandCategory.SCHEMATIC,
|
48
|
-
requiredType = RequiredType.NONE,
|
49
|
-
permission = "plots.save")
|
50
|
-
public class Save extends SubCommand {
|
51
|
-
|
52
|
-
private final PlotAreaManager plotAreaManager;
|
53
|
-
private final SchematicHandler schematicHandler;
|
54
|
-
|
55
|
-
@Inject
|
56
|
-
public Save(
|
57
|
-
final @NonNull PlotAreaManager plotAreaManager,
|
58
|
-
final @NonNull SchematicHandler schematicHandler
|
59
|
-
) {
|
60
|
-
this.plotAreaManager = plotAreaManager;
|
61
|
-
this.schematicHandler = schematicHandler;
|
62
|
-
}
|
63
|
-
|
64
|
-
@Override
|
65
|
-
public boolean onCommand(final PlotPlayer<?> player, final String[] args) {
|
66
|
-
final String world = player.getLocation().getWorldName();
|
67
|
-
if (!this.plotAreaManager.hasPlotArea(world)) {
|
68
|
-
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world"));
|
69
|
-
return false;
|
70
|
-
}
|
71
|
-
final Plot plot = player.getCurrentPlot();
|
72
|
-
if (plot == null) {
|
73
|
-
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
74
|
-
return false;
|
75
|
-
}
|
76
|
-
if (!plot.hasOwner()) {
|
77
|
-
player.sendMessage(TranslatableCaption.of("info.plot_unowned"));
|
78
|
-
return false;
|
79
|
-
}
|
80
|
-
if (plot.getVolume() > Integer.MAX_VALUE) {
|
81
|
-
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large"));
|
82
|
-
return false;
|
83
|
-
}
|
84
|
-
if (!plot.isOwner(player.getUUID()) && !player.hasPermission(Permission.PERMISSION_ADMIN_COMMAND_SAVE)) {
|
85
|
-
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
86
|
-
return false;
|
87
|
-
}
|
88
|
-
if (plot.getRunning() > 0) {
|
89
|
-
player.sendMessage(TranslatableCaption.of("errors.wait_for_timer"));
|
90
|
-
return false;
|
91
|
-
}
|
92
|
-
plot.addRunning();
|
93
|
-
this.schematicHandler.getCompoundTag(plot)
|
94
|
-
.whenComplete((compoundTag, throwable) -> {
|
95
|
-
TaskManager.runTaskAsync(() -> {
|
96
|
-
String time = (System.currentTimeMillis() / 1000) + "";
|
97
|
-
Location[] corners = plot.getCorners();
|
98
|
-
corners[0] = corners[0].withY(plot.getArea().getMinBuildHeight());
|
99
|
-
corners[1] = corners[1].withY(plot.getArea().getMaxBuildHeight());
|
100
|
-
int size = (corners[1].getX() - corners[0].getX()) + 1;
|
101
|
-
PlotId id = plot.getId();
|
102
|
-
String world1 = plot.getArea().toString().replaceAll(";", "-")
|
103
|
-
.replaceAll("[^A-Za-z0-9]", "");
|
104
|
-
final String file = time + '_' + world1 + '_' + id.getX() + '_' + id.getY() + '_' + size;
|
105
|
-
UUID uuid = player.getUUID();
|
106
|
-
schematicHandler.upload(compoundTag, uuid, file, new RunnableVal<>() {
|
107
|
-
@Override
|
108
|
-
public void run(URL url) {
|
109
|
-
plot.removeRunning();
|
110
|
-
if (url == null) {
|
111
|
-
player.sendMessage(TranslatableCaption.of("backups.backup_save_failed"));
|
112
|
-
return;
|
113
|
-
}
|
114
|
-
player.sendMessage(TranslatableCaption.of("web.save_success"));
|
115
|
-
player.sendMessage(
|
116
|
-
TranslatableCaption.of("errors.deprecated_commands"),
|
117
|
-
Template.of("replacement", "/plot download")
|
118
|
-
);
|
119
|
-
try (final MetaDataAccess<List<String>> schematicAccess =
|
120
|
-
player.accessTemporaryMetaData(PlayerMetaDataKeys.TEMPORARY_SCHEMATICS)) {
|
121
|
-
schematicAccess.get().ifPresent(schematics -> schematics.add(file + ".schem"));
|
122
|
-
}
|
123
|
-
}
|
124
|
-
});
|
125
|
-
});
|
126
|
-
});
|
127
|
-
return true;
|
128
|
-
}
|
129
|
-
|
130
|
-
}
|
@@ -35,7 +35,9 @@ import com.plotsquared.core.util.StringMan;
|
|
35
35
|
import com.plotsquared.core.util.TabCompletions;
|
36
36
|
import com.plotsquared.core.util.task.RunnableVal;
|
37
37
|
import com.plotsquared.core.util.task.TaskManager;
|
38
|
-
import net.kyori.adventure.text.
|
38
|
+
import net.kyori.adventure.text.Component;
|
39
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
40
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
39
41
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
40
42
|
|
41
43
|
import java.net.URL;
|
@@ -72,7 +74,7 @@ public class SchematicCmd extends SubCommand {
|
|
72
74
|
if (args.length < 1) {
|
73
75
|
player.sendMessage(
|
74
76
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
75
|
-
|
77
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("Possible values: save, paste, exportall, list")))
|
76
78
|
);
|
77
79
|
return true;
|
78
80
|
}
|
@@ -82,14 +84,20 @@ public class SchematicCmd extends SubCommand {
|
|
82
84
|
if (!player.hasPermission(Permission.PERMISSION_SCHEMATIC_PASTE)) {
|
83
85
|
player.sendMessage(
|
84
86
|
TranslatableCaption.of("permission.no_permission"),
|
85
|
-
|
87
|
+
TagResolver.resolver(
|
88
|
+
"node",
|
89
|
+
Tag.inserting(Permission.PERMISSION_SCHEMATIC_PASTE)
|
90
|
+
)
|
86
91
|
);
|
87
92
|
return false;
|
88
93
|
}
|
89
94
|
if (args.length < 2) {
|
90
95
|
player.sendMessage(
|
91
96
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
92
|
-
|
97
|
+
TagResolver.resolver(
|
98
|
+
"value",
|
99
|
+
Tag.inserting(Component.text("Possible values: save, paste, exportall, list"))
|
100
|
+
)
|
93
101
|
);
|
94
102
|
break;
|
95
103
|
}
|
@@ -129,7 +137,10 @@ public class SchematicCmd extends SubCommand {
|
|
129
137
|
e.printStackTrace();
|
130
138
|
player.sendMessage(
|
131
139
|
TranslatableCaption.of("schematics.schematic_invalid"),
|
132
|
-
|
140
|
+
TagResolver.resolver(
|
141
|
+
"reason",
|
142
|
+
Tag.inserting(Component.text("non-existent url: " + location))
|
143
|
+
)
|
133
144
|
);
|
134
145
|
SchematicCmd.this.running = false;
|
135
146
|
return;
|
@@ -145,7 +156,10 @@ public class SchematicCmd extends SubCommand {
|
|
145
156
|
SchematicCmd.this.running = false;
|
146
157
|
player.sendMessage(
|
147
158
|
TranslatableCaption.of("schematics.schematic_invalid"),
|
148
|
-
|
159
|
+
TagResolver.resolver(
|
160
|
+
"reason",
|
161
|
+
Tag.inserting(Component.text("non-existent or not in gzip format"))
|
162
|
+
)
|
149
163
|
);
|
150
164
|
return;
|
151
165
|
}
|
@@ -180,7 +194,10 @@ public class SchematicCmd extends SubCommand {
|
|
180
194
|
player.sendMessage(TranslatableCaption.of("schematics.schematic_exportall_world_args"));
|
181
195
|
player.sendMessage(
|
182
196
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
183
|
-
|
197
|
+
TagResolver.resolver(
|
198
|
+
"value",
|
199
|
+
Tag.inserting(Component.text("Use /plot schematic exportall <area>"))
|
200
|
+
)
|
184
201
|
);
|
185
202
|
return false;
|
186
203
|
}
|
@@ -188,7 +205,7 @@ public class SchematicCmd extends SubCommand {
|
|
188
205
|
if (area == null) {
|
189
206
|
player.sendMessage(
|
190
207
|
TranslatableCaption.of("errors.not_valid_plot_world"),
|
191
|
-
|
208
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(args[1])))
|
192
209
|
);
|
193
210
|
return false;
|
194
211
|
}
|
@@ -197,7 +214,7 @@ public class SchematicCmd extends SubCommand {
|
|
197
214
|
player.sendMessage(TranslatableCaption.of("schematic.schematic_exportall_world"));
|
198
215
|
player.sendMessage(
|
199
216
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
200
|
-
|
217
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("Use /plot sch exportall <area>")))
|
201
218
|
);
|
202
219
|
return false;
|
203
220
|
}
|
@@ -211,7 +228,7 @@ public class SchematicCmd extends SubCommand {
|
|
211
228
|
player.sendMessage(TranslatableCaption.of("schematics.schematic_exportall_started"));
|
212
229
|
player.sendMessage(
|
213
230
|
TranslatableCaption.of("schematics.plot_to_schem"),
|
214
|
-
|
231
|
+
TagResolver.resolver("amount", Tag.inserting(Component.text(plots.size())))
|
215
232
|
);
|
216
233
|
}
|
217
234
|
}
|
@@ -219,7 +236,10 @@ public class SchematicCmd extends SubCommand {
|
|
219
236
|
if (!player.hasPermission(Permission.PERMISSION_SCHEMATIC_SAVE)) {
|
220
237
|
player.sendMessage(
|
221
238
|
TranslatableCaption.of("permission.no_permission"),
|
222
|
-
|
239
|
+
TagResolver.resolver(
|
240
|
+
"node",
|
241
|
+
Tag.inserting(Permission.PERMISSION_SCHEMATIC_SAVE)
|
242
|
+
)
|
223
243
|
);
|
224
244
|
return false;
|
225
245
|
}
|
@@ -261,19 +281,22 @@ public class SchematicCmd extends SubCommand {
|
|
261
281
|
if (!player.hasPermission(Permission.PERMISSION_SCHEMATIC_LIST)) {
|
262
282
|
player.sendMessage(
|
263
283
|
TranslatableCaption.of("permission.no_permission"),
|
264
|
-
|
284
|
+
TagResolver.resolver(
|
285
|
+
"node",
|
286
|
+
Tag.inserting(Permission.PERMISSION_SCHEMATIC_LIST)
|
287
|
+
)
|
265
288
|
);
|
266
289
|
return false;
|
267
290
|
}
|
268
291
|
final String string = StringMan.join(this.schematicHandler.getSchematicNames(), "$2, $1");
|
269
292
|
player.sendMessage(
|
270
293
|
TranslatableCaption.of("schematics.schematic_list"),
|
271
|
-
|
294
|
+
TagResolver.resolver("list", Tag.inserting(Component.text(string)))
|
272
295
|
);
|
273
296
|
}
|
274
297
|
default -> player.sendMessage(
|
275
298
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
276
|
-
|
299
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("Possible values: save, paste, exportall, list")))
|
277
300
|
);
|
278
301
|
}
|
279
302
|
return true;
|
@@ -39,7 +39,9 @@ import com.sk89q.worldedit.function.pattern.Pattern;
|
|
39
39
|
import com.sk89q.worldedit.world.block.BlockCategory;
|
40
40
|
import com.sk89q.worldedit.world.block.BlockType;
|
41
41
|
import com.sk89q.worldedit.world.block.BlockTypes;
|
42
|
-
import net.kyori.adventure.text.
|
42
|
+
import net.kyori.adventure.text.Component;
|
43
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
44
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
43
45
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
44
46
|
|
45
47
|
import java.util.ArrayList;
|
@@ -122,7 +124,7 @@ public class Set extends SubCommand {
|
|
122
124
|
}
|
123
125
|
player.sendMessage(
|
124
126
|
TranslatableCaption.of("invalid.component_illegal_block"),
|
125
|
-
|
127
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(forbiddenType)))
|
126
128
|
);
|
127
129
|
return true;
|
128
130
|
}
|
@@ -134,7 +136,10 @@ public class Set extends SubCommand {
|
|
134
136
|
if (!player.hasPermission(Permission.PERMISSION_SET_COMPONENT.format(component))) {
|
135
137
|
player.sendMessage(
|
136
138
|
TranslatableCaption.of("permission.no_permission"),
|
137
|
-
|
139
|
+
TagResolver.resolver(
|
140
|
+
"node",
|
141
|
+
Tag.inserting(Component.text(Permission.PERMISSION_SET_COMPONENT.format(component)))
|
142
|
+
)
|
138
143
|
);
|
139
144
|
return false;
|
140
145
|
}
|
@@ -157,7 +162,7 @@ public class Set extends SubCommand {
|
|
157
162
|
plot.removeRunning();
|
158
163
|
player.sendMessage(
|
159
164
|
TranslatableCaption.of("working.component_complete"),
|
160
|
-
|
165
|
+
TagResolver.resolver("plot", Tag.inserting(Component.text(plot.getId().toString())))
|
161
166
|
);
|
162
167
|
});
|
163
168
|
if (Settings.QUEUE.NOTIFY_PROGRESS) {
|
@@ -24,7 +24,9 @@ import com.plotsquared.core.permissions.Permission;
|
|
24
24
|
import com.plotsquared.core.player.PlotPlayer;
|
25
25
|
import com.plotsquared.core.plot.Plot;
|
26
26
|
import com.plotsquared.core.util.StringMan;
|
27
|
-
import net.kyori.adventure.text.
|
27
|
+
import net.kyori.adventure.text.Component;
|
28
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
29
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
28
30
|
|
29
31
|
public abstract class SetCommand extends SubCommand {
|
30
32
|
|
@@ -40,7 +42,10 @@ public abstract class SetCommand extends SubCommand {
|
|
40
42
|
if (!player.hasPermission(Permission.PERMISSION_ADMIN_COMMAND.format(getFullId()))) {
|
41
43
|
player.sendMessage(
|
42
44
|
TranslatableCaption.of("permission.no_permission"),
|
43
|
-
|
45
|
+
TagResolver.resolver(
|
46
|
+
"node",
|
47
|
+
Tag.inserting(Component.text(Permission.PERMISSION_ADMIN_COMMAND.format(getFullId())))
|
48
|
+
)
|
44
49
|
);
|
45
50
|
player.sendMessage(TranslatableCaption.of("working.plot_not_claimed"));
|
46
51
|
return false;
|
@@ -50,7 +55,10 @@ public abstract class SetCommand extends SubCommand {
|
|
50
55
|
if (!player.hasPermission(Permission.PERMISSION_ADMIN_COMMAND.format(getFullId()))) {
|
51
56
|
player.sendMessage(
|
52
57
|
TranslatableCaption.of("permission.no_permission"),
|
53
|
-
|
58
|
+
TagResolver.resolver(
|
59
|
+
"node",
|
60
|
+
Tag.inserting(Component.text(Permission.PERMISSION_ADMIN_COMMAND.format(getFullId())))
|
61
|
+
)
|
54
62
|
);
|
55
63
|
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
56
64
|
return false;
|
@@ -23,7 +23,9 @@ import com.plotsquared.core.location.BlockLoc;
|
|
23
23
|
import com.plotsquared.core.location.Location;
|
24
24
|
import com.plotsquared.core.player.PlotPlayer;
|
25
25
|
import com.plotsquared.core.plot.Plot;
|
26
|
-
import net.kyori.adventure.text.
|
26
|
+
import net.kyori.adventure.text.Component;
|
27
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
28
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
27
29
|
|
28
30
|
@CommandDeclaration(command = "sethome",
|
29
31
|
permission = "plots.set.home",
|
@@ -64,7 +66,7 @@ public class SetHome extends SetCommand {
|
|
64
66
|
default -> {
|
65
67
|
player.sendMessage(
|
66
68
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
67
|
-
|
69
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("Use /plot set home [none]")))
|
68
70
|
);
|
69
71
|
return false;
|
70
72
|
}
|
@@ -29,7 +29,9 @@ import com.plotsquared.core.player.PlotPlayer;
|
|
29
29
|
import com.plotsquared.core.setup.SetupProcess;
|
30
30
|
import com.plotsquared.core.setup.SetupStep;
|
31
31
|
import com.plotsquared.core.util.SetupUtils;
|
32
|
-
import net.kyori.adventure.text.
|
32
|
+
import net.kyori.adventure.text.Component;
|
33
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
34
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
33
35
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
34
36
|
|
35
37
|
import java.util.ArrayList;
|
@@ -78,7 +80,10 @@ public class Setup extends SubCommand {
|
|
78
80
|
player.sendMessage(TranslatableCaption.of("setup.setup_not_started"));
|
79
81
|
player.sendMessage(
|
80
82
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
81
|
-
|
83
|
+
TagResolver.resolver(
|
84
|
+
"value",
|
85
|
+
Tag.inserting(Component.text("Use /plot setup to start a setup process."))
|
86
|
+
)
|
82
87
|
);
|
83
88
|
return true;
|
84
89
|
}
|
@@ -25,7 +25,9 @@ import com.plotsquared.core.player.PlotPlayer;
|
|
25
25
|
import com.plotsquared.core.plot.Plot;
|
26
26
|
import com.plotsquared.core.util.task.RunnableVal2;
|
27
27
|
import com.plotsquared.core.util.task.RunnableVal3;
|
28
|
-
import net.kyori.adventure.text.
|
28
|
+
import net.kyori.adventure.text.Component;
|
29
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
30
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
29
31
|
|
30
32
|
import java.util.concurrent.CompletableFuture;
|
31
33
|
|
@@ -82,8 +84,10 @@ public class Swap extends SubCommand {
|
|
82
84
|
if (result) {
|
83
85
|
player.sendMessage(
|
84
86
|
TranslatableCaption.of("swap.swap_success"),
|
85
|
-
|
86
|
-
|
87
|
+
TagResolver.builder()
|
88
|
+
.tag("origin", Tag.inserting(Component.text(p1)))
|
89
|
+
.tag("target", Tag.inserting(Component.text(p2)))
|
90
|
+
.build()
|
87
91
|
);
|
88
92
|
return true;
|
89
93
|
} else {
|
@@ -24,7 +24,9 @@ import com.plotsquared.core.player.PlotPlayer;
|
|
24
24
|
import com.plotsquared.core.plot.Plot;
|
25
25
|
import com.plotsquared.core.util.StringMan;
|
26
26
|
import com.plotsquared.core.util.query.PlotQuery;
|
27
|
-
import net.kyori.adventure.text.
|
27
|
+
import net.kyori.adventure.text.Component;
|
28
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
29
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
28
30
|
|
29
31
|
import java.util.Collection;
|
30
32
|
import java.util.Locale;
|
@@ -52,7 +54,7 @@ public class Target extends SubCommand {
|
|
52
54
|
if (args.length == 0) {
|
53
55
|
player.sendMessage(
|
54
56
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
55
|
-
|
57
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("/plot target <<X;Z> | nearest>")))
|
56
58
|
);
|
57
59
|
return false;
|
58
60
|
}
|
@@ -76,7 +78,7 @@ public class Target extends SubCommand {
|
|
76
78
|
target.getCenter(player::setCompassTarget);
|
77
79
|
player.sendMessage(
|
78
80
|
TranslatableCaption.of("compass.compass_target"),
|
79
|
-
|
81
|
+
TagResolver.resolver("target", Tag.inserting(Component.text(target.toString())))
|
80
82
|
);
|
81
83
|
return true;
|
82
84
|
}
|
@@ -43,6 +43,9 @@ import com.plotsquared.core.util.SetupUtils;
|
|
43
43
|
import com.plotsquared.core.util.TabCompletions;
|
44
44
|
import com.plotsquared.core.util.WorldUtil;
|
45
45
|
import com.plotsquared.core.util.task.TaskManager;
|
46
|
+
import net.kyori.adventure.text.Component;
|
47
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
48
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
46
49
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
47
50
|
|
48
51
|
import java.io.File;
|
@@ -153,9 +156,9 @@ public class Template extends SubCommand {
|
|
153
156
|
ZipOutputStream zos = new ZipOutputStream(fos)) {
|
154
157
|
|
155
158
|
for (FileBytes file : files) {
|
156
|
-
ZipEntry ze = new ZipEntry(file.path);
|
159
|
+
ZipEntry ze = new ZipEntry(file.path());
|
157
160
|
zos.putNextEntry(ze);
|
158
|
-
zos.write(file.data);
|
161
|
+
zos.write(file.data());
|
159
162
|
}
|
160
163
|
zos.closeEntry();
|
161
164
|
}
|
@@ -168,13 +171,16 @@ public class Template extends SubCommand {
|
|
168
171
|
if (args[0].equalsIgnoreCase("export")) {
|
169
172
|
player.sendMessage(
|
170
173
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
171
|
-
|
174
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("/plot template export <world>")))
|
172
175
|
);
|
173
176
|
return true;
|
174
177
|
} else if (args[0].equalsIgnoreCase("import")) {
|
175
178
|
player.sendMessage(
|
176
179
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
177
|
-
|
180
|
+
TagResolver.resolver(
|
181
|
+
"value",
|
182
|
+
Tag.inserting(Component.text("/plot template import <world> <template>"))
|
183
|
+
)
|
178
184
|
);
|
179
185
|
return true;
|
180
186
|
}
|
@@ -188,14 +194,17 @@ public class Template extends SubCommand {
|
|
188
194
|
if (args.length != 3) {
|
189
195
|
player.sendMessage(
|
190
196
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
191
|
-
|
197
|
+
TagResolver.resolver(
|
198
|
+
"value",
|
199
|
+
Tag.inserting(Component.text("/plot template import <world> <template>"))
|
200
|
+
)
|
192
201
|
);
|
193
202
|
return false;
|
194
203
|
}
|
195
204
|
if (this.plotAreaManager.hasPlotArea(world)) {
|
196
205
|
player.sendMessage(
|
197
206
|
TranslatableCaption.of("setup.setup_world_taken"),
|
198
|
-
|
207
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(world)))
|
199
208
|
);
|
200
209
|
return false;
|
201
210
|
}
|
@@ -203,7 +212,7 @@ public class Template extends SubCommand {
|
|
203
212
|
if (!result) {
|
204
213
|
player.sendMessage(
|
205
214
|
TranslatableCaption.of("template.invalid_template"),
|
206
|
-
|
215
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(args[2])))
|
207
216
|
);
|
208
217
|
return false;
|
209
218
|
}
|
@@ -241,7 +250,7 @@ public class Template extends SubCommand {
|
|
241
250
|
if (args.length != 2) {
|
242
251
|
player.sendMessage(
|
243
252
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
244
|
-
|
253
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("/plot template export <world>")))
|
245
254
|
);
|
246
255
|
return false;
|
247
256
|
}
|
@@ -249,7 +258,7 @@ public class Template extends SubCommand {
|
|
249
258
|
if (area == null) {
|
250
259
|
player.sendMessage(
|
251
260
|
TranslatableCaption.of("errors.not_valid_plot_world"),
|
252
|
-
|
261
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(args[1])))
|
253
262
|
);
|
254
263
|
return false;
|
255
264
|
}
|
@@ -261,7 +270,7 @@ public class Template extends SubCommand {
|
|
261
270
|
e.printStackTrace();
|
262
271
|
player.sendMessage(
|
263
272
|
TranslatableCaption.of("template.template_failed"),
|
264
|
-
|
273
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(e.getMessage())))
|
265
274
|
);
|
266
275
|
return;
|
267
276
|
}
|
@@ -22,7 +22,9 @@ import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
|
22
22
|
import com.plotsquared.core.player.PlotPlayer;
|
23
23
|
import com.plotsquared.core.util.task.RunnableVal2;
|
24
24
|
import com.plotsquared.core.util.task.RunnableVal3;
|
25
|
-
import net.kyori.adventure.text.
|
25
|
+
import net.kyori.adventure.text.Component;
|
26
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
27
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
26
28
|
|
27
29
|
@CommandDeclaration(command = "toggle",
|
28
30
|
aliases = {"attribute"},
|
@@ -47,12 +49,12 @@ public class Toggle extends Command {
|
|
47
49
|
if (toggle(player, "chatspy")) {
|
48
50
|
player.sendMessage(
|
49
51
|
TranslatableCaption.of("toggle.toggle_disabled"),
|
50
|
-
|
52
|
+
TagResolver.resolver("setting", Tag.inserting(Component.text(command.toString())))
|
51
53
|
);
|
52
54
|
} else {
|
53
55
|
player.sendMessage(
|
54
56
|
TranslatableCaption.of("toggle.toggle_enabled"),
|
55
|
-
|
57
|
+
TagResolver.resolver("setting", Tag.inserting(Component.text(command.toString())))
|
56
58
|
);
|
57
59
|
}
|
58
60
|
}
|
@@ -68,12 +70,12 @@ public class Toggle extends Command {
|
|
68
70
|
if (toggle(player, "worldedit")) {
|
69
71
|
player.sendMessage(
|
70
72
|
TranslatableCaption.of("toggle.toggle_disabled"),
|
71
|
-
|
73
|
+
TagResolver.resolver("setting", Tag.inserting(Component.text(command.toString())))
|
72
74
|
);
|
73
75
|
} else {
|
74
76
|
player.sendMessage(
|
75
77
|
TranslatableCaption.of("toggle.toggle_enabled"),
|
76
|
-
|
78
|
+
TagResolver.resolver("setting", Tag.inserting(Component.text(command.toString())))
|
77
79
|
);
|
78
80
|
}
|
79
81
|
}
|
@@ -88,12 +90,12 @@ public class Toggle extends Command {
|
|
88
90
|
if (toggle(player, "chat")) {
|
89
91
|
player.sendMessage(
|
90
92
|
TranslatableCaption.of("toggle.toggle_disabled"),
|
91
|
-
|
93
|
+
TagResolver.resolver("setting", Tag.inserting(Component.text(command.toString())))
|
92
94
|
);
|
93
95
|
} else {
|
94
96
|
player.sendMessage(
|
95
97
|
TranslatableCaption.of("toggle.toggle_enabled"),
|
96
|
-
|
98
|
+
TagResolver.resolver("setting", Tag.inserting(Component.text(command.toString())))
|
97
99
|
);
|
98
100
|
}
|
99
101
|
}
|
@@ -108,12 +110,12 @@ public class Toggle extends Command {
|
|
108
110
|
if (toggle(player, "ignoreExpireTask")) {
|
109
111
|
player.sendMessage(
|
110
112
|
TranslatableCaption.of("toggle.toggle_enabled"),
|
111
|
-
|
113
|
+
TagResolver.resolver("setting", Tag.inserting(Component.text(command.toString())))
|
112
114
|
);
|
113
115
|
} else {
|
114
116
|
player.sendMessage(
|
115
117
|
TranslatableCaption.of("toggle.toggle_disabled"),
|
116
|
-
|
118
|
+
TagResolver.resolver("setting", Tag.inserting(Component.text(command.toString())))
|
117
119
|
);
|
118
120
|
}
|
119
121
|
}
|
@@ -128,12 +130,12 @@ public class Toggle extends Command {
|
|
128
130
|
if (toggle(player, "disabletitles")) {
|
129
131
|
player.sendMessage(
|
130
132
|
TranslatableCaption.of("toggle.toggle_enabled"),
|
131
|
-
|
133
|
+
TagResolver.resolver("setting", Tag.inserting(Component.text(command.toString())))
|
132
134
|
);
|
133
135
|
} else {
|
134
136
|
player.sendMessage(
|
135
137
|
TranslatableCaption.of("toggle.toggle_disabled"),
|
136
|
-
|
138
|
+
TagResolver.resolver("setting", Tag.inserting(Component.text(command.toString())))
|
137
139
|
);
|
138
140
|
}
|
139
141
|
}
|
@@ -148,12 +150,12 @@ public class Toggle extends Command {
|
|
148
150
|
if (toggle(player, "disabletime")) {
|
149
151
|
player.sendMessage(
|
150
152
|
TranslatableCaption.of("toggle.toggle_enabled"),
|
151
|
-
|
153
|
+
TagResolver.resolver("setting", Tag.inserting(Component.text(command.toString())))
|
152
154
|
);
|
153
155
|
} else {
|
154
156
|
player.sendMessage(
|
155
157
|
TranslatableCaption.of("toggle.toggle_disabled"),
|
156
|
-
|
158
|
+
TagResolver.resolver("setting", Tag.inserting(Component.text(command.toString())))
|
157
159
|
);
|
158
160
|
}
|
159
161
|
}
|
@@ -168,12 +170,12 @@ public class Toggle extends Command {
|
|
168
170
|
if (toggle(player, "debug")) {
|
169
171
|
player.sendMessage(
|
170
172
|
TranslatableCaption.of("toggle.toggle_disabled"),
|
171
|
-
|
173
|
+
TagResolver.resolver("setting", Tag.inserting(Component.text(command.toString())))
|
172
174
|
);
|
173
175
|
} else {
|
174
176
|
player.sendMessage(
|
175
177
|
TranslatableCaption.of("toggle.toggle_enabled"),
|
176
|
-
|
178
|
+
TagResolver.resolver("setting", Tag.inserting(Component.text(command.toString())))
|
177
179
|
);
|
178
180
|
}
|
179
181
|
player.refreshDebug();
|
@@ -20,7 +20,6 @@ package com.plotsquared.core.command;
|
|
20
20
|
|
21
21
|
import com.google.inject.Inject;
|
22
22
|
import com.plotsquared.core.configuration.Settings;
|
23
|
-
import com.plotsquared.core.configuration.caption.Templates;
|
24
23
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
25
24
|
import com.plotsquared.core.database.DBFunc;
|
26
25
|
import com.plotsquared.core.permissions.Permission;
|
@@ -31,7 +30,9 @@ import com.plotsquared.core.util.PlayerManager;
|
|
31
30
|
import com.plotsquared.core.util.TabCompletions;
|
32
31
|
import com.plotsquared.core.util.task.RunnableVal2;
|
33
32
|
import com.plotsquared.core.util.task.RunnableVal3;
|
34
|
-
import net.kyori.adventure.text.
|
33
|
+
import net.kyori.adventure.text.Component;
|
34
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
35
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
35
36
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
36
37
|
|
37
38
|
import java.util.Collection;
|
@@ -73,7 +74,7 @@ public class Trust extends Command {
|
|
73
74
|
);
|
74
75
|
|
75
76
|
checkTrue(args.length == 1, TranslatableCaption.of("commandconfig.command_syntax"),
|
76
|
-
|
77
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(getUsage())))
|
77
78
|
);
|
78
79
|
|
79
80
|
final CompletableFuture<Boolean> future = new CompletableFuture<>();
|
@@ -84,14 +85,14 @@ public class Trust extends Command {
|
|
84
85
|
} else {
|
85
86
|
player.sendMessage(
|
86
87
|
TranslatableCaption.of("errors.invalid_player"),
|
87
|
-
|
88
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(args[0])))
|
88
89
|
);
|
89
90
|
}
|
90
91
|
future.completeExceptionally(throwable);
|
91
92
|
return;
|
92
93
|
} else {
|
93
94
|
checkTrue(!uuids.isEmpty(), TranslatableCaption.of("errors.invalid_player"),
|
94
|
-
|
95
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(args[0])))
|
95
96
|
);
|
96
97
|
|
97
98
|
Iterator<UUID> iterator = uuids.iterator();
|
@@ -102,7 +103,10 @@ public class Trust extends Command {
|
|
102
103
|
player.hasPermission(Permission.PERMISSION_TRUST_EVERYONE) || player.hasPermission(Permission.PERMISSION_ADMIN_COMMAND_TRUST))) {
|
103
104
|
player.sendMessage(
|
104
105
|
TranslatableCaption.of("errors.invalid_player"),
|
105
|
-
|
106
|
+
TagResolver.resolver(
|
107
|
+
"value",
|
108
|
+
Tag.inserting(PlayerManager.resolveName(uuid).toComponent(player))
|
109
|
+
)
|
106
110
|
);
|
107
111
|
iterator.remove();
|
108
112
|
continue;
|
@@ -110,7 +114,10 @@ public class Trust extends Command {
|
|
110
114
|
if (currentPlot.isOwner(uuid)) {
|
111
115
|
player.sendMessage(
|
112
116
|
TranslatableCaption.of("member.already_added"),
|
113
|
-
|
117
|
+
TagResolver.resolver(
|
118
|
+
"value",
|
119
|
+
Tag.inserting(PlayerManager.resolveName(uuid).toComponent(player))
|
120
|
+
)
|
114
121
|
);
|
115
122
|
iterator.remove();
|
116
123
|
continue;
|
@@ -118,7 +125,10 @@ public class Trust extends Command {
|
|
118
125
|
if (currentPlot.getTrusted().contains(uuid)) {
|
119
126
|
player.sendMessage(
|
120
127
|
TranslatableCaption.of("member.already_added"),
|
121
|
-
|
128
|
+
TagResolver.resolver(
|
129
|
+
"value",
|
130
|
+
Tag.inserting(PlayerManager.resolveName(uuid).toComponent(player))
|
131
|
+
)
|
122
132
|
);
|
123
133
|
iterator.remove();
|
124
134
|
continue;
|
@@ -131,7 +141,7 @@ public class Trust extends Command {
|
|
131
141
|
if (localTrustSize >= maxTrustSize) {
|
132
142
|
player.sendMessage(
|
133
143
|
TranslatableCaption.of("members.plot_max_members_trusted"),
|
134
|
-
|
144
|
+
TagResolver.resolver("amount", Tag.inserting(Component.text(localTrustSize)))
|
135
145
|
);
|
136
146
|
return;
|
137
147
|
}
|
@@ -29,7 +29,9 @@ import com.plotsquared.core.plot.Plot;
|
|
29
29
|
import com.plotsquared.core.util.EventDispatcher;
|
30
30
|
import com.plotsquared.core.util.StringMan;
|
31
31
|
import com.plotsquared.core.util.task.TaskManager;
|
32
|
-
import net.kyori.adventure.text.
|
32
|
+
import net.kyori.adventure.text.Component;
|
33
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
34
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
33
35
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
34
36
|
|
35
37
|
@CommandDeclaration(command = "unlink",
|
@@ -85,7 +87,7 @@ public class Unlink extends SubCommand {
|
|
85
87
|
if (event.getEventResult() == Result.DENY) {
|
86
88
|
player.sendMessage(
|
87
89
|
TranslatableCaption.of("events.event_denied"),
|
88
|
-
|
90
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("Unlink")))
|
89
91
|
);
|
90
92
|
return true;
|
91
93
|
}
|
@@ -21,7 +21,6 @@ package com.plotsquared.core.command;
|
|
21
21
|
import com.google.inject.Inject;
|
22
22
|
import com.plotsquared.core.PlotSquared;
|
23
23
|
import com.plotsquared.core.configuration.Settings;
|
24
|
-
import com.plotsquared.core.configuration.caption.Templates;
|
25
24
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
26
25
|
import com.plotsquared.core.events.TeleportCause;
|
27
26
|
import com.plotsquared.core.permissions.Permission;
|
@@ -37,7 +36,9 @@ import com.plotsquared.core.util.query.PlotQuery;
|
|
37
36
|
import com.plotsquared.core.util.query.SortingStrategy;
|
38
37
|
import com.plotsquared.core.util.task.RunnableVal2;
|
39
38
|
import com.plotsquared.core.util.task.RunnableVal3;
|
40
|
-
import net.kyori.adventure.text.
|
39
|
+
import net.kyori.adventure.text.Component;
|
40
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
41
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
41
42
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
42
43
|
|
43
44
|
import java.util.ArrayList;
|
@@ -99,8 +100,10 @@ public class Visit extends Command {
|
|
99
100
|
} else if (plots.size() < page || page < 1) {
|
100
101
|
player.sendMessage(
|
101
102
|
TranslatableCaption.of("invalid.number_not_in_range"),
|
102
|
-
|
103
|
-
|
103
|
+
TagResolver.builder()
|
104
|
+
.tag("min", Tag.inserting(Component.text(1)))
|
105
|
+
.tag("max", Tag.inserting(Component.text(plots.size())))
|
106
|
+
.build()
|
104
107
|
);
|
105
108
|
return;
|
106
109
|
}
|
@@ -110,7 +113,7 @@ public class Visit extends Command {
|
|
110
113
|
if (!player.hasPermission(Permission.PERMISSION_VISIT_UNOWNED)) {
|
111
114
|
player.sendMessage(
|
112
115
|
TranslatableCaption.of("permission.no_permission"),
|
113
|
-
|
116
|
+
TagResolver.resolver("node", Tag.inserting(Component.text("plots.visit.unowned")))
|
114
117
|
);
|
115
118
|
return;
|
116
119
|
}
|
@@ -118,7 +121,7 @@ public class Visit extends Command {
|
|
118
121
|
if (!player.hasPermission(Permission.PERMISSION_VISIT_OWNED) && !player.hasPermission(Permission.PERMISSION_HOME)) {
|
119
122
|
player.sendMessage(
|
120
123
|
TranslatableCaption.of("permission.no_permission"),
|
121
|
-
|
124
|
+
TagResolver.resolver("node", Tag.inserting(Component.text("plots.visit.owned")))
|
122
125
|
);
|
123
126
|
return;
|
124
127
|
}
|
@@ -126,7 +129,7 @@ public class Visit extends Command {
|
|
126
129
|
if (!player.hasPermission(Permission.PERMISSION_SHARED)) {
|
127
130
|
player.sendMessage(
|
128
131
|
TranslatableCaption.of("permission.no_permission"),
|
129
|
-
|
132
|
+
TagResolver.resolver("node", Tag.inserting(Component.text("plots.visit.shared")))
|
130
133
|
);
|
131
134
|
return;
|
132
135
|
}
|
@@ -137,7 +140,7 @@ public class Visit extends Command {
|
|
137
140
|
&& !player.hasPermission(Permission.PERMISSION_ADMIN_VISIT_UNTRUSTED)) {
|
138
141
|
player.sendMessage(
|
139
142
|
TranslatableCaption.of("permission.no_permission"),
|
140
|
-
|
143
|
+
TagResolver.resolver("node", Tag.inserting(Component.text("plots.visit.other")))
|
141
144
|
);
|
142
145
|
return;
|
143
146
|
}
|
@@ -145,7 +148,10 @@ public class Visit extends Command {
|
|
145
148
|
if (!player.hasPermission(Permission.PERMISSION_VISIT_DENIED)) {
|
146
149
|
player.sendMessage(
|
147
150
|
TranslatableCaption.of("permission.no_permission"),
|
148
|
-
|
151
|
+
TagResolver.resolver(
|
152
|
+
"node",
|
153
|
+
Tag.inserting(Permission.PERMISSION_VISIT_DENIED)
|
154
|
+
)
|
149
155
|
);
|
150
156
|
return;
|
151
157
|
}
|
@@ -187,11 +193,11 @@ public class Visit extends Command {
|
|
187
193
|
if (!MathMan.isInteger(args[2])) {
|
188
194
|
player.sendMessage(
|
189
195
|
TranslatableCaption.of("invalid.not_valid_number"),
|
190
|
-
|
196
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("(1, ∞)")))
|
191
197
|
);
|
192
198
|
player.sendMessage(
|
193
199
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
194
|
-
|
200
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(getUsage())))
|
195
201
|
);
|
196
202
|
return CompletableFuture.completedFuture(false);
|
197
203
|
}
|
@@ -204,11 +210,11 @@ public class Visit extends Command {
|
|
204
210
|
if (sortByArea == null) {
|
205
211
|
player.sendMessage(
|
206
212
|
TranslatableCaption.of("invalid.not_valid_number"),
|
207
|
-
|
213
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("(1, ∞)")))
|
208
214
|
);
|
209
215
|
player.sendMessage(
|
210
216
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
211
|
-
|
217
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(getUsage())))
|
212
218
|
);
|
213
219
|
return CompletableFuture.completedFuture(false);
|
214
220
|
}
|
@@ -221,7 +227,7 @@ public class Visit extends Command {
|
|
221
227
|
} else if (throwable != null || uuids.size() != 1) {
|
222
228
|
player.sendMessage(
|
223
229
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
224
|
-
|
230
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(getUsage())))
|
225
231
|
);
|
226
232
|
} else {
|
227
233
|
final UUID uuid = uuids.toArray(new UUID[0])[0];
|
@@ -248,7 +254,7 @@ public class Visit extends Command {
|
|
248
254
|
} catch (NumberFormatException ignored) {
|
249
255
|
player.sendMessage(
|
250
256
|
TranslatableCaption.of("invalid.not_a_number"),
|
251
|
-
|
257
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(args[1])))
|
252
258
|
);
|
253
259
|
return CompletableFuture.completedFuture(false);
|
254
260
|
}
|
@@ -283,7 +289,7 @@ public class Visit extends Command {
|
|
283
289
|
} else {
|
284
290
|
player.sendMessage(
|
285
291
|
TranslatableCaption.of("errors.invalid_player"),
|
286
|
-
|
292
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(finalArgs[0])))
|
287
293
|
);
|
288
294
|
}
|
289
295
|
} else {
|
@@ -311,7 +317,7 @@ public class Visit extends Command {
|
|
311
317
|
// /p v is invalid
|
312
318
|
player.sendMessage(
|
313
319
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
314
|
-
|
320
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(getUsage())))
|
315
321
|
);
|
316
322
|
return CompletableFuture.completedFuture(false);
|
317
323
|
default:
|
@@ -35,34 +35,22 @@ import java.util.Map;
|
|
35
35
|
* the component GUI
|
36
36
|
*/
|
37
37
|
@SerializableAs("preset")
|
38
|
-
public
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
public ComponentPreset(
|
49
|
-
ClassicPlotManagerComponent component, String pattern, double cost,
|
50
|
-
String permission, String displayName, List<String> description, final ItemType icon
|
51
|
-
) {
|
52
|
-
this.component = component;
|
53
|
-
this.pattern = pattern;
|
54
|
-
this.cost = cost;
|
55
|
-
this.permission = permission;
|
56
|
-
this.displayName = displayName;
|
57
|
-
this.description = description;
|
58
|
-
this.icon = icon;
|
59
|
-
}
|
38
|
+
public record ComponentPreset(
|
39
|
+
ClassicPlotManagerComponent component,
|
40
|
+
String pattern,
|
41
|
+
double cost,
|
42
|
+
String permission,
|
43
|
+
String displayName,
|
44
|
+
List<String> description,
|
45
|
+
ItemType icon
|
46
|
+
) implements ConfigurationSerializable {
|
60
47
|
|
61
48
|
@SuppressWarnings("unchecked")
|
62
49
|
public static ComponentPreset deserialize(final @NonNull Map<String, Object> map) {
|
63
50
|
final ClassicPlotManagerComponent classicPlotManagerComponent = ClassicPlotManagerComponent
|
64
51
|
.fromString(map.getOrDefault("component", "").toString()).orElseThrow(() ->
|
65
|
-
new IllegalArgumentException("The preset in components.yml needs a valid target component, got: " + map.get(
|
52
|
+
new IllegalArgumentException("The preset in components.yml needs a valid target component, got: " + map.get(
|
53
|
+
"component")));
|
66
54
|
final String pattern = map.getOrDefault("pattern", "").toString();
|
67
55
|
final double cost = Double.parseDouble(map.getOrDefault("cost", "0.0").toString());
|
68
56
|
final String permission = map.getOrDefault("permission", "").toString();
|
@@ -74,34 +62,6 @@ public class ComponentPreset implements ConfigurationSerializable {
|
|
74
62
|
);
|
75
63
|
}
|
76
64
|
|
77
|
-
public ClassicPlotManagerComponent getComponent() {
|
78
|
-
return this.component;
|
79
|
-
}
|
80
|
-
|
81
|
-
public String getPattern() {
|
82
|
-
return this.pattern;
|
83
|
-
}
|
84
|
-
|
85
|
-
public double getCost() {
|
86
|
-
return this.cost;
|
87
|
-
}
|
88
|
-
|
89
|
-
public String getPermission() {
|
90
|
-
return this.permission;
|
91
|
-
}
|
92
|
-
|
93
|
-
public String getDisplayName() {
|
94
|
-
return this.displayName;
|
95
|
-
}
|
96
|
-
|
97
|
-
public List<String> getDescription() {
|
98
|
-
return this.description;
|
99
|
-
}
|
100
|
-
|
101
|
-
public ItemType getIcon() {
|
102
|
-
return this.icon;
|
103
|
-
}
|
104
|
-
|
105
65
|
@Override
|
106
66
|
public Map<String, Object> serialize() {
|
107
67
|
final Map<String, Object> map = new HashMap<>();
|
@@ -37,8 +37,10 @@ import com.plotsquared.core.util.InventoryUtil;
|
|
37
37
|
import com.plotsquared.core.util.PatternUtil;
|
38
38
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
39
39
|
import com.sk89q.worldedit.world.item.ItemTypes;
|
40
|
+
import net.kyori.adventure.text.Component;
|
40
41
|
import net.kyori.adventure.text.minimessage.MiniMessage;
|
41
|
-
import net.kyori.adventure.text.minimessage.
|
42
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
43
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
42
44
|
import org.apache.logging.log4j.LogManager;
|
43
45
|
import org.apache.logging.log4j.Logger;
|
44
46
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
@@ -163,8 +165,8 @@ public class ComponentPresetManager {
|
|
163
165
|
|
164
166
|
final List<ComponentPreset> allowedPresets = new ArrayList<>(this.presets.size());
|
165
167
|
for (final ComponentPreset componentPreset : this.presets) {
|
166
|
-
if (!componentPreset.
|
167
|
-
componentPreset.
|
168
|
+
if (!componentPreset.permission().isEmpty() && !player.hasPermission(
|
169
|
+
componentPreset.permission()
|
168
170
|
)) {
|
169
171
|
continue;
|
170
172
|
}
|
@@ -176,7 +178,8 @@ public class ComponentPresetManager {
|
|
176
178
|
}
|
177
179
|
final int size = (int) Math.ceil((double) allowedPresets.size() / 9.0D);
|
178
180
|
final PlotInventory plotInventory = new PlotInventory(this.inventoryUtil, player, size,
|
179
|
-
TranslatableCaption.of("preset.title").getComponent(player)
|
181
|
+
TranslatableCaption.of("preset.title").getComponent(player)
|
182
|
+
) {
|
180
183
|
@Override
|
181
184
|
public boolean onClick(final int index) {
|
182
185
|
if (!getPlayer().getCurrentPlot().equals(plot)) {
|
@@ -197,27 +200,31 @@ public class ComponentPresetManager {
|
|
197
200
|
return false;
|
198
201
|
}
|
199
202
|
|
200
|
-
final Pattern pattern = PatternUtil.parse(null, componentPreset.
|
203
|
+
final Pattern pattern = PatternUtil.parse(null, componentPreset.pattern(), false);
|
201
204
|
if (pattern == null) {
|
202
205
|
getPlayer().sendMessage(TranslatableCaption.of("preset.preset_invalid"));
|
203
206
|
return false;
|
204
207
|
}
|
205
208
|
|
206
|
-
if (componentPreset.
|
209
|
+
if (componentPreset.cost() > 0.0D && !player.hasPermission(Permission.PERMISSION_ADMIN_BYPASS_ECON)) {
|
207
210
|
if (!econHandler.isEnabled(plot.getArea())) {
|
208
211
|
getPlayer().sendMessage(
|
209
212
|
TranslatableCaption.of("preset.economy_disabled"),
|
210
|
-
|
213
|
+
TagResolver.resolver("preset", Tag.inserting(Component.text(componentPreset.displayName())))
|
214
|
+
);
|
211
215
|
return false;
|
212
216
|
}
|
213
|
-
if (econHandler.getMoney(getPlayer()) < componentPreset.
|
217
|
+
if (econHandler.getMoney(getPlayer()) < componentPreset.cost()) {
|
214
218
|
getPlayer().sendMessage(TranslatableCaption.of("preset.preset_cannot_afford"));
|
215
219
|
return false;
|
216
220
|
} else {
|
217
|
-
econHandler.withdrawMoney(getPlayer(), componentPreset.
|
221
|
+
econHandler.withdrawMoney(getPlayer(), componentPreset.cost());
|
218
222
|
getPlayer().sendMessage(
|
219
223
|
TranslatableCaption.of("economy.removed_balance"),
|
220
|
-
|
224
|
+
TagResolver.resolver(
|
225
|
+
"money",
|
226
|
+
Tag.inserting(Component.text(econHandler.format(componentPreset.cost())))
|
227
|
+
)
|
221
228
|
);
|
222
229
|
}
|
223
230
|
}
|
@@ -228,7 +235,7 @@ public class ComponentPresetManager {
|
|
228
235
|
queue.setCompleteTask(plot::removeRunning);
|
229
236
|
for (Plot current : plot.getConnectedPlots()) {
|
230
237
|
current.getPlotModificationManager().setComponent(
|
231
|
-
componentPreset.
|
238
|
+
componentPreset.component().name(),
|
232
239
|
pattern,
|
233
240
|
player,
|
234
241
|
queue
|
@@ -245,30 +252,32 @@ public class ComponentPresetManager {
|
|
245
252
|
for (int i = 0; i < allowedPresets.size(); i++) {
|
246
253
|
final ComponentPreset preset = allowedPresets.get(i);
|
247
254
|
final List<String> lore = new ArrayList<>();
|
248
|
-
if (preset.
|
255
|
+
if (preset.cost() > 0) {
|
249
256
|
if (!this.econHandler.isEnabled(plot.getArea())) {
|
250
|
-
lore.add(MINI_MESSAGE.serialize(MINI_MESSAGE.
|
257
|
+
lore.add(MINI_MESSAGE.serialize(MINI_MESSAGE.deserialize(
|
251
258
|
TranslatableCaption.of("preset.preset_lore_economy_disabled").getComponent(player))));
|
252
259
|
} else {
|
253
|
-
lore.add(MINI_MESSAGE.serialize(MINI_MESSAGE.
|
260
|
+
lore.add(MINI_MESSAGE.serialize(MINI_MESSAGE.deserialize(
|
254
261
|
TranslatableCaption.of("preset.preset_lore_cost").getComponent(player),
|
255
|
-
|
262
|
+
TagResolver.resolver("cost", Tag.inserting(Component.text(String.format("%.2f", preset.cost()))))
|
256
263
|
)));
|
257
264
|
}
|
258
265
|
}
|
259
|
-
lore.add(MINI_MESSAGE.serialize(MINI_MESSAGE.
|
266
|
+
lore.add(MINI_MESSAGE.serialize(MINI_MESSAGE.deserialize(
|
260
267
|
TranslatableCaption.of("preset.preset_lore_component").getComponent(player),
|
261
|
-
|
262
|
-
|
268
|
+
TagResolver.builder()
|
269
|
+
.tag("component", Tag.inserting(Component.text(preset.component().name().toLowerCase())))
|
270
|
+
.tag("prefix", Tag.inserting(TranslatableCaption.of("core.prefix").toComponent(player)))
|
271
|
+
.build()
|
263
272
|
)));
|
264
273
|
lore.removeIf(String::isEmpty);
|
265
|
-
lore.addAll(preset.
|
274
|
+
lore.addAll(preset.description());
|
266
275
|
plotInventory.setItem(
|
267
276
|
i,
|
268
277
|
new PlotItemStack(
|
269
|
-
preset.
|
278
|
+
preset.icon().getId().replace("minecraft:", ""),
|
270
279
|
1,
|
271
|
-
preset.
|
280
|
+
preset.displayName(),
|
272
281
|
lore.toArray(new String[0])
|
273
282
|
)
|
274
283
|
);
|
@@ -42,34 +42,6 @@ public class Config {
|
|
42
42
|
|
43
43
|
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + Config.class.getSimpleName());
|
44
44
|
|
45
|
-
/**
|
46
|
-
* Get the value for a node<br>
|
47
|
-
* Probably throws some error if you try to get a non existent key
|
48
|
-
*
|
49
|
-
* @param key configuration key
|
50
|
-
* @param root configuration class
|
51
|
-
* @param <T> value type
|
52
|
-
* @return value
|
53
|
-
* @deprecated Unused internally. Scheduled for removal in next major release.
|
54
|
-
*/
|
55
|
-
@Deprecated(forRemoval = true, since = "6.11.1")
|
56
|
-
@SuppressWarnings("unchecked")
|
57
|
-
public static <T> T get(String key, Class<?> root) {
|
58
|
-
String[] split = key.split("\\.");
|
59
|
-
Object instance = getInstance(split, root);
|
60
|
-
if (instance != null) {
|
61
|
-
Field field = getField(split, instance);
|
62
|
-
if (field != null) {
|
63
|
-
try {
|
64
|
-
return (T) field.get(instance);
|
65
|
-
} catch (IllegalAccessException e) {
|
66
|
-
e.printStackTrace();
|
67
|
-
}
|
68
|
-
}
|
69
|
-
}
|
70
|
-
return null;
|
71
|
-
}
|
72
|
-
|
73
45
|
/**
|
74
46
|
* Set the value of a specific node<br>
|
75
47
|
* Probably throws some error if you supply non existing keys or invalid values
|
@@ -261,7 +233,6 @@ public class Config {
|
|
261
233
|
*
|
262
234
|
* @param split the node (split by period)
|
263
235
|
* @param instance the instance
|
264
|
-
* @return
|
265
236
|
*/
|
266
237
|
private static Field getField(String[] split, Object instance) {
|
267
238
|
try {
|
@@ -447,14 +418,6 @@ public class Config {
|
|
447
418
|
return INSTANCES.values();
|
448
419
|
}
|
449
420
|
|
450
|
-
/**
|
451
|
-
* @deprecated Unused internally. Scheduled for removal in next major release.
|
452
|
-
*/
|
453
|
-
@Deprecated(forRemoval = true, since = "6.11.1")
|
454
|
-
public Collection<String> getSections() {
|
455
|
-
return INSTANCES.keySet();
|
456
|
-
}
|
457
|
-
|
458
421
|
private Map<String, T> getRaw() {
|
459
422
|
return INSTANCES;
|
460
423
|
}
|
@@ -194,7 +194,7 @@ public class Settings extends Config {
|
|
194
194
|
public List<String> WORLDS = new ArrayList<>(Collections.singletonList("*"));
|
195
195
|
|
196
196
|
|
197
|
-
@Comment("See: https://intellectualsites.
|
197
|
+
@Comment("See: https://intellectualsites.gitbook.io/plotsquared/optimization/plot-analysis for a description of each value.")
|
198
198
|
public static final class CALIBRATION {
|
199
199
|
|
200
200
|
public int VARIETY = 0;
|
@@ -214,7 +214,7 @@ public class Settings extends Config {
|
|
214
214
|
|
215
215
|
|
216
216
|
@Comment({"Chunk processor related settings",
|
217
|
-
"See https://intellectualsites.
|
217
|
+
"See https://intellectualsites.gitbook.io/plotsquared/optimization/chunk-processor for more information."})
|
218
218
|
public static class Chunk_Processor {
|
219
219
|
|
220
220
|
@Comment("Auto trim will not save chunks which aren't claimed")
|
@@ -280,7 +280,7 @@ public class Settings extends Config {
|
|
280
280
|
@Comment("Always show explosion Particles, even if explosion flag is set to false")
|
281
281
|
public static boolean ALWAYS_SHOW_EXPLOSIONS = false;
|
282
282
|
@Comment({"Blocks that may not be used in plot components",
|
283
|
-
"Checkout the wiki article regarding plot components before modifying: https://intellectualsites.
|
283
|
+
"Checkout the wiki article regarding plot components before modifying: https://intellectualsites.gitbook.io/plotsquared/customization/plot-components"})
|
284
284
|
public static List<String>
|
285
285
|
INVALID_BLOCKS = Arrays.asList(
|
286
286
|
// Acacia Stuff
|
@@ -402,7 +402,7 @@ public class Settings extends Config {
|
|
402
402
|
|
403
403
|
|
404
404
|
@Comment({"Schematic Settings",
|
405
|
-
"See https://intellectualsites.
|
405
|
+
"See https://intellectualsites.gitbook.io/plotsquared/schematics/schematic-on-claim for more information."})
|
406
406
|
public static final class Schematics {
|
407
407
|
|
408
408
|
@Comment(
|
@@ -531,7 +531,7 @@ public class Settings extends Config {
|
|
531
531
|
|
532
532
|
|
533
533
|
@Comment({"Backup related settings",
|
534
|
-
"See https://intellectualsites.
|
534
|
+
"See https://intellectualsites.gitbook.io/plotsquared/plot-backups for more information."})
|
535
535
|
public static final class Backup {
|
536
536
|
|
537
537
|
@Comment("Automatically backup plots when destructive commands are performed, e.g. /plot clear")
|
@@ -783,7 +783,7 @@ public class Settings extends Config {
|
|
783
783
|
public static boolean
|
784
784
|
PERSISTENT_ROAD_REGEN = true;
|
785
785
|
@Comment({"Enable the `/plot component` preset GUI",
|
786
|
-
"Read more about components here: https://intellectualsites.
|
786
|
+
"Read more about components here: https://intellectualsites.gitbook.io/plotsquared/customization/plot-components"})
|
787
787
|
public static boolean COMPONENT_PRESETS = true;
|
788
788
|
@Comment("Enable per user locale")
|
789
789
|
public static boolean PER_USER_LOCALE = false;
|
@@ -18,6 +18,8 @@
|
|
18
18
|
*/
|
19
19
|
package com.plotsquared.core.configuration.caption;
|
20
20
|
|
21
|
+
import net.kyori.adventure.text.Component;
|
22
|
+
import net.kyori.adventure.text.ComponentLike;
|
21
23
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
22
24
|
|
23
25
|
/**
|
@@ -33,4 +35,13 @@ public interface Caption {
|
|
33
35
|
*/
|
34
36
|
@NonNull String getComponent(@NonNull LocaleHolder localeHolder);
|
35
37
|
|
38
|
+
/**
|
39
|
+
* Get the Adventure {@link ComponentLike} for this caption
|
40
|
+
*
|
41
|
+
* @param localeHolder Locale holder
|
42
|
+
* @return {@link ComponentLike}
|
43
|
+
* @since 7.0.0
|
44
|
+
*/
|
45
|
+
@NonNull Component toComponent(@NonNull LocaleHolder localeHolder);
|
46
|
+
|
36
47
|
}
|
@@ -18,27 +18,53 @@
|
|
18
18
|
*/
|
19
19
|
package com.plotsquared.core.configuration.caption;
|
20
20
|
|
21
|
-
import net.kyori.adventure.text.minimessage.
|
21
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
22
22
|
|
23
|
+
/**
|
24
|
+
* A holder for a caption.
|
25
|
+
* Useful when constructing messages in multiple steps with {@link TagResolver}s.
|
26
|
+
*/
|
23
27
|
public class CaptionHolder {
|
24
28
|
|
25
29
|
private Caption caption = StaticCaption.of("");
|
26
|
-
private
|
30
|
+
private TagResolver[] tagResolvers = new TagResolver[0];
|
27
31
|
|
32
|
+
/**
|
33
|
+
* Set the {@link Caption} to send.
|
34
|
+
*
|
35
|
+
* @param caption The new caption.
|
36
|
+
*/
|
28
37
|
public void set(Caption caption) {
|
29
38
|
this.caption = caption;
|
30
39
|
}
|
31
40
|
|
41
|
+
/**
|
42
|
+
* Get the {@link Caption} to send.
|
43
|
+
*
|
44
|
+
* @return The caption to send.
|
45
|
+
*/
|
32
46
|
public Caption get() {
|
33
47
|
return this.caption;
|
34
48
|
}
|
35
49
|
|
36
|
-
|
37
|
-
|
50
|
+
/**
|
51
|
+
* Get the {@link TagResolver}s to use when resolving tags in the {@link Caption}.
|
52
|
+
*
|
53
|
+
* @return The tag resolvers to use.
|
54
|
+
* @since 7.0.0
|
55
|
+
*/
|
56
|
+
public TagResolver[] getTagResolvers() {
|
57
|
+
return this.tagResolvers;
|
38
58
|
}
|
39
59
|
|
40
|
-
|
41
|
-
|
60
|
+
/**
|
61
|
+
* Set the {@link TagResolver}s to use when resolving tags in the {@link Caption}.
|
62
|
+
*
|
63
|
+
* @param tagResolvers The tag resolvers to use.
|
64
|
+
* @since 7.0.0
|
65
|
+
*/
|
66
|
+
public void setTagResolvers(TagResolver... tagResolvers) {
|
67
|
+
this.tagResolvers = tagResolvers;
|
42
68
|
}
|
43
69
|
|
44
70
|
}
|
@@ -28,16 +28,20 @@ import com.plotsquared.core.plot.flag.implementations.PlotTitleFlag;
|
|
28
28
|
import net.kyori.adventure.text.Component;
|
29
29
|
import net.kyori.adventure.text.event.ClickEvent;
|
30
30
|
import net.kyori.adventure.text.minimessage.MiniMessage;
|
31
|
+
import net.kyori.adventure.text.minimessage.ParsingException;
|
31
32
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
32
33
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
33
34
|
|
34
35
|
import java.util.Set;
|
36
|
+
import java.util.regex.Pattern;
|
35
37
|
|
36
38
|
import static com.plotsquared.core.configuration.caption.ComponentTransform.nested;
|
37
39
|
import static com.plotsquared.core.configuration.caption.ComponentTransform.stripClicks;
|
38
40
|
|
39
41
|
public class CaptionUtility {
|
40
42
|
|
43
|
+
private static final Pattern LEGACY_FORMATTING = Pattern.compile("§[a-gklmnor0-9]");
|
44
|
+
|
41
45
|
// flags which values are parsed by minimessage
|
42
46
|
private static final Set<Class<? extends PlotFlag<?, ?>>> MINI_MESSAGE_FLAGS = Set.of(
|
43
47
|
GreetingFlag.class,
|
@@ -100,9 +104,16 @@ public class CaptionUtility {
|
|
100
104
|
*/
|
101
105
|
public static String stripClickEvents(final @NonNull String miniMessageString) {
|
102
106
|
// parse, transform and serialize again
|
103
|
-
Component component
|
107
|
+
Component component;
|
108
|
+
try {
|
109
|
+
component = MiniMessage.miniMessage().deserialize(miniMessageString);
|
110
|
+
} catch (ParsingException e) {
|
111
|
+
// if the String cannot be parsed, we try stripping legacy colors
|
112
|
+
String legacyStripped = LEGACY_FORMATTING.matcher(miniMessageString).replaceAll("");
|
113
|
+
component = MiniMessage.miniMessage().deserialize(legacyStripped);
|
114
|
+
}
|
104
115
|
component = CLICK_STRIP_TRANSFORM.transform(component);
|
105
|
-
return MiniMessage.
|
116
|
+
return MiniMessage.miniMessage().serialize(component);
|
106
117
|
}
|
107
118
|
|
108
119
|
/**
|
@@ -19,6 +19,8 @@
|
|
19
19
|
package com.plotsquared.core.configuration.caption;
|
20
20
|
|
21
21
|
import com.google.common.base.Preconditions;
|
22
|
+
import net.kyori.adventure.text.Component;
|
23
|
+
import net.kyori.adventure.text.minimessage.MiniMessage;
|
22
24
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
23
25
|
|
24
26
|
public final class StaticCaption implements Caption {
|
@@ -44,4 +46,9 @@ public final class StaticCaption implements Caption {
|
|
44
46
|
return this.value; // can't be translated
|
45
47
|
}
|
46
48
|
|
49
|
+
@Override
|
50
|
+
public @NonNull Component toComponent(@NonNull final LocaleHolder localeHolder) {
|
51
|
+
return MiniMessage.miniMessage().deserialize(this.value);
|
52
|
+
}
|
53
|
+
|
47
54
|
}
|
@@ -1,103 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* PlotSquared, a land and world management plugin for Minecraft.
|
3
|
-
* Copyright (C) IntellectualSites <https://intellectualsites.com>
|
4
|
-
* Copyright (C) IntellectualSites team and contributors
|
5
|
-
*
|
6
|
-
* This program is free software: you can redistribute it and/or modify
|
7
|
-
* it under the terms of the GNU General Public License as published by
|
8
|
-
* the Free Software Foundation, either version 3 of the License, or
|
9
|
-
* (at your option) any later version.
|
10
|
-
*
|
11
|
-
* This program is distributed in the hope that it will be useful,
|
12
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
-
* GNU General Public License for more details.
|
15
|
-
*
|
16
|
-
* You should have received a copy of the GNU General Public License
|
17
|
-
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
18
|
-
*/
|
19
|
-
package com.plotsquared.core.configuration.caption;
|
20
|
-
|
21
|
-
import com.plotsquared.core.plot.PlotArea;
|
22
|
-
import com.plotsquared.core.util.PlayerManager;
|
23
|
-
import net.kyori.adventure.text.minimessage.MiniMessage;
|
24
|
-
import net.kyori.adventure.text.minimessage.Template;
|
25
|
-
import org.checkerframework.checker.nullness.qual.NonNull;
|
26
|
-
|
27
|
-
import java.util.UUID;
|
28
|
-
|
29
|
-
/**
|
30
|
-
* Utility class that generates {@link net.kyori.adventure.text.minimessage.Template templates}
|
31
|
-
*/
|
32
|
-
public final class Templates {
|
33
|
-
|
34
|
-
private static final MiniMessage MINI_MESSAGE = MiniMessage.builder().build();
|
35
|
-
|
36
|
-
private Templates() {
|
37
|
-
throw new UnsupportedOperationException(
|
38
|
-
"This is a utility class and cannot be instantiated");
|
39
|
-
}
|
40
|
-
|
41
|
-
/**
|
42
|
-
* Create a {@link net.kyori.adventure.text.minimessage.Template} from a PlotSquared {@link Caption}
|
43
|
-
*
|
44
|
-
* @param localeHolder Locale holder
|
45
|
-
* @param key Template key
|
46
|
-
* @param caption Caption object
|
47
|
-
* @param replacements Replacements
|
48
|
-
* @return Generated template
|
49
|
-
*/
|
50
|
-
public static @NonNull Template of(
|
51
|
-
final @NonNull LocaleHolder localeHolder,
|
52
|
-
final @NonNull String key, final @NonNull Caption caption,
|
53
|
-
final @NonNull Template... replacements
|
54
|
-
) {
|
55
|
-
return Template.of(key, MINI_MESSAGE.parse(caption.getComponent(localeHolder), replacements));
|
56
|
-
}
|
57
|
-
|
58
|
-
/**
|
59
|
-
* Create a {@link Template} from a username (using UUID mappings)
|
60
|
-
*
|
61
|
-
* @param key Template key
|
62
|
-
* @param uuid Player UUID
|
63
|
-
* @return Generated template
|
64
|
-
*/
|
65
|
-
public static @NonNull Template of(final @NonNull String key, final @NonNull UUID uuid) {
|
66
|
-
final String username = PlayerManager.resolveName(uuid).getComponent(LocaleHolder.console());
|
67
|
-
return Template.of(key, username);
|
68
|
-
}
|
69
|
-
|
70
|
-
/**
|
71
|
-
* Create a {@link Template} from a string
|
72
|
-
*
|
73
|
-
* @param key Template key
|
74
|
-
* @param value Template value
|
75
|
-
* @return Generated template
|
76
|
-
*/
|
77
|
-
public static @NonNull Template of(final @NonNull String key, final @NonNull String value) {
|
78
|
-
return Template.of(key, value);
|
79
|
-
}
|
80
|
-
|
81
|
-
/**
|
82
|
-
* Create a {@link Template} from a plot area
|
83
|
-
*
|
84
|
-
* @param key Template Key
|
85
|
-
* @param area Plot area
|
86
|
-
* @return Generated template
|
87
|
-
*/
|
88
|
-
public static @NonNull Template of(final @NonNull String key, final @NonNull PlotArea area) {
|
89
|
-
return Template.of(key, area.toString());
|
90
|
-
}
|
91
|
-
|
92
|
-
/**
|
93
|
-
* Create a {@link Template} from a number
|
94
|
-
*
|
95
|
-
* @param key Template key
|
96
|
-
* @param number Number
|
97
|
-
* @return Generated template
|
98
|
-
*/
|
99
|
-
public static @NonNull Template of(final @NonNull String key, final @NonNull Number number) {
|
100
|
-
return Template.of(key, number.toString());
|
101
|
-
}
|
102
|
-
|
103
|
-
}
|
@@ -20,6 +20,10 @@ package com.plotsquared.core.configuration.caption;
|
|
20
20
|
|
21
21
|
import com.google.common.base.Objects;
|
22
22
|
import com.plotsquared.core.PlotSquared;
|
23
|
+
import net.kyori.adventure.text.Component;
|
24
|
+
import net.kyori.adventure.text.minimessage.MiniMessage;
|
25
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
26
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
23
27
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
24
28
|
|
25
29
|
import java.util.Locale;
|
@@ -89,6 +93,17 @@ public final class TranslatableCaption implements NamespacedCaption {
|
|
89
93
|
return PlotSquared.get().getCaptionMap(this.namespace).getMessage(this, localeHolder);
|
90
94
|
}
|
91
95
|
|
96
|
+
@Override
|
97
|
+
public @NonNull Component toComponent(@NonNull final LocaleHolder localeHolder) {
|
98
|
+
if (getKey().equals("core.prefix")) {
|
99
|
+
return MiniMessage.miniMessage().deserialize(getComponent(localeHolder));
|
100
|
+
}
|
101
|
+
return MiniMessage.miniMessage().deserialize(getComponent(localeHolder), TagResolver.resolver(
|
102
|
+
"prefix",
|
103
|
+
Tag.inserting(TranslatableCaption.of("core.prefix").toComponent(localeHolder))
|
104
|
+
));
|
105
|
+
}
|
106
|
+
|
92
107
|
@Override
|
93
108
|
public @NonNull String getKey() {
|
94
109
|
return this.key;
|
@@ -225,7 +225,7 @@ public final class CaptionLoader {
|
|
225
225
|
*/
|
226
226
|
public @NonNull CaptionMap loadOrCreateSingle(final @NonNull Path file) throws IOException {
|
227
227
|
final Locale locale = this.localeExtractor.apply(file);
|
228
|
-
if (!Files.exists(file)
|
228
|
+
if (!Files.exists(file)) {
|
229
229
|
Map<String, String> map = new LinkedHashMap<>();
|
230
230
|
patch(map, locale);
|
231
231
|
save(file, map);
|
@@ -56,7 +56,8 @@ final class ClassLoaderCaptionProvider implements DefaultCaptionProvider {
|
|
56
56
|
LOGGER.info("No resource for locale '{}' found in the plugin file." +
|
57
57
|
"Please ensure you have placed the latest version of the file messages_{}.json in the 'lang' folder." +
|
58
58
|
"You may be able to find completed translations at https://intellectualsites.crowdin.com/plotsquared",
|
59
|
-
locale, locale
|
59
|
+
locale, locale
|
60
|
+
);
|
60
61
|
return null;
|
61
62
|
}
|
62
63
|
try (final BufferedReader reader = new BufferedReader(new InputStreamReader(stream))) {
|
@@ -19,6 +19,7 @@
|
|
19
19
|
package com.plotsquared.core.configuration.file;
|
20
20
|
|
21
21
|
import com.plotsquared.core.configuration.serialization.ConfigurationSerialization;
|
22
|
+
import org.yaml.snakeyaml.LoaderOptions;
|
22
23
|
import org.yaml.snakeyaml.constructor.SafeConstructor;
|
23
24
|
import org.yaml.snakeyaml.error.YAMLException;
|
24
25
|
import org.yaml.snakeyaml.nodes.Node;
|
@@ -30,6 +31,7 @@ import java.util.Map;
|
|
30
31
|
public class YamlConstructor extends SafeConstructor {
|
31
32
|
|
32
33
|
YamlConstructor() {
|
34
|
+
super(new LoaderOptions());
|
33
35
|
yamlConstructors.put(Tag.MAP, new ConstructCustomObject());
|
34
36
|
}
|
35
37
|
|
@@ -21,6 +21,7 @@ package com.plotsquared.core.configuration.file;
|
|
21
21
|
import com.plotsquared.core.configuration.ConfigurationSection;
|
22
22
|
import com.plotsquared.core.configuration.serialization.ConfigurationSerializable;
|
23
23
|
import com.plotsquared.core.configuration.serialization.ConfigurationSerialization;
|
24
|
+
import org.yaml.snakeyaml.DumperOptions;
|
24
25
|
import org.yaml.snakeyaml.nodes.Node;
|
25
26
|
import org.yaml.snakeyaml.representer.Representer;
|
26
27
|
|
@@ -30,6 +31,7 @@ import java.util.Map;
|
|
30
31
|
class YamlRepresenter extends Representer {
|
31
32
|
|
32
33
|
YamlRepresenter() {
|
34
|
+
super(new DumperOptions());
|
33
35
|
this.multiRepresenters.put(ConfigurationSection.class, new RepresentConfigurationSection());
|
34
36
|
this.multiRepresenters
|
35
37
|
.put(ConfigurationSerializable.class, new RepresentConfigurationSerializable());
|
@@ -2400,13 +2400,13 @@ public class SQLManager implements AbstractDB {
|
|
2400
2400
|
if (plot != null) {
|
2401
2401
|
statement.setString(1, plot.getArea().toString());
|
2402
2402
|
statement.setInt(2, plot.getId().hashCode());
|
2403
|
-
statement.setString(3, comment.comment);
|
2404
|
-
statement.setString(4, comment.inbox);
|
2405
|
-
statement.setString(5, comment.senderName);
|
2403
|
+
statement.setString(3, comment.comment());
|
2404
|
+
statement.setString(4, comment.inbox());
|
2405
|
+
statement.setString(5, comment.senderName());
|
2406
2406
|
} else {
|
2407
|
-
statement.setString(1, comment.comment);
|
2408
|
-
statement.setString(2, comment.inbox);
|
2409
|
-
statement.setString(3, comment.senderName);
|
2407
|
+
statement.setString(1, comment.comment());
|
2408
|
+
statement.setString(2, comment.inbox());
|
2409
|
+
statement.setString(3, comment.senderName());
|
2410
2410
|
}
|
2411
2411
|
}
|
2412
2412
|
|
@@ -2518,10 +2518,10 @@ public class SQLManager implements AbstractDB {
|
|
2518
2518
|
public void set(PreparedStatement statement) throws SQLException {
|
2519
2519
|
statement.setString(1, plot.getArea().toString());
|
2520
2520
|
statement.setInt(2, plot.getId().hashCode());
|
2521
|
-
statement.setString(3, comment.comment);
|
2522
|
-
statement.setString(4, comment.inbox);
|
2523
|
-
statement.setInt(5, (int) (comment.timestamp / 1000));
|
2524
|
-
statement.setString(6, comment.senderName);
|
2521
|
+
statement.setString(3, comment.comment());
|
2522
|
+
statement.setString(4, comment.inbox());
|
2523
|
+
statement.setInt(5, (int) (comment.timestamp() / 1000));
|
2524
|
+
statement.setString(6, comment.senderName());
|
2525
2525
|
}
|
2526
2526
|
|
2527
2527
|
@Override
|
@@ -3414,15 +3414,10 @@ public class SQLManager implements AbstractDB {
|
|
3414
3414
|
}
|
3415
3415
|
}
|
3416
3416
|
|
3417
|
-
private
|
3418
|
-
|
3419
|
-
|
3420
|
-
|
3421
|
-
|
3422
|
-
public LegacySettings(int id, PlotSettings settings) {
|
3423
|
-
this.id = id;
|
3424
|
-
this.settings = settings;
|
3425
|
-
}
|
3417
|
+
private record LegacySettings(
|
3418
|
+
int id,
|
3419
|
+
PlotSettings settings
|
3420
|
+
) {
|
3426
3421
|
|
3427
3422
|
}
|
3428
3423
|
|
@@ -53,7 +53,8 @@ public abstract class EntityEvent {
|
|
53
53
|
* @return the event class name
|
54
54
|
* @since 6.11.0
|
55
55
|
*/
|
56
|
-
@NonNull
|
56
|
+
@NonNull
|
57
|
+
public String getEventName() {
|
57
58
|
if (this.name == null) {
|
58
59
|
this.name = this.getClass().getSimpleName();
|
59
60
|
}
|
@@ -105,38 +105,6 @@ public class PlayerAutoPlotEvent extends PlotEvent implements CancellablePlotEve
|
|
105
105
|
return this.plotArea;
|
106
106
|
}
|
107
107
|
|
108
|
-
/**
|
109
|
-
* @deprecated for removal. Use {@link PlayerAutoPlotEvent#getSizeX()}
|
110
|
-
*/
|
111
|
-
@Deprecated(forRemoval = true, since = "6.1.0")
|
112
|
-
public int getSize_x() {
|
113
|
-
return getSizeX();
|
114
|
-
}
|
115
|
-
|
116
|
-
/**
|
117
|
-
* @deprecated for removal. Use {@link PlayerAutoPlotEvent#setSizeX(int)}
|
118
|
-
*/
|
119
|
-
@Deprecated(forRemoval = true, since = "6.1.0")
|
120
|
-
public void setSize_x(int sizeX) {
|
121
|
-
setSizeX(sizeX);
|
122
|
-
}
|
123
|
-
|
124
|
-
/**
|
125
|
-
* @deprecated for removal. Use {@link PlayerAutoPlotEvent#getSizeZ()}
|
126
|
-
*/
|
127
|
-
@Deprecated(forRemoval = true, since = "6.1.0")
|
128
|
-
public int getSize_z() {
|
129
|
-
return getSizeZ();
|
130
|
-
}
|
131
|
-
|
132
|
-
/**
|
133
|
-
* @deprecated for removal. Use {@link PlayerAutoPlotEvent#setSizeZ(int)}
|
134
|
-
*/
|
135
|
-
@Deprecated(forRemoval = true, since = "6.1.0")
|
136
|
-
public void setSize_z(int sizeZ) {
|
137
|
-
setSizeZ(sizeZ);
|
138
|
-
}
|
139
|
-
|
140
108
|
/**
|
141
109
|
* Get the x size of the auto-area
|
142
110
|
*
|
@@ -31,15 +31,6 @@ public class PlayerTeleportToPlotEvent extends PlotPlayerEvent implements Cancel
|
|
31
31
|
private final TeleportCause cause;
|
32
32
|
private Result eventResult;
|
33
33
|
|
34
|
-
/**
|
35
|
-
* @deprecated use {@link PlayerTeleportToPlotEvent#PlayerTeleportToPlotEvent(PlotPlayer, Location, Plot, TeleportCause)}.
|
36
|
-
* You should not be creating events in the first place.
|
37
|
-
*/
|
38
|
-
@Deprecated(forRemoval = true, since = "6.1.0")
|
39
|
-
public PlayerTeleportToPlotEvent(PlotPlayer<?> player, Location from, Plot plot) {
|
40
|
-
this(player, from, plot, TeleportCause.UNKNOWN);
|
41
|
-
}
|
42
|
-
|
43
34
|
/**
|
44
35
|
* PlayerTeleportToPlotEvent: Called when a player teleports to a plot
|
45
36
|
*
|
@@ -27,7 +27,7 @@ import com.plotsquared.core.plot.PlotManager;
|
|
27
27
|
import com.plotsquared.core.queue.AreaBoundDelegateQueueCoordinator;
|
28
28
|
import com.plotsquared.core.queue.LocationOffsetDelegateQueueCoordinator;
|
29
29
|
import com.plotsquared.core.queue.QueueCoordinator;
|
30
|
-
import com.plotsquared.core.queue.
|
30
|
+
import com.plotsquared.core.queue.ZeroedDelegateScopedQueueCoordinator;
|
31
31
|
import com.plotsquared.core.util.RegionUtil;
|
32
32
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
33
33
|
import com.sk89q.worldedit.world.block.BlockState;
|
@@ -161,13 +161,13 @@ public class AugmentedUtils {
|
|
161
161
|
|
162
162
|
// This queue should not be enqueued as it is simply used to restrict block setting, and then delegate to the
|
163
163
|
// actual queue
|
164
|
-
|
165
|
-
new
|
164
|
+
ZeroedDelegateScopedQueueCoordinator scoped =
|
165
|
+
new ZeroedDelegateScopedQueueCoordinator(
|
166
166
|
secondaryMask,
|
167
167
|
Location.at(world, blockX, area.getMinGenHeight(), blockZ),
|
168
168
|
Location.at(world, blockX + 15, area.getMaxGenHeight(), blockZ + 15)
|
169
169
|
);
|
170
|
-
generator.generateChunk(scoped, area);
|
170
|
+
generator.generateChunk(scoped, area, true);
|
171
171
|
generator.populateChunk(scoped, area);
|
172
172
|
}
|
173
173
|
if (enqueue) {
|
@@ -176,19 +176,4 @@ public class AugmentedUtils {
|
|
176
176
|
return generationResult;
|
177
177
|
}
|
178
178
|
|
179
|
-
/**
|
180
|
-
* @deprecated Use {@link AugmentedUtils#generateChunk(String, int, int, QueueCoordinator)} as chunkObject is not required
|
181
|
-
* in the above method
|
182
|
-
*/
|
183
|
-
@Deprecated(forRemoval = true, since = "6.8.0")
|
184
|
-
public static boolean generate(
|
185
|
-
@Nullable Object chunkObject,
|
186
|
-
final @NonNull String world,
|
187
|
-
final int chunkX,
|
188
|
-
final int chunkZ,
|
189
|
-
QueueCoordinator queue
|
190
|
-
) {
|
191
|
-
return generateChunk(world, chunkX, chunkZ, queue);
|
192
|
-
}
|
193
|
-
|
194
179
|
}
|
@@ -379,10 +379,11 @@ public class ClassicPlotManager extends SquarePlotManager {
|
|
379
379
|
}
|
380
380
|
}
|
381
381
|
|
382
|
+
int yStart = classicPlotWorld.getMinBuildHeight() + (classicPlotWorld.PLOT_BEDROCK ? 1 : 0);
|
382
383
|
if (!plot.isMerged(Direction.NORTH)) {
|
383
384
|
int z = bot.getZ();
|
384
385
|
for (int x = bot.getX(); x < top.getX(); x++) {
|
385
|
-
for (int y =
|
386
|
+
for (int y = yStart; y <= classicPlotWorld.WALL_HEIGHT; y++) {
|
386
387
|
queue.setBlock(x, y, z, blocks);
|
387
388
|
}
|
388
389
|
}
|
@@ -390,7 +391,7 @@ public class ClassicPlotManager extends SquarePlotManager {
|
|
390
391
|
if (!plot.isMerged(Direction.WEST)) {
|
391
392
|
int x = bot.getX();
|
392
393
|
for (int z = bot.getZ(); z < top.getZ(); z++) {
|
393
|
-
for (int y =
|
394
|
+
for (int y = yStart; y <= classicPlotWorld.WALL_HEIGHT; y++) {
|
394
395
|
queue.setBlock(x, y, z, blocks);
|
395
396
|
}
|
396
397
|
}
|
@@ -398,7 +399,7 @@ public class ClassicPlotManager extends SquarePlotManager {
|
|
398
399
|
if (!plot.isMerged(Direction.SOUTH)) {
|
399
400
|
int z = top.getZ();
|
400
401
|
for (int x = bot.getX(); x < top.getX() + (plot.isMerged(Direction.EAST) ? 0 : 1); x++) {
|
401
|
-
for (int y =
|
402
|
+
for (int y = yStart; y <= classicPlotWorld.WALL_HEIGHT; y++) {
|
402
403
|
queue.setBlock(x, y, z, blocks);
|
403
404
|
}
|
404
405
|
}
|
@@ -406,7 +407,7 @@ public class ClassicPlotManager extends SquarePlotManager {
|
|
406
407
|
if (!plot.isMerged(Direction.EAST)) {
|
407
408
|
int x = top.getX();
|
408
409
|
for (int z = bot.getZ(); z < top.getZ() + (plot.isMerged(Direction.SOUTH) ? 0 : 1); z++) {
|
409
|
-
for (int y =
|
410
|
+
for (int y = yStart; y <= classicPlotWorld.WALL_HEIGHT; y++) {
|
410
411
|
queue.setBlock(x, y, z, blocks);
|
411
412
|
}
|
412
413
|
}
|
@@ -38,6 +38,7 @@ import javax.annotation.Nullable;
|
|
38
38
|
|
39
39
|
@SuppressWarnings("WeakerAccess")
|
40
40
|
public abstract class ClassicPlotWorld extends SquarePlotWorld {
|
41
|
+
|
41
42
|
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + ClassicPlotWorld.class.getSimpleName());
|
42
43
|
|
43
44
|
public int ROAD_HEIGHT = 62;
|
@@ -64,6 +65,21 @@ public abstract class ClassicPlotWorld extends SquarePlotWorld {
|
|
64
65
|
super(worldName, id, generator, min, max, worldConfiguration, blockQueue);
|
65
66
|
}
|
66
67
|
|
68
|
+
private static BlockBucket createCheckedBlockBucket(String input, BlockBucket def) {
|
69
|
+
final BlockBucket bucket = new BlockBucket(input);
|
70
|
+
Pattern pattern = null;
|
71
|
+
try {
|
72
|
+
pattern = bucket.toPattern();
|
73
|
+
} catch (Exception ignore) {
|
74
|
+
}
|
75
|
+
if (pattern == null) {
|
76
|
+
LOGGER.error("Failed to parse pattern '{}', check your worlds.yml", input);
|
77
|
+
LOGGER.error("Falling back to {}", def);
|
78
|
+
return def;
|
79
|
+
}
|
80
|
+
return bucket;
|
81
|
+
}
|
82
|
+
|
67
83
|
/**
|
68
84
|
* CONFIG NODE | DEFAULT VALUE | DESCRIPTION | CONFIGURATION TYPE | REQUIRED FOR INITIAL SETUP.
|
69
85
|
*
|
@@ -144,19 +160,4 @@ public abstract class ClassicPlotWorld extends SquarePlotWorld {
|
|
144
160
|
return Math.min(WALL_HEIGHT, plotRoadMin);
|
145
161
|
}
|
146
162
|
|
147
|
-
private static BlockBucket createCheckedBlockBucket(String input, BlockBucket def) {
|
148
|
-
final BlockBucket bucket = new BlockBucket(input);
|
149
|
-
Pattern pattern = null;
|
150
|
-
try {
|
151
|
-
pattern = bucket.toPattern();
|
152
|
-
} catch (Exception ignore) {
|
153
|
-
}
|
154
|
-
if (pattern == null) {
|
155
|
-
LOGGER.error("Failed to parse pattern '{}', check your worlds.yml", input);
|
156
|
-
LOGGER.error("Falling back to {}", def);
|
157
|
-
return def;
|
158
|
-
}
|
159
|
-
return bucket;
|
160
|
-
}
|
161
|
-
|
162
163
|
}
|
@@ -26,7 +26,7 @@ import com.plotsquared.core.inject.factory.HybridPlotWorldFactory;
|
|
26
26
|
import com.plotsquared.core.location.Location;
|
27
27
|
import com.plotsquared.core.plot.PlotArea;
|
28
28
|
import com.plotsquared.core.plot.PlotId;
|
29
|
-
import com.plotsquared.core.queue.
|
29
|
+
import com.plotsquared.core.queue.ZeroedDelegateScopedQueueCoordinator;
|
30
30
|
import com.plotsquared.core.util.MathMan;
|
31
31
|
import com.sk89q.worldedit.entity.BaseEntity;
|
32
32
|
import com.sk89q.worldedit.entity.Entity;
|
@@ -42,6 +42,8 @@ import com.sk89q.worldedit.world.block.BlockTypes;
|
|
42
42
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
43
43
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
44
44
|
|
45
|
+
import java.util.EnumSet;
|
46
|
+
|
45
47
|
public class HybridGen extends IndependentPlotGenerator {
|
46
48
|
|
47
49
|
private static final CuboidRegion CHUNK = new CuboidRegion(BlockVector3.ZERO, BlockVector3.at(15, 396, 15));
|
@@ -59,15 +61,15 @@ public class HybridGen extends IndependentPlotGenerator {
|
|
59
61
|
|
60
62
|
private void placeSchem(
|
61
63
|
HybridPlotWorld world,
|
62
|
-
|
64
|
+
ZeroedDelegateScopedQueueCoordinator result,
|
63
65
|
short relativeX,
|
64
66
|
short relativeZ,
|
65
67
|
int x,
|
66
68
|
int z,
|
67
|
-
|
68
|
-
boolean isPopulating
|
69
|
+
EnumSet<SchematicFeature> features
|
69
70
|
) {
|
70
71
|
int minY; // Math.min(world.PLOT_HEIGHT, world.ROAD_HEIGHT);
|
72
|
+
boolean isRoad = features.contains(SchematicFeature.ROAD);
|
71
73
|
if ((isRoad && Settings.Schematics.PASTE_ROAD_ON_TOP) || (!isRoad && Settings.Schematics.PASTE_ON_TOP)) {
|
72
74
|
minY = world.SCHEM_Y;
|
73
75
|
} else {
|
@@ -77,12 +79,15 @@ public class HybridGen extends IndependentPlotGenerator {
|
|
77
79
|
if (blocks != null) {
|
78
80
|
for (int y = 0; y < blocks.length; y++) {
|
79
81
|
if (blocks[y] != null) {
|
80
|
-
if (!
|
82
|
+
if (!features.contains(SchematicFeature.POPULATING) || blocks[y].hasNbtData()) {
|
81
83
|
result.setBlock(x, minY + y, z, blocks[y]);
|
82
84
|
}
|
83
85
|
}
|
84
86
|
}
|
85
87
|
}
|
88
|
+
if (!features.contains(SchematicFeature.BIOMES)) {
|
89
|
+
return;
|
90
|
+
}
|
86
91
|
BiomeType biome = world.G_SCH_B.get(MathMan.pair(relativeX, relativeZ));
|
87
92
|
if (biome != null) {
|
88
93
|
result.setBiome(x, z, biome);
|
@@ -90,13 +95,15 @@ public class HybridGen extends IndependentPlotGenerator {
|
|
90
95
|
}
|
91
96
|
|
92
97
|
@Override
|
93
|
-
public void generateChunk(@NonNull
|
98
|
+
public void generateChunk(@NonNull ZeroedDelegateScopedQueueCoordinator result, @NonNull PlotArea settings, boolean biomes) {
|
94
99
|
Preconditions.checkNotNull(result, "result cannot be null");
|
95
100
|
Preconditions.checkNotNull(settings, "settings cannot be null");
|
96
101
|
|
97
102
|
HybridPlotWorld hybridPlotWorld = (HybridPlotWorld) settings;
|
98
103
|
// Biome
|
99
|
-
|
104
|
+
if (biomes) {
|
105
|
+
result.fillBiome(hybridPlotWorld.getPlotBiome());
|
106
|
+
}
|
100
107
|
// Bedrock
|
101
108
|
if (hybridPlotWorld.PLOT_BEDROCK) {
|
102
109
|
for (short x = 0; x < 16; x++) {
|
@@ -105,26 +112,25 @@ public class HybridGen extends IndependentPlotGenerator {
|
|
105
112
|
}
|
106
113
|
}
|
107
114
|
}
|
115
|
+
EnumSet<SchematicFeature> roadFeatures = EnumSet.of(SchematicFeature.ROAD);
|
116
|
+
EnumSet<SchematicFeature> plotFeatures = EnumSet.noneOf(SchematicFeature.class);
|
117
|
+
if (biomes) {
|
118
|
+
roadFeatures.add(SchematicFeature.BIOMES);
|
119
|
+
plotFeatures.add(SchematicFeature.BIOMES);
|
120
|
+
}
|
121
|
+
|
108
122
|
// Coords
|
109
123
|
Location min = result.getMin();
|
110
124
|
int bx = min.getX() - hybridPlotWorld.ROAD_OFFSET_X;
|
111
125
|
int bz = min.getZ() - hybridPlotWorld.ROAD_OFFSET_Z;
|
126
|
+
|
112
127
|
// The relative X-coordinate (within the plot) of the minimum X coordinate
|
113
128
|
// contained in the scoped queue
|
114
|
-
short relativeOffsetX;
|
115
|
-
if (bx < 0) {
|
116
|
-
relativeOffsetX = (short) (hybridPlotWorld.SIZE + (bx % hybridPlotWorld.SIZE));
|
117
|
-
} else {
|
118
|
-
relativeOffsetX = (short) (bx % hybridPlotWorld.SIZE);
|
119
|
-
}
|
129
|
+
short relativeOffsetX = (short) Math.floorMod(bx, hybridPlotWorld.SIZE);
|
120
130
|
// The relative Z-coordinate (within the plot) of the minimum Z coordinate
|
121
131
|
// contained in the scoped queue
|
122
|
-
short relativeOffsetZ;
|
123
|
-
|
124
|
-
relativeOffsetZ = (short) (hybridPlotWorld.SIZE + (bz % hybridPlotWorld.SIZE));
|
125
|
-
} else {
|
126
|
-
relativeOffsetZ = (short) (bz % hybridPlotWorld.SIZE);
|
127
|
-
}
|
132
|
+
short relativeOffsetZ = (short) Math.floorMod(bz, hybridPlotWorld.SIZE);
|
133
|
+
|
128
134
|
// The X-coordinate of a given X coordinate, relative to the
|
129
135
|
// plot (Counting from the corner with the least positive
|
130
136
|
// coordinates)
|
@@ -171,7 +177,7 @@ public class HybridGen extends IndependentPlotGenerator {
|
|
171
177
|
result.setBlock(x, y, z, hybridPlotWorld.ROAD_BLOCK.toPattern());
|
172
178
|
}
|
173
179
|
if (hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) {
|
174
|
-
placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z,
|
180
|
+
placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z, roadFeatures);
|
175
181
|
}
|
176
182
|
}
|
177
183
|
} else if (insideWallX[x]) {
|
@@ -182,7 +188,7 @@ public class HybridGen extends IndependentPlotGenerator {
|
|
182
188
|
result.setBlock(x, y, z, hybridPlotWorld.ROAD_BLOCK.toPattern());
|
183
189
|
}
|
184
190
|
if (hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) {
|
185
|
-
placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z,
|
191
|
+
placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z, roadFeatures);
|
186
192
|
}
|
187
193
|
} else {
|
188
194
|
// wall
|
@@ -194,7 +200,7 @@ public class HybridGen extends IndependentPlotGenerator {
|
|
194
200
|
result.setBlock(x, hybridPlotWorld.WALL_HEIGHT + 1, z, hybridPlotWorld.WALL_BLOCK.toPattern());
|
195
201
|
}
|
196
202
|
} else {
|
197
|
-
placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z,
|
203
|
+
placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z, roadFeatures);
|
198
204
|
}
|
199
205
|
}
|
200
206
|
}
|
@@ -206,7 +212,7 @@ public class HybridGen extends IndependentPlotGenerator {
|
|
206
212
|
result.setBlock(x, y, z, hybridPlotWorld.ROAD_BLOCK.toPattern());
|
207
213
|
}
|
208
214
|
if (hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) {
|
209
|
-
placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z,
|
215
|
+
placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z, roadFeatures);
|
210
216
|
}
|
211
217
|
} else if (insideWallZ[z]) {
|
212
218
|
// wall
|
@@ -218,7 +224,7 @@ public class HybridGen extends IndependentPlotGenerator {
|
|
218
224
|
result.setBlock(x, hybridPlotWorld.WALL_HEIGHT + 1, z, hybridPlotWorld.WALL_BLOCK.toPattern());
|
219
225
|
}
|
220
226
|
} else {
|
221
|
-
placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z,
|
227
|
+
placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z, roadFeatures);
|
222
228
|
}
|
223
229
|
} else {
|
224
230
|
// plot
|
@@ -227,7 +233,7 @@ public class HybridGen extends IndependentPlotGenerator {
|
|
227
233
|
}
|
228
234
|
result.setBlock(x, hybridPlotWorld.PLOT_HEIGHT, z, hybridPlotWorld.TOP_BLOCK.toPattern());
|
229
235
|
if (hybridPlotWorld.PLOT_SCHEMATIC) {
|
230
|
-
placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z,
|
236
|
+
placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z, plotFeatures);
|
231
237
|
}
|
232
238
|
}
|
233
239
|
}
|
@@ -236,31 +242,26 @@ public class HybridGen extends IndependentPlotGenerator {
|
|
236
242
|
}
|
237
243
|
|
238
244
|
@Override
|
239
|
-
public
|
245
|
+
public void populateChunk(final ZeroedDelegateScopedQueueCoordinator result, final PlotArea settings) {
|
240
246
|
HybridPlotWorld hybridPlotWorld = (HybridPlotWorld) settings;
|
241
247
|
if (!hybridPlotWorld.populationNeeded()) {
|
242
|
-
return
|
248
|
+
return;
|
243
249
|
}
|
250
|
+
EnumSet<SchematicFeature> roadFeatures = EnumSet.of(SchematicFeature.POPULATING, SchematicFeature.ROAD);
|
251
|
+
EnumSet<SchematicFeature> plotFeatures = EnumSet.of(SchematicFeature.POPULATING);
|
252
|
+
|
244
253
|
// Coords
|
245
254
|
Location min = result.getMin();
|
246
255
|
int bx = min.getX() - hybridPlotWorld.ROAD_OFFSET_X;
|
247
256
|
int bz = min.getZ() - hybridPlotWorld.ROAD_OFFSET_Z;
|
257
|
+
|
248
258
|
// The relative X-coordinate (within the plot) of the minimum X coordinate
|
249
259
|
// contained in the scoped queue
|
250
|
-
short relativeOffsetX;
|
251
|
-
if (bx < 0) {
|
252
|
-
relativeOffsetX = (short) (hybridPlotWorld.SIZE + (bx % hybridPlotWorld.SIZE));
|
253
|
-
} else {
|
254
|
-
relativeOffsetX = (short) (bx % hybridPlotWorld.SIZE);
|
255
|
-
}
|
260
|
+
short relativeOffsetX = (short) Math.floorMod(bx, hybridPlotWorld.SIZE);
|
256
261
|
// The relative Z-coordinate (within the plot) of the minimum Z coordinate
|
257
262
|
// contained in the scoped queue
|
258
|
-
short relativeOffsetZ;
|
259
|
-
|
260
|
-
relativeOffsetZ = (short) (hybridPlotWorld.SIZE + (bz % hybridPlotWorld.SIZE));
|
261
|
-
} else {
|
262
|
-
relativeOffsetZ = (short) (bz % hybridPlotWorld.SIZE);
|
263
|
-
}
|
263
|
+
short relativeOffsetZ = (short) Math.floorMod(bz, hybridPlotWorld.SIZE);
|
264
|
+
|
264
265
|
boolean allRoad = true;
|
265
266
|
boolean overlap = false;
|
266
267
|
|
@@ -313,17 +314,17 @@ public class HybridGen extends IndependentPlotGenerator {
|
|
313
314
|
if (insideRoadX[x] || insideWallX[x]) {
|
314
315
|
if (hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) {
|
315
316
|
for (short z = 0; z < 16; z++) {
|
316
|
-
placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z,
|
317
|
+
placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z, roadFeatures);
|
317
318
|
}
|
318
319
|
}
|
319
320
|
} else {
|
320
321
|
for (short z = 0; z < 16; z++) {
|
321
322
|
if (insideRoadZ[z] || insideWallZ[z]) {
|
322
323
|
if (hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) {
|
323
|
-
placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z,
|
324
|
+
placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z, roadFeatures);
|
324
325
|
}
|
325
326
|
} else if (hybridPlotWorld.PLOT_SCHEMATIC) {
|
326
|
-
placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z,
|
327
|
+
placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z, plotFeatures);
|
327
328
|
}
|
328
329
|
}
|
329
330
|
}
|
@@ -340,7 +341,10 @@ public class HybridGen extends IndependentPlotGenerator {
|
|
340
341
|
for (Entity entity : hybridPlotWorld.getPlotSchematicEntities()) {
|
341
342
|
if (region.contains(entity.getLocation().toVector().toBlockPoint())) {
|
342
343
|
Vector3 pos = (entity.getLocation().toVector()
|
343
|
-
.subtract(region
|
344
|
+
.subtract(region
|
345
|
+
.getMinimumPoint()
|
346
|
+
.withY(hybridPlotWorld.getPlotSchematicMinPoint().getY())
|
347
|
+
.toVector3()))
|
344
348
|
.add(min.getBlockVector3().withY(hybridPlotWorld.SCHEM_Y).toVector3());
|
345
349
|
result.setEntity(new PopulatingEntity(
|
346
350
|
entity,
|
@@ -364,7 +368,7 @@ public class HybridGen extends IndependentPlotGenerator {
|
|
364
368
|
}
|
365
369
|
}
|
366
370
|
}
|
367
|
-
return
|
371
|
+
return;
|
368
372
|
}
|
369
373
|
|
370
374
|
@Override
|
@@ -377,6 +381,33 @@ public class HybridGen extends IndependentPlotGenerator {
|
|
377
381
|
// All initialization is done in the PlotArea class
|
378
382
|
}
|
379
383
|
|
384
|
+
@Override
|
385
|
+
public BiomeType getBiome(final PlotArea settings, final int worldX, final int worldY, final int worldZ) {
|
386
|
+
HybridPlotWorld hybridPlotWorld = (HybridPlotWorld) settings;
|
387
|
+
if (!hybridPlotWorld.PLOT_SCHEMATIC && !hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) {
|
388
|
+
return hybridPlotWorld.getPlotBiome();
|
389
|
+
}
|
390
|
+
int relativeX = worldX;
|
391
|
+
int relativeZ = worldZ;
|
392
|
+
if (hybridPlotWorld.ROAD_OFFSET_X != 0) {
|
393
|
+
relativeX -= hybridPlotWorld.ROAD_OFFSET_X;
|
394
|
+
}
|
395
|
+
if (hybridPlotWorld.ROAD_OFFSET_Z != 0) {
|
396
|
+
relativeZ -= hybridPlotWorld.ROAD_OFFSET_Z;
|
397
|
+
}
|
398
|
+
int size = hybridPlotWorld.PLOT_WIDTH + hybridPlotWorld.ROAD_WIDTH;
|
399
|
+
relativeX = Math.floorMod(relativeX, size);
|
400
|
+
relativeZ = Math.floorMod(relativeZ, size);
|
401
|
+
BiomeType biome = hybridPlotWorld.G_SCH_B.get(MathMan.pair((short) relativeX, (short) relativeZ));
|
402
|
+
return biome == null ? hybridPlotWorld.getPlotBiome() : biome;
|
403
|
+
}
|
404
|
+
|
405
|
+
private enum SchematicFeature {
|
406
|
+
BIOMES,
|
407
|
+
ROAD,
|
408
|
+
POPULATING
|
409
|
+
}
|
410
|
+
|
380
411
|
/**
|
381
412
|
* Wrapper to allow a WorldEdit {@link Entity} to effectively have a mutable location as the location in its NBT should be changed
|
382
413
|
* when set to the world.
|
@@ -141,7 +141,11 @@ public class HybridPlotManager extends ClassicPlotManager {
|
|
141
141
|
(pos1.getX() + pos2.getX()) / 2,
|
142
142
|
(pos1.getZ() + pos2.getZ()) / 2
|
143
143
|
), biome)) {
|
144
|
-
WorldUtil.setBiome(
|
144
|
+
WorldUtil.setBiome(
|
145
|
+
hybridPlotWorld.getWorldName(),
|
146
|
+
new CuboidRegion(pos1.getBlockVector3(), pos2.getBlockVector3()),
|
147
|
+
biome
|
148
|
+
);
|
145
149
|
}
|
146
150
|
}
|
147
151
|
|
@@ -158,6 +162,7 @@ public class HybridPlotManager extends ClassicPlotManager {
|
|
158
162
|
} else {
|
159
163
|
minY = hybridPlotWorld.getMinBuildHeight();
|
160
164
|
}
|
165
|
+
int schemYDiff = (isRoad ? hybridPlotWorld.getRoadYStart() : hybridPlotWorld.getPlotYStart()) - minY;
|
161
166
|
BaseBlock airBlock = BlockTypes.AIR.getDefaultState().toBaseBlock();
|
162
167
|
for (int x = pos1.getX(); x <= pos2.getX(); x++) {
|
163
168
|
short absX = (short) ((x - hybridPlotWorld.ROAD_OFFSET_X) % size);
|
@@ -174,10 +179,14 @@ public class HybridPlotManager extends ClassicPlotManager {
|
|
174
179
|
for (int y = 0; y < blocks.length; y++) {
|
175
180
|
if (blocks[y] != null) {
|
176
181
|
queue.setBlock(x, minY + y, z, blocks[y]);
|
177
|
-
} else if (
|
178
|
-
// This is necessary, otherwise any blocks not specified in the schematic will remain after a clear
|
179
|
-
//
|
182
|
+
} else if (y > schemYDiff) {
|
183
|
+
// This is necessary, otherwise any blocks not specified in the schematic will remain after a clear.
|
184
|
+
// This should only be done where the schematic has actually "started"
|
180
185
|
queue.setBlock(x, minY + y, z, airBlock);
|
186
|
+
} else if (isRoad) {
|
187
|
+
queue.setBlock(x, minY + y, z, hybridPlotWorld.ROAD_BLOCK.toPattern());
|
188
|
+
} else {
|
189
|
+
queue.setBlock(x, minY + y, z, hybridPlotWorld.MAIN_BLOCK.toPattern());
|
181
190
|
}
|
182
191
|
}
|
183
192
|
}
|
@@ -203,8 +212,18 @@ public class HybridPlotManager extends ClassicPlotManager {
|
|
203
212
|
PlotId id2 = PlotId.of(id.getX(), id.getY() + 1);
|
204
213
|
Location bot = getPlotBottomLocAbs(id2);
|
205
214
|
Location top = getPlotTopLocAbs(id);
|
206
|
-
Location pos1 = Location.at(
|
207
|
-
|
215
|
+
Location pos1 = Location.at(
|
216
|
+
hybridPlotWorld.getWorldName(),
|
217
|
+
bot.getX() - 1,
|
218
|
+
hybridPlotWorld.getMinGenHeight(),
|
219
|
+
top.getZ() + 1
|
220
|
+
);
|
221
|
+
Location pos2 = Location.at(
|
222
|
+
hybridPlotWorld.getWorldName(),
|
223
|
+
top.getX() + 1,
|
224
|
+
hybridPlotWorld.getMaxGenHeight(),
|
225
|
+
bot.getZ()
|
226
|
+
);
|
208
227
|
this.resetBiome(hybridPlotWorld, pos1, pos2);
|
209
228
|
if (!hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) {
|
210
229
|
return true;
|
@@ -274,6 +293,13 @@ public class HybridPlotManager extends ClassicPlotManager {
|
|
274
293
|
queue.setCompleteTask(whenDone);
|
275
294
|
}
|
276
295
|
if (!canRegen) {
|
296
|
+
if (hybridPlotWorld.getMinBuildHeight() < hybridPlotWorld.getMinGenHeight()) {
|
297
|
+
queue.setCuboid(
|
298
|
+
pos1.withY(hybridPlotWorld.getMinBuildHeight()),
|
299
|
+
pos2.withY(hybridPlotWorld.getMinGenHeight()),
|
300
|
+
BlockTypes.AIR.getDefaultState()
|
301
|
+
);
|
302
|
+
}
|
277
303
|
queue.setCuboid(
|
278
304
|
pos1.withY(hybridPlotWorld.getMinGenHeight()),
|
279
305
|
pos2.withY(hybridPlotWorld.getMinGenHeight()),
|
@@ -291,6 +317,13 @@ public class HybridPlotManager extends ClassicPlotManager {
|
|
291
317
|
pos2.withY(hybridPlotWorld.getMaxGenHeight()),
|
292
318
|
BlockTypes.AIR.getDefaultState()
|
293
319
|
);
|
320
|
+
if (hybridPlotWorld.getMaxGenHeight() < hybridPlotWorld.getMaxBuildHeight() - 1) {
|
321
|
+
queue.setCuboid(
|
322
|
+
pos1.withY(hybridPlotWorld.getMaxGenHeight()),
|
323
|
+
pos2.withY(hybridPlotWorld.getMaxBuildHeight() - 1),
|
324
|
+
BlockTypes.AIR.getDefaultState()
|
325
|
+
);
|
326
|
+
}
|
294
327
|
queue.setBiomeCuboid(pos1, pos2, biome);
|
295
328
|
} else {
|
296
329
|
queue.setRegenRegion(new CuboidRegion(pos1.getBlockVector3(), pos2.getBlockVector3()));
|
@@ -68,8 +68,6 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
|
68
68
|
private static final AffineTransform transform = new AffineTransform().rotateY(90);
|
69
69
|
public boolean ROAD_SCHEMATIC_ENABLED;
|
70
70
|
public boolean PLOT_SCHEMATIC = false;
|
71
|
-
@Deprecated(forRemoval = true, since = "6.9.0")
|
72
|
-
public int PLOT_SCHEMATIC_HEIGHT = -1;
|
73
71
|
public short PATH_WIDTH_LOWER;
|
74
72
|
public short PATH_WIDTH_UPPER;
|
75
73
|
public HashMap<Integer, BaseBlock[]> G_SCH;
|
@@ -78,6 +76,9 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
|
78
76
|
* The Y level at which schematic generation will start, lowest of either road or plot schematic generation.
|
79
77
|
*/
|
80
78
|
public int SCHEM_Y;
|
79
|
+
|
80
|
+
private int plotY;
|
81
|
+
private int roadY;
|
81
82
|
private Location SIGN_LOCATION;
|
82
83
|
private File root = null;
|
83
84
|
private int lastOverlayHeightError = Integer.MIN_VALUE;
|
@@ -104,22 +105,6 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
|
104
105
|
PlotSquared.platform().injector().injectMembers(this);
|
105
106
|
}
|
106
107
|
|
107
|
-
@Deprecated(forRemoval = true, since = "6.9.0")
|
108
|
-
public static byte wrap(byte data, int start) {
|
109
|
-
if ((data >= start) && (data < (start + 4))) {
|
110
|
-
data = (byte) ((((data - start) + 2) & 3) + start);
|
111
|
-
}
|
112
|
-
return data;
|
113
|
-
}
|
114
|
-
|
115
|
-
@Deprecated(forRemoval = true, since = "6.9.0")
|
116
|
-
public static byte wrap2(byte data, int start) {
|
117
|
-
if ((data >= start) && (data < (start + 2))) {
|
118
|
-
data = (byte) ((((data - start) + 1) & 1) + start);
|
119
|
-
}
|
120
|
-
return data;
|
121
|
-
}
|
122
|
-
|
123
108
|
public static BaseBlock rotate(BaseBlock id) {
|
124
109
|
|
125
110
|
CompoundTag tag = id.getNbtData();
|
@@ -270,68 +255,60 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
|
270
255
|
|
271
256
|
SCHEM_Y = schematicStartHeight();
|
272
257
|
|
273
|
-
// plotY and roadY are important to allow plot and/or road schematic "overflow" into each other
|
274
|
-
//
|
258
|
+
// plotY and roadY are important to allow plot and/or road schematic "overflow" into each other
|
259
|
+
// without causing AIOOB exceptions when attempting either to set blocks to, or get block from G_SCH
|
275
260
|
// Default plot schematic start height, normalized to the minimum height schematics are pasted from.
|
276
|
-
|
261
|
+
plotY = PLOT_HEIGHT - SCHEM_Y;
|
277
262
|
int minRoadWall = Settings.Schematics.USE_WALL_IN_ROAD_SCHEM_HEIGHT ? Math.min(ROAD_HEIGHT, WALL_HEIGHT) : ROAD_HEIGHT;
|
278
263
|
// Default road schematic start height, normalized to the minimum height schematics are pasted from.
|
279
|
-
|
264
|
+
roadY = minRoadWall - SCHEM_Y;
|
280
265
|
|
281
266
|
int worldGenHeight = getMaxGenHeight() - getMinGenHeight() + 1;
|
282
267
|
|
283
|
-
int maxSchematicHeight = 0;
|
284
268
|
int plotSchemHeight = 0;
|
285
269
|
|
286
270
|
// SCHEM_Y should be normalised to the plot "start" height
|
287
271
|
if (schematic3 != null) {
|
288
|
-
plotSchemHeight =
|
289
|
-
if (
|
272
|
+
plotSchemHeight = schematic3.getClipboard().getDimensions().getY();
|
273
|
+
if (plotSchemHeight == worldGenHeight) {
|
290
274
|
SCHEM_Y = getMinGenHeight();
|
291
275
|
plotY = 0;
|
292
276
|
} else if (!Settings.Schematics.PASTE_ON_TOP) {
|
293
|
-
SCHEM_Y =
|
277
|
+
SCHEM_Y = getMinGenHeight();
|
294
278
|
plotY = 0;
|
295
279
|
}
|
296
280
|
}
|
297
281
|
|
298
|
-
int roadSchemHeight;
|
282
|
+
int roadSchemHeight = 0;
|
299
283
|
|
300
284
|
if (schematic1 != null) {
|
301
285
|
roadSchemHeight = Math.max(
|
302
286
|
schematic1.getClipboard().getDimensions().getY(),
|
303
287
|
schematic2.getClipboard().getDimensions().getY()
|
304
288
|
);
|
305
|
-
|
306
|
-
if (maxSchematicHeight == worldGenHeight) {
|
289
|
+
if (roadSchemHeight == worldGenHeight) {
|
307
290
|
SCHEM_Y = getMinGenHeight();
|
308
291
|
roadY = 0; // Road is the lowest schematic
|
309
292
|
if (schematic3 != null && schematic3.getClipboard().getDimensions().getY() != worldGenHeight) {
|
310
293
|
// Road is the lowest schematic. Normalize plotY to it.
|
311
294
|
if (Settings.Schematics.PASTE_ON_TOP) {
|
312
295
|
plotY = PLOT_HEIGHT - getMinGenHeight();
|
313
|
-
} else {
|
314
|
-
plotY = getMinBuildHeight() - getMinGenHeight();
|
315
296
|
}
|
316
297
|
}
|
317
298
|
} else if (!Settings.Schematics.PASTE_ROAD_ON_TOP) {
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
} else if (schematic3 != null) {
|
322
|
-
SCHEM_Y = getMinBuildHeight();
|
323
|
-
roadY = 0;// Road is the lowest schematic
|
299
|
+
roadY = 0;
|
300
|
+
SCHEM_Y = getMinGenHeight();
|
301
|
+
if (schematic3 != null) {
|
324
302
|
if (Settings.Schematics.PASTE_ON_TOP) {
|
325
303
|
// Road is the lowest schematic. Normalize plotY to it.
|
326
|
-
plotY = PLOT_HEIGHT -
|
304
|
+
plotY = PLOT_HEIGHT - SCHEM_Y;
|
327
305
|
}
|
328
|
-
maxSchematicHeight = Math.max(maxSchematicHeight, plotY + plotSchemHeight);
|
329
306
|
}
|
330
307
|
} else {
|
331
308
|
roadY = minRoadWall - SCHEM_Y;
|
332
|
-
maxSchematicHeight = Math.max(maxSchematicHeight, roadY + roadSchemHeight);
|
333
309
|
}
|
334
310
|
}
|
311
|
+
int maxSchematicHeight = Math.max(plotY + plotSchemHeight, roadY + roadSchemHeight);
|
335
312
|
|
336
313
|
if (schematic3 != null) {
|
337
314
|
this.PLOT_SCHEMATIC = true;
|
@@ -341,7 +318,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
|
341
318
|
short w3 = (short) d3.getX();
|
342
319
|
short l3 = (short) d3.getZ();
|
343
320
|
short h3 = (short) d3.getY();
|
344
|
-
if (w3 > PLOT_WIDTH ||
|
321
|
+
if (w3 > PLOT_WIDTH || l3 > PLOT_WIDTH) {
|
345
322
|
this.ROAD_SCHEMATIC_ENABLED = true;
|
346
323
|
}
|
347
324
|
int centerShiftZ;
|
@@ -396,7 +373,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
|
396
373
|
}
|
397
374
|
if ((schematic1 == null && schematic2 == null) || this.ROAD_WIDTH == 0) {
|
398
375
|
if (Settings.DEBUG) {
|
399
|
-
LOGGER.info("- schematic: false");
|
376
|
+
LOGGER.info("- road schematic: false");
|
400
377
|
}
|
401
378
|
return;
|
402
379
|
}
|
@@ -486,11 +463,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
|
486
463
|
}
|
487
464
|
}
|
488
465
|
|
489
|
-
|
490
|
-
* @deprecated This method should not be available for public API usage and will be made private.
|
491
|
-
*/
|
492
|
-
@Deprecated(forRemoval = true, since = "6.10.2")
|
493
|
-
public void addOverlayBlock(short x, short y, short z, BaseBlock id, boolean rotate, int height) {
|
466
|
+
private void addOverlayBlock(short x, short y, short z, BaseBlock id, boolean rotate, int height) {
|
494
467
|
if (z < 0) {
|
495
468
|
z += this.SIZE;
|
496
469
|
} else if (z >= this.SIZE) {
|
@@ -521,11 +494,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
|
521
494
|
existing[y] = id;
|
522
495
|
}
|
523
496
|
|
524
|
-
|
525
|
-
* @deprecated This method should not be available for public API usage and will be made private.
|
526
|
-
*/
|
527
|
-
@Deprecated(forRemoval = true, since = "6.10.2")
|
528
|
-
public void addOverlayBiome(short x, short z, BiomeType id) {
|
497
|
+
private void addOverlayBiome(short x, short z, BiomeType id) {
|
529
498
|
if (z < 0) {
|
530
499
|
z += this.SIZE;
|
531
500
|
} else if (z >= this.SIZE) {
|
@@ -570,14 +539,6 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
|
570
539
|
return schem1PopulationNeeded || schem2PopulationNeeded || schem3PopulationNeeded;
|
571
540
|
}
|
572
541
|
|
573
|
-
/**
|
574
|
-
* @deprecated in favour of {@link HybridPlotWorld#getSchematicRoot()}
|
575
|
-
*/
|
576
|
-
@Deprecated(forRemoval = true, since = "6.9.0")
|
577
|
-
public File getRoot() {
|
578
|
-
return this.root;
|
579
|
-
}
|
580
|
-
|
581
542
|
/**
|
582
543
|
* Get the root folder for this world's generation schematics. May be null if schematics not initialised via
|
583
544
|
* {@link HybridPlotWorld#setupSchematics()}
|
@@ -588,4 +549,24 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
|
588
549
|
return this.root;
|
589
550
|
}
|
590
551
|
|
552
|
+
/**
|
553
|
+
* Get the y value where the plot schematic should be pasted from.
|
554
|
+
*
|
555
|
+
* @return plot schematic y start value
|
556
|
+
* @since 7.0.0
|
557
|
+
*/
|
558
|
+
public int getPlotYStart() {
|
559
|
+
return SCHEM_Y + plotY;
|
560
|
+
}
|
561
|
+
|
562
|
+
/**
|
563
|
+
* Get the y value where the road schematic should be pasted from.
|
564
|
+
*
|
565
|
+
* @return road schematic y start value
|
566
|
+
* @since 7.0.0
|
567
|
+
*/
|
568
|
+
public int getRoadYStart() {
|
569
|
+
return SCHEM_Y + roadY;
|
570
|
+
}
|
571
|
+
|
591
572
|
}
|
@@ -63,7 +63,6 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
|
63
63
|
import java.io.File;
|
64
64
|
import java.util.ArrayDeque;
|
65
65
|
import java.util.ArrayList;
|
66
|
-
import java.util.Arrays;
|
67
66
|
import java.util.Collections;
|
68
67
|
import java.util.HashSet;
|
69
68
|
import java.util.Iterator;
|
@@ -78,6 +77,10 @@ public class HybridUtils {
|
|
78
77
|
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + HybridUtils.class.getSimpleName());
|
79
78
|
private static final BlockState AIR = BlockTypes.AIR.getDefaultState();
|
80
79
|
|
80
|
+
/**
|
81
|
+
* Deprecated and likely to be removed in a future release.
|
82
|
+
*/
|
83
|
+
@Deprecated(forRemoval = true, since = "7.0.0")
|
81
84
|
public static HybridUtils manager;
|
82
85
|
public static Set<BlockVector2> regions;
|
83
86
|
public static int height;
|
@@ -163,7 +166,7 @@ public class HybridUtils {
|
|
163
166
|
int relChunkZ = chunkPos.getZ() - cbz;
|
164
167
|
oldBlockQueue.setOffsetX(relChunkX << 4);
|
165
168
|
oldBlockQueue.setOffsetZ(relChunkZ << 4);
|
166
|
-
hpw.getGenerator().generateChunk(oldBlockQueue, hpw);
|
169
|
+
hpw.getGenerator().generateChunk(oldBlockQueue, hpw, false);
|
167
170
|
});
|
168
171
|
|
169
172
|
final BlockState[][][] oldBlocks = oldBlockQueue.getBlockStates();
|
@@ -380,26 +383,6 @@ public class HybridUtils {
|
|
380
383
|
run.run();
|
381
384
|
}
|
382
385
|
|
383
|
-
/**
|
384
|
-
* @deprecated Unused internally and poor implementation. Scheduled for removal in next major release.
|
385
|
-
*/
|
386
|
-
@Deprecated(forRemoval = true, since = "6.11.1")
|
387
|
-
public int checkModified(QueueCoordinator queue, int x1, int x2, int y1, int y2, int z1, int z2, BlockState[] blocks) {
|
388
|
-
int count = 0;
|
389
|
-
for (int y = y1; y <= y2; y++) {
|
390
|
-
for (int x = x1; x <= x2; x++) {
|
391
|
-
for (int z = z1; z <= z2; z++) {
|
392
|
-
BlockState block = queue.getBlock(x, y, z);
|
393
|
-
boolean same = Arrays.stream(blocks).anyMatch(p -> this.worldUtil.isBlockSame(block, p));
|
394
|
-
if (!same) {
|
395
|
-
count++;
|
396
|
-
}
|
397
|
-
}
|
398
|
-
}
|
399
|
-
}
|
400
|
-
return count;
|
401
|
-
}
|
402
|
-
|
403
386
|
public final ArrayList<BlockVector2> getChunks(BlockVector2 region) {
|
404
387
|
ArrayList<BlockVector2> chunks = new ArrayList<>();
|
405
388
|
int sx = region.getX() << 5;
|
@@ -550,7 +533,7 @@ public class HybridUtils {
|
|
550
533
|
Math.min(plotworld.PLOT_HEIGHT, Math.min(plotworld.WALL_HEIGHT, plotworld.ROAD_HEIGHT)) : plotworld.ROAD_HEIGHT;
|
551
534
|
int sx = bot.getX() - plotworld.ROAD_WIDTH + 1;
|
552
535
|
int sz = bot.getZ() + 1;
|
553
|
-
int sy = Settings.Schematics.PASTE_ROAD_ON_TOP ? schemY : plot.getArea().
|
536
|
+
int sy = Settings.Schematics.PASTE_ROAD_ON_TOP ? schemY : plot.getArea().getMinGenHeight();
|
554
537
|
int ex = bot.getX();
|
555
538
|
int ez = top.getZ();
|
556
539
|
int ey = get_ey(plotworld, queue, sx, ex, sz, ez, sy);
|
@@ -599,20 +582,6 @@ public class HybridUtils {
|
|
599
582
|
return ey;
|
600
583
|
}
|
601
584
|
|
602
|
-
/**
|
603
|
-
* Regenerate the road in a chunk in a plot area.
|
604
|
-
*
|
605
|
-
* @param area Plot area to regenerate road for
|
606
|
-
* @param chunk Chunk location to regenerate
|
607
|
-
* @param extend How far to extend setting air above the road
|
608
|
-
* @return if successful
|
609
|
-
* @deprecated use {@link HybridUtils#regenerateRoad(PlotArea, BlockVector2, int, QueueCoordinator)}
|
610
|
-
*/
|
611
|
-
@Deprecated(forRemoval = true, since = "6.6.0")
|
612
|
-
public boolean regenerateRoad(final PlotArea area, final BlockVector2 chunk, int extend) {
|
613
|
-
return regenerateRoad(area, chunk, extend, null);
|
614
|
-
}
|
615
|
-
|
616
585
|
/**
|
617
586
|
* Regenerate the road in a chunk in a plot area.
|
618
587
|
*
|
@@ -703,7 +672,7 @@ public class HybridUtils {
|
|
703
672
|
}
|
704
673
|
if (condition) {
|
705
674
|
BaseBlock[] blocks = plotWorld.G_SCH.get(MathMan.pair(absX, absZ));
|
706
|
-
int minY =
|
675
|
+
int minY = plotWorld.getRoadYStart();
|
707
676
|
int maxDy = Math.max(extend, blocks.length);
|
708
677
|
for (int dy = 0; dy < maxDy; dy++) {
|
709
678
|
if (dy > blocks.length - 1) {
|
@@ -21,8 +21,9 @@ package com.plotsquared.core.generator;
|
|
21
21
|
import com.plotsquared.core.PlotSquared;
|
22
22
|
import com.plotsquared.core.plot.PlotArea;
|
23
23
|
import com.plotsquared.core.plot.PlotId;
|
24
|
-
import com.plotsquared.core.queue.
|
24
|
+
import com.plotsquared.core.queue.ZeroedDelegateScopedQueueCoordinator;
|
25
25
|
import com.plotsquared.core.setup.PlotAreaBuilder;
|
26
|
+
import com.sk89q.worldedit.world.biome.BiomeType;
|
26
27
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
27
28
|
|
28
29
|
/**
|
@@ -42,24 +43,21 @@ public abstract class IndependentPlotGenerator {
|
|
42
43
|
/**
|
43
44
|
* Generate chunk block data
|
44
45
|
*
|
45
|
-
* @param result
|
46
|
+
* @param result Queue to write to
|
46
47
|
* @param settings PlotArea (settings)
|
47
|
-
* @
|
48
|
+
* @param biomes If biomes should be generated
|
49
|
+
* @since 7.0.0
|
48
50
|
*/
|
49
|
-
|
50
|
-
public abstract void generateChunk(ScopedQueueCoordinator result, PlotArea settings);
|
51
|
+
public abstract void generateChunk(ZeroedDelegateScopedQueueCoordinator result, PlotArea settings, boolean biomes);
|
51
52
|
|
52
53
|
/**
|
53
|
-
*
|
54
|
+
* Populate a chunk-queue with tile entities, entities, etc.
|
54
55
|
*
|
55
|
-
* @param result
|
56
|
-
* @param
|
57
|
-
* @
|
58
|
-
* @deprecated {@link ScopedQueueCoordinator} will be renamed in v7.
|
56
|
+
* @param result Queue to write to
|
57
|
+
* @param setting PlotArea (settings)
|
58
|
+
* @since 7.0.0
|
59
59
|
*/
|
60
|
-
|
61
|
-
public boolean populateChunk(ScopedQueueCoordinator result, PlotArea settings) {
|
62
|
-
return false;
|
60
|
+
public void populateChunk(ZeroedDelegateScopedQueueCoordinator result, PlotArea setting) {
|
63
61
|
}
|
64
62
|
|
65
63
|
/**
|
@@ -102,6 +100,18 @@ public abstract class IndependentPlotGenerator {
|
|
102
100
|
return (GeneratorWrapper<T>) PlotSquared.platform().wrapPlotGenerator(world, this);
|
103
101
|
}
|
104
102
|
|
103
|
+
/**
|
104
|
+
* Get the biome to be generated at a specific point
|
105
|
+
*
|
106
|
+
* @param settings PlotArea settings to provide biome
|
107
|
+
* @param x World x position
|
108
|
+
* @param y World y position
|
109
|
+
* @param z World z position
|
110
|
+
* @return Biome type to be generated
|
111
|
+
* @since 7.0.0
|
112
|
+
*/
|
113
|
+
public abstract BiomeType getBiome(PlotArea settings, int x, int y, int z);
|
114
|
+
|
105
115
|
@Override
|
106
116
|
public String toString() {
|
107
117
|
return getName();
|
@@ -25,8 +25,10 @@ import com.plotsquared.core.plot.PlotId;
|
|
25
25
|
import com.plotsquared.core.plot.world.PlotAreaManager;
|
26
26
|
import com.plotsquared.core.plot.world.SinglePlotArea;
|
27
27
|
import com.plotsquared.core.plot.world.SinglePlotAreaManager;
|
28
|
-
import com.plotsquared.core.queue.
|
28
|
+
import com.plotsquared.core.queue.ZeroedDelegateScopedQueueCoordinator;
|
29
|
+
import com.sk89q.worldedit.world.biome.BiomeType;
|
29
30
|
import com.sk89q.worldedit.world.biome.BiomeTypes;
|
31
|
+
import com.sk89q.worldedit.world.block.BlockState;
|
30
32
|
import com.sk89q.worldedit.world.block.BlockTypes;
|
31
33
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
32
34
|
|
@@ -38,6 +40,9 @@ public class SingleWorldGenerator extends IndependentPlotGenerator {
|
|
38
40
|
private static final Location dirt2 = Location.at("", 15, 2, 15);
|
39
41
|
private static final Location grass1 = Location.at("", 0, 3, 0);
|
40
42
|
private static final Location grass2 = Location.at("", 15, 3, 15);
|
43
|
+
private static final BlockState BEDROCK = BlockTypes.BEDROCK.getDefaultState();
|
44
|
+
private static final BlockState DIRT = BlockTypes.DIRT.getDefaultState();
|
45
|
+
private static final BlockState GRASS_BLOCK = BlockTypes.GRASS_BLOCK.getDefaultState();
|
41
46
|
|
42
47
|
private final PlotAreaManager plotAreaManager;
|
43
48
|
|
@@ -52,19 +57,21 @@ public class SingleWorldGenerator extends IndependentPlotGenerator {
|
|
52
57
|
}
|
53
58
|
|
54
59
|
@Override
|
55
|
-
public void generateChunk(
|
60
|
+
public void generateChunk(ZeroedDelegateScopedQueueCoordinator result, PlotArea settings, boolean biomes) {
|
56
61
|
SinglePlotArea area = (SinglePlotArea) settings;
|
57
62
|
if (area.VOID) {
|
58
63
|
Location min = result.getMin();
|
59
64
|
if (min.getX() == 0 && min.getZ() == 0) {
|
60
|
-
result.setBlock(0, 0, 0,
|
65
|
+
result.setBlock(0, 0, 0, BEDROCK);
|
61
66
|
}
|
62
67
|
} else {
|
63
|
-
result.setCuboid(bedrock1, bedrock2,
|
64
|
-
result.setCuboid(dirt1, dirt2,
|
65
|
-
result.setCuboid(grass1, grass2,
|
68
|
+
result.setCuboid(bedrock1, bedrock2, BEDROCK);
|
69
|
+
result.setCuboid(dirt1, dirt2, DIRT);
|
70
|
+
result.setCuboid(grass1, grass2, GRASS_BLOCK);
|
71
|
+
}
|
72
|
+
if (biomes) {
|
73
|
+
result.fillBiome(BiomeTypes.PLAINS);
|
66
74
|
}
|
67
|
-
result.fillBiome(BiomeTypes.PLAINS);
|
68
75
|
}
|
69
76
|
|
70
77
|
@Override
|
@@ -76,4 +83,9 @@ public class SingleWorldGenerator extends IndependentPlotGenerator {
|
|
76
83
|
public void initialize(PlotArea area) {
|
77
84
|
}
|
78
85
|
|
86
|
+
@Override
|
87
|
+
public BiomeType getBiome(final PlotArea settings, final int x, final int y, final int z) {
|
88
|
+
return BiomeTypes.PLAINS;
|
89
|
+
}
|
90
|
+
|
79
91
|
}
|
@@ -185,30 +185,38 @@ public abstract class SquarePlotManager extends GridPlotManager {
|
|
185
185
|
return null;
|
186
186
|
}
|
187
187
|
switch (hash) {
|
188
|
-
case 8
|
188
|
+
case 8 -> {
|
189
189
|
// north
|
190
190
|
return plot.isMerged(Direction.NORTH) ? id : null;
|
191
|
-
|
191
|
+
}
|
192
|
+
case 4 -> {
|
192
193
|
// east
|
193
194
|
return plot.isMerged(Direction.EAST) ? id : null;
|
194
|
-
|
195
|
+
}
|
196
|
+
case 2 -> {
|
195
197
|
// south
|
196
198
|
return plot.isMerged(Direction.SOUTH) ? id : null;
|
197
|
-
|
199
|
+
}
|
200
|
+
case 1 -> {
|
198
201
|
// west
|
199
202
|
return plot.isMerged(Direction.WEST) ? id : null;
|
200
|
-
|
203
|
+
}
|
204
|
+
case 12 -> {
|
201
205
|
// northeast
|
202
206
|
return plot.isMerged(Direction.NORTHEAST) ? id : null;
|
203
|
-
|
207
|
+
}
|
208
|
+
case 6 -> {
|
204
209
|
// southeast
|
205
210
|
return plot.isMerged(Direction.SOUTHEAST) ? id : null;
|
206
|
-
|
211
|
+
}
|
212
|
+
case 3 -> {
|
207
213
|
// southwest
|
208
214
|
return plot.isMerged(Direction.SOUTHWEST) ? id : null;
|
209
|
-
|
215
|
+
}
|
216
|
+
case 9 -> {
|
210
217
|
// northwest
|
211
218
|
return plot.isMerged(Direction.NORTHWEST) ? id : null;
|
219
|
+
}
|
212
220
|
}
|
213
221
|
} catch (Exception ignored) {
|
214
222
|
LOGGER.error("Invalid plot / road width in settings.yml for world: {}", squarePlotWorld.getWorldName());
|
@@ -23,7 +23,6 @@ import com.plotsquared.core.configuration.Settings;
|
|
23
23
|
import com.plotsquared.core.configuration.caption.Caption;
|
24
24
|
import com.plotsquared.core.configuration.caption.StaticCaption;
|
25
25
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
26
|
-
import com.plotsquared.core.database.DBFunc;
|
27
26
|
import com.plotsquared.core.events.PlotFlagRemoveEvent;
|
28
27
|
import com.plotsquared.core.events.Result;
|
29
28
|
import com.plotsquared.core.location.Location;
|
@@ -63,8 +62,11 @@ import com.sk89q.worldedit.world.gamemode.GameMode;
|
|
63
62
|
import com.sk89q.worldedit.world.gamemode.GameModes;
|
64
63
|
import com.sk89q.worldedit.world.item.ItemType;
|
65
64
|
import com.sk89q.worldedit.world.item.ItemTypes;
|
65
|
+
import net.kyori.adventure.text.Component;
|
66
|
+
import net.kyori.adventure.text.ComponentLike;
|
66
67
|
import net.kyori.adventure.text.minimessage.MiniMessage;
|
67
|
-
import net.kyori.adventure.text.minimessage.
|
68
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
69
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
68
70
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
69
71
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
70
72
|
|
@@ -75,11 +77,10 @@ import java.util.List;
|
|
75
77
|
import java.util.Map;
|
76
78
|
import java.util.Optional;
|
77
79
|
import java.util.UUID;
|
78
|
-
import java.util.function.Consumer;
|
79
80
|
|
80
81
|
public class PlotListener {
|
81
82
|
|
82
|
-
private static final MiniMessage MINI_MESSAGE = MiniMessage.
|
83
|
+
private static final MiniMessage MINI_MESSAGE = MiniMessage.miniMessage();
|
83
84
|
|
84
85
|
private final HashMap<UUID, Interval> feedRunnable = new HashMap<>();
|
85
86
|
private final HashMap<UUID, Interval> healRunnable = new HashMap<>();
|
@@ -141,7 +142,9 @@ public class PlotListener {
|
|
141
142
|
Map.Entry<UUID, List<StatusEffect>> entry = iterator.next();
|
142
143
|
List<StatusEffect> effects = entry.getValue();
|
143
144
|
effects.removeIf(effect -> currentTime > effect.expiresAt);
|
144
|
-
if (effects.isEmpty())
|
145
|
+
if (effects.isEmpty()) {
|
146
|
+
iterator.remove();
|
147
|
+
}
|
145
148
|
}
|
146
149
|
}
|
147
150
|
}, TaskTime.seconds(1L));
|
@@ -151,7 +154,7 @@ public class PlotListener {
|
|
151
154
|
if (plot.isDenied(player.getUUID()) && !player.hasPermission("plots.admin.entry.denied")) {
|
152
155
|
player.sendMessage(
|
153
156
|
TranslatableCaption.of("deny.no_enter"),
|
154
|
-
|
157
|
+
TagResolver.resolver("plot", Tag.inserting(Component.text(plot.toString())))
|
155
158
|
);
|
156
159
|
return false;
|
157
160
|
}
|
@@ -219,8 +222,10 @@ public class PlotListener {
|
|
219
222
|
} else {
|
220
223
|
player.sendMessage(
|
221
224
|
TranslatableCaption.of("gamemode.gamemode_was_bypassed"),
|
222
|
-
|
223
|
-
|
225
|
+
TagResolver.builder()
|
226
|
+
.tag("gamemode", Tag.inserting(Component.text(gameMode.toString())))
|
227
|
+
.tag("plot", Tag.inserting(Component.text(plot.getId().toString())))
|
228
|
+
.build()
|
224
229
|
);
|
225
230
|
}
|
226
231
|
}
|
@@ -234,8 +239,10 @@ public class PlotListener {
|
|
234
239
|
} else {
|
235
240
|
player.sendMessage(
|
236
241
|
TranslatableCaption.of("gamemode.gamemode_was_bypassed"),
|
237
|
-
|
238
|
-
|
242
|
+
TagResolver.builder()
|
243
|
+
.tag("gamemode", Tag.inserting(Component.text(guestGameMode.toString())))
|
244
|
+
.tag("plot", Tag.inserting(Component.text(plot.getId().toString())))
|
245
|
+
.build()
|
239
246
|
);
|
240
247
|
}
|
241
248
|
}
|
@@ -314,39 +321,21 @@ public class PlotListener {
|
|
314
321
|
}
|
315
322
|
if ((lastPlot != null) && plot.getId().equals(lastPlot.getId()) && plot.hasOwner()) {
|
316
323
|
final UUID plotOwner = plot.getOwnerAbs();
|
317
|
-
|
324
|
+
ComponentLike owner = PlayerManager.resolveName(plotOwner, true).toComponent(player);
|
318
325
|
Caption header = fromFlag ? StaticCaption.of(title) : TranslatableCaption.of("titles" +
|
319
326
|
".title_entered_plot");
|
320
327
|
Caption subHeader = fromFlag ? StaticCaption.of(subtitle) : TranslatableCaption.of("titles" +
|
321
328
|
".title_entered_plot_sub");
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
} else {
|
331
|
-
player.sendTitle(header, subHeader, aliasTemplate, plotTemplate, worldTemplate, ownerTemplate);
|
332
|
-
}
|
333
|
-
};
|
334
|
-
|
335
|
-
UUID uuid = plot.getOwner();
|
336
|
-
if (uuid == null) {
|
337
|
-
userConsumer.accept("Unknown");
|
338
|
-
} else if (uuid.equals(DBFunc.SERVER)) {
|
339
|
-
userConsumer.accept(MINI_MESSAGE.stripTokens(TranslatableCaption
|
340
|
-
.of("info.server")
|
341
|
-
.getComponent(player)));
|
329
|
+
TagResolver resolver = TagResolver.builder()
|
330
|
+
.tag("plot", Tag.inserting(Component.text(lastPlot.getId().toString())))
|
331
|
+
.tag("world", Tag.inserting(Component.text(player.getLocation().getWorldName())))
|
332
|
+
.tag("owner", Tag.inserting(owner))
|
333
|
+
.tag("alias", Tag.inserting(Component.text(plot.getAlias())))
|
334
|
+
.build();
|
335
|
+
if (Settings.Titles.TITLES_AS_ACTIONBAR) {
|
336
|
+
player.sendActionBar(header, resolver);
|
342
337
|
} else {
|
343
|
-
|
344
|
-
if (throwable != null) {
|
345
|
-
userConsumer.accept("Unknown");
|
346
|
-
} else {
|
347
|
-
userConsumer.accept(user);
|
348
|
-
}
|
349
|
-
});
|
338
|
+
player.sendTitle(header, subHeader, resolver);
|
350
339
|
}
|
351
340
|
}
|
352
341
|
}, TaskTime.seconds(1L));
|
@@ -354,14 +343,14 @@ public class PlotListener {
|
|
354
343
|
}
|
355
344
|
|
356
345
|
TimedFlag.Timed<Integer> feed = plot.getFlag(FeedFlag.class);
|
357
|
-
if (feed.
|
346
|
+
if (feed.interval() != 0 && feed.value() != 0) {
|
358
347
|
feedRunnable
|
359
|
-
.put(player.getUUID(), new Interval(feed.
|
348
|
+
.put(player.getUUID(), new Interval(feed.interval(), feed.value(), 20));
|
360
349
|
}
|
361
350
|
TimedFlag.Timed<Integer> heal = plot.getFlag(HealFlag.class);
|
362
|
-
if (heal.
|
351
|
+
if (heal.interval() != 0 && heal.value() != 0) {
|
363
352
|
healRunnable
|
364
|
-
.put(player.getUUID(), new Interval(heal.
|
353
|
+
.put(player.getUUID(), new Interval(heal.interval(), heal.value(), 20));
|
365
354
|
}
|
366
355
|
return true;
|
367
356
|
}
|
@@ -406,8 +395,10 @@ public class PlotListener {
|
|
406
395
|
} else {
|
407
396
|
player.sendMessage(
|
408
397
|
TranslatableCaption.of("gamemode.gamemode_was_bypassed"),
|
409
|
-
|
410
|
-
|
398
|
+
TagResolver.builder()
|
399
|
+
.tag("gamemode", Tag.inserting(Component.text(pw.getGameMode().toString())))
|
400
|
+
.tag("plot", Tag.inserting(Component.text(plot.toString())))
|
401
|
+
.build()
|
411
402
|
);
|
412
403
|
}
|
413
404
|
}
|
@@ -477,13 +468,15 @@ public class PlotListener {
|
|
477
468
|
}
|
478
469
|
|
479
470
|
private void notifyPlotOwner(final PlotPlayer<?> player, final Plot plot, final PlotPlayer<?> owner, final Caption caption) {
|
480
|
-
|
481
|
-
|
482
|
-
|
471
|
+
TagResolver resolver = TagResolver.builder()
|
472
|
+
.tag("player", Tag.inserting(Component.text(player.getName())))
|
473
|
+
.tag("plot", Tag.inserting(Component.text(plot.getId().toString())))
|
474
|
+
.tag("area", Tag.inserting(Component.text(String.valueOf(plot.getArea()))))
|
475
|
+
.build();
|
483
476
|
if (!Settings.Chat.NOTIFICATION_AS_ACTIONBAR) {
|
484
|
-
owner.sendMessage(caption,
|
477
|
+
owner.sendMessage(caption, resolver);
|
485
478
|
} else {
|
486
|
-
owner.sendActionBar(caption,
|
479
|
+
owner.sendActionBar(caption, resolver);
|
487
480
|
}
|
488
481
|
}
|
489
482
|
|
@@ -495,8 +488,9 @@ public class PlotListener {
|
|
495
488
|
|
496
489
|
/**
|
497
490
|
* Marks an effect as a status effect that will be removed on leaving a plot
|
498
|
-
*
|
499
|
-
* @param
|
491
|
+
*
|
492
|
+
* @param uuid The uuid of the player the effect belongs to
|
493
|
+
* @param name The name of the status effect
|
500
494
|
* @param expiresAt The time when the effect expires
|
501
495
|
* @since 6.10.0
|
502
496
|
*/
|
@@ -527,10 +521,10 @@ public class PlotListener {
|
|
527
521
|
private record StatusEffect(@NonNull String name, long expiresAt) {
|
528
522
|
|
529
523
|
private StatusEffect(@NonNull String name, long expiresAt) {
|
530
|
-
|
531
|
-
|
532
|
-
}
|
533
|
-
|
524
|
+
this.name = name;
|
525
|
+
this.expiresAt = expiresAt;
|
534
526
|
}
|
535
527
|
|
528
|
+
}
|
529
|
+
|
536
530
|
}
|
@@ -38,7 +38,9 @@ import com.sk89q.worldedit.util.Location;
|
|
38
38
|
import com.sk89q.worldedit.util.eventbus.EventHandler.Priority;
|
39
39
|
import com.sk89q.worldedit.util.eventbus.Subscribe;
|
40
40
|
import com.sk89q.worldedit.world.World;
|
41
|
-
import net.kyori.adventure.text.
|
41
|
+
import net.kyori.adventure.text.Component;
|
42
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
43
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
42
44
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
43
45
|
|
44
46
|
import java.util.Set;
|
@@ -94,7 +96,7 @@ public class WESubscriber {
|
|
94
96
|
if (plotPlayer.hasPermission("plots.worldedit.bypass")) {
|
95
97
|
plotPlayer.sendMessage(
|
96
98
|
TranslatableCaption.of("worldedit.worldedit_bypass"),
|
97
|
-
|
99
|
+
TagResolver.resolver("command", Tag.inserting(Component.text("/plot toggle worldedit")))
|
98
100
|
);
|
99
101
|
}
|
100
102
|
if (this.plotAreaManager.hasPlotArea(world)) {
|
@@ -21,17 +21,11 @@ package com.plotsquared.core.location;
|
|
21
21
|
import com.plotsquared.core.util.MathMan;
|
22
22
|
import com.plotsquared.core.util.StringMan;
|
23
23
|
|
24
|
-
public
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
public ChunkWrapper(String world, int x, int z) {
|
31
|
-
this.world = world;
|
32
|
-
this.x = x;
|
33
|
-
this.z = z;
|
34
|
-
}
|
24
|
+
public record ChunkWrapper(
|
25
|
+
String world,
|
26
|
+
int x,
|
27
|
+
int z
|
28
|
+
) {
|
35
29
|
|
36
30
|
@Override
|
37
31
|
public int hashCode() {
|
@@ -51,7 +51,6 @@ public final class UncheckedWorldLocation extends Location {
|
|
51
51
|
* @param y Y coordinate
|
52
52
|
* @param z Z coordinate
|
53
53
|
* @return New location
|
54
|
-
*
|
55
54
|
* @since 6.9.0
|
56
55
|
*/
|
57
56
|
@DoNotUse
|
@@ -61,6 +60,19 @@ public final class UncheckedWorldLocation extends Location {
|
|
61
60
|
return new UncheckedWorldLocation(world, x, y, z);
|
62
61
|
}
|
63
62
|
|
63
|
+
/**
|
64
|
+
* Construct a new location with yaw and pitch equal to 0
|
65
|
+
*
|
66
|
+
* @param world World
|
67
|
+
* @param loc Coordinates
|
68
|
+
* @return New location
|
69
|
+
* @since 7.0.0
|
70
|
+
*/
|
71
|
+
@DoNotUse
|
72
|
+
public static @NonNull UncheckedWorldLocation at(final @NonNull String world, BlockVector3 loc) {
|
73
|
+
return new UncheckedWorldLocation(world, loc.getX(), loc.getY(), loc.getZ());
|
74
|
+
}
|
75
|
+
|
64
76
|
@Override
|
65
77
|
@DoNotUse
|
66
78
|
public @NonNull String getWorldName() {
|
@@ -18,22 +18,21 @@
|
|
18
18
|
*/
|
19
19
|
package com.plotsquared.core.permissions;
|
20
20
|
|
21
|
+
import net.kyori.adventure.text.Component;
|
22
|
+
import net.kyori.adventure.text.ComponentLike;
|
21
23
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
24
|
+
import org.jetbrains.annotations.NotNull;
|
22
25
|
|
23
26
|
/**
|
24
27
|
* Permission class.
|
25
28
|
*/
|
26
|
-
public enum Permission {
|
29
|
+
public enum Permission implements ComponentLike {
|
27
30
|
|
28
31
|
//@formatter:off
|
29
32
|
//<editor-fold desc="Static Permission">
|
30
33
|
PERMISSION_STAR("*"),
|
31
34
|
PERMISSION_ADMIN("plots.admin"),
|
32
35
|
PERMISSION_ADMIN_AREA_SUDO("plots.admin.area.sudo"),
|
33
|
-
@Deprecated(forRemoval = true, since = "6.2.2")
|
34
|
-
PERMISSION_PROJECTILE_UNOWNED("plots.projectile.unowned"),
|
35
|
-
@Deprecated(forRemoval = true, since = "6.2.2")
|
36
|
-
PERMISSION_PROJECTILE_OTHER("plots.projectile.other"),
|
37
36
|
PERMISSION_ADMIN_INTERACT_BLOCKED_CMDS("plots.admin.interact.blockedcommands"),
|
38
37
|
PERMISSION_WORLDEDIT_BYPASS("plots.worldedit.bypass"),
|
39
38
|
PERMISSION_PLOT_TOGGLE_TITLES("plots.toggle.titles"),
|
@@ -46,6 +45,7 @@ public enum Permission {
|
|
46
45
|
PERMISSION_ADMIN_ENTRY_FORCEFIELD("plots.admin.entry.forcefield"),
|
47
46
|
PERMISSION_ADMIN_COMMANDS_CHATSPY("plots.admin.command.chatspy"),
|
48
47
|
PERMISSION_MERGE("plots.merge"),
|
48
|
+
PERMISSION_MERGE_ALL("plots.merge.all"),
|
49
49
|
PERMISSION_MERGE_OTHER("plots.merge.other"),
|
50
50
|
PERMISSION_MERGE_KEEP_ROAD("plots.merge.keeproad"),
|
51
51
|
PERMISSION_ADMIN_CAPS_OTHER("plots.admin.caps.other"),
|
@@ -201,7 +201,8 @@ public enum Permission {
|
|
201
201
|
PERMISSION_RATE("plots.rate"),
|
202
202
|
PERMISSION_ADMIN_FLIGHT("plots.admin.flight"),
|
203
203
|
PERMISSION_ADMIN_COMPONENTS_OTHER("plots.admin.component.other"),
|
204
|
-
PERMISSION_ADMIN_BYPASS_BORDER("plots.admin.border.bypass")
|
204
|
+
PERMISSION_ADMIN_BYPASS_BORDER("plots.admin.border.bypass"),
|
205
|
+
PERMISSION_ADMIN_BYPASS_ECON("plots.admin.econ.bypass");
|
205
206
|
//</editor-fold>
|
206
207
|
|
207
208
|
private final String text;
|
@@ -219,4 +220,9 @@ public enum Permission {
|
|
219
220
|
return String.format(this.toString(), replacements);
|
220
221
|
}
|
221
222
|
|
223
|
+
@Override
|
224
|
+
public @NotNull Component asComponent() {
|
225
|
+
return Component.text(text);
|
226
|
+
}
|
227
|
+
|
222
228
|
}
|
@@ -42,7 +42,7 @@ import com.sk89q.worldedit.world.gamemode.GameModes;
|
|
42
42
|
import com.sk89q.worldedit.world.item.ItemType;
|
43
43
|
import net.kyori.adventure.audience.Audience;
|
44
44
|
import net.kyori.adventure.text.minimessage.MiniMessage;
|
45
|
-
import net.kyori.adventure.text.minimessage.
|
45
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
46
46
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
47
47
|
|
48
48
|
import java.util.UUID;
|
@@ -110,7 +110,7 @@ public class ConsolePlayer extends PlotPlayer<Actor> {
|
|
110
110
|
@Override
|
111
111
|
public void sendTitle(
|
112
112
|
final @NonNull Caption title, final @NonNull Caption subtitle,
|
113
|
-
final int fadeIn, final int stay, final int fadeOut, final @NonNull
|
113
|
+
final int fadeIn, final int stay, final int fadeOut, final @NonNull TagResolver... resolvers
|
114
114
|
) {
|
115
115
|
}
|
116
116
|
|
@@ -144,7 +144,7 @@ public class ConsolePlayer extends PlotPlayer<Actor> {
|
|
144
144
|
@Override
|
145
145
|
public void sendMessage(
|
146
146
|
final @NonNull Caption caption,
|
147
|
-
final @NonNull
|
147
|
+
final @NonNull TagResolver... replacements
|
148
148
|
) {
|
149
149
|
String message = caption.getComponent(this);
|
150
150
|
if (message.isEmpty()) {
|
@@ -154,7 +154,7 @@ public class ConsolePlayer extends PlotPlayer<Actor> {
|
|
154
154
|
.replace('\u2010', '%').replace('\u2020', '&').replace('\u2030', '&')
|
155
155
|
.replace("<prefix>", TranslatableCaption.of("core.prefix").getComponent(this));
|
156
156
|
// Parse the message
|
157
|
-
PlotSquared.platform().consoleAudience().sendMessage(MINI_MESSAGE.
|
157
|
+
PlotSquared.platform().consoleAudience().sendMessage(MINI_MESSAGE.deserialize(message, replacements));
|
158
158
|
}
|
159
159
|
|
160
160
|
@Override
|
@@ -57,7 +57,8 @@ import com.sk89q.worldedit.world.item.ItemType;
|
|
57
57
|
import net.kyori.adventure.audience.Audience;
|
58
58
|
import net.kyori.adventure.text.Component;
|
59
59
|
import net.kyori.adventure.text.minimessage.MiniMessage;
|
60
|
-
import net.kyori.adventure.text.minimessage.
|
60
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
61
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
61
62
|
import net.kyori.adventure.title.Title;
|
62
63
|
import org.apache.logging.log4j.LogManager;
|
63
64
|
import org.apache.logging.log4j.Logger;
|
@@ -205,7 +206,7 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer,
|
|
205
206
|
if (notify) {
|
206
207
|
sendMessage(
|
207
208
|
TranslatableCaption.of("permission.no_permission_event"),
|
208
|
-
|
209
|
+
TagResolver.resolver("node", Tag.inserting(Component.text(permission)))
|
209
210
|
);
|
210
211
|
}
|
211
212
|
return false;
|
@@ -849,7 +850,7 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer,
|
|
849
850
|
*/
|
850
851
|
public void sendTitle(
|
851
852
|
final @NonNull Caption title, final @NonNull Caption subtitle,
|
852
|
-
final @NonNull
|
853
|
+
final @NonNull TagResolver... replacements
|
853
854
|
) {
|
854
855
|
sendTitle(
|
855
856
|
title,
|
@@ -874,11 +875,11 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer,
|
|
874
875
|
public void sendTitle(
|
875
876
|
final @NonNull Caption title, final @NonNull Caption subtitle,
|
876
877
|
final int fadeIn, final int stay, final int fadeOut,
|
877
|
-
final @NonNull
|
878
|
+
final @NonNull TagResolver... replacements
|
878
879
|
) {
|
879
|
-
final Component titleComponent = MiniMessage.
|
880
|
+
final Component titleComponent = MiniMessage.miniMessage().deserialize(title.getComponent(this), replacements);
|
880
881
|
final Component subtitleComponent =
|
881
|
-
MiniMessage.
|
882
|
+
MiniMessage.miniMessage().deserialize(subtitle.getComponent(this), replacements);
|
882
883
|
final Title.Times times = Title.Times.of(
|
883
884
|
Duration.of(Settings.Titles.TITLES_FADE_IN * 50L, ChronoUnit.MILLIS),
|
884
885
|
Duration.of(Settings.Titles.TITLES_STAY * 50L, ChronoUnit.MILLIS),
|
@@ -896,7 +897,7 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer,
|
|
896
897
|
*/
|
897
898
|
public void sendActionBar(
|
898
899
|
final @NonNull Caption caption,
|
899
|
-
final @NonNull
|
900
|
+
final @NonNull TagResolver... replacements
|
900
901
|
) {
|
901
902
|
String message;
|
902
903
|
try {
|
@@ -916,14 +917,14 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer,
|
|
916
917
|
.replace("<prefix>", TranslatableCaption.of("core.prefix").getComponent(this));
|
917
918
|
|
918
919
|
|
919
|
-
final Component component = MiniMessage.
|
920
|
+
final Component component = MiniMessage.miniMessage().deserialize(message, replacements);
|
920
921
|
getAudience().sendActionBar(component);
|
921
922
|
}
|
922
923
|
|
923
924
|
@Override
|
924
925
|
public void sendMessage(
|
925
926
|
final @NonNull Caption caption,
|
926
|
-
final @NonNull
|
927
|
+
final @NonNull TagResolver... replacements
|
927
928
|
) {
|
928
929
|
String message;
|
929
930
|
try {
|
@@ -942,7 +943,7 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer,
|
|
942
943
|
.replace('\u2010', '%').replace('\u2020', '&').replace('\u2030', '&')
|
943
944
|
.replace("<prefix>", TranslatableCaption.of("core.prefix").getComponent(this));
|
944
945
|
// Parse the message
|
945
|
-
final Component component = MiniMessage.
|
946
|
+
final Component component = MiniMessage.miniMessage().deserialize(message, replacements);
|
946
947
|
if (!Objects.equal(component, this.getMeta("lastMessage"))
|
947
948
|
|| System.currentTimeMillis() - this.<Long>getMeta("lastMessageTime") > 5000) {
|
948
949
|
setMeta("lastMessage", component);
|
@@ -110,54 +110,62 @@ public final class BlockBucket implements ConfigurationSerializable {
|
|
110
110
|
if (isCompiled()) {
|
111
111
|
return;
|
112
112
|
}
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
113
|
+
// Synchronized as BlockBuckets may require compilation asynchronously due to async chunk generation on Paper servers
|
114
|
+
synchronized (this) {
|
115
|
+
if (isCompiled()) {
|
116
|
+
return;
|
117
|
+
}
|
118
|
+
String string = this.input.toString();
|
119
|
+
if (string.isEmpty()) {
|
120
|
+
this.single = null;
|
121
|
+
this.pattern = null;
|
122
|
+
this.compiled = true;
|
123
|
+
return;
|
124
|
+
}
|
125
|
+
// Convert legacy format
|
126
|
+
boolean legacy = false;
|
127
|
+
String[] blocksStr = string.split(",(?![^\\(\\[]*[\\]\\)])");
|
128
|
+
if (blocksStr.length == 1) {
|
129
|
+
try {
|
130
|
+
Matcher matcher = regex.matcher(string);
|
131
|
+
if (matcher.find()) {
|
132
|
+
String chanceStr = matcher.group("chance");
|
133
|
+
String block = matcher.group("block");
|
134
|
+
//noinspection PointlessNullCheck
|
135
|
+
if (chanceStr != null && block != null && !MathMan.isInteger(block) && MathMan
|
136
|
+
.isInteger(chanceStr)) {
|
137
|
+
String namespace = matcher.group("namespace");
|
138
|
+
string = (namespace == null ? "" : namespace + ":") + block;
|
139
|
+
}
|
140
|
+
}
|
141
|
+
this.single = BlockUtil.get(string);
|
142
|
+
this.pattern = new BlockPattern(single);
|
143
|
+
this.compiled = true;
|
144
|
+
return;
|
145
|
+
} catch (Exception ignore) {
|
146
|
+
}
|
147
|
+
}
|
148
|
+
for (int i = 0; i < blocksStr.length; i++) {
|
149
|
+
String entry = blocksStr[i];
|
150
|
+
Matcher matcher = regex.matcher(entry);
|
126
151
|
if (matcher.find()) {
|
127
152
|
String chanceStr = matcher.group("chance");
|
128
|
-
String block = matcher.group("block");
|
129
153
|
//noinspection PointlessNullCheck
|
130
|
-
if (chanceStr != null &&
|
131
|
-
|
132
|
-
|
133
|
-
|
154
|
+
if (chanceStr != null && MathMan.isInteger(chanceStr)) {
|
155
|
+
String[] parts = entry.split(":");
|
156
|
+
parts = Arrays.copyOf(parts, parts.length - 1);
|
157
|
+
entry = chanceStr + "%" + StringMan.join(parts, ":");
|
158
|
+
blocksStr[i] = entry;
|
159
|
+
legacy = true;
|
134
160
|
}
|
135
161
|
}
|
136
|
-
this.single = BlockUtil.get(string);
|
137
|
-
this.pattern = new BlockPattern(single);
|
138
|
-
return;
|
139
|
-
} catch (Exception ignore) {
|
140
162
|
}
|
141
|
-
|
142
|
-
|
143
|
-
String entry = blocksStr[i];
|
144
|
-
Matcher matcher = regex.matcher(entry);
|
145
|
-
if (matcher.find()) {
|
146
|
-
String chanceStr = matcher.group("chance");
|
147
|
-
//noinspection PointlessNullCheck
|
148
|
-
if (chanceStr != null && MathMan.isInteger(chanceStr)) {
|
149
|
-
String[] parts = entry.split(":");
|
150
|
-
parts = Arrays.copyOf(parts, parts.length - 1);
|
151
|
-
entry = chanceStr + "%" + StringMan.join(parts, ":");
|
152
|
-
blocksStr[i] = entry;
|
153
|
-
legacy = true;
|
154
|
-
}
|
163
|
+
if (legacy) {
|
164
|
+
string = StringMan.join(blocksStr, ",");
|
155
165
|
}
|
166
|
+
pattern = PatternUtil.parse(null, string);
|
167
|
+
this.compiled = true;
|
156
168
|
}
|
157
|
-
if (legacy) {
|
158
|
-
string = StringMan.join(blocksStr, ",");
|
159
|
-
}
|
160
|
-
pattern = PatternUtil.parse(null, string);
|
161
169
|
}
|
162
170
|
|
163
171
|
public boolean isCompiled() {
|
@@ -207,17 +215,11 @@ public final class BlockBucket implements ConfigurationSerializable {
|
|
207
215
|
return result;
|
208
216
|
}
|
209
217
|
|
210
|
-
private
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
public Range(int min, int max, boolean automatic) {
|
217
|
-
this.min = min;
|
218
|
-
this.max = max;
|
219
|
-
this.automatic = automatic;
|
220
|
-
}
|
218
|
+
private record Range(
|
219
|
+
int min,
|
220
|
+
int max,
|
221
|
+
boolean automatic
|
222
|
+
) {
|
221
223
|
|
222
224
|
public int getWeight() {
|
223
225
|
return max - min;
|
@@ -227,46 +229,6 @@ public final class BlockBucket implements ConfigurationSerializable {
|
|
227
229
|
return num <= max && num >= min;
|
228
230
|
}
|
229
231
|
|
230
|
-
public int getMin() {
|
231
|
-
return this.min;
|
232
|
-
}
|
233
|
-
|
234
|
-
public int getMax() {
|
235
|
-
return this.max;
|
236
|
-
}
|
237
|
-
|
238
|
-
public boolean equals(final Object o) {
|
239
|
-
if (o == this) {
|
240
|
-
return true;
|
241
|
-
}
|
242
|
-
if (!(o instanceof final Range other)) {
|
243
|
-
return false;
|
244
|
-
}
|
245
|
-
if (this.getMin() != other.getMin()) {
|
246
|
-
return false;
|
247
|
-
}
|
248
|
-
if (this.getMax() != other.getMax()) {
|
249
|
-
return false;
|
250
|
-
}
|
251
|
-
if (this.isAutomatic() != other.isAutomatic()) {
|
252
|
-
return false;
|
253
|
-
}
|
254
|
-
return true;
|
255
|
-
}
|
256
|
-
|
257
|
-
public int hashCode() {
|
258
|
-
final int PRIME = 59;
|
259
|
-
int result = 1;
|
260
|
-
result = result * PRIME + this.getMin();
|
261
|
-
result = result * PRIME + this.getMax();
|
262
|
-
result = result * PRIME + (this.isAutomatic() ? 79 : 97);
|
263
|
-
return result;
|
264
|
-
}
|
265
|
-
|
266
|
-
public boolean isAutomatic() {
|
267
|
-
return this.automatic;
|
268
|
-
}
|
269
|
-
|
270
232
|
}
|
271
233
|
|
272
234
|
}
|
@@ -20,7 +20,6 @@ package com.plotsquared.core.plot;
|
|
20
20
|
|
21
21
|
import com.google.common.collect.ImmutableSet;
|
22
22
|
import com.google.common.collect.Lists;
|
23
|
-
import com.google.common.collect.Sets;
|
24
23
|
import com.google.inject.Inject;
|
25
24
|
import com.plotsquared.core.PlotSquared;
|
26
25
|
import com.plotsquared.core.command.Like;
|
@@ -40,6 +39,7 @@ import com.plotsquared.core.location.Location;
|
|
40
39
|
import com.plotsquared.core.permissions.Permission;
|
41
40
|
import com.plotsquared.core.player.ConsolePlayer;
|
42
41
|
import com.plotsquared.core.player.PlotPlayer;
|
42
|
+
import com.plotsquared.core.plot.expiration.ExpireManager;
|
43
43
|
import com.plotsquared.core.plot.expiration.PlotAnalysis;
|
44
44
|
import com.plotsquared.core.plot.flag.FlagContainer;
|
45
45
|
import com.plotsquared.core.plot.flag.GlobalFlagContainer;
|
@@ -68,9 +68,11 @@ import com.sk89q.worldedit.math.BlockVector3;
|
|
68
68
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
69
69
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
70
70
|
import net.kyori.adventure.text.Component;
|
71
|
+
import net.kyori.adventure.text.ComponentLike;
|
71
72
|
import net.kyori.adventure.text.TextComponent;
|
72
73
|
import net.kyori.adventure.text.minimessage.MiniMessage;
|
73
|
-
import net.kyori.adventure.text.minimessage.
|
74
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
75
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
74
76
|
import org.apache.logging.log4j.LogManager;
|
75
77
|
import org.apache.logging.log4j.Logger;
|
76
78
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
@@ -113,9 +115,6 @@ import static com.plotsquared.core.util.entity.EntityCategories.CAP_VEHICLE;
|
|
113
115
|
*/
|
114
116
|
public class Plot {
|
115
117
|
|
116
|
-
@Deprecated(forRemoval = true, since = "6.6.0")
|
117
|
-
public static final int MAX_HEIGHT = 256;
|
118
|
-
|
119
118
|
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + Plot.class.getSimpleName());
|
120
119
|
private static final DecimalFormat FLAG_DECIMAL_FORMAT = new DecimalFormat("0");
|
121
120
|
private static final MiniMessage MINI_MESSAGE = MiniMessage.builder().build();
|
@@ -1691,19 +1690,6 @@ public class Plot {
|
|
1691
1690
|
return base.settings != null && base.settings.getRatings() != null;
|
1692
1691
|
}
|
1693
1692
|
|
1694
|
-
@Deprecated(forRemoval = true, since = "6.1.0")
|
1695
|
-
public boolean claim(final @NonNull PlotPlayer<?> player, boolean teleport, String schematic) {
|
1696
|
-
if (!canClaim(player)) {
|
1697
|
-
return false;
|
1698
|
-
}
|
1699
|
-
return claim(player, teleport, schematic, true);
|
1700
|
-
}
|
1701
|
-
|
1702
|
-
@Deprecated(forRemoval = true, since = "6.1.0")
|
1703
|
-
public boolean claim(final @NonNull PlotPlayer<?> player, boolean teleport, String schematic, boolean updateDB) {
|
1704
|
-
return claim(player, teleport, schematic, updateDB, false);
|
1705
|
-
}
|
1706
|
-
|
1707
1693
|
/**
|
1708
1694
|
* Claim the plot
|
1709
1695
|
*
|
@@ -1731,7 +1717,10 @@ public class Plot {
|
|
1731
1717
|
area.addPlot(this);
|
1732
1718
|
updateWorldBorder();
|
1733
1719
|
}
|
1734
|
-
player.sendMessage(
|
1720
|
+
player.sendMessage(
|
1721
|
+
TranslatableCaption.of("working.claimed"),
|
1722
|
+
TagResolver.resolver("plot", Tag.inserting(Component.text(this.getId().toString())))
|
1723
|
+
);
|
1735
1724
|
if (teleport) {
|
1736
1725
|
if (!auto && Settings.Teleport.ON_CLAIM) {
|
1737
1726
|
teleportPlayer(player, TeleportCause.COMMAND_CLAIM, result -> {
|
@@ -2428,7 +2417,6 @@ public class Plot {
|
|
2428
2417
|
if (!this.isMerged()) {
|
2429
2418
|
Location pos1 = this.getBottomAbs().withY(getArea().getMinBuildHeight());
|
2430
2419
|
Location pos2 = this.getTopAbs().withY(getArea().getMaxBuildHeight());
|
2431
|
-
this.connectedCache = Sets.newHashSet(this);
|
2432
2420
|
CuboidRegion rg = new CuboidRegion(pos1.getBlockVector3(), pos2.getBlockVector3());
|
2433
2421
|
return Collections.singleton(rg);
|
2434
2422
|
}
|
@@ -2594,11 +2582,13 @@ public class Plot {
|
|
2594
2582
|
return;
|
2595
2583
|
}
|
2596
2584
|
Caption caption = TranslatableCaption.of("debug.plot_debug");
|
2597
|
-
|
2598
|
-
|
2585
|
+
TagResolver resolver = TagResolver.builder()
|
2586
|
+
.tag("plot", Tag.inserting(Component.text(toString())))
|
2587
|
+
.tag("message", Tag.inserting(Component.text(message)))
|
2588
|
+
.build();
|
2599
2589
|
for (final PlotPlayer<?> player : players) {
|
2600
2590
|
if (isOwner(player.getUUID()) || player.hasPermission(Permission.PERMISSION_ADMIN_DEBUG_OTHER)) {
|
2601
|
-
player.sendMessage(caption,
|
2591
|
+
player.sendMessage(caption, resolver);
|
2602
2592
|
}
|
2603
2593
|
}
|
2604
2594
|
} catch (final Exception ignored) {
|
@@ -2628,7 +2618,7 @@ public class Plot {
|
|
2628
2618
|
if (result == Result.DENY) {
|
2629
2619
|
player.sendMessage(
|
2630
2620
|
TranslatableCaption.of("events.event_denied"),
|
2631
|
-
|
2621
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("Teleport")))
|
2632
2622
|
);
|
2633
2623
|
resultConsumer.accept(false);
|
2634
2624
|
return;
|
@@ -2642,7 +2632,7 @@ public class Plot {
|
|
2642
2632
|
}
|
2643
2633
|
player.sendMessage(
|
2644
2634
|
TranslatableCaption.of("teleport.teleport_in_seconds"),
|
2645
|
-
|
2635
|
+
TagResolver.resolver("amount", Tag.inserting(Component.text(Settings.Teleport.DELAY)))
|
2646
2636
|
);
|
2647
2637
|
final String name = player.getName();
|
2648
2638
|
TaskManager.addToTeleportQueue(name);
|
@@ -2818,41 +2808,45 @@ public class Plot {
|
|
2818
2808
|
public CompletableFuture<Caption> format(final Caption iInfo, PlotPlayer<?> player, final boolean full) {
|
2819
2809
|
final CompletableFuture<Caption> future = new CompletableFuture<>();
|
2820
2810
|
int num = this.getConnectedPlots().size();
|
2821
|
-
|
2811
|
+
ComponentLike alias = !this.getAlias().isEmpty() ?
|
2812
|
+
Component.text(this.getAlias()) :
|
2813
|
+
TranslatableCaption.of("info.none").toComponent(player);
|
2822
2814
|
Location bot = this.getCorners()[0];
|
2823
2815
|
PlotSquared.platform().worldUtil().getBiome(
|
2824
2816
|
Objects.requireNonNull(this.getWorldName()),
|
2825
2817
|
bot.getX(),
|
2826
2818
|
bot.getZ(),
|
2827
2819
|
biome -> {
|
2828
|
-
|
2829
|
-
|
2830
|
-
|
2831
|
-
|
2832
|
-
|
2820
|
+
ComponentLike trusted = PlayerManager.getPlayerList(this.getTrusted(), player);
|
2821
|
+
ComponentLike members = PlayerManager.getPlayerList(this.getMembers(), player);
|
2822
|
+
ComponentLike denied = PlayerManager.getPlayerList(this.getDenied(), player);
|
2823
|
+
ComponentLike seen;
|
2824
|
+
ExpireManager expireManager = PlotSquared.platform().expireManager();
|
2825
|
+
if (Settings.Enabled_Components.PLOT_EXPIRY && expireManager != null) {
|
2833
2826
|
if (this.isOnline()) {
|
2834
|
-
seen = TranslatableCaption.of("info.now").
|
2827
|
+
seen = TranslatableCaption.of("info.now").toComponent(player);
|
2835
2828
|
} else {
|
2836
2829
|
int time = (int) (PlotSquared.platform().expireManager().getAge(this, false) / 1000);
|
2837
2830
|
if (time != 0) {
|
2838
|
-
seen = TimeUtil.secToTime(time);
|
2831
|
+
seen = Component.text(TimeUtil.secToTime(time));
|
2839
2832
|
} else {
|
2840
|
-
seen = TranslatableCaption.of("info.unknown").
|
2833
|
+
seen = TranslatableCaption.of("info.unknown").toComponent(player);
|
2841
2834
|
}
|
2842
2835
|
}
|
2843
2836
|
} else {
|
2844
|
-
seen = TranslatableCaption.of("info.never").
|
2837
|
+
seen = TranslatableCaption.of("info.never").toComponent(player);
|
2845
2838
|
}
|
2846
2839
|
|
2847
|
-
|
2848
|
-
|
2849
|
-
|
2840
|
+
ComponentLike description = TranslatableCaption.of("info.plot_no_description").toComponent(player);
|
2841
|
+
String descriptionValue = this.getFlag(DescriptionFlag.class);
|
2842
|
+
if (!descriptionValue.isEmpty()) {
|
2843
|
+
description = Component.text(descriptionValue);
|
2850
2844
|
}
|
2851
2845
|
|
2852
|
-
|
2846
|
+
ComponentLike flags;
|
2853
2847
|
Collection<PlotFlag<?, ?>> flagCollection = this.getApplicableFlags(true);
|
2854
2848
|
if (flagCollection.isEmpty()) {
|
2855
|
-
flags =
|
2849
|
+
flags = TranslatableCaption.of("info.none").toComponent(player);
|
2856
2850
|
} else {
|
2857
2851
|
TextComponent.Builder flagBuilder = Component.text();
|
2858
2852
|
String prefix = "";
|
@@ -2863,13 +2857,18 @@ public class Plot {
|
|
2863
2857
|
} else {
|
2864
2858
|
value = flag.toString();
|
2865
2859
|
}
|
2866
|
-
Component snip = MINI_MESSAGE.
|
2860
|
+
Component snip = MINI_MESSAGE.deserialize(
|
2867
2861
|
prefix + CaptionUtility.format(
|
2868
2862
|
player,
|
2869
2863
|
TranslatableCaption.of("info.plot_flag_list").getComponent(player)
|
2870
2864
|
),
|
2871
|
-
|
2872
|
-
|
2865
|
+
TagResolver.builder()
|
2866
|
+
.tag("flag", Tag.inserting(Component.text(flag.getName())))
|
2867
|
+
.tag("value", Tag.inserting(Component.text(CaptionUtility.formatRaw(
|
2868
|
+
player,
|
2869
|
+
value.toString()
|
2870
|
+
))))
|
2871
|
+
.build()
|
2873
2872
|
);
|
2874
2873
|
flagBuilder.append(snip);
|
2875
2874
|
prefix = ", ";
|
@@ -2881,67 +2880,57 @@ public class Plot {
|
|
2881
2880
|
if (this.getOwner() == null) {
|
2882
2881
|
owner = Component.text("unowned");
|
2883
2882
|
} else if (this.getOwner().equals(DBFunc.SERVER)) {
|
2884
|
-
owner = Component.text(MINI_MESSAGE.
|
2883
|
+
owner = Component.text(MINI_MESSAGE.stripTags(TranslatableCaption
|
2885
2884
|
.of("info.server")
|
2886
2885
|
.getComponent(player)));
|
2887
2886
|
} else {
|
2888
2887
|
owner = PlayerManager.getPlayerList(this.getOwners(), player);
|
2889
2888
|
}
|
2890
|
-
|
2891
|
-
|
2892
|
-
|
2893
|
-
);
|
2894
|
-
Template footerTemplate = Template.of(
|
2895
|
-
"footer",
|
2896
|
-
TranslatableCaption.of("info.plot_info_footer").getComponent(player)
|
2897
|
-
);
|
2898
|
-
Template areaTemplate;
|
2889
|
+
TagResolver.Builder tagBuilder = TagResolver.builder();
|
2890
|
+
tagBuilder.tag("header", Tag.inserting(TranslatableCaption.of("info.plot_info_header").toComponent(player)));
|
2891
|
+
tagBuilder.tag("footer", Tag.inserting(TranslatableCaption.of("info.plot_info_footer").toComponent(player)));
|
2892
|
+
TextComponent.Builder areaComponent = Component.text();
|
2899
2893
|
if (this.getArea() != null) {
|
2900
|
-
|
2901
|
-
|
2902
|
-
|
2903
|
-
|
2904
|
-
|
2905
|
-
|
2906
|
-
);
|
2894
|
+
areaComponent.append(Component.text(getArea().getWorldName()));
|
2895
|
+
if (getArea().getId() != null) {
|
2896
|
+
areaComponent.append(Component.text("("))
|
2897
|
+
.append(Component.text(getArea().getId()))
|
2898
|
+
.append(Component.text(")"));
|
2899
|
+
}
|
2907
2900
|
} else {
|
2908
|
-
|
2901
|
+
areaComponent.append(TranslatableCaption.of("info.none").toComponent(player));
|
2909
2902
|
}
|
2903
|
+
tagBuilder.tag("area", Tag.inserting(areaComponent));
|
2910
2904
|
long creationDate = Long.parseLong(String.valueOf(timestamp));
|
2911
2905
|
SimpleDateFormat sdf = new SimpleDateFormat(Settings.Timeformat.DATE_FORMAT);
|
2912
2906
|
sdf.setTimeZone(TimeZone.getTimeZone(Settings.Timeformat.TIME_ZONE));
|
2913
2907
|
String newDate = sdf.format(creationDate);
|
2914
2908
|
|
2915
|
-
|
2916
|
-
|
2917
|
-
|
2918
|
-
|
2919
|
-
|
2920
|
-
|
2921
|
-
|
2922
|
-
|
2923
|
-
|
2924
|
-
|
2925
|
-
|
2926
|
-
|
2927
|
-
|
2928
|
-
|
2929
|
-
|
2930
|
-
Template sizeTemplate = Template.of("size", String.valueOf(getConnectedPlots().size()));
|
2909
|
+
tagBuilder.tag("id", Tag.inserting(Component.text(getId().toString())));
|
2910
|
+
tagBuilder.tag("alias", Tag.inserting(alias));
|
2911
|
+
tagBuilder.tag("num", Tag.inserting(Component.text(num)));
|
2912
|
+
tagBuilder.tag("desc", Tag.inserting(description));
|
2913
|
+
tagBuilder.tag("biome", Tag.inserting(Component.text(biome.toString().toLowerCase())));
|
2914
|
+
tagBuilder.tag("owner", Tag.inserting(owner));
|
2915
|
+
tagBuilder.tag("members", Tag.inserting(members));
|
2916
|
+
tagBuilder.tag("player", Tag.inserting(Component.text(player.getName())));
|
2917
|
+
tagBuilder.tag("trusted", Tag.inserting(trusted));
|
2918
|
+
tagBuilder.tag("denied", Tag.inserting(denied));
|
2919
|
+
tagBuilder.tag("seen", Tag.inserting(seen));
|
2920
|
+
tagBuilder.tag("flags", Tag.inserting(flags));
|
2921
|
+
tagBuilder.tag("creationdate", Tag.inserting(Component.text(newDate)));
|
2922
|
+
tagBuilder.tag("build", Tag.inserting(Component.text(build)));
|
2923
|
+
tagBuilder.tag("size", Tag.inserting(Component.text(getConnectedPlots().size())));
|
2931
2924
|
String component = iInfo.getComponent(player);
|
2932
2925
|
if (component.contains("<rating>") || component.contains("<likes>")) {
|
2933
2926
|
TaskManager.runTaskAsync(() -> {
|
2934
|
-
Template ratingTemplate;
|
2935
|
-
Template likesTemplate;
|
2936
2927
|
if (Settings.Ratings.USE_LIKES) {
|
2937
|
-
|
2938
|
-
"rating",
|
2928
|
+
tagBuilder.tag("rating", Tag.inserting(Component.text(
|
2939
2929
|
String.format("%.0f%%", Like.getLikesPercentage(this) * 100D)
|
2940
|
-
);
|
2941
|
-
|
2942
|
-
"likes",
|
2930
|
+
)));
|
2931
|
+
tagBuilder.tag("likes", Tag.inserting(Component.text(
|
2943
2932
|
String.format("%.0f%%", Like.getLikesPercentage(this) * 100D)
|
2944
|
-
);
|
2933
|
+
)));
|
2945
2934
|
} else {
|
2946
2935
|
int max = 10;
|
2947
2936
|
if (Settings.Ratings.CATEGORIES != null && !Settings.Ratings.CATEGORIES.isEmpty()) {
|
@@ -2956,70 +2945,34 @@ public class Plot {
|
|
2956
2945
|
.append(String.format("%.1f", ratings[i]));
|
2957
2946
|
prefix = ",";
|
2958
2947
|
}
|
2959
|
-
|
2948
|
+
tagBuilder.tag("rating", Tag.inserting(Component.text(rating.toString())));
|
2960
2949
|
} else {
|
2961
2950
|
double rating = this.getAverageRating();
|
2962
2951
|
if (Double.isFinite(rating)) {
|
2963
|
-
|
2964
|
-
} else {
|
2965
|
-
ratingTemplate = Template.of(
|
2952
|
+
tagBuilder.tag(
|
2966
2953
|
"rating",
|
2967
|
-
|
2954
|
+
Tag.inserting(Component.text(String.format("%.1f", rating) + '/' + max))
|
2955
|
+
);
|
2956
|
+
} else {
|
2957
|
+
tagBuilder.tag(
|
2958
|
+
"rating", Tag.inserting(TranslatableCaption.of("info.none").toComponent(player))
|
2968
2959
|
);
|
2969
2960
|
}
|
2970
2961
|
}
|
2971
|
-
|
2962
|
+
tagBuilder.tag("likes", Tag.inserting(Component.text("N/A")));
|
2972
2963
|
}
|
2973
2964
|
future.complete(StaticCaption.of(MINI_MESSAGE.serialize(MINI_MESSAGE
|
2974
|
-
.
|
2965
|
+
.deserialize(
|
2975
2966
|
iInfo.getComponent(player),
|
2976
|
-
|
2977
|
-
areaTemplate,
|
2978
|
-
idTemplate,
|
2979
|
-
aliasTemplate,
|
2980
|
-
numTemplate,
|
2981
|
-
descTemplate,
|
2982
|
-
biomeTemplate,
|
2983
|
-
ownerTemplate,
|
2984
|
-
membersTemplate,
|
2985
|
-
playerTemplate,
|
2986
|
-
trustedTemplate,
|
2987
|
-
helpersTemplate,
|
2988
|
-
deniedTemplate,
|
2989
|
-
seenTemplate,
|
2990
|
-
flagsTemplate,
|
2991
|
-
buildTemplate,
|
2992
|
-
ratingTemplate,
|
2993
|
-
creationTemplate,
|
2994
|
-
sizeTemplate,
|
2995
|
-
likesTemplate,
|
2996
|
-
footerTemplate
|
2967
|
+
tagBuilder.build()
|
2997
2968
|
))));
|
2998
2969
|
});
|
2999
2970
|
return;
|
3000
2971
|
}
|
3001
2972
|
future.complete(StaticCaption.of(MINI_MESSAGE.serialize(MINI_MESSAGE
|
3002
|
-
.
|
2973
|
+
.deserialize(
|
3003
2974
|
iInfo.getComponent(player),
|
3004
|
-
|
3005
|
-
areaTemplate,
|
3006
|
-
idTemplate,
|
3007
|
-
aliasTemplate,
|
3008
|
-
numTemplate,
|
3009
|
-
descTemplate,
|
3010
|
-
biomeTemplate,
|
3011
|
-
ownerTemplate,
|
3012
|
-
membersTemplate,
|
3013
|
-
playerTemplate,
|
3014
|
-
trustedTemplate,
|
3015
|
-
helpersTemplate,
|
3016
|
-
deniedTemplate,
|
3017
|
-
seenTemplate,
|
3018
|
-
flagsTemplate,
|
3019
|
-
buildTemplate,
|
3020
|
-
creationTemplate,
|
3021
|
-
sizeTemplate,
|
3022
|
-
footerTemplate
|
2975
|
+
tagBuilder.build()
|
3023
2976
|
))));
|
3024
2977
|
}
|
3025
2978
|
);
|
@@ -35,7 +35,6 @@ import com.plotsquared.core.inject.annotations.WorldConfig;
|
|
35
35
|
import com.plotsquared.core.location.BlockLoc;
|
36
36
|
import com.plotsquared.core.location.Direction;
|
37
37
|
import com.plotsquared.core.location.Location;
|
38
|
-
import com.plotsquared.core.location.PlotLoc;
|
39
38
|
import com.plotsquared.core.permissions.Permission;
|
40
39
|
import com.plotsquared.core.player.ConsolePlayer;
|
41
40
|
import com.plotsquared.core.player.MetaDataAccess;
|
@@ -59,12 +58,16 @@ import com.sk89q.worldedit.world.biome.BiomeType;
|
|
59
58
|
import com.sk89q.worldedit.world.biome.BiomeTypes;
|
60
59
|
import com.sk89q.worldedit.world.gamemode.GameMode;
|
61
60
|
import com.sk89q.worldedit.world.gamemode.GameModes;
|
61
|
+
import net.kyori.adventure.text.Component;
|
62
|
+
import net.kyori.adventure.text.ComponentLike;
|
62
63
|
import net.kyori.adventure.text.minimessage.MiniMessage;
|
63
|
-
import net.kyori.adventure.text.minimessage.
|
64
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
65
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
64
66
|
import org.apache.logging.log4j.LogManager;
|
65
67
|
import org.apache.logging.log4j.Logger;
|
66
68
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
67
69
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
70
|
+
import org.jetbrains.annotations.NotNull;
|
68
71
|
|
69
72
|
import java.text.DecimalFormat;
|
70
73
|
import java.util.ArrayList;
|
@@ -84,7 +87,7 @@ import java.util.function.Consumer;
|
|
84
87
|
/**
|
85
88
|
* @author Jesse Boyd, Alexander Söderberg
|
86
89
|
*/
|
87
|
-
public abstract class PlotArea {
|
90
|
+
public abstract class PlotArea implements ComponentLike {
|
88
91
|
|
89
92
|
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + PlotArea.class.getSimpleName());
|
90
93
|
private static final MiniMessage MINI_MESSAGE = MiniMessage.builder().build();
|
@@ -177,8 +180,7 @@ public abstract class PlotArea {
|
|
177
180
|
this.worldConfiguration = worldConfiguration;
|
178
181
|
}
|
179
182
|
|
180
|
-
private static
|
181
|
-
final Collection<PlotFlag<?, ?>> flags = new ArrayList<>();
|
183
|
+
private static void parseFlags(FlagContainer flagContainer, List<String> flagStrings) {
|
182
184
|
for (final String key : flagStrings) {
|
183
185
|
final String[] split;
|
184
186
|
if (key.contains(";")) {
|
@@ -190,7 +192,7 @@ public abstract class PlotArea {
|
|
190
192
|
GlobalFlagContainer.getInstance().getFlagFromString(split[0]);
|
191
193
|
if (flagInstance != null) {
|
192
194
|
try {
|
193
|
-
|
195
|
+
flagContainer.addFlag(flagInstance.parse(split[1]));
|
194
196
|
} catch (final FlagParseException e) {
|
195
197
|
LOGGER.warn(
|
196
198
|
"Failed to parse default flag with key '{}' and value '{}'. "
|
@@ -201,9 +203,10 @@ public abstract class PlotArea {
|
|
201
203
|
);
|
202
204
|
e.printStackTrace();
|
203
205
|
}
|
206
|
+
} else {
|
207
|
+
flagContainer.addUnknownFlag(split[0], split[1]);
|
204
208
|
}
|
205
209
|
}
|
206
|
-
return flags;
|
207
210
|
}
|
208
211
|
|
209
212
|
@NonNull
|
@@ -402,10 +405,10 @@ public abstract class PlotArea {
|
|
402
405
|
}
|
403
406
|
}
|
404
407
|
}
|
405
|
-
this.getFlagContainer()
|
408
|
+
parseFlags(this.getFlagContainer(), flags);
|
406
409
|
ConsolePlayer.getConsole().sendMessage(
|
407
410
|
TranslatableCaption.of("flags.area_flags"),
|
408
|
-
|
411
|
+
TagResolver.resolver("flags", Tag.inserting(Component.text(flags.toString())))
|
409
412
|
);
|
410
413
|
|
411
414
|
this.spawnEggs = config.getBoolean("event.spawn.egg");
|
@@ -424,10 +427,10 @@ public abstract class PlotArea {
|
|
424
427
|
}
|
425
428
|
}
|
426
429
|
this.roadFlags = roadflags.size() > 0;
|
427
|
-
this.getRoadFlagContainer()
|
430
|
+
parseFlags(this.getRoadFlagContainer(), roadflags);
|
428
431
|
ConsolePlayer.getConsole().sendMessage(
|
429
432
|
TranslatableCaption.of("flags.road_flags"),
|
430
|
-
|
433
|
+
TagResolver.resolver("flags", Tag.inserting(Component.text(roadflags.toString())))
|
431
434
|
);
|
432
435
|
|
433
436
|
loadConfiguration(config);
|
@@ -520,6 +523,11 @@ public abstract class PlotArea {
|
|
520
523
|
}
|
521
524
|
}
|
522
525
|
|
526
|
+
@Override
|
527
|
+
public @NotNull Component asComponent() {
|
528
|
+
return Component.text(toString());
|
529
|
+
}
|
530
|
+
|
523
531
|
@Override
|
524
532
|
public int hashCode() {
|
525
533
|
if (this.hash != 0) {
|
@@ -648,8 +656,12 @@ public abstract class PlotArea {
|
|
648
656
|
if (!buildRangeContainsY(y) && !player.hasPermission(Permission.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) {
|
649
657
|
player.sendMessage(
|
650
658
|
TranslatableCaption.of("height.height_limit"),
|
651
|
-
|
652
|
-
|
659
|
+
TagResolver.builder()
|
660
|
+
.tag("minheight", Tag.inserting(Component.text(minBuildHeight)))
|
661
|
+
.tag(
|
662
|
+
"maxheight",
|
663
|
+
Tag.inserting(Component.text(maxBuildHeight))
|
664
|
+
).build()
|
653
665
|
);
|
654
666
|
// Return true if "failed" as the method will always be inverted otherwise
|
655
667
|
return true;
|
@@ -1007,7 +1019,7 @@ public abstract class PlotArea {
|
|
1007
1019
|
*
|
1008
1020
|
* @param plotIds List of plot IDs to merge
|
1009
1021
|
* @param removeRoads If the roads between plots should be removed
|
1010
|
-
* @param whenDone
|
1022
|
+
* @param whenDone Task to run when any merge world changes are complete. Also runs if no changes were made. Does not
|
1011
1023
|
* run if there was an error or if too few plots IDs were supplied.
|
1012
1024
|
* @return if merges were completed successfully.
|
1013
1025
|
* @since 6.9.0
|
@@ -1324,20 +1336,6 @@ public abstract class PlotArea {
|
|
1324
1336
|
return this.signMaterial;
|
1325
1337
|
}
|
1326
1338
|
|
1327
|
-
/**
|
1328
|
-
* Get the legacy plot sign material before wall signs used a "wall" stance.
|
1329
|
-
*
|
1330
|
-
* @return the legacy sign material.
|
1331
|
-
* @deprecated Use {@link #signMaterial()}. This method is used for 1.13 only and
|
1332
|
-
* will be removed without replacement in favor of {@link #signMaterial()}
|
1333
|
-
* once we remove the support for 1.13.
|
1334
|
-
* @since 6.0.3
|
1335
|
-
*/
|
1336
|
-
@Deprecated(forRemoval = true, since = "6.0.3")
|
1337
|
-
public String getLegacySignMaterial() {
|
1338
|
-
return this.legacySignMaterial;
|
1339
|
-
}
|
1340
|
-
|
1341
1339
|
public boolean isSpawnCustom() {
|
1342
1340
|
return this.spawnCustom;
|
1343
1341
|
}
|
@@ -1396,22 +1394,6 @@ public abstract class PlotArea {
|
|
1396
1394
|
return this.defaultHome;
|
1397
1395
|
}
|
1398
1396
|
|
1399
|
-
/**
|
1400
|
-
* @deprecated Use {@link #nonmemberHome}
|
1401
|
-
*/
|
1402
|
-
@Deprecated(forRemoval = true, since = "6.1.4")
|
1403
|
-
public PlotLoc getNonmemberHome() {
|
1404
|
-
return new PlotLoc(this.defaultHome.getX(), this.defaultHome.getY(), this.defaultHome.getZ());
|
1405
|
-
}
|
1406
|
-
|
1407
|
-
/**
|
1408
|
-
* @deprecated Use {@link #defaultHome}
|
1409
|
-
*/
|
1410
|
-
@Deprecated(forRemoval = true, since = "6.1.4")
|
1411
|
-
public PlotLoc getDefaultHome() {
|
1412
|
-
return new PlotLoc(this.defaultHome.getX(), this.defaultHome.getY(), this.defaultHome.getZ());
|
1413
|
-
}
|
1414
|
-
|
1415
1397
|
protected void setDefaultHome(BlockLoc defaultHome) {
|
1416
1398
|
this.defaultHome = defaultHome;
|
1417
1399
|
}
|
@@ -106,17 +106,6 @@ public final class PlotId {
|
|
106
106
|
return PlotId.of(hash >> 16, hash & 0xFFFF);
|
107
107
|
}
|
108
108
|
|
109
|
-
/**
|
110
|
-
* Get a copy of the plot ID
|
111
|
-
*
|
112
|
-
* @return Plot ID copy
|
113
|
-
* @deprecated PlotId is immutable, copy is not required.
|
114
|
-
*/
|
115
|
-
@Deprecated(forRemoval = true, since = "6.10.2")
|
116
|
-
public @NonNull PlotId copy() {
|
117
|
-
return this;
|
118
|
-
}
|
119
|
-
|
120
109
|
/**
|
121
110
|
* Get the ID X component
|
122
111
|
*
|
@@ -100,7 +100,7 @@ public class PlotInventory {
|
|
100
100
|
* Put an item into this inventory
|
101
101
|
*
|
102
102
|
* @param index the index (= slot) where to place the item
|
103
|
-
* @param item
|
103
|
+
* @param item the item to place
|
104
104
|
* @see #setItemChecked(int, PlotItemStack)
|
105
105
|
*/
|
106
106
|
public void setItem(int index, PlotItemStack item) {
|
@@ -203,15 +203,6 @@ public abstract class PlotManager {
|
|
203
203
|
Template.zipAll(plotArea.getWorldName(), files);
|
204
204
|
}
|
205
205
|
|
206
|
-
/**
|
207
|
-
* @return the world height
|
208
|
-
* @deprecated In favor of custom world heights within 1.17 and therefore scheduled for removal without replacement
|
209
|
-
*/
|
210
|
-
@Deprecated(forRemoval = true, since = "6.0.0")
|
211
|
-
public int getWorldHeight() {
|
212
|
-
return 255;
|
213
|
-
}
|
214
|
-
|
215
206
|
/**
|
216
207
|
* Sets all the blocks along all the plot walls to their correct state (claimed or unclaimed).
|
217
208
|
*
|
@@ -46,7 +46,9 @@ import com.sk89q.worldedit.math.BlockVector2;
|
|
46
46
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
47
47
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
48
48
|
import com.sk89q.worldedit.world.block.BlockTypes;
|
49
|
-
import net.kyori.adventure.text.
|
49
|
+
import net.kyori.adventure.text.Component;
|
50
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
51
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
50
52
|
import org.apache.logging.log4j.LogManager;
|
51
53
|
import org.apache.logging.log4j.Logger;
|
52
54
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
@@ -415,7 +417,10 @@ public final class PlotModificationManager {
|
|
415
417
|
Caption[] lines = new Caption[]{TranslatableCaption.of("signs.owner_sign_line_1"), TranslatableCaption.of(
|
416
418
|
"signs.owner_sign_line_2"),
|
417
419
|
TranslatableCaption.of("signs.owner_sign_line_3"), TranslatableCaption.of("signs.owner_sign_line_4")};
|
418
|
-
PlotSquared.platform().worldUtil().setSign(location, lines,
|
420
|
+
PlotSquared.platform().worldUtil().setSign(location, lines, TagResolver.builder()
|
421
|
+
.tag("id", Tag.inserting(Component.text(id)))
|
422
|
+
.tag("owner", Tag.inserting(Component.text(name)))
|
423
|
+
.build());
|
419
424
|
}
|
420
425
|
}
|
421
426
|
|
@@ -524,7 +529,7 @@ public final class PlotModificationManager {
|
|
524
529
|
if (player != null) {
|
525
530
|
player.sendMessage(
|
526
531
|
TranslatableCaption.of("events.event_denied"),
|
527
|
-
|
532
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("Auto merge on claim")))
|
528
533
|
);
|
529
534
|
}
|
530
535
|
return;
|
@@ -79,18 +79,6 @@ public class PlotSettings {
|
|
79
79
|
this.ratings = ratings;
|
80
80
|
}
|
81
81
|
|
82
|
-
/**
|
83
|
-
* @deprecated Unused internally. Scheduled for removal in next major release. Use {@link PlotSettings#setMerged(Direction, boolean)}
|
84
|
-
*/
|
85
|
-
@Deprecated(forRemoval = true, since = "6.11.1")
|
86
|
-
public boolean setMerged(int direction, boolean merged) {
|
87
|
-
if (this.merged[direction] != merged) {
|
88
|
-
this.merged[direction] = merged;
|
89
|
-
return true;
|
90
|
-
}
|
91
|
-
return false;
|
92
|
-
}
|
93
|
-
|
94
82
|
public boolean setMerged(Direction direction, boolean merged) {
|
95
83
|
if (Direction.ALL == direction) {
|
96
84
|
throw new IllegalArgumentException("You cannot use Direction.ALL in this method!");
|
@@ -117,13 +105,12 @@ public class PlotSettings {
|
|
117
105
|
this.position = position;
|
118
106
|
}
|
119
107
|
|
120
|
-
@SuppressWarnings({"UnstableApiUsage"})
|
121
108
|
public List<PlotComment> getComments(String inbox) {
|
122
109
|
if (this.comments == null) {
|
123
110
|
return Collections.emptyList();
|
124
111
|
}
|
125
112
|
|
126
|
-
return this.comments.stream().filter(comment -> comment.inbox.equals(inbox))
|
113
|
+
return this.comments.stream().filter(comment -> comment.inbox().equals(inbox))
|
127
114
|
.collect(ImmutableList.toImmutableList());
|
128
115
|
}
|
129
116
|
|
@@ -114,12 +114,4 @@ public abstract class PlotWorld {
|
|
114
114
|
return world.hashCode();
|
115
115
|
}
|
116
116
|
|
117
|
-
/**
|
118
|
-
* @deprecated This method is not meant to be invoked or overridden, with no replacement.
|
119
|
-
*/
|
120
|
-
@Deprecated(forRemoval = true, since = "6.6.0")
|
121
|
-
protected boolean canEqual(final Object other) {
|
122
|
-
return other instanceof PlotWorld;
|
123
|
-
}
|
124
|
-
|
125
117
|
}
|
@@ -29,7 +29,9 @@ import com.plotsquared.core.plot.Plot;
|
|
29
29
|
import com.plotsquared.core.util.task.RunnableVal;
|
30
30
|
import com.plotsquared.core.util.task.TaskManager;
|
31
31
|
import com.plotsquared.core.util.task.TaskTime;
|
32
|
-
import net.kyori.adventure.text.
|
32
|
+
import net.kyori.adventure.text.Component;
|
33
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
34
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
33
35
|
|
34
36
|
import java.util.Collection;
|
35
37
|
import java.util.HashMap;
|
@@ -56,7 +58,7 @@ public class CommentManager {
|
|
56
58
|
if (value != null) {
|
57
59
|
int num = 0;
|
58
60
|
for (PlotComment comment : value) {
|
59
|
-
if (comment.timestamp > getTimestamp(player, inbox.toString())) {
|
61
|
+
if (comment.timestamp() > getTimestamp(player, inbox.toString())) {
|
60
62
|
num++;
|
61
63
|
}
|
62
64
|
}
|
@@ -68,8 +70,10 @@ public class CommentManager {
|
|
68
70
|
player.sendTitle(
|
69
71
|
StaticCaption.of(""),
|
70
72
|
TranslatableCaption.of("comment.inbox_notification"),
|
71
|
-
|
72
|
-
|
73
|
+
TagResolver.builder()
|
74
|
+
.tag("amount", Tag.inserting(Component.text(total)))
|
75
|
+
.tag("command", Tag.inserting(Component.text("/plot inbox")))
|
76
|
+
.build()
|
73
77
|
);
|
74
78
|
}
|
75
79
|
}
|
@@ -20,25 +20,13 @@ package com.plotsquared.core.plot.comment;
|
|
20
20
|
|
21
21
|
import com.plotsquared.core.plot.PlotId;
|
22
22
|
|
23
|
-
public
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
public PlotComment(
|
33
|
-
String world, PlotId id, String comment, String senderName, String inbox,
|
34
|
-
long timestamp
|
35
|
-
) {
|
36
|
-
this.world = world;
|
37
|
-
this.id = id;
|
38
|
-
this.comment = comment;
|
39
|
-
this.senderName = senderName;
|
40
|
-
this.inbox = inbox;
|
41
|
-
this.timestamp = timestamp;
|
42
|
-
}
|
23
|
+
public record PlotComment(
|
24
|
+
String world,
|
25
|
+
PlotId id,
|
26
|
+
String comment,
|
27
|
+
String senderName,
|
28
|
+
String inbox,
|
29
|
+
long timestamp
|
30
|
+
) {
|
43
31
|
|
44
32
|
}
|
@@ -19,10 +19,8 @@
|
|
19
19
|
package com.plotsquared.core.plot.expiration;
|
20
20
|
|
21
21
|
import com.google.inject.Inject;
|
22
|
-
import com.plotsquared.core.PlotPlatform;
|
23
22
|
import com.plotsquared.core.PlotSquared;
|
24
23
|
import com.plotsquared.core.configuration.caption.Caption;
|
25
|
-
import com.plotsquared.core.configuration.caption.Templates;
|
26
24
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
27
25
|
import com.plotsquared.core.database.DBFunc;
|
28
26
|
import com.plotsquared.core.events.PlotFlagAddEvent;
|
@@ -46,7 +44,9 @@ import com.plotsquared.core.util.task.RunnableVal;
|
|
46
44
|
import com.plotsquared.core.util.task.RunnableVal3;
|
47
45
|
import com.plotsquared.core.util.task.TaskManager;
|
48
46
|
import com.plotsquared.core.util.task.TaskTime;
|
49
|
-
import net.kyori.adventure.text.
|
47
|
+
import net.kyori.adventure.text.Component;
|
48
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
49
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
50
50
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
51
51
|
|
52
52
|
import java.util.ArrayDeque;
|
@@ -62,11 +62,6 @@ import java.util.concurrent.ConcurrentLinkedDeque;
|
|
62
62
|
|
63
63
|
public class ExpireManager {
|
64
64
|
|
65
|
-
/**
|
66
|
-
* @deprecated Use {@link PlotPlatform#expireManager()} instead
|
67
|
-
*/
|
68
|
-
@Deprecated(forRemoval = true, since = "6.10.2")
|
69
|
-
public static ExpireManager IMP;
|
70
65
|
private final ConcurrentHashMap<UUID, Long> dates_cache;
|
71
66
|
private final ConcurrentHashMap<UUID, Long> account_age_cache;
|
72
67
|
private final EventDispatcher eventDispatcher;
|
@@ -152,25 +147,17 @@ public class ExpireManager {
|
|
152
147
|
current.getCenter(pp::teleport);
|
153
148
|
metaDataAccess.remove();
|
154
149
|
Caption msg = TranslatableCaption.of("expiry.expired_options_clicky");
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
areIsTemplate,
|
167
|
-
list_cmd,
|
168
|
-
plot,
|
169
|
-
cmd_del,
|
170
|
-
cmd_keep_1d,
|
171
|
-
cmd_keep,
|
172
|
-
cmd_no_show_expir
|
173
|
-
);
|
150
|
+
TagResolver resolver = TagResolver.builder()
|
151
|
+
.tag("num", Tag.inserting(Component.text(num)))
|
152
|
+
.tag("are_or_is", Tag.inserting(Component.text(num > 1 ? "plots are" : "plot is")))
|
153
|
+
.tag("list_cmd", Tag.preProcessParsed("/plot list expired"))
|
154
|
+
.tag("plot", Tag.inserting(Component.text(current.toString())))
|
155
|
+
.tag("cmd_del", Tag.preProcessParsed("/plot delete"))
|
156
|
+
.tag("cmd_keep_1d", Tag.preProcessParsed("/plot flag set keep 1d"))
|
157
|
+
.tag("cmd_keep", Tag.preProcessParsed("/plot flag set keep true"))
|
158
|
+
.tag("cmd_no_show_expir", Tag.preProcessParsed("/plot toggle clear-confirmation"))
|
159
|
+
.build();
|
160
|
+
pp.sendMessage(msg, resolver);
|
174
161
|
return;
|
175
162
|
} else {
|
176
163
|
iter.remove();
|
@@ -436,7 +423,7 @@ public class ExpireManager {
|
|
436
423
|
if (player != null) {
|
437
424
|
player.sendMessage(
|
438
425
|
TranslatableCaption.of("trusted.plot_removed_user"),
|
439
|
-
|
426
|
+
TagResolver.resolver("plot", Tag.inserting(Component.text(plot.toString())))
|
440
427
|
);
|
441
428
|
}
|
442
429
|
}
|
@@ -445,18 +432,13 @@ public class ExpireManager {
|
|
445
432
|
if (player != null) {
|
446
433
|
player.sendMessage(
|
447
434
|
TranslatableCaption.of("trusted.plot_removed_user"),
|
448
|
-
|
435
|
+
TagResolver.resolver("plot", Tag.inserting(Component.text(plot.toString())))
|
449
436
|
);
|
450
437
|
}
|
451
438
|
}
|
452
439
|
plot.getPlotModificationManager().deletePlot(null, whenDone);
|
453
440
|
}
|
454
441
|
|
455
|
-
@Deprecated(forRemoval = true, since = "6.4.0")
|
456
|
-
public long getAge(UUID uuid) {
|
457
|
-
return getAge(uuid, false);
|
458
|
-
}
|
459
|
-
|
460
442
|
/**
|
461
443
|
* Get the age (last play time) of the passed player
|
462
444
|
*
|
@@ -154,6 +154,7 @@ public class ExpiryTask {
|
|
154
154
|
|
155
155
|
/**
|
156
156
|
* Returns {@code true} if this task respects unknown owners
|
157
|
+
*
|
157
158
|
* @return {@code true} if unknown owners should be counted as never online
|
158
159
|
* @since 6.4.0
|
159
160
|
*/
|
@@ -380,14 +380,6 @@ public class FlagContainer {
|
|
380
380
|
return flagMap.hashCode();
|
381
381
|
}
|
382
382
|
|
383
|
-
/**
|
384
|
-
* @deprecated This method is not meant to be invoked or overridden, with no replacement.
|
385
|
-
*/
|
386
|
-
@Deprecated(forRemoval = true, since = "6.6.0")
|
387
|
-
protected boolean canEqual(final Object other) {
|
388
|
-
return other instanceof FlagContainer;
|
389
|
-
}
|
390
|
-
|
391
383
|
/**
|
392
384
|
* Update event types used in {@link PlotFlagUpdateHandler}.
|
393
385
|
*/
|
@@ -19,14 +19,14 @@
|
|
19
19
|
package com.plotsquared.core.plot.flag;
|
20
20
|
|
21
21
|
import com.plotsquared.core.configuration.caption.Caption;
|
22
|
-
import net.kyori.adventure.text.minimessage.
|
22
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
23
23
|
|
24
24
|
public class FlagParseException extends Exception {
|
25
25
|
|
26
26
|
private final PlotFlag<?, ?> flag;
|
27
27
|
private final String value;
|
28
28
|
private final Caption errorMessage;
|
29
|
-
private final
|
29
|
+
private final TagResolver[] tagResolvers;
|
30
30
|
|
31
31
|
/**
|
32
32
|
* Construct a new flag parse exception to indicate that an attempt to parse a plot
|
@@ -39,7 +39,7 @@ public class FlagParseException extends Exception {
|
|
39
39
|
*/
|
40
40
|
public FlagParseException(
|
41
41
|
final PlotFlag<?, ?> flag, final String value,
|
42
|
-
final Caption errorMessage, final
|
42
|
+
final Caption errorMessage, final TagResolver... args
|
43
43
|
) {
|
44
44
|
super(String.format("Failed to parse flag of type '%s'. Value '%s' was not accepted.",
|
45
45
|
flag.getName(), value
|
@@ -47,7 +47,7 @@ public class FlagParseException extends Exception {
|
|
47
47
|
this.flag = flag;
|
48
48
|
this.value = value;
|
49
49
|
this.errorMessage = errorMessage;
|
50
|
-
this.
|
50
|
+
this.tagResolvers = args;
|
51
51
|
}
|
52
52
|
|
53
53
|
/**
|
@@ -82,8 +82,8 @@ public class FlagParseException extends Exception {
|
|
82
82
|
*
|
83
83
|
* @return Message templates.
|
84
84
|
*/
|
85
|
-
public
|
86
|
-
return
|
85
|
+
public TagResolver[] getTagResolvers() {
|
86
|
+
return tagResolvers;
|
87
87
|
}
|
88
88
|
|
89
89
|
}
|
@@ -91,6 +91,7 @@ import com.plotsquared.core.plot.flag.implementations.ProjectilesFlag;
|
|
91
91
|
import com.plotsquared.core.plot.flag.implementations.PveFlag;
|
92
92
|
import com.plotsquared.core.plot.flag.implementations.PvpFlag;
|
93
93
|
import com.plotsquared.core.plot.flag.implementations.RedstoneFlag;
|
94
|
+
import com.plotsquared.core.plot.flag.implementations.SculkSensorInteractFlag;
|
94
95
|
import com.plotsquared.core.plot.flag.implementations.ServerPlotFlag;
|
95
96
|
import com.plotsquared.core.plot.flag.implementations.SnowFormFlag;
|
96
97
|
import com.plotsquared.core.plot.flag.implementations.SnowMeltFlag;
|
@@ -172,6 +173,7 @@ public final class GlobalFlagContainer extends FlagContainer {
|
|
172
173
|
this.addFlag(MobBreakFlag.MOB_BREAK_FALSE);
|
173
174
|
this.addFlag(MobPlaceFlag.MOB_PLACE_FALSE);
|
174
175
|
this.addFlag(MiscInteractFlag.MISC_INTERACT_FALSE);
|
176
|
+
this.addFlag(SculkSensorInteractFlag.SCULK_SENSOR_INTERACT_FALSE);
|
175
177
|
this.addFlag(MiscPlaceFlag.MISC_PLACE_FALSE);
|
176
178
|
this.addFlag(MycelGrowFlag.MYCEL_GROW_TRUE);
|
177
179
|
this.addFlag(NotifyEnterFlag.NOTIFY_ENTER_FALSE);
|
@@ -20,6 +20,7 @@ package com.plotsquared.core.plot.flag;
|
|
20
20
|
|
21
21
|
import com.google.common.base.Preconditions;
|
22
22
|
import com.plotsquared.core.configuration.caption.Caption;
|
23
|
+
import net.kyori.adventure.text.Component;
|
23
24
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
24
25
|
|
25
26
|
import java.util.Collection;
|
@@ -83,6 +84,16 @@ public abstract class PlotFlag<T, F extends PlotFlag<T, F>> {
|
|
83
84
|
return flagName.toString();
|
84
85
|
}
|
85
86
|
|
87
|
+
/**
|
88
|
+
* Gets the flag name as a Kyori {@link Component}
|
89
|
+
*
|
90
|
+
* @see #getFlagName(Class)
|
91
|
+
* @since 7.0.0
|
92
|
+
*/
|
93
|
+
public static <T, F extends PlotFlag<T, F>> Component getFlagNameComponent(Class<F> flagClass) {
|
94
|
+
return Component.text(getFlagName(flagClass));
|
95
|
+
}
|
96
|
+
|
86
97
|
/**
|
87
98
|
* Get the flag value
|
88
99
|
*
|
@@ -210,13 +221,4 @@ public abstract class PlotFlag<T, F extends PlotFlag<T, F>> {
|
|
210
221
|
return value.hashCode();
|
211
222
|
}
|
212
223
|
|
213
|
-
/**
|
214
|
-
* @deprecated This method is not meant to be invoked or overridden, with no replacement.
|
215
|
-
*/
|
216
|
-
@Deprecated(forRemoval = true, since = "6.6.0")
|
217
|
-
protected boolean canEqual(final Object other) {
|
218
|
-
return other instanceof PlotFlag;
|
219
|
-
}
|
220
|
-
|
221
|
-
|
222
224
|
}
|
@@ -27,7 +27,7 @@ public class BeaconEffectsFlag extends BooleanFlag<BeaconEffectsFlag> {
|
|
27
27
|
public static final BeaconEffectsFlag BEACON_EFFECT_TRUE = new BeaconEffectsFlag(true);
|
28
28
|
public static final BeaconEffectsFlag BEACON_EFFECT_FALSE = new BeaconEffectsFlag(false);
|
29
29
|
|
30
|
-
private BeaconEffectsFlag(boolean value){
|
30
|
+
private BeaconEffectsFlag(boolean value) {
|
31
31
|
super(value, TranslatableCaption.of("flags.flag_description_beacon_effect"));
|
32
32
|
}
|
33
33
|
|
@@ -23,7 +23,9 @@ import com.plotsquared.core.player.PlotPlayer;
|
|
23
23
|
import com.plotsquared.core.plot.Plot;
|
24
24
|
import com.plotsquared.core.plot.flag.FlagParseException;
|
25
25
|
import com.plotsquared.core.plot.flag.PlotFlag;
|
26
|
-
import net.kyori.adventure.text.
|
26
|
+
import net.kyori.adventure.text.Component;
|
27
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
28
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
27
29
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
28
30
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
29
31
|
|
@@ -55,24 +57,15 @@ public class DenyTeleportFlag extends PlotFlag<DenyTeleportFlag.DeniedGroup, Den
|
|
55
57
|
}
|
56
58
|
final boolean result;
|
57
59
|
switch (value) {
|
58
|
-
case TRUSTED
|
59
|
-
|
60
|
-
|
61
|
-
case
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
result = plot.isAdded(player.getUUID());
|
66
|
-
break;
|
67
|
-
case NONTRUSTED:
|
68
|
-
result =
|
69
|
-
plot.getTrusted().contains(player.getUUID()) || plot.isOwner(player.getUUID());
|
70
|
-
break;
|
71
|
-
case NONOWNERS:
|
72
|
-
result = plot.isOwner(player.getUUID());
|
73
|
-
break;
|
74
|
-
default:
|
60
|
+
case TRUSTED -> result = !plot.getTrusted().contains(player.getUUID());
|
61
|
+
case MEMBERS -> result = !plot.getMembers().contains(player.getUUID());
|
62
|
+
case NONMEMBERS -> result = plot.isAdded(player.getUUID());
|
63
|
+
case NONTRUSTED -> result =
|
64
|
+
plot.getTrusted().contains(player.getUUID()) || plot.isOwner(player.getUUID());
|
65
|
+
case NONOWNERS -> result = plot.isOwner(player.getUUID());
|
66
|
+
default -> {
|
75
67
|
return true;
|
68
|
+
}
|
76
69
|
}
|
77
70
|
return result || player.hasPermission("plots.admin.entry.denied");
|
78
71
|
}
|
@@ -82,7 +75,10 @@ public class DenyTeleportFlag extends PlotFlag<DenyTeleportFlag.DeniedGroup, Den
|
|
82
75
|
final DeniedGroup group = DeniedGroup.fromString(input);
|
83
76
|
if (group == null) {
|
84
77
|
throw new FlagParseException(this, input, TranslatableCaption.of("flags.flag_error_enum"),
|
85
|
-
|
78
|
+
TagResolver.resolver(
|
79
|
+
"list",
|
80
|
+
Tag.inserting(Component.text("members, nonmembers, trusted, nontrusted, nonowners"))
|
81
|
+
)
|
86
82
|
);
|
87
83
|
}
|
88
84
|
return flagOf(group);
|
@@ -51,7 +51,7 @@ public class DescriptionFlag extends StringFlag<DescriptionFlag> {
|
|
51
51
|
|
52
52
|
@Override
|
53
53
|
public String getExample() {
|
54
|
-
return "
|
54
|
+
return "<gold>This is my plot!";
|
55
55
|
}
|
56
56
|
|
57
57
|
@Override
|
@@ -21,7 +21,9 @@ package com.plotsquared.core.plot.flag.implementations;
|
|
21
21
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
22
22
|
import com.plotsquared.core.plot.flag.FlagParseException;
|
23
23
|
import com.plotsquared.core.plot.flag.types.TimedFlag;
|
24
|
-
import net.kyori.adventure.text.
|
24
|
+
import net.kyori.adventure.text.Component;
|
25
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
26
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
25
27
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
26
28
|
|
27
29
|
public class FeedFlag extends TimedFlag<Integer, FeedFlag> {
|
@@ -42,7 +44,7 @@ public class FeedFlag extends TimedFlag<Integer, FeedFlag> {
|
|
42
44
|
this,
|
43
45
|
input,
|
44
46
|
TranslatableCaption.of("invalid.not_a_number"),
|
45
|
-
|
47
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(input)))
|
46
48
|
);
|
47
49
|
}
|
48
50
|
if (parsed < 1) {
|
@@ -50,7 +52,7 @@ public class FeedFlag extends TimedFlag<Integer, FeedFlag> {
|
|
50
52
|
this,
|
51
53
|
input,
|
52
54
|
TranslatableCaption.of("invalid.number_not_positive"),
|
53
|
-
|
55
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(parsed)))
|
54
56
|
);
|
55
57
|
}
|
56
58
|
return parsed;
|
@@ -58,7 +60,7 @@ public class FeedFlag extends TimedFlag<Integer, FeedFlag> {
|
|
58
60
|
|
59
61
|
@Override
|
60
62
|
protected Integer mergeValue(Integer other) {
|
61
|
-
return this.getValue().
|
63
|
+
return this.getValue().value() + other;
|
62
64
|
}
|
63
65
|
|
64
66
|
@Override
|
@@ -68,14 +68,11 @@ public class FlyFlag extends PlotFlag<FlyFlag.FlyStatus, FlyFlag> {
|
|
68
68
|
|
69
69
|
@Override
|
70
70
|
protected FlyFlag flagOf(final @NonNull FlyStatus value) {
|
71
|
-
switch (value) {
|
72
|
-
case ENABLED
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
default:
|
77
|
-
return FLIGHT_FLAG_DEFAULT;
|
78
|
-
}
|
71
|
+
return switch (value) {
|
72
|
+
case ENABLED -> FLIGHT_FLAG_ENABLED;
|
73
|
+
case DISABLED -> FLIGHT_FLAG_DISABLED;
|
74
|
+
default -> FLIGHT_FLAG_DEFAULT;
|
75
|
+
};
|
79
76
|
}
|
80
77
|
|
81
78
|
@Override
|
@@ -51,7 +51,7 @@ public class GreetingFlag extends StringFlag<GreetingFlag> {
|
|
51
51
|
|
52
52
|
@Override
|
53
53
|
public String getExample() {
|
54
|
-
return "
|
54
|
+
return "<gold>Welcome to my plot!";
|
55
55
|
}
|
56
56
|
|
57
57
|
@Override
|
@@ -21,7 +21,9 @@ package com.plotsquared.core.plot.flag.implementations;
|
|
21
21
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
22
22
|
import com.plotsquared.core.plot.flag.FlagParseException;
|
23
23
|
import com.plotsquared.core.plot.flag.types.TimedFlag;
|
24
|
-
import net.kyori.adventure.text.
|
24
|
+
import net.kyori.adventure.text.Component;
|
25
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
26
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
25
27
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
26
28
|
|
27
29
|
public class HealFlag extends TimedFlag<Integer, HealFlag> {
|
@@ -42,7 +44,7 @@ public class HealFlag extends TimedFlag<Integer, HealFlag> {
|
|
42
44
|
this,
|
43
45
|
input,
|
44
46
|
TranslatableCaption.of("invalid.not_a_number"),
|
45
|
-
|
47
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(input)))
|
46
48
|
);
|
47
49
|
}
|
48
50
|
if (parsed < 1) {
|
@@ -50,7 +52,7 @@ public class HealFlag extends TimedFlag<Integer, HealFlag> {
|
|
50
52
|
this,
|
51
53
|
input,
|
52
54
|
TranslatableCaption.of("invalid.number_not_positive"),
|
53
|
-
|
55
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(parsed)))
|
54
56
|
);
|
55
57
|
}
|
56
58
|
return parsed;
|
@@ -58,7 +60,7 @@ public class HealFlag extends TimedFlag<Integer, HealFlag> {
|
|
58
60
|
|
59
61
|
@Override
|
60
62
|
protected Integer mergeValue(Integer other) {
|
61
|
-
return this.getValue().
|
63
|
+
return this.getValue().value() + other;
|
62
64
|
}
|
63
65
|
|
64
66
|
@Override
|
@@ -27,7 +27,7 @@ public class ProjectilesFlag extends BooleanFlag<ProjectilesFlag> {
|
|
27
27
|
public static final ProjectilesFlag PROJECTILES_TRUE = new ProjectilesFlag(true);
|
28
28
|
public static final ProjectilesFlag PROJECTILES_FALSE = new ProjectilesFlag(false);
|
29
29
|
|
30
|
-
private ProjectilesFlag(boolean value){
|
30
|
+
private ProjectilesFlag(boolean value) {
|
31
31
|
super(value, TranslatableCaption.of("flags.flag_description_projectiles"));
|
32
32
|
}
|
33
33
|
|
@@ -0,0 +1,39 @@
|
|
1
|
+
/*
|
2
|
+
* PlotSquared, a land and world management plugin for Minecraft.
|
3
|
+
* Copyright (C) IntellectualSites <https://intellectualsites.com>
|
4
|
+
* Copyright (C) IntellectualSites team and contributors
|
5
|
+
*
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
7
|
+
* it under the terms of the GNU General Public License as published by
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
9
|
+
* (at your option) any later version.
|
10
|
+
*
|
11
|
+
* This program is distributed in the hope that it will be useful,
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
* GNU General Public License for more details.
|
15
|
+
*
|
16
|
+
* You should have received a copy of the GNU General Public License
|
17
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
18
|
+
*/
|
19
|
+
package com.plotsquared.core.plot.flag.implementations;
|
20
|
+
|
21
|
+
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
22
|
+
import com.plotsquared.core.plot.flag.types.BooleanFlag;
|
23
|
+
import org.checkerframework.checker.nullness.qual.NonNull;
|
24
|
+
|
25
|
+
public class SculkSensorInteractFlag extends BooleanFlag<SculkSensorInteractFlag> {
|
26
|
+
|
27
|
+
public static final SculkSensorInteractFlag SCULK_SENSOR_INTERACT_TRUE = new SculkSensorInteractFlag(true);
|
28
|
+
public static final SculkSensorInteractFlag SCULK_SENSOR_INTERACT_FALSE = new SculkSensorInteractFlag(false);
|
29
|
+
|
30
|
+
private SculkSensorInteractFlag(boolean value) {
|
31
|
+
super(value, TranslatableCaption.of("flags.flag_description_sculk_sensor_interact"));
|
32
|
+
}
|
33
|
+
|
34
|
+
@Override
|
35
|
+
protected SculkSensorInteractFlag flagOf(@NonNull Boolean value) {
|
36
|
+
return value ? SCULK_SENSOR_INTERACT_TRUE : SCULK_SENSOR_INTERACT_FALSE;
|
37
|
+
}
|
38
|
+
|
39
|
+
}
|
@@ -21,7 +21,9 @@ package com.plotsquared.core.plot.flag.implementations;
|
|
21
21
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
22
22
|
import com.plotsquared.core.plot.flag.FlagParseException;
|
23
23
|
import com.plotsquared.core.plot.flag.PlotFlag;
|
24
|
-
import net.kyori.adventure.text.
|
24
|
+
import net.kyori.adventure.text.Component;
|
25
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
26
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
25
27
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
26
28
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
27
29
|
|
@@ -47,7 +49,7 @@ public class TitlesFlag extends PlotFlag<TitlesFlag.TitlesFlagValue, TitlesFlag>
|
|
47
49
|
this,
|
48
50
|
input,
|
49
51
|
TranslatableCaption.of("flags.flag_error_enum"),
|
50
|
-
|
52
|
+
TagResolver.resolver("list", Tag.inserting(Component.text("none, true, false")))
|
51
53
|
);
|
52
54
|
}
|
53
55
|
return flagOf(titlesFlagValue);
|
@@ -76,23 +76,10 @@ public abstract class TimedFlag<T, F extends PlotFlag<TimedFlag.Timed<T>, F>>
|
|
76
76
|
return getValue().toString();
|
77
77
|
}
|
78
78
|
|
79
|
-
public
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
public Timed(int interval, T value) {
|
85
|
-
this.interval = interval;
|
86
|
-
this.value = value;
|
87
|
-
}
|
88
|
-
|
89
|
-
public int getInterval() {
|
90
|
-
return interval;
|
91
|
-
}
|
92
|
-
|
93
|
-
public T getValue() {
|
94
|
-
return value;
|
95
|
-
}
|
79
|
+
public record Timed<T>(
|
80
|
+
int interval,
|
81
|
+
T value
|
82
|
+
) {
|
96
83
|
|
97
84
|
@Override
|
98
85
|
public String toString() {
|
@@ -29,17 +29,17 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
|
29
29
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
30
30
|
|
31
31
|
import java.util.ArrayList;
|
32
|
-
import java.util.HashMap;
|
33
32
|
import java.util.HashSet;
|
34
33
|
import java.util.List;
|
35
34
|
import java.util.Map;
|
36
35
|
import java.util.Set;
|
36
|
+
import java.util.concurrent.ConcurrentHashMap;
|
37
37
|
|
38
38
|
@Singleton
|
39
39
|
public class DefaultPlotAreaManager implements PlotAreaManager {
|
40
40
|
|
41
41
|
final PlotArea[] noPlotAreas = new PlotArea[0];
|
42
|
-
private final Map<String, PlotWorld> plotWorlds = new
|
42
|
+
private final Map<String, PlotWorld> plotWorlds = new ConcurrentHashMap<>();
|
43
43
|
|
44
44
|
@Override
|
45
45
|
public @NonNull PlotArea[] getAllPlotAreas() {
|
@@ -137,15 +137,16 @@ public class DefaultPlotAreaManager implements PlotAreaManager {
|
|
137
137
|
}
|
138
138
|
|
139
139
|
@Override
|
140
|
-
public
|
140
|
+
public boolean addWorld(final @NonNull String worldName) {
|
141
141
|
PlotWorld world = this.plotWorlds.get(worldName);
|
142
142
|
if (world != null) {
|
143
|
-
return;
|
143
|
+
return false;
|
144
144
|
}
|
145
145
|
// Create a new empty world. When a new area is added
|
146
146
|
// the world will be re-recreated with the correct type
|
147
147
|
world = new StandardPlotWorld(worldName, null);
|
148
148
|
this.plotWorlds.put(worldName, world);
|
149
|
+
return true;
|
149
150
|
}
|
150
151
|
|
151
152
|
@Override
|
@@ -110,8 +110,10 @@ public interface PlotAreaManager {
|
|
110
110
|
* Add a world
|
111
111
|
*
|
112
112
|
* @param worldName Name of the world to add
|
113
|
+
* @return {@code true} if successful, {@code false} if world already existed
|
114
|
+
* @since 7.0.0
|
113
115
|
*/
|
114
|
-
|
116
|
+
boolean addWorld(@NonNull String worldName);
|
115
117
|
|
116
118
|
/**
|
117
119
|
* Remove a world
|
@@ -76,6 +76,7 @@ public class SinglePlotArea extends GridPlotWorld {
|
|
76
76
|
* Returns true if the given string matches the naming system used to identify single plot worlds
|
77
77
|
* e.g. -1_5 represents plot id *;-1;5. "*" being the plot area name given to single plot world
|
78
78
|
* {@link com.plotsquared.core.plot.PlotArea}.
|
79
|
+
*
|
79
80
|
* @since 6.1.4
|
80
81
|
*/
|
81
82
|
public static boolean isSinglePlotWorld(String worldName) {
|
@@ -172,8 +172,8 @@ public class SinglePlotAreaManager extends DefaultPlotAreaManager {
|
|
172
172
|
}
|
173
173
|
|
174
174
|
@Override
|
175
|
-
public
|
176
|
-
super.addWorld(worldName);
|
175
|
+
public boolean addWorld(final @NonNull String worldName) {
|
176
|
+
return super.addWorld(worldName);
|
177
177
|
}
|
178
178
|
|
179
179
|
@Override
|
@@ -18,7 +18,7 @@
|
|
18
18
|
*/
|
19
19
|
package com.plotsquared.core.queue;
|
20
20
|
|
21
|
-
import com.intellectualsites.annotations.
|
21
|
+
import com.intellectualsites.annotations.NotPublic;
|
22
22
|
import com.plotsquared.core.location.Location;
|
23
23
|
import com.sk89q.jnbt.CompoundTag;
|
24
24
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
@@ -36,9 +36,11 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
|
36
36
|
* The min and max points of this queue are offset according to the minimum point given in the constructor, and the offsets set
|
37
37
|
* in {@link BlockArrayCacheScopedQueueCoordinator#setOffsetX(int)} and
|
38
38
|
* {@link BlockArrayCacheScopedQueueCoordinator#setOffsetZ(int)}
|
39
|
+
* <p>
|
40
|
+
* Internal use only. Subject to change at any time and created for specific use cases.
|
39
41
|
*/
|
40
|
-
@
|
41
|
-
public class BlockArrayCacheScopedQueueCoordinator extends
|
42
|
+
@NotPublic
|
43
|
+
public class BlockArrayCacheScopedQueueCoordinator extends ZeroedDelegateScopedQueueCoordinator {
|
42
44
|
|
43
45
|
private final BlockState[][][] blockStates;
|
44
46
|
private final int height;
|
@@ -52,6 +54,7 @@ public class BlockArrayCacheScopedQueueCoordinator extends ScopedQueueCoordinato
|
|
52
54
|
private final int scopeMaxZ;
|
53
55
|
private int offsetX = 0;
|
54
56
|
private int offsetZ = 0;
|
57
|
+
|
55
58
|
/**
|
56
59
|
* Construct a new instance
|
57
60
|
*
|
@@ -29,6 +29,7 @@ public abstract class ChunkCoordinator implements Runnable {
|
|
29
29
|
|
30
30
|
/**
|
31
31
|
* Cancel the chunk coordinator.
|
32
|
+
*
|
32
33
|
* @since 6.0.10
|
33
34
|
*/
|
34
35
|
public abstract void cancel();
|
@@ -1,163 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* PlotSquared, a land and world management plugin for Minecraft.
|
3
|
-
* Copyright (C) IntellectualSites <https://intellectualsites.com>
|
4
|
-
* Copyright (C) IntellectualSites team and contributors
|
5
|
-
*
|
6
|
-
* This program is free software: you can redistribute it and/or modify
|
7
|
-
* it under the terms of the GNU General Public License as published by
|
8
|
-
* the Free Software Foundation, either version 3 of the License, or
|
9
|
-
* (at your option) any later version.
|
10
|
-
*
|
11
|
-
* This program is distributed in the hope that it will be useful,
|
12
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
-
* GNU General Public License for more details.
|
15
|
-
*
|
16
|
-
* You should have received a copy of the GNU General Public License
|
17
|
-
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
18
|
-
*/
|
19
|
-
package com.plotsquared.core.queue;
|
20
|
-
|
21
|
-
import com.plotsquared.core.location.Location;
|
22
|
-
import com.sk89q.worldedit.function.pattern.Pattern;
|
23
|
-
import com.sk89q.worldedit.math.BlockVector3;
|
24
|
-
import com.sk89q.worldedit.world.World;
|
25
|
-
import com.sk89q.worldedit.world.biome.BiomeType;
|
26
|
-
import com.sk89q.worldedit.world.block.BaseBlock;
|
27
|
-
import com.sk89q.worldedit.world.block.BlockState;
|
28
|
-
import org.checkerframework.checker.nullness.qual.NonNull;
|
29
|
-
import org.checkerframework.checker.nullness.qual.Nullable;
|
30
|
-
|
31
|
-
/**
|
32
|
-
* Queue that is limited to a single chunk. It does not allow a delegate queue and should be treated as a cache for changes to
|
33
|
-
* be set to. Does not support tile entities or entities.
|
34
|
-
*
|
35
|
-
* @deprecated This class is poorly designed and will no longer be used in PlotSquared
|
36
|
-
*/
|
37
|
-
@Deprecated(forRemoval = true, since = "6.8.0")
|
38
|
-
public class ChunkQueueCoordinator extends ScopedQueueCoordinator {
|
39
|
-
|
40
|
-
public final BiomeType[][][] biomeResult;
|
41
|
-
public final BlockState[][][] result;
|
42
|
-
private final int width;
|
43
|
-
private final int length;
|
44
|
-
private final BlockVector3 bot;
|
45
|
-
private final BlockVector3 top;
|
46
|
-
private final World weWorld;
|
47
|
-
|
48
|
-
public ChunkQueueCoordinator(
|
49
|
-
final @NonNull World weWorld,
|
50
|
-
@NonNull BlockVector3 bot,
|
51
|
-
@NonNull BlockVector3 top,
|
52
|
-
boolean biomes
|
53
|
-
) {
|
54
|
-
super(null, Location.at("", 0, weWorld.getMinY(), 0), Location.at("", 15, weWorld.getMaxY(), 15));
|
55
|
-
this.weWorld = weWorld;
|
56
|
-
this.width = top.getX() - bot.getX() + 1;
|
57
|
-
this.length = top.getZ() - bot.getZ() + 1;
|
58
|
-
this.result = new BlockState[weWorld.getMaxY() - weWorld.getMinY() + 1][width][length];
|
59
|
-
this.biomeResult = biomes ? new BiomeType[weWorld.getMaxY() - weWorld.getMinY() + 1][width][length] : null;
|
60
|
-
this.bot = bot;
|
61
|
-
this.top = top;
|
62
|
-
}
|
63
|
-
|
64
|
-
public @NonNull BlockState[][][] getBlocks() {
|
65
|
-
return result;
|
66
|
-
}
|
67
|
-
|
68
|
-
@Override
|
69
|
-
public boolean setBiome(int x, int z, @NonNull BiomeType biomeType) {
|
70
|
-
if (this.biomeResult != null) {
|
71
|
-
for (int y = weWorld.getMinY(); y <= weWorld.getMaxY(); y++) {
|
72
|
-
this.storeCacheBiome(x, y, z, biomeType);
|
73
|
-
}
|
74
|
-
return true;
|
75
|
-
}
|
76
|
-
return false;
|
77
|
-
}
|
78
|
-
|
79
|
-
@Override
|
80
|
-
public boolean setBiome(int x, int y, int z, @NonNull BiomeType biomeType) {
|
81
|
-
if (this.biomeResult != null) {
|
82
|
-
this.storeCacheBiome(x, y, z, biomeType);
|
83
|
-
return true;
|
84
|
-
}
|
85
|
-
return false;
|
86
|
-
}
|
87
|
-
|
88
|
-
@Override
|
89
|
-
public boolean setBlock(int x, int y, int z, @NonNull BlockState id) {
|
90
|
-
this.storeCache(x, y, z, id);
|
91
|
-
return true;
|
92
|
-
}
|
93
|
-
|
94
|
-
@Override
|
95
|
-
public boolean setBlock(int x, int y, int z, @NonNull Pattern pattern) {
|
96
|
-
this.storeCache(x, y, z, pattern.applyBlock(BlockVector3.at(x, y, z)).toImmutableState());
|
97
|
-
return true;
|
98
|
-
}
|
99
|
-
|
100
|
-
private void storeCache(final int x, final int y, final int z, final @NonNull BlockState id) {
|
101
|
-
int yIndex = getYIndex(y);
|
102
|
-
BlockState[][] resultY = result[yIndex];
|
103
|
-
if (resultY == null) {
|
104
|
-
result[yIndex] = resultY = new BlockState[length][];
|
105
|
-
}
|
106
|
-
BlockState[] resultYZ = resultY[z];
|
107
|
-
if (resultYZ == null) {
|
108
|
-
resultY[z] = resultYZ = new BlockState[width];
|
109
|
-
}
|
110
|
-
resultYZ[x] = id;
|
111
|
-
}
|
112
|
-
|
113
|
-
private void storeCacheBiome(final int x, final int y, final int z, final @NonNull BiomeType id) {
|
114
|
-
int yIndex = getYIndex(y);
|
115
|
-
BiomeType[][] resultY = biomeResult[yIndex];
|
116
|
-
if (resultY == null) {
|
117
|
-
biomeResult[yIndex] = resultY = new BiomeType[length][];
|
118
|
-
}
|
119
|
-
BiomeType[] resultYZ = resultY[z];
|
120
|
-
if (resultYZ == null) {
|
121
|
-
resultY[z] = resultYZ = new BiomeType[width];
|
122
|
-
}
|
123
|
-
resultYZ[x] = id;
|
124
|
-
}
|
125
|
-
|
126
|
-
@Override
|
127
|
-
public boolean setBlock(int x, int y, int z, final @NonNull BaseBlock id) {
|
128
|
-
this.storeCache(x, y, z, id.toImmutableState());
|
129
|
-
return true;
|
130
|
-
}
|
131
|
-
|
132
|
-
@Override
|
133
|
-
public @Nullable BlockState getBlock(int x, int y, int z) {
|
134
|
-
BlockState[][] blocksY = result[getYIndex(y)];
|
135
|
-
if (blocksY != null) {
|
136
|
-
BlockState[] blocksYZ = blocksY[z];
|
137
|
-
if (blocksYZ != null) {
|
138
|
-
return blocksYZ[x];
|
139
|
-
}
|
140
|
-
}
|
141
|
-
return null;
|
142
|
-
}
|
143
|
-
|
144
|
-
@Override
|
145
|
-
public @Nullable World getWorld() {
|
146
|
-
return weWorld;
|
147
|
-
}
|
148
|
-
|
149
|
-
@Override
|
150
|
-
public @NonNull Location getMax() {
|
151
|
-
return Location.at(getWorld().getName(), top.getX(), top.getY(), top.getZ());
|
152
|
-
}
|
153
|
-
|
154
|
-
@Override
|
155
|
-
public @NonNull Location getMin() {
|
156
|
-
return Location.at(getWorld().getName(), bot.getX(), bot.getY(), bot.getZ());
|
157
|
-
}
|
158
|
-
|
159
|
-
private int getYIndex(int y) {
|
160
|
-
return y - weWorld.getMinY();
|
161
|
-
}
|
162
|
-
|
163
|
-
}
|
@@ -43,11 +43,10 @@ import java.util.function.Consumer;
|
|
43
43
|
|
44
44
|
public abstract class QueueCoordinator {
|
45
45
|
|
46
|
+
private final AtomicBoolean enqueued = new AtomicBoolean();
|
46
47
|
private boolean forceSync = false;
|
47
48
|
@Nullable
|
48
49
|
private Object chunkObject;
|
49
|
-
private final AtomicBoolean enqueued = new AtomicBoolean();
|
50
|
-
|
51
50
|
@SuppressWarnings({"unused", "FieldCanBeLocal"})
|
52
51
|
@Inject
|
53
52
|
private GlobalBlockQueue blockQueue;
|
@@ -62,35 +61,17 @@ public abstract class QueueCoordinator {
|
|
62
61
|
}
|
63
62
|
|
64
63
|
/**
|
65
|
-
* Get a {@link
|
66
|
-
*
|
67
|
-
* @param x chunk x coordinate
|
68
|
-
* @param z chunk z coordinate
|
69
|
-
* @return a new {@link ScopedQueueCoordinator}
|
70
|
-
* @deprecated Use {@link ScopedQueueCoordinator#getForChunk(int, int, int, int)}
|
71
|
-
*/
|
72
|
-
@Deprecated(forRemoval = true, since = "6.6.0")
|
73
|
-
public ScopedQueueCoordinator getForChunk(int x, int z) {
|
74
|
-
if (getWorld() == null) {
|
75
|
-
return getForChunk(x, z, PlotSquared.platform().versionMinHeight(), PlotSquared.platform().versionMaxHeight());
|
76
|
-
}
|
77
|
-
return getForChunk(x, z, getWorld().getMinY(), getWorld().getMaxY());
|
78
|
-
}
|
79
|
-
|
80
|
-
/**
|
81
|
-
* Get a {@link ScopedQueueCoordinator} limited to the chunk at the specific chunk Coordinates
|
64
|
+
* Get a {@link ZeroedDelegateScopedQueueCoordinator} limited to the chunk at the specific chunk Coordinates
|
82
65
|
*
|
83
66
|
* @param x chunk x coordinate
|
84
67
|
* @param z chunk z coordinate
|
85
|
-
* @return a new {@link
|
86
|
-
* @since
|
87
|
-
* @deprecated {@link ScopedQueueCoordinator} will be renamed in v7.
|
68
|
+
* @return a new {@link ZeroedDelegateScopedQueueCoordinator}
|
69
|
+
* @since 7.0.0
|
88
70
|
*/
|
89
|
-
|
90
|
-
public ScopedQueueCoordinator getForChunk(int x, int z, int minY, int maxY) {
|
71
|
+
public ZeroedDelegateScopedQueueCoordinator getForChunk(int x, int z, int minY, int maxY) {
|
91
72
|
int bx = x << 4;
|
92
73
|
int bz = z << 4;
|
93
|
-
return new
|
74
|
+
return new ZeroedDelegateScopedQueueCoordinator(this, Location.at(getWorld().getName(), bx, minY, bz),
|
94
75
|
Location.at(getWorld().getName(), bx + 15, maxY, bz + 15)
|
95
76
|
);
|
96
77
|
}
|
@@ -28,13 +28,13 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
|
28
28
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
29
29
|
|
30
30
|
/**
|
31
|
-
* Queue that only sets blocks with a designated X-Z area, will accept any Y values. Requires all blocks be set normalized
|
32
|
-
* the x and z directions, i.e. starting from 0,0. An offset of the minimum point of the region will then be applied to
|
31
|
+
* Queue that only sets blocks with a designated X-Z area, will accept any Y values. Requires all blocks be set normalized to
|
32
|
+
* zero in the x and z directions, i.e. starting from 0,0. An offset of the minimum point of the region will then be applied to
|
33
|
+
* x and z.
|
33
34
|
*
|
34
|
-
* @
|
35
|
+
* @since 7.0.0
|
35
36
|
*/
|
36
|
-
|
37
|
-
public class ScopedQueueCoordinator extends DelegateQueueCoordinator {
|
37
|
+
public class ZeroedDelegateScopedQueueCoordinator extends DelegateQueueCoordinator {
|
38
38
|
|
39
39
|
private final Location min;
|
40
40
|
private final Location max;
|
@@ -49,8 +49,10 @@ public class ScopedQueueCoordinator extends DelegateQueueCoordinator {
|
|
49
49
|
|
50
50
|
/**
|
51
51
|
* Create a new ScopedQueueCoordinator instance that delegates to a given QueueCoordinator. Locations are inclusive.
|
52
|
+
*
|
53
|
+
* @since 7.0.0
|
52
54
|
*/
|
53
|
-
public
|
55
|
+
public ZeroedDelegateScopedQueueCoordinator(@Nullable QueueCoordinator parent, @NonNull Location min, @NonNull Location max) {
|
54
56
|
super(parent);
|
55
57
|
this.min = min;
|
56
58
|
this.max = max;
|
@@ -30,10 +30,13 @@ import com.plotsquared.core.queue.ChunkCoordinator;
|
|
30
30
|
import com.plotsquared.core.util.task.PlotSquaredTask;
|
31
31
|
import com.plotsquared.core.util.task.TaskManager;
|
32
32
|
import com.plotsquared.core.util.task.TaskTime;
|
33
|
-
import net.kyori.adventure.text.
|
33
|
+
import net.kyori.adventure.text.Component;
|
34
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
35
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
34
36
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
35
37
|
|
36
38
|
import javax.annotation.Nullable;
|
39
|
+
import java.util.Objects;
|
37
40
|
import java.util.concurrent.atomic.AtomicBoolean;
|
38
41
|
|
39
42
|
/**
|
@@ -90,11 +93,7 @@ public class DefaultProgressSubscriber implements ProgressSubscriber {
|
|
90
93
|
this.actor = actor;
|
91
94
|
this.interval = TaskTime.ms(interval);
|
92
95
|
this.wait = TaskTime.ms(wait);
|
93
|
-
|
94
|
-
this.caption = TranslatableCaption.of("working.progress");
|
95
|
-
} else {
|
96
|
-
this.caption = caption;
|
97
|
-
}
|
96
|
+
this.caption = Objects.requireNonNullElseGet(caption, () -> TranslatableCaption.of("working.progress"));
|
98
97
|
}
|
99
98
|
|
100
99
|
@Override
|
@@ -113,7 +112,10 @@ public class DefaultProgressSubscriber implements ProgressSubscriber {
|
|
113
112
|
}
|
114
113
|
actor.sendMessage(
|
115
114
|
caption,
|
116
|
-
|
115
|
+
TagResolver.resolver(
|
116
|
+
"progress",
|
117
|
+
Tag.inserting(Component.text(String.format("%.2f", this.progress.doubleValue() * 100)))
|
118
|
+
)
|
117
119
|
);
|
118
120
|
}, interval), wait);
|
119
121
|
}
|
@@ -0,0 +1,94 @@
|
|
1
|
+
/*
|
2
|
+
* PlotSquared, a land and world management plugin for Minecraft.
|
3
|
+
* Copyright (C) IntellectualSites <https://intellectualsites.com>
|
4
|
+
* Copyright (C) IntellectualSites team and contributors
|
5
|
+
*
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
7
|
+
* it under the terms of the GNU General Public License as published by
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
9
|
+
* (at your option) any later version.
|
10
|
+
*
|
11
|
+
* This program is distributed in the hope that it will be useful,
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
* GNU General Public License for more details.
|
15
|
+
*
|
16
|
+
* You should have received a copy of the GNU General Public License
|
17
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
18
|
+
*/
|
19
|
+
package com.plotsquared.core.services.plots;
|
20
|
+
|
21
|
+
import com.plotsquared.core.player.PlotPlayer;
|
22
|
+
import com.plotsquared.core.plot.PlotArea;
|
23
|
+
import com.plotsquared.core.plot.PlotId;
|
24
|
+
import org.checkerframework.checker.nullness.qual.NonNull;
|
25
|
+
import org.checkerframework.checker.nullness.qual.Nullable;
|
26
|
+
|
27
|
+
/**
|
28
|
+
* Crate a new auto query
|
29
|
+
*
|
30
|
+
* @param player Player to claim for
|
31
|
+
* @param startId Plot ID to start searching from
|
32
|
+
* @param sizeX Number of plots along the X axis
|
33
|
+
* @param sizeZ Number of plots along the Z axis
|
34
|
+
* @param plotArea Plot area to search in
|
35
|
+
*/
|
36
|
+
public record AutoQuery(
|
37
|
+
@NonNull PlotPlayer<?> player,
|
38
|
+
@Nullable PlotId startId,
|
39
|
+
int sizeX,
|
40
|
+
int sizeZ,
|
41
|
+
@NonNull PlotArea plotArea
|
42
|
+
) {
|
43
|
+
|
44
|
+
/**
|
45
|
+
* Get the player that the plots are meant for
|
46
|
+
*
|
47
|
+
* @return Player
|
48
|
+
*/
|
49
|
+
@Override
|
50
|
+
public @NonNull PlotPlayer<?> player() {
|
51
|
+
return this.player;
|
52
|
+
}
|
53
|
+
|
54
|
+
/**
|
55
|
+
* Get the plot ID to start searching from
|
56
|
+
*
|
57
|
+
* @return Start ID
|
58
|
+
*/
|
59
|
+
@Override
|
60
|
+
public @Nullable PlotId startId() {
|
61
|
+
return this.startId;
|
62
|
+
}
|
63
|
+
|
64
|
+
/**
|
65
|
+
* Get the number of plots along the X axis
|
66
|
+
*
|
67
|
+
* @return Number of plots along the X axis
|
68
|
+
*/
|
69
|
+
@Override
|
70
|
+
public int sizeX() {
|
71
|
+
return this.sizeX;
|
72
|
+
}
|
73
|
+
|
74
|
+
/**
|
75
|
+
* Get the number of plots along the Z axis
|
76
|
+
*
|
77
|
+
* @return Number of plots along the Z axis
|
78
|
+
*/
|
79
|
+
@Override
|
80
|
+
public int sizeZ() {
|
81
|
+
return this.sizeZ;
|
82
|
+
}
|
83
|
+
|
84
|
+
/**
|
85
|
+
* Get the plot area to search in
|
86
|
+
*
|
87
|
+
* @return Plot area
|
88
|
+
*/
|
89
|
+
@Override
|
90
|
+
public @NonNull PlotArea plotArea() {
|
91
|
+
return this.plotArea;
|
92
|
+
}
|
93
|
+
|
94
|
+
}
|
@@ -21,9 +21,7 @@ package com.plotsquared.core.services.plots;
|
|
21
21
|
import cloud.commandframework.services.types.Service;
|
22
22
|
import com.google.common.cache.Cache;
|
23
23
|
import com.google.common.cache.CacheBuilder;
|
24
|
-
import com.plotsquared.core.player.PlotPlayer;
|
25
24
|
import com.plotsquared.core.plot.Plot;
|
26
|
-
import com.plotsquared.core.plot.PlotArea;
|
27
25
|
import com.plotsquared.core.plot.PlotAreaType;
|
28
26
|
import com.plotsquared.core.plot.PlotId;
|
29
27
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
@@ -34,88 +32,12 @@ import java.util.List;
|
|
34
32
|
import java.util.concurrent.TimeUnit;
|
35
33
|
import java.util.function.Predicate;
|
36
34
|
|
37
|
-
public interface AutoService extends Service<
|
35
|
+
public interface AutoService extends Service<AutoQuery, List<Plot>> {
|
38
36
|
|
39
37
|
Cache<PlotId, Plot> plotCandidateCache = CacheBuilder.newBuilder()
|
40
38
|
.expireAfterWrite(20, TimeUnit.SECONDS).build();
|
41
39
|
Object plotLock = new Object();
|
42
40
|
|
43
|
-
final class AutoQuery {
|
44
|
-
|
45
|
-
private final PlotPlayer<?> player;
|
46
|
-
private final PlotId startId;
|
47
|
-
private final int sizeX;
|
48
|
-
private final int sizeZ;
|
49
|
-
private final PlotArea plotArea;
|
50
|
-
|
51
|
-
/**
|
52
|
-
* Crate a new auto query
|
53
|
-
*
|
54
|
-
* @param player Player to claim for
|
55
|
-
* @param startId Plot ID to start searching from
|
56
|
-
* @param sizeX Number of plots along the X axis
|
57
|
-
* @param sizeZ Number of plots along the Z axis
|
58
|
-
* @param plotArea Plot area to search in
|
59
|
-
*/
|
60
|
-
public AutoQuery(
|
61
|
-
final @NonNull PlotPlayer<?> player, final @Nullable PlotId startId,
|
62
|
-
final int sizeX, final int sizeZ, final @NonNull PlotArea plotArea
|
63
|
-
) {
|
64
|
-
this.player = player;
|
65
|
-
this.startId = startId;
|
66
|
-
this.sizeX = sizeX;
|
67
|
-
this.sizeZ = sizeZ;
|
68
|
-
this.plotArea = plotArea;
|
69
|
-
}
|
70
|
-
|
71
|
-
/**
|
72
|
-
* Get the player that the plots are meant for
|
73
|
-
*
|
74
|
-
* @return Player
|
75
|
-
*/
|
76
|
-
public @NonNull PlotPlayer<?> getPlayer() {
|
77
|
-
return this.player;
|
78
|
-
}
|
79
|
-
|
80
|
-
/**
|
81
|
-
* Get the plot ID to start searching from
|
82
|
-
*
|
83
|
-
* @return Start ID
|
84
|
-
*/
|
85
|
-
public @Nullable PlotId getStartId() {
|
86
|
-
return this.startId;
|
87
|
-
}
|
88
|
-
|
89
|
-
/**
|
90
|
-
* Get the number of plots along the X axis
|
91
|
-
*
|
92
|
-
* @return Number of plots along the X axis
|
93
|
-
*/
|
94
|
-
public int getSizeX() {
|
95
|
-
return this.sizeX;
|
96
|
-
}
|
97
|
-
|
98
|
-
/**
|
99
|
-
* Get the number of plots along the Z axis
|
100
|
-
*
|
101
|
-
* @return Number of plots along the Z axis
|
102
|
-
*/
|
103
|
-
public int getSizeZ() {
|
104
|
-
return this.sizeZ;
|
105
|
-
}
|
106
|
-
|
107
|
-
/**
|
108
|
-
* Get the plot area to search in
|
109
|
-
*
|
110
|
-
* @return Plot area
|
111
|
-
*/
|
112
|
-
public @NonNull PlotArea getPlotArea() {
|
113
|
-
return this.plotArea;
|
114
|
-
}
|
115
|
-
|
116
|
-
}
|
117
|
-
|
118
|
-
|
119
41
|
final class DefaultAutoService implements AutoService {
|
120
42
|
|
121
43
|
@Override
|
@@ -125,17 +47,16 @@ public interface AutoService extends Service<AutoService.AutoQuery, List<Plot>>
|
|
125
47
|
|
126
48
|
}
|
127
49
|
|
128
|
-
|
129
50
|
final class SinglePlotService implements AutoService, Predicate<AutoQuery> {
|
130
51
|
|
131
52
|
@Nullable
|
132
53
|
@Override
|
133
54
|
public List<Plot> handle(@NonNull AutoQuery autoQuery) {
|
134
55
|
Plot plot;
|
135
|
-
PlotId nextId = autoQuery.
|
56
|
+
PlotId nextId = autoQuery.startId();
|
136
57
|
do {
|
137
58
|
synchronized (plotLock) {
|
138
|
-
plot = autoQuery.
|
59
|
+
plot = autoQuery.plotArea().getNextFreePlot(autoQuery.player(), nextId);
|
139
60
|
if (plot != null && plotCandidateCache.getIfPresent(plot.getId()) == null) {
|
140
61
|
plotCandidateCache.put(plot.getId(), plot);
|
141
62
|
return Collections.singletonList(plot);
|
@@ -151,12 +72,11 @@ public interface AutoService extends Service<AutoService.AutoQuery, List<Plot>>
|
|
151
72
|
|
152
73
|
@Override
|
153
74
|
public boolean test(final @NonNull AutoQuery autoQuery) {
|
154
|
-
return autoQuery.sizeX == 1 && autoQuery.sizeZ == 1;
|
75
|
+
return autoQuery.sizeX() == 1 && autoQuery.sizeZ() == 1;
|
155
76
|
}
|
156
77
|
|
157
78
|
}
|
158
79
|
|
159
|
-
|
160
80
|
final class MultiPlotService implements AutoService, Predicate<AutoQuery> {
|
161
81
|
|
162
82
|
@Override
|
@@ -166,14 +86,14 @@ public interface AutoService extends Service<AutoService.AutoQuery, List<Plot>>
|
|
166
86
|
while (true) {
|
167
87
|
synchronized (plotLock) {
|
168
88
|
final PlotId start =
|
169
|
-
autoQuery.
|
89
|
+
autoQuery.plotArea().getMeta("lastPlot", PlotId.of(0, 0)).getNextId();
|
170
90
|
final PlotId end = PlotId.of(
|
171
|
-
start.getX() + autoQuery.
|
172
|
-
start.getY() + autoQuery.
|
91
|
+
start.getX() + autoQuery.sizeX() - 1,
|
92
|
+
start.getY() + autoQuery.sizeZ() - 1
|
173
93
|
);
|
174
94
|
final List<Plot> plots =
|
175
|
-
autoQuery.
|
176
|
-
autoQuery.
|
95
|
+
autoQuery.plotArea().canClaim(autoQuery.player(), start, end);
|
96
|
+
autoQuery.plotArea().setMeta("lastPlot", start); // set entry point for next try
|
177
97
|
if (plots != null && !plots.isEmpty()) {
|
178
98
|
for (final Plot plot : plots) {
|
179
99
|
if (plotCandidateCache.getIfPresent(plot.getId()) != null) {
|
@@ -189,7 +109,7 @@ public interface AutoService extends Service<AutoService.AutoQuery, List<Plot>>
|
|
189
109
|
|
190
110
|
@Override
|
191
111
|
public boolean test(final @NonNull AutoQuery autoQuery) {
|
192
|
-
return autoQuery.
|
112
|
+
return autoQuery.plotArea().getType() != PlotAreaType.PARTIAL;
|
193
113
|
}
|
194
114
|
|
195
115
|
}
|
@@ -32,7 +32,9 @@ import com.plotsquared.core.plot.PlotAreaType;
|
|
32
32
|
import com.plotsquared.core.plot.PlotId;
|
33
33
|
import com.plotsquared.core.util.SetupUtils;
|
34
34
|
import com.plotsquared.core.util.StringMan;
|
35
|
-
import net.kyori.adventure.text.
|
35
|
+
import net.kyori.adventure.text.Component;
|
36
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
37
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
36
38
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
37
39
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
38
40
|
|
@@ -206,7 +208,10 @@ public enum CommonSetupSteps implements SetupStep {
|
|
206
208
|
}
|
207
209
|
if (PlotSquared.platform().worldUtil().isWorld(argument)) {
|
208
210
|
if (PlotSquared.get().getPlotAreaManager().hasPlotArea(argument)) {
|
209
|
-
plotPlayer.sendMessage(
|
211
|
+
plotPlayer.sendMessage(
|
212
|
+
TranslatableCaption.of("setup.setup_world_taken"),
|
213
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(argument)))
|
214
|
+
);
|
210
215
|
return this;
|
211
216
|
}
|
212
217
|
plotPlayer.sendMessage(TranslatableCaption.of("setup.setup_world_apply_plotsquared"));
|
@@ -25,11 +25,17 @@ import com.plotsquared.core.plot.PlotAreaTerrainType;
|
|
25
25
|
import com.plotsquared.core.plot.PlotAreaType;
|
26
26
|
import com.plotsquared.core.plot.PlotId;
|
27
27
|
import com.plotsquared.core.util.SetupUtils;
|
28
|
+
import org.jetbrains.annotations.Contract;
|
29
|
+
import org.jetbrains.annotations.NotNull;
|
30
|
+
import org.jetbrains.annotations.Nullable;
|
31
|
+
|
32
|
+
import java.util.Objects;
|
28
33
|
|
29
34
|
public class PlotAreaBuilder {
|
30
35
|
|
31
36
|
private String generatorName;
|
32
37
|
private String plotManager;
|
38
|
+
@Nullable
|
33
39
|
private PlotAreaType plotAreaType;
|
34
40
|
private PlotAreaTerrainType terrainType;
|
35
41
|
private String worldName;
|
@@ -85,8 +91,10 @@ public class PlotAreaBuilder {
|
|
85
91
|
return this.plotManager;
|
86
92
|
}
|
87
93
|
|
94
|
+
@NotNull
|
95
|
+
@Contract(" -> !null")
|
88
96
|
public PlotAreaType plotAreaType() {
|
89
|
-
return this.plotAreaType;
|
97
|
+
return Objects.requireNonNullElse(this.plotAreaType, PlotAreaType.NORMAL);
|
90
98
|
}
|
91
99
|
|
92
100
|
public PlotAreaTerrainType terrainType() {
|
@@ -127,7 +135,8 @@ public class PlotAreaBuilder {
|
|
127
135
|
return this;
|
128
136
|
}
|
129
137
|
|
130
|
-
public PlotAreaBuilder plotAreaType(PlotAreaType plotAreaType) {
|
138
|
+
public PlotAreaBuilder plotAreaType(@NotNull PlotAreaType plotAreaType) {
|
139
|
+
Objects.requireNonNull(plotAreaType, "PlotAreaType must not be null");
|
131
140
|
this.plotAreaType = plotAreaType;
|
132
141
|
return this;
|
133
142
|
}
|
@@ -24,7 +24,9 @@ import com.plotsquared.core.configuration.ConfigurationNode;
|
|
24
24
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
25
25
|
import com.plotsquared.core.player.PlotPlayer;
|
26
26
|
import com.plotsquared.core.util.TabCompletions;
|
27
|
-
import net.kyori.adventure.text.
|
27
|
+
import net.kyori.adventure.text.Component;
|
28
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
29
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
28
30
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
29
31
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
30
32
|
|
@@ -46,10 +48,10 @@ public class SettingsNodeStep implements SetupStep {
|
|
46
48
|
) {
|
47
49
|
this.configurationNode = configurationNode;
|
48
50
|
this.id = id;
|
49
|
-
if (wrapper.
|
50
|
-
this.next = new SettingsNodeStep(wrapper.
|
51
|
+
if (wrapper.settingsNodes().length > id + 1) {
|
52
|
+
this.next = new SettingsNodeStep(wrapper.settingsNodes()[id + 1], id + 1, wrapper);
|
51
53
|
} else {
|
52
|
-
this.next = wrapper.
|
54
|
+
this.next = wrapper.afterwards();
|
53
55
|
}
|
54
56
|
}
|
55
57
|
|
@@ -77,10 +79,15 @@ public class SettingsNodeStep implements SetupStep {
|
|
77
79
|
public void announce(PlotPlayer<?> plotPlayer) {
|
78
80
|
plotPlayer.sendMessage(
|
79
81
|
TranslatableCaption.of("setup.setup_step"),
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
82
|
+
TagResolver.builder()
|
83
|
+
.tag("step", Tag.inserting(Component.text(this.getId() + 1)))
|
84
|
+
.tag(
|
85
|
+
"description",
|
86
|
+
Tag.inserting(this.configurationNode.getDescription().toComponent(plotPlayer))
|
87
|
+
)
|
88
|
+
.tag("type", Tag.inserting(Component.text(this.configurationNode.getType().getType())))
|
89
|
+
.tag("value", Tag.inserting(Component.text(this.configurationNode.getDefaultValue().toString())))
|
90
|
+
.build()
|
84
91
|
);
|
85
92
|
}
|
86
93
|
|
@@ -23,15 +23,10 @@ import com.plotsquared.core.configuration.ConfigurationNode;
|
|
23
23
|
/**
|
24
24
|
* This class wraps an array of {@link ConfigurationNode}s.
|
25
25
|
*/
|
26
|
-
public
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
public SettingsNodesWrapper(final ConfigurationNode[] settingsNodes, final SetupStep afterwards) {
|
32
|
-
this.settingsNodes = settingsNodes;
|
33
|
-
this.afterwards = afterwards;
|
34
|
-
}
|
26
|
+
public record SettingsNodesWrapper(
|
27
|
+
ConfigurationNode[] settingsNodes,
|
28
|
+
SetupStep afterwards
|
29
|
+
) {
|
35
30
|
|
36
31
|
/**
|
37
32
|
* Returns the first step of this wrapper or the step or the
|
@@ -43,12 +38,4 @@ public class SettingsNodesWrapper {
|
|
43
38
|
return this.settingsNodes.length == 0 ? this.afterwards : new SettingsNodeStep(this.settingsNodes[0], 0, this);
|
44
39
|
}
|
45
40
|
|
46
|
-
public ConfigurationNode[] getSettingsNodes() {
|
47
|
-
return this.settingsNodes;
|
48
|
-
}
|
49
|
-
|
50
|
-
public SetupStep getAfterwards() {
|
51
|
-
return this.afterwards;
|
52
|
-
}
|
53
|
-
|
54
41
|
}
|
@@ -65,9 +65,9 @@ public final class LockRepository {
|
|
65
65
|
* @param runnable Action to run when the lock is available
|
66
66
|
*/
|
67
67
|
public void useLock(final @NonNull LockKey key, final @NonNull Runnable runnable) {
|
68
|
-
|
69
|
-
|
70
|
-
|
68
|
+
try (LockAccess ignored = lock(key)) {
|
69
|
+
runnable.run();
|
70
|
+
}
|
71
71
|
}
|
72
72
|
|
73
73
|
/**
|
@@ -31,8 +31,6 @@ import com.sk89q.worldedit.world.registry.LegacyMapper;
|
|
31
31
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
32
32
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
33
33
|
|
34
|
-
import java.util.Map;
|
35
|
-
|
36
34
|
/**
|
37
35
|
* {@link BlockState} related utility methods
|
38
36
|
*/
|
@@ -109,38 +107,4 @@ public final class BlockUtil {
|
|
109
107
|
}
|
110
108
|
}
|
111
109
|
|
112
|
-
/**
|
113
|
-
* Parse a comma delimited list of block states
|
114
|
-
*
|
115
|
-
* @param commaDelimited List of block states
|
116
|
-
* @return Parsed block states
|
117
|
-
* @deprecated Unused internally. Scheduled for removal in next major release.
|
118
|
-
*/
|
119
|
-
@Deprecated(forRemoval = true, since = "6.11.1")
|
120
|
-
public static @NonNull BlockState[] parse(final @NonNull String commaDelimited) {
|
121
|
-
final String[] split = commaDelimited.split(",(?![^\\(\\[]*[\\]\\)])");
|
122
|
-
final BlockState[] result = new BlockState[split.length];
|
123
|
-
for (int i = 0; i < split.length; i++) {
|
124
|
-
result[i] = get(split[i]);
|
125
|
-
}
|
126
|
-
return result;
|
127
|
-
}
|
128
|
-
|
129
|
-
/**
|
130
|
-
* Deserialize a serialized {@link BlockState}
|
131
|
-
*
|
132
|
-
* @param map Serialized block state
|
133
|
-
* @return Deserialized block state, or {@code null} if the map is
|
134
|
-
* not a properly serialized block state
|
135
|
-
* @deprecated Unused internally. Scheduled for removal in next major release.
|
136
|
-
*/
|
137
|
-
@Deprecated(forRemoval = true, since = "6.11.1")
|
138
|
-
public static @Nullable BlockState deserialize(final @NonNull Map<String, Object> map) {
|
139
|
-
if (map.containsKey("material")) {
|
140
|
-
final Object object = map.get("material");
|
141
|
-
return get(object.toString());
|
142
|
-
}
|
143
|
-
return null;
|
144
|
-
}
|
145
|
-
|
146
110
|
}
|
@@ -21,7 +21,7 @@ package com.plotsquared.core.util;
|
|
21
21
|
import com.plotsquared.core.PlotSquared;
|
22
22
|
import com.plotsquared.core.location.Location;
|
23
23
|
import com.plotsquared.core.queue.QueueCoordinator;
|
24
|
-
import com.plotsquared.core.queue.
|
24
|
+
import com.plotsquared.core.queue.ZeroedDelegateScopedQueueCoordinator;
|
25
25
|
import com.plotsquared.core.util.task.RunnableVal;
|
26
26
|
import com.sk89q.worldedit.math.BlockVector2;
|
27
27
|
import com.sk89q.worldedit.world.World;
|
@@ -32,16 +32,15 @@ import java.util.concurrent.ConcurrentHashMap;
|
|
32
32
|
|
33
33
|
public abstract class ChunkManager {
|
34
34
|
|
35
|
-
private static final Map<BlockVector2, RunnableVal<
|
36
|
-
private static final Map<BlockVector2, RunnableVal<
|
35
|
+
private static final Map<BlockVector2, RunnableVal<ZeroedDelegateScopedQueueCoordinator>> forceChunks = new ConcurrentHashMap<>();
|
36
|
+
private static final Map<BlockVector2, RunnableVal<ZeroedDelegateScopedQueueCoordinator>> addChunks = new ConcurrentHashMap<>();
|
37
37
|
|
38
38
|
/**
|
39
|
-
* @
|
39
|
+
* @since 7.0.0
|
40
40
|
*/
|
41
|
-
@Deprecated(forRemoval = true, since = "6.9.0")
|
42
41
|
public static void setChunkInPlotArea(
|
43
|
-
RunnableVal<
|
44
|
-
RunnableVal<
|
42
|
+
RunnableVal<ZeroedDelegateScopedQueueCoordinator> force,
|
43
|
+
RunnableVal<ZeroedDelegateScopedQueueCoordinator> add,
|
45
44
|
String world,
|
46
45
|
BlockVector2 loc
|
47
46
|
) {
|
@@ -50,8 +49,8 @@ public abstract class ChunkManager {
|
|
50
49
|
if (PlotSquared.get().getPlotAreaManager().isAugmented(world) && PlotSquared.get().isNonStandardGeneration(world, loc)) {
|
51
50
|
int blockX = loc.getX() << 4;
|
52
51
|
int blockZ = loc.getZ() << 4;
|
53
|
-
|
54
|
-
new
|
52
|
+
ZeroedDelegateScopedQueueCoordinator scoped =
|
53
|
+
new ZeroedDelegateScopedQueueCoordinator(
|
55
54
|
queue,
|
56
55
|
Location.at(world, blockX, weWorld.getMinY(), blockZ),
|
57
56
|
Location.at(world, blockX + 15, weWorld.getMaxY(), blockZ + 15)
|
@@ -77,11 +76,10 @@ public abstract class ChunkManager {
|
|
77
76
|
}
|
78
77
|
|
79
78
|
/**
|
80
|
-
* @
|
79
|
+
* @since 7.0.0
|
81
80
|
*/
|
82
|
-
|
83
|
-
|
84
|
-
final RunnableVal<ScopedQueueCoordinator> forceChunk = forceChunks.get(loc);
|
81
|
+
public static boolean preProcessChunk(BlockVector2 loc, ZeroedDelegateScopedQueueCoordinator queue) {
|
82
|
+
final RunnableVal<ZeroedDelegateScopedQueueCoordinator> forceChunk = forceChunks.get(loc);
|
85
83
|
if (forceChunk != null) {
|
86
84
|
forceChunk.run(queue);
|
87
85
|
forceChunks.remove(loc);
|
@@ -91,11 +89,10 @@ public abstract class ChunkManager {
|
|
91
89
|
}
|
92
90
|
|
93
91
|
/**
|
94
|
-
* @
|
92
|
+
* @since 7.0.0
|
95
93
|
*/
|
96
|
-
|
97
|
-
|
98
|
-
final RunnableVal<ScopedQueueCoordinator> addChunk = forceChunks.get(loc);
|
94
|
+
public static boolean postProcessChunk(BlockVector2 loc, ZeroedDelegateScopedQueueCoordinator queue) {
|
95
|
+
final RunnableVal<ZeroedDelegateScopedQueueCoordinator> addChunk = forceChunks.get(loc);
|
99
96
|
if (addChunk != null) {
|
100
97
|
addChunk.run(queue);
|
101
98
|
addChunks.remove(loc);
|
@@ -18,10 +18,6 @@
|
|
18
18
|
*/
|
19
19
|
package com.plotsquared.core.util;
|
20
20
|
|
21
|
-
import com.plotsquared.core.location.Location;
|
22
|
-
import com.sk89q.worldedit.math.BlockVector2;
|
23
|
-
import org.checkerframework.checker.nullness.qual.NonNull;
|
24
|
-
|
25
21
|
/**
|
26
22
|
* This cache is used for world generation and just saves a bit of calculation time when checking if something is in the plot area.
|
27
23
|
*/
|
@@ -107,24 +103,4 @@ public class ChunkUtil {
|
|
107
103
|
return z_loc[j];
|
108
104
|
}
|
109
105
|
|
110
|
-
/**
|
111
|
-
* Returns true if the region pos1-pos2 contains the chunk
|
112
|
-
*
|
113
|
-
* @param pos1 Region minimum point
|
114
|
-
* @param pos2 Region maximum point
|
115
|
-
* @param chunk BlockVector2 of chunk coordinates
|
116
|
-
* @return {@code true} if the region pos1-pos2 contains the chunk
|
117
|
-
* @deprecated Unused internally. Scheduled for removal in next major release.
|
118
|
-
*/
|
119
|
-
@Deprecated(forRemoval = true, since = "6.11.1")
|
120
|
-
public static boolean isWholeChunk(@NonNull Location pos1, @NonNull Location pos2, @NonNull BlockVector2 chunk) {
|
121
|
-
int x1 = pos1.getX();
|
122
|
-
int z1 = pos1.getZ();
|
123
|
-
int x2 = pos2.getX();
|
124
|
-
int z2 = pos2.getZ();
|
125
|
-
int cx = chunk.getX() << 4;
|
126
|
-
int cz = chunk.getZ() << 4;
|
127
|
-
return cx > x1 && cz > z1 && cx < x2 && cz < z2;
|
128
|
-
}
|
129
|
-
|
130
106
|
}
|
@@ -0,0 +1,65 @@
|
|
1
|
+
/*
|
2
|
+
* PlotSquared, a land and world management plugin for Minecraft.
|
3
|
+
* Copyright (C) IntellectualSites <https://intellectualsites.com>
|
4
|
+
* Copyright (C) IntellectualSites team and contributors
|
5
|
+
*
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
7
|
+
* it under the terms of the GNU General Public License as published by
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
9
|
+
* (at your option) any later version.
|
10
|
+
*
|
11
|
+
* This program is distributed in the hope that it will be useful,
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
* GNU General Public License for more details.
|
15
|
+
*
|
16
|
+
* You should have received a copy of the GNU General Public License
|
17
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
18
|
+
*/
|
19
|
+
package com.plotsquared.core.util;
|
20
|
+
|
21
|
+
import net.kyori.adventure.text.Component;
|
22
|
+
import net.kyori.adventure.text.ComponentLike;
|
23
|
+
import net.kyori.adventure.text.TextComponent;
|
24
|
+
|
25
|
+
import java.util.Collection;
|
26
|
+
|
27
|
+
/**
|
28
|
+
* A utility class for modifying components.
|
29
|
+
*
|
30
|
+
* @since 7.0.0
|
31
|
+
*/
|
32
|
+
public class ComponentHelper {
|
33
|
+
|
34
|
+
/**
|
35
|
+
* Joins multiple {@link Component}s into one final {@link ComponentLike}
|
36
|
+
*
|
37
|
+
* @param components The components to join
|
38
|
+
* @param delimiter The delimiter to use between the components
|
39
|
+
* @return The joined components
|
40
|
+
* @since 7.0.0
|
41
|
+
*/
|
42
|
+
public static ComponentLike join(Collection<? extends ComponentLike> components, Component delimiter) {
|
43
|
+
return join(components.toArray(ComponentLike[]::new), delimiter);
|
44
|
+
}
|
45
|
+
|
46
|
+
/**
|
47
|
+
* Joins multiple {@link ComponentLike}s into one final {@link ComponentLike}
|
48
|
+
*
|
49
|
+
* @param components The components to join
|
50
|
+
* @param delimiter The delimiter to use between the components
|
51
|
+
* @return The joined components
|
52
|
+
* @since 7.0.0
|
53
|
+
*/
|
54
|
+
public static Component join(ComponentLike[] components, Component delimiter) {
|
55
|
+
TextComponent.Builder builder = Component.text();
|
56
|
+
for (int i = 0, j = components.length; i < j; i++) {
|
57
|
+
if (i > 0) {
|
58
|
+
builder.append(delimiter);
|
59
|
+
}
|
60
|
+
builder.append(components[i]);
|
61
|
+
}
|
62
|
+
return builder.build();
|
63
|
+
}
|
64
|
+
|
65
|
+
}
|
@@ -76,7 +76,9 @@ import com.sk89q.worldedit.entity.Entity;
|
|
76
76
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
77
77
|
import com.sk89q.worldedit.world.block.BlockType;
|
78
78
|
import com.sk89q.worldedit.world.block.BlockTypes;
|
79
|
-
import net.kyori.adventure.text.
|
79
|
+
import net.kyori.adventure.text.Component;
|
80
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
81
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
80
82
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
81
83
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
82
84
|
|
@@ -343,8 +345,10 @@ public class EventDispatcher {
|
|
343
345
|
if (!area.buildRangeContainsY(location.getY()) && !player.hasPermission(Permission.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) {
|
344
346
|
player.sendMessage(
|
345
347
|
TranslatableCaption.of("height.height_limit"),
|
346
|
-
|
347
|
-
|
348
|
+
TagResolver.builder()
|
349
|
+
.tag("minheight", Tag.inserting(Component.text(area.getMinBuildHeight())))
|
350
|
+
.tag("maxheight", Tag.inserting(Component.text(area.getMaxBuildHeight())))
|
351
|
+
.build()
|
348
352
|
);
|
349
353
|
return false;
|
350
354
|
}
|
@@ -355,11 +359,13 @@ public class EventDispatcher {
|
|
355
359
|
}
|
356
360
|
}
|
357
361
|
switch (type) {
|
358
|
-
case TELEPORT_OBJECT
|
362
|
+
case TELEPORT_OBJECT -> {
|
359
363
|
return false;
|
360
|
-
|
364
|
+
}
|
365
|
+
case READ -> {
|
361
366
|
return true;
|
362
|
-
|
367
|
+
}
|
368
|
+
case INTERACT_BLOCK -> {
|
363
369
|
if (plot == null) {
|
364
370
|
final List<BlockTypeWrapper> use = area.getRoadFlag(UseFlag.class);
|
365
371
|
for (final BlockTypeWrapper blockTypeWrapper : use) {
|
@@ -389,12 +395,12 @@ public class EventDispatcher {
|
|
389
395
|
if (notifyPerms) {
|
390
396
|
player.sendMessage(
|
391
397
|
TranslatableCaption.of("commandconfig.flag_tutorial_usage"),
|
392
|
-
|
398
|
+
TagResolver.resolver("flag", Tag.inserting(PlaceFlag.getFlagNameComponent(UseFlag.class)))
|
393
399
|
);
|
394
400
|
}
|
395
401
|
return false;
|
396
402
|
}
|
397
|
-
case TRIGGER_PHYSICAL
|
403
|
+
case TRIGGER_PHYSICAL -> {
|
398
404
|
if (plot == null) {
|
399
405
|
final List<BlockTypeWrapper> use = area.getRoadFlag(UseFlag.class);
|
400
406
|
for (final BlockTypeWrapper blockTypeWrapper : use) {
|
@@ -426,7 +432,7 @@ public class EventDispatcher {
|
|
426
432
|
false
|
427
433
|
);
|
428
434
|
}
|
429
|
-
case SPAWN_MOB
|
435
|
+
case SPAWN_MOB -> {
|
430
436
|
if (plot == null) {
|
431
437
|
return player.hasPermission(
|
432
438
|
Permission.PERMISSION_ADMIN_INTERACT_ROAD.toString(), notifyPerms
|
@@ -456,13 +462,19 @@ public class EventDispatcher {
|
|
456
462
|
if (notifyPerms) {
|
457
463
|
player.sendMessage(
|
458
464
|
TranslatableCaption.of("commandconfig.flag_tutorial_usage"),
|
459
|
-
|
460
|
-
|
465
|
+
TagResolver.resolver(
|
466
|
+
"flag",
|
467
|
+
Tag.inserting(
|
468
|
+
PlotFlag.getFlagNameComponent(MobPlaceFlag.class)
|
469
|
+
.append(Component.text("/"))
|
470
|
+
.append(PlotFlag.getFlagNameComponent(PlaceFlag.class))
|
471
|
+
)
|
472
|
+
)
|
461
473
|
);
|
462
474
|
}
|
463
475
|
return false;
|
464
476
|
}
|
465
|
-
case PLACE_MISC
|
477
|
+
case PLACE_MISC -> {
|
466
478
|
if (plot == null) {
|
467
479
|
return player.hasPermission(
|
468
480
|
Permission.PERMISSION_ADMIN_INTERACT_ROAD.toString(), notifyPerms
|
@@ -492,13 +504,19 @@ public class EventDispatcher {
|
|
492
504
|
if (notifyPerms) {
|
493
505
|
player.sendMessage(
|
494
506
|
TranslatableCaption.of("commandconfig.flag_tutorial_usage"),
|
495
|
-
|
496
|
-
|
507
|
+
TagResolver.resolver(
|
508
|
+
"flag",
|
509
|
+
Tag.inserting(
|
510
|
+
PlotFlag.getFlagNameComponent(MiscPlaceFlag.class)
|
511
|
+
.append(Component.text("/"))
|
512
|
+
.append(PlotFlag.getFlagNameComponent(PlaceFlag.class))
|
513
|
+
)
|
514
|
+
)
|
497
515
|
);
|
498
516
|
}
|
499
517
|
return false;
|
500
518
|
}
|
501
|
-
case PLACE_VEHICLE
|
519
|
+
case PLACE_VEHICLE -> {
|
502
520
|
if (plot == null) {
|
503
521
|
return player.hasPermission(
|
504
522
|
Permission.PERMISSION_ADMIN_INTERACT_ROAD.toString(), notifyPerms
|
@@ -510,8 +528,9 @@ public class EventDispatcher {
|
|
510
528
|
);
|
511
529
|
}
|
512
530
|
return plot.getFlag(VehiclePlaceFlag.class);
|
513
|
-
|
514
|
-
|
531
|
+
}
|
532
|
+
default -> {
|
533
|
+
}
|
515
534
|
}
|
516
535
|
return true;
|
517
536
|
}
|
@@ -18,14 +18,9 @@
|
|
18
18
|
*/
|
19
19
|
package com.plotsquared.core.util;
|
20
20
|
|
21
|
-
public
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
public FileBytes(String path, byte[] data) {
|
27
|
-
this.path = path;
|
28
|
-
this.data = data;
|
29
|
-
}
|
21
|
+
public record FileBytes(
|
22
|
+
String path,
|
23
|
+
byte[] data
|
24
|
+
) {
|
30
25
|
|
31
26
|
}
|
@@ -35,8 +35,8 @@ public abstract class InventoryUtil {
|
|
35
35
|
* Attempts to set an item into a {@link PlotInventory} while also checking the existence of the material
|
36
36
|
*
|
37
37
|
* @param plotInventory The inventory where the item should be placed
|
38
|
-
* @param index
|
39
|
-
* @param item
|
38
|
+
* @param index The index where to place the item
|
39
|
+
* @param item The item to place into the inventory
|
40
40
|
* @return {@code true} if the item could be placed, {@code false} otherwise (e.g. item not available in current version)
|
41
41
|
* @since 6.5.0
|
42
42
|
*/
|
@@ -49,12 +49,14 @@ public abstract class InventoryUtil {
|
|
49
49
|
* Attempts to set an item into a {@link PlotInventory}
|
50
50
|
*
|
51
51
|
* @param plotInventory The inventory where the item should be placed
|
52
|
-
* @param index
|
53
|
-
* @param item
|
52
|
+
* @param index The index where to place the item
|
53
|
+
* @param item The item to place into the inventory
|
54
54
|
* @see #setItemChecked(PlotInventory, int, PlotItemStack)
|
55
55
|
*/
|
56
|
-
public void setItem(
|
57
|
-
|
56
|
+
public void setItem(
|
57
|
+
final PlotInventory plotInventory, final int index,
|
58
|
+
final PlotItemStack item
|
59
|
+
) {
|
58
60
|
setItemChecked(plotInventory, index, item);
|
59
61
|
}
|
60
62
|
|
@@ -24,7 +24,9 @@ import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
|
24
24
|
import com.plotsquared.core.player.ConsolePlayer;
|
25
25
|
import com.plotsquared.core.plot.BlockBucket;
|
26
26
|
import com.sk89q.worldedit.world.block.BlockState;
|
27
|
-
import net.kyori.adventure.text.
|
27
|
+
import net.kyori.adventure.text.Component;
|
28
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
29
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
28
30
|
import org.apache.logging.log4j.LogManager;
|
29
31
|
import org.apache.logging.log4j.Logger;
|
30
32
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
@@ -112,8 +114,10 @@ public final class LegacyConverter {
|
|
112
114
|
this.setString(section, key, bucket);
|
113
115
|
ConsolePlayer.getConsole().sendMessage(
|
114
116
|
TranslatableCaption.of("legacyconfig.legacy_config_replaced"),
|
115
|
-
|
116
|
-
|
117
|
+
TagResolver.builder()
|
118
|
+
.tag("value1", Tag.inserting(Component.text(block)))
|
119
|
+
.tag("value2", Tag.inserting(Component.text(bucket.toString())))
|
120
|
+
.build()
|
117
121
|
);
|
118
122
|
}
|
119
123
|
|
@@ -128,8 +132,10 @@ public final class LegacyConverter {
|
|
128
132
|
ConsolePlayer.getConsole()
|
129
133
|
.sendMessage(
|
130
134
|
TranslatableCaption.of("legacyconfig.legacy_config_replaced"),
|
131
|
-
|
132
|
-
|
135
|
+
TagResolver.builder()
|
136
|
+
.tag("value1", Tag.inserting(Component.text(plotBlockArrayString(blocks))))
|
137
|
+
.tag("value2", Tag.inserting(Component.text(bucket.toString())))
|
138
|
+
.build()
|
133
139
|
);
|
134
140
|
}
|
135
141
|
|
@@ -1,82 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* PlotSquared, a land and world management plugin for Minecraft.
|
3
|
-
* Copyright (C) IntellectualSites <https://intellectualsites.com>
|
4
|
-
* Copyright (C) IntellectualSites team and contributors
|
5
|
-
*
|
6
|
-
* This program is free software: you can redistribute it and/or modify
|
7
|
-
* it under the terms of the GNU General Public License as published by
|
8
|
-
* the Free Software Foundation, either version 3 of the License, or
|
9
|
-
* (at your option) any later version.
|
10
|
-
*
|
11
|
-
* This program is distributed in the hope that it will be useful,
|
12
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
-
* GNU General Public License for more details.
|
15
|
-
*
|
16
|
-
* You should have received a copy of the GNU General Public License
|
17
|
-
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
18
|
-
*/
|
19
|
-
package com.plotsquared.core.util;
|
20
|
-
|
21
|
-
/**
|
22
|
-
* plot functions
|
23
|
-
*
|
24
|
-
* @deprecated Do not use
|
25
|
-
*/
|
26
|
-
@Deprecated(forRemoval = true, since = "6.0.0")
|
27
|
-
public class MainUtil {
|
28
|
-
|
29
|
-
/**
|
30
|
-
* Cache of mapping x,y,z coordinates to the chunk array<br>
|
31
|
-
* - Used for efficient world generation<br>
|
32
|
-
*/
|
33
|
-
@Deprecated(forRemoval = true, since = "6.0.0")
|
34
|
-
public static short[][] x_loc;
|
35
|
-
@Deprecated(forRemoval = true, since = "6.0.0")
|
36
|
-
public static short[][] y_loc;
|
37
|
-
@Deprecated(forRemoval = true, since = "6.0.0")
|
38
|
-
public static short[][] z_loc;
|
39
|
-
@Deprecated(forRemoval = true, since = "6.0.0")
|
40
|
-
public static short[][][] CACHE_I = null;
|
41
|
-
@Deprecated(forRemoval = true, since = "6.0.0")
|
42
|
-
public static short[][][] CACHE_J = null;
|
43
|
-
|
44
|
-
/**
|
45
|
-
* This cache is used for world generation and just saves a bit of calculation time when checking if something is in the plot area.
|
46
|
-
*/
|
47
|
-
@Deprecated(forRemoval = true, since = "6.0.0")
|
48
|
-
public static void initCache() {
|
49
|
-
if (x_loc == null) {
|
50
|
-
x_loc = new short[16][4096];
|
51
|
-
y_loc = new short[16][4096];
|
52
|
-
z_loc = new short[16][4096];
|
53
|
-
for (int i = 0; i < 16; i++) {
|
54
|
-
int i4 = i << 4;
|
55
|
-
for (int j = 0; j < 4096; j++) {
|
56
|
-
int y = i4 + (j >> 8);
|
57
|
-
int a = j - ((y & 0xF) << 8);
|
58
|
-
int z1 = a >> 4;
|
59
|
-
int x1 = a - (z1 << 4);
|
60
|
-
x_loc[i][j] = (short) x1;
|
61
|
-
y_loc[i][j] = (short) y;
|
62
|
-
z_loc[i][j] = (short) z1;
|
63
|
-
}
|
64
|
-
}
|
65
|
-
}
|
66
|
-
if (CACHE_I == null) {
|
67
|
-
CACHE_I = new short[256][16][16];
|
68
|
-
CACHE_J = new short[256][16][16];
|
69
|
-
for (int x = 0; x < 16; x++) {
|
70
|
-
for (int z = 0; z < 16; z++) {
|
71
|
-
for (int y = 0; y < 256; y++) {
|
72
|
-
short i = (short) (y >> 4);
|
73
|
-
short j = (short) ((y & 0xF) << 8 | z << 4 | x);
|
74
|
-
CACHE_I[y][x][z] = i;
|
75
|
-
CACHE_J[y][x][z] = j;
|
76
|
-
}
|
77
|
-
}
|
78
|
-
}
|
79
|
-
}
|
80
|
-
}
|
81
|
-
|
82
|
-
}
|
@@ -70,135 +70,6 @@ public class MathMan {
|
|
70
70
|
return result;
|
71
71
|
}
|
72
72
|
|
73
|
-
/**
|
74
|
-
* @deprecated Unused internally. Scheduled for removal in next major release.
|
75
|
-
*/
|
76
|
-
@Deprecated(forRemoval = true, since = "6.11.1")
|
77
|
-
public static long pairInt(int x, int y) {
|
78
|
-
return (((long) x) << 32) | (y & 0xffffffffL);
|
79
|
-
}
|
80
|
-
|
81
|
-
/**
|
82
|
-
* @deprecated Unused internally. Scheduled for removal in next major release.
|
83
|
-
*/
|
84
|
-
@Deprecated(forRemoval = true, since = "6.11.1")
|
85
|
-
public static int unpairIntX(long pair) {
|
86
|
-
return (int) (pair >> 32);
|
87
|
-
}
|
88
|
-
|
89
|
-
/**
|
90
|
-
* @deprecated Unused internally. Scheduled for removal in next major release.
|
91
|
-
*/
|
92
|
-
@Deprecated(forRemoval = true, since = "6.11.1")
|
93
|
-
public static int unpairIntY(long pair) {
|
94
|
-
return (int) pair;
|
95
|
-
}
|
96
|
-
|
97
|
-
/**
|
98
|
-
* @deprecated Unused internally. Scheduled for removal in next major release.
|
99
|
-
*/
|
100
|
-
@Deprecated(forRemoval = true, since = "6.11.1")
|
101
|
-
public static byte pair16(byte x, byte y) {
|
102
|
-
return (byte) (x + (y << 4));
|
103
|
-
}
|
104
|
-
|
105
|
-
/**
|
106
|
-
* @deprecated Unused internally. Scheduled for removal in next major release.
|
107
|
-
*/
|
108
|
-
@Deprecated(forRemoval = true, since = "6.11.1")
|
109
|
-
public static byte unpair16x(byte value) {
|
110
|
-
return (byte) (value & 0xF);
|
111
|
-
}
|
112
|
-
|
113
|
-
/**
|
114
|
-
* @deprecated Unused internally. Scheduled for removal in next major release.
|
115
|
-
*/
|
116
|
-
@Deprecated(forRemoval = true, since = "6.11.1")
|
117
|
-
public static byte unpair16y(byte value) {
|
118
|
-
return (byte) ((value >> 4) & 0xF);
|
119
|
-
}
|
120
|
-
|
121
|
-
/**
|
122
|
-
* @deprecated Unused internally. Scheduled for removal in next major release.
|
123
|
-
*/
|
124
|
-
@Deprecated(forRemoval = true, since = "6.11.1")
|
125
|
-
public static long inverseRound(double val) {
|
126
|
-
long round = Math.round(val);
|
127
|
-
return (long) (round + Math.signum(val - round));
|
128
|
-
}
|
129
|
-
|
130
|
-
/**
|
131
|
-
* @deprecated Unused internally. Scheduled for removal in next major release.
|
132
|
-
*/
|
133
|
-
@Deprecated(forRemoval = true, since = "6.11.1")
|
134
|
-
public static int sqrt(int x) {
|
135
|
-
int xn;
|
136
|
-
|
137
|
-
if (x >= 0x10000) {
|
138
|
-
if (x >= 0x1000000) {
|
139
|
-
if (x >= 0x10000000) {
|
140
|
-
if (x >= 0x40000000) {
|
141
|
-
xn = table[x >> 24] << 8;
|
142
|
-
} else {
|
143
|
-
xn = table[x >> 22] << 7;
|
144
|
-
}
|
145
|
-
} else {
|
146
|
-
if (x >= 0x4000000) {
|
147
|
-
xn = table[x >> 20] << 6;
|
148
|
-
} else {
|
149
|
-
xn = table[x >> 18] << 5;
|
150
|
-
}
|
151
|
-
}
|
152
|
-
|
153
|
-
xn = (xn + 1 + (x / xn)) >> 1;
|
154
|
-
xn = (xn + 1 + (x / xn)) >> 1;
|
155
|
-
return ((xn * xn) > x) ? --xn : xn;
|
156
|
-
} else {
|
157
|
-
if (x >= 0x100000) {
|
158
|
-
if (x >= 0x400000) {
|
159
|
-
xn = table[x >> 16] << 4;
|
160
|
-
} else {
|
161
|
-
xn = table[x >> 14] << 3;
|
162
|
-
}
|
163
|
-
} else {
|
164
|
-
if (x >= 0x40000) {
|
165
|
-
xn = table[x >> 12] << 2;
|
166
|
-
} else {
|
167
|
-
xn = table[x >> 10] << 1;
|
168
|
-
}
|
169
|
-
}
|
170
|
-
|
171
|
-
xn = (xn + 1 + (x / xn)) >> 1;
|
172
|
-
|
173
|
-
return ((xn * xn) > x) ? --xn : xn;
|
174
|
-
}
|
175
|
-
} else {
|
176
|
-
if (x >= 0x100) {
|
177
|
-
if (x >= 0x1000) {
|
178
|
-
if (x >= 0x4000) {
|
179
|
-
xn = (table[x >> 8]) + 1;
|
180
|
-
} else {
|
181
|
-
xn = (table[x >> 6] >> 1) + 1;
|
182
|
-
}
|
183
|
-
} else {
|
184
|
-
if (x >= 0x400) {
|
185
|
-
xn = (table[x >> 4] >> 2) + 1;
|
186
|
-
} else {
|
187
|
-
xn = (table[x >> 2] >> 3) + 1;
|
188
|
-
}
|
189
|
-
}
|
190
|
-
|
191
|
-
return ((xn * xn) > x) ? --xn : xn;
|
192
|
-
} else {
|
193
|
-
if (x >= 0) {
|
194
|
-
return table[x] >> 4;
|
195
|
-
}
|
196
|
-
}
|
197
|
-
}
|
198
|
-
throw new IllegalArgumentException("Invalid number:" + x);
|
199
|
-
}
|
200
|
-
|
201
|
-
|
202
73
|
public static double getMean(int[] array) {
|
203
74
|
double count = 0;
|
204
75
|
for (int i : array) {
|
@@ -207,18 +78,6 @@ public class MathMan {
|
|
207
78
|
return count / array.length;
|
208
79
|
}
|
209
80
|
|
210
|
-
/**
|
211
|
-
* @deprecated Unused internally. Scheduled for removal in next major release.
|
212
|
-
*/
|
213
|
-
@Deprecated(forRemoval = true, since = "6.11.1")
|
214
|
-
public static double getMean(double[] array) {
|
215
|
-
double count = 0;
|
216
|
-
for (double i : array) {
|
217
|
-
count += i;
|
218
|
-
}
|
219
|
-
return count / array.length;
|
220
|
-
}
|
221
|
-
|
222
81
|
public static int pair(short x, short y) {
|
223
82
|
return (x << 16) | (y & 0xFFFF);
|
224
83
|
}
|
@@ -227,139 +86,10 @@ public class MathMan {
|
|
227
86
|
return (a & b) + (a ^ b) / 2;
|
228
87
|
}
|
229
88
|
|
230
|
-
|
231
|
-
/**
|
232
|
-
* @deprecated Unused internally. Scheduled for removal in next major release.
|
233
|
-
*/
|
234
|
-
@Deprecated(forRemoval = true, since = "6.11.1")
|
235
|
-
public static short unpairX(int hash) {
|
236
|
-
return (short) (hash >> 16);
|
237
|
-
}
|
238
|
-
|
239
|
-
/**
|
240
|
-
* @deprecated Unused internally. Scheduled for removal in next major release.
|
241
|
-
*/
|
242
|
-
@Deprecated(forRemoval = true, since = "6.11.1")
|
243
|
-
public static short unpairY(int hash) {
|
244
|
-
return (short) (hash & 0xFFFF);
|
245
|
-
}
|
246
|
-
|
247
|
-
/**
|
248
|
-
* get the x,y,z unit vector from pitch and yaw specified
|
249
|
-
*
|
250
|
-
* @param yaw yaw
|
251
|
-
* @param pitch pitch
|
252
|
-
* @return x, y, z unit vector
|
253
|
-
* @deprecated Unused internally. Scheduled for removal in next major release.
|
254
|
-
*/
|
255
|
-
@Deprecated(forRemoval = true, since = "6.11.1")
|
256
|
-
public static float[] getDirection(float yaw, float pitch) {
|
257
|
-
double pitch_sin = Math.sin(pitch);
|
258
|
-
return new float[]{(float) (pitch_sin * Math.cos(yaw)),
|
259
|
-
(float) (pitch_sin * Math.sin(yaw)), (float) Math.cos(pitch)};
|
260
|
-
}
|
261
|
-
|
262
|
-
/**
|
263
|
-
* @deprecated Unused internally. Scheduled for removal in next major release.
|
264
|
-
*/
|
265
|
-
@Deprecated(forRemoval = true, since = "6.11.1")
|
266
|
-
public static int floorMod(int x, int y) {
|
267
|
-
int i = x % y;
|
268
|
-
if (i < 0) {
|
269
|
-
i += y;
|
270
|
-
}
|
271
|
-
return i;
|
272
|
-
}
|
273
|
-
|
274
89
|
public static int roundInt(double value) {
|
275
90
|
return (int) (value < 0 ? (value == (int) value) ? value : value - 1 : value);
|
276
91
|
}
|
277
92
|
|
278
|
-
/**
|
279
|
-
* Returns [ pitch, yaw ]
|
280
|
-
*
|
281
|
-
* @param x x
|
282
|
-
* @param y y
|
283
|
-
* @param z z
|
284
|
-
* @return pitch and yaw of x,y,z from 0,0,0
|
285
|
-
* @deprecated Unused internally. Scheduled for removal in next major release.
|
286
|
-
*/
|
287
|
-
@Deprecated(forRemoval = true, since = "6.11.1")
|
288
|
-
public static float[] getPitchAndYaw(float x, float y, float z) {
|
289
|
-
float distance = sqrtApprox((z * z) + (x * x));
|
290
|
-
return new float[]{atan2(y, distance), atan2(x, z)};
|
291
|
-
}
|
292
|
-
|
293
|
-
/**
|
294
|
-
* @deprecated Unused internally. Scheduled for removal in next major release.
|
295
|
-
*/
|
296
|
-
@Deprecated(forRemoval = true, since = "6.11.1")
|
297
|
-
public static final float atan2(float y, float x) {
|
298
|
-
float add;
|
299
|
-
float mul;
|
300
|
-
|
301
|
-
if (x < 0.0f) {
|
302
|
-
if (y < 0.0f) {
|
303
|
-
x = -x;
|
304
|
-
y = -y;
|
305
|
-
|
306
|
-
mul = 1.0f;
|
307
|
-
} else {
|
308
|
-
x = -x;
|
309
|
-
mul = -1.0f;
|
310
|
-
}
|
311
|
-
|
312
|
-
add = -3.141592653f;
|
313
|
-
} else {
|
314
|
-
if (y < 0.0f) {
|
315
|
-
y = -y;
|
316
|
-
mul = -1.0f;
|
317
|
-
} else {
|
318
|
-
mul = 1.0f;
|
319
|
-
}
|
320
|
-
|
321
|
-
add = 0.0f;
|
322
|
-
}
|
323
|
-
|
324
|
-
float invDiv = 1.0f / (((x < y) ? y : x) * INV_ATAN2_DIM_MINUS_1);
|
325
|
-
|
326
|
-
int xi = (int) (x * invDiv);
|
327
|
-
int yi = (int) (y * invDiv);
|
328
|
-
|
329
|
-
return (atan2[(yi * ATAN2_DIM) + xi] + add) * mul;
|
330
|
-
}
|
331
|
-
|
332
|
-
/**
|
333
|
-
* @deprecated Unused internally. Scheduled for removal in next major release.
|
334
|
-
*/
|
335
|
-
@Deprecated(forRemoval = true, since = "6.11.1")
|
336
|
-
public static float sqrtApprox(float f) {
|
337
|
-
return f * Float.intBitsToFloat(0x5f375a86 - (Float.floatToIntBits(f) >> 1));
|
338
|
-
}
|
339
|
-
|
340
|
-
|
341
|
-
/**
|
342
|
-
* @deprecated Unused internally. Scheduled for removal in next major release.
|
343
|
-
*/
|
344
|
-
@Deprecated(forRemoval = true, since = "6.11.1")
|
345
|
-
public static double sqrtApprox(double d) {
|
346
|
-
return Double
|
347
|
-
.longBitsToDouble(((Double.doubleToLongBits(d) - (1L << 52)) >> 1) + (1L << 61));
|
348
|
-
}
|
349
|
-
|
350
|
-
/**
|
351
|
-
* @deprecated Unused internally. Scheduled for removal in next major release.
|
352
|
-
*/
|
353
|
-
@Deprecated(forRemoval = true, since = "6.11.1")
|
354
|
-
public static float invSqrt(float x) {
|
355
|
-
float xhalf = 0.5f * x;
|
356
|
-
int i = Float.floatToIntBits(x);
|
357
|
-
i = 0x5f3759df - (i >> 1);
|
358
|
-
x = Float.intBitsToFloat(i);
|
359
|
-
x = x * (1.5f - (xhalf * x * x));
|
360
|
-
return x;
|
361
|
-
}
|
362
|
-
|
363
93
|
public static int getPositiveId(int i) {
|
364
94
|
if (i < 0) {
|
365
95
|
return (-i * 2) - 1;
|
@@ -391,18 +121,6 @@ public class MathMan {
|
|
391
121
|
return true;
|
392
122
|
}
|
393
123
|
|
394
|
-
/**
|
395
|
-
* @deprecated Unused internally. Scheduled for removal in next major release.
|
396
|
-
*/
|
397
|
-
@Deprecated(forRemoval = true, since = "6.11.1")
|
398
|
-
public static double getSD(double[] array, double av) {
|
399
|
-
double sd = 0;
|
400
|
-
for (double element : array) {
|
401
|
-
sd += Math.pow(Math.abs(element - av), 2);
|
402
|
-
}
|
403
|
-
return Math.sqrt(sd / array.length);
|
404
|
-
}
|
405
|
-
|
406
124
|
public static double getSD(int[] array, double av) {
|
407
125
|
double sd = 0;
|
408
126
|
for (int element : array) {
|
@@ -411,34 +129,4 @@ public class MathMan {
|
|
411
129
|
return Math.sqrt(sd / array.length);
|
412
130
|
}
|
413
131
|
|
414
|
-
/**
|
415
|
-
* @deprecated Unused internally. Scheduled for removal in next major release.
|
416
|
-
*/
|
417
|
-
@Deprecated(forRemoval = true, since = "6.11.1")
|
418
|
-
public static int mod(int x, int y) {
|
419
|
-
if (isPowerOfTwo(y)) {
|
420
|
-
return x & (y - 1);
|
421
|
-
}
|
422
|
-
return x % y;
|
423
|
-
}
|
424
|
-
|
425
|
-
/**
|
426
|
-
* @deprecated Unused internally. Scheduled for removal in next major release.
|
427
|
-
*/
|
428
|
-
@Deprecated(forRemoval = true, since = "6.11.1")
|
429
|
-
public static int unsignedmod(int x, int y) {
|
430
|
-
if (isPowerOfTwo(y)) {
|
431
|
-
return x & (y - 1);
|
432
|
-
}
|
433
|
-
return x % y;
|
434
|
-
}
|
435
|
-
|
436
|
-
/**
|
437
|
-
* @deprecated Unused internally. Scheduled for removal in next major release.
|
438
|
-
*/
|
439
|
-
@Deprecated(forRemoval = true, since = "6.11.1")
|
440
|
-
public static boolean isPowerOfTwo(int number) {
|
441
|
-
return (number & (number - 1)) == 0;
|
442
|
-
}
|
443
|
-
|
444
132
|
}
|
@@ -33,7 +33,9 @@ import com.sk89q.worldedit.math.BlockVector3;
|
|
33
33
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
34
34
|
import com.sk89q.worldedit.world.block.BlockState;
|
35
35
|
import com.sk89q.worldedit.world.block.BlockType;
|
36
|
-
import net.kyori.adventure.text.
|
36
|
+
import net.kyori.adventure.text.Component;
|
37
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
38
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
37
39
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
38
40
|
|
39
41
|
import java.util.ArrayList;
|
@@ -83,7 +85,7 @@ public class PatternUtil {
|
|
83
85
|
} catch (InputParseException e) {
|
84
86
|
throw new Command.CommandException(
|
85
87
|
TranslatableCaption.of("invalid.not_valid_block"),
|
86
|
-
|
88
|
+
TagResolver.resolver("value", Tag.inserting(Component.text(e.getMessage())))
|
87
89
|
);
|
88
90
|
}
|
89
91
|
}
|
@@ -1,148 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* PlotSquared, a land and world management plugin for Minecraft.
|
3
|
-
* Copyright (C) IntellectualSites <https://intellectualsites.com>
|
4
|
-
* Copyright (C) IntellectualSites team and contributors
|
5
|
-
*
|
6
|
-
* This program is free software: you can redistribute it and/or modify
|
7
|
-
* it under the terms of the GNU General Public License as published by
|
8
|
-
* the Free Software Foundation, either version 3 of the License, or
|
9
|
-
* (at your option) any later version.
|
10
|
-
*
|
11
|
-
* This program is distributed in the hope that it will be useful,
|
12
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
-
* GNU General Public License for more details.
|
15
|
-
*
|
16
|
-
* You should have received a copy of the GNU General Public License
|
17
|
-
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
18
|
-
*/
|
19
|
-
package com.plotsquared.core.util;
|
20
|
-
|
21
|
-
import com.plotsquared.core.configuration.Settings;
|
22
|
-
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
23
|
-
import com.plotsquared.core.permissions.Permission;
|
24
|
-
import com.plotsquared.core.permissions.PermissionHolder;
|
25
|
-
import com.plotsquared.core.player.PlotPlayer;
|
26
|
-
import net.kyori.adventure.text.minimessage.Template;
|
27
|
-
import org.checkerframework.checker.nullness.qual.NonNull;
|
28
|
-
|
29
|
-
/**
|
30
|
-
* The Permissions class handles checking user permissions.<br>
|
31
|
-
* - This will respect * nodes and plots.admin and can be used to check permission ranges (e.g. plots.plot.5)<br>
|
32
|
-
* - Checking the PlotPlayer class directly will not take the above into account<br>
|
33
|
-
*
|
34
|
-
* @deprecated all logic that may once have been in the class lives elsewhere. We also want to do away with statically-accessed
|
35
|
-
* classes
|
36
|
-
*/
|
37
|
-
@Deprecated(forRemoval = true, since = "6.9.3")
|
38
|
-
public class Permissions {
|
39
|
-
|
40
|
-
/**
|
41
|
-
* @deprecated all logic that may once have been in the class lives elsewhere. We also want to do away with statically-accessed
|
42
|
-
* classes. Use {@link PlotPlayer#hasPermission(String, boolean)}
|
43
|
-
*/
|
44
|
-
@Deprecated(forRemoval = true, since = "6.9.3")
|
45
|
-
public static boolean hasPermission(PlotPlayer<?> player, Permission permission, boolean notify) {
|
46
|
-
return hasPermission(player, permission.toString(), notify);
|
47
|
-
}
|
48
|
-
|
49
|
-
/**
|
50
|
-
* Check if the owner of the profile has a given (global) permission
|
51
|
-
*
|
52
|
-
* @param caller permission holder
|
53
|
-
* @param permission Permission
|
54
|
-
* @return {@code true} if the owner has the given permission, else {@code false}
|
55
|
-
* @deprecated all logic that may once have been in the class lives elsewhere. We also want to do away with statically-accessed
|
56
|
-
* classes. Use {@link PermissionHolder#hasPermission(Permission)}
|
57
|
-
*/
|
58
|
-
@Deprecated(forRemoval = true, since = "6.9.3")
|
59
|
-
public static boolean hasPermission(final @NonNull PermissionHolder caller, final @NonNull Permission permission) {
|
60
|
-
return caller.hasPermission(permission.toString());
|
61
|
-
}
|
62
|
-
|
63
|
-
/**
|
64
|
-
* Check if the owner of the profile has a given (global) permission. There is no guarantee that per-world permissions will
|
65
|
-
* be checked because unmaintained crap plugins like PEX exist.
|
66
|
-
*
|
67
|
-
* @param caller permission holder
|
68
|
-
* @param permission Permission
|
69
|
-
* @return {@code true} if the owner has the given permission, else {@code false}
|
70
|
-
* @deprecated all logic that may once have been in the class lives elsewhere. We also want to do away with statically-accessed
|
71
|
-
* classes. Use {@link PermissionHolder#hasPermission(String)}
|
72
|
-
*/
|
73
|
-
@Deprecated(forRemoval = true, since = "6.9.3")
|
74
|
-
public static boolean hasPermission(final @NonNull PermissionHolder caller, final @NonNull String permission) {
|
75
|
-
return caller.hasPermission(permission);
|
76
|
-
}
|
77
|
-
|
78
|
-
/**
|
79
|
-
* Check if the owner of the profile has a given (global) keyed permission. Checks both {@code permission.key}
|
80
|
-
* and {@code permission.*}
|
81
|
-
*
|
82
|
-
* @param caller permission holder
|
83
|
-
* @param permission Permission
|
84
|
-
* @param key Permission "key"
|
85
|
-
* @return {@code true} if the owner has the given permission, else {@code false}
|
86
|
-
* @since 6.0.10
|
87
|
-
* @deprecated all logic that may once have been in the class lives elsewhere. We also want to do away with statically-accessed
|
88
|
-
* classes. Use {@link PermissionHolder#hasKeyedPermission(String, String)}
|
89
|
-
*/
|
90
|
-
@Deprecated(forRemoval = true, since = "6.9.3")
|
91
|
-
public static boolean hasKeyedPermission(
|
92
|
-
final @NonNull PermissionHolder caller, final @NonNull String permission,
|
93
|
-
final @NonNull String key
|
94
|
-
) {
|
95
|
-
return caller.hasKeyedPermission(permission, key);
|
96
|
-
}
|
97
|
-
|
98
|
-
/**
|
99
|
-
* Checks if a PlotPlayer has a permission, and optionally send the no permission message if applicable.
|
100
|
-
*
|
101
|
-
* @param player permission holder
|
102
|
-
* @param permission permission
|
103
|
-
* @param notify if to notify the permission holder
|
104
|
-
* @return if permission is had
|
105
|
-
* @deprecated all logic that may once have been in the class lives elsewhere. We also want to do away with statically-accessed
|
106
|
-
* classes. Use {@link PlotPlayer#hasPermission(String, boolean)}
|
107
|
-
*/
|
108
|
-
@Deprecated(forRemoval = true, since = "6.9.3")
|
109
|
-
public static boolean hasPermission(PlotPlayer<?> player, String permission, boolean notify) {
|
110
|
-
if (!hasPermission(player, permission)) {
|
111
|
-
if (notify) {
|
112
|
-
player.sendMessage(
|
113
|
-
TranslatableCaption.of("permission.no_permission_event"),
|
114
|
-
Template.of("node", permission)
|
115
|
-
);
|
116
|
-
}
|
117
|
-
return false;
|
118
|
-
}
|
119
|
-
return true;
|
120
|
-
}
|
121
|
-
|
122
|
-
/**
|
123
|
-
* @deprecated all logic that may once have been in the class lives elsewhere. We also want to do away with statically-accessed
|
124
|
-
* classes. Use {@link PlotPlayer#hasPermissionRange(Permission, int)}
|
125
|
-
*/
|
126
|
-
@Deprecated(forRemoval = true, since = "6.9.3")
|
127
|
-
public static int hasPermissionRange(PlotPlayer<?> player, Permission Permission, int range) {
|
128
|
-
return hasPermissionRange(player, Permission.toString(), range);
|
129
|
-
}
|
130
|
-
|
131
|
-
/**
|
132
|
-
* Check the highest permission a PlotPlayer has within a specified range.<br>
|
133
|
-
* - Excessively high values will lag<br>
|
134
|
-
* - The default range that is checked is {@link Settings.Limit#MAX_PLOTS}<br>
|
135
|
-
*
|
136
|
-
* @param player Player to check for
|
137
|
-
* @param stub The permission stub to check e.g. for `plots.plot.#` the stub is `plots.plot`
|
138
|
-
* @param range The range to check
|
139
|
-
* @return The highest permission they have within that range
|
140
|
-
* @deprecated all logic that may once have been in the class lives elsewhere. We also want to do away with statically-accessed
|
141
|
-
* classes. Use {@link PlotPlayer#hasPermissionRange(String, int)}
|
142
|
-
*/
|
143
|
-
@Deprecated(forRemoval = true, since = "6.9.3")
|
144
|
-
public static int hasPermissionRange(PlotPlayer<?> player, String stub, int range) {
|
145
|
-
return player.hasPermissionRange(stub, range);
|
146
|
-
}
|
147
|
-
|
148
|
-
}
|
@@ -30,9 +30,11 @@ import com.plotsquared.core.player.OfflinePlotPlayer;
|
|
30
30
|
import com.plotsquared.core.player.PlotPlayer;
|
31
31
|
import com.plotsquared.core.uuid.UUIDMapping;
|
32
32
|
import net.kyori.adventure.text.Component;
|
33
|
+
import net.kyori.adventure.text.ComponentLike;
|
33
34
|
import net.kyori.adventure.text.TextComponent;
|
34
35
|
import net.kyori.adventure.text.minimessage.MiniMessage;
|
35
|
-
import net.kyori.adventure.text.minimessage.
|
36
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
37
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
36
38
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
37
39
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
38
40
|
|
@@ -96,7 +98,7 @@ public abstract class PlayerManager<P extends PlotPlayer<? extends T>, T> {
|
|
96
98
|
consumer.accept(null, throwable);
|
97
99
|
} else {
|
98
100
|
for (final UUIDMapping uuid : uuids) {
|
99
|
-
result.add(uuid.
|
101
|
+
result.add(uuid.uuid());
|
100
102
|
}
|
101
103
|
consumer.accept(result, null);
|
102
104
|
}
|
@@ -114,18 +116,18 @@ public abstract class PlayerManager<P extends PlotPlayer<? extends T>, T> {
|
|
114
116
|
*/
|
115
117
|
public static @NonNull Component getPlayerList(final @NonNull Collection<UUID> uuids, LocaleHolder localeHolder) {
|
116
118
|
if (uuids.isEmpty()) {
|
117
|
-
return
|
119
|
+
return TranslatableCaption.of("info.none").toComponent(localeHolder).asComponent();
|
118
120
|
}
|
119
121
|
|
120
122
|
final List<UUID> players = new LinkedList<>();
|
121
|
-
final List<
|
123
|
+
final List<ComponentLike> users = new LinkedList<>();
|
122
124
|
for (final UUID uuid : uuids) {
|
123
125
|
if (uuid == null) {
|
124
|
-
users.add(
|
126
|
+
users.add(TranslatableCaption.of("info.none").toComponent(localeHolder));
|
125
127
|
} else if (DBFunc.EVERYONE.equals(uuid)) {
|
126
|
-
users.add(
|
128
|
+
users.add(TranslatableCaption.of("info.everyone").toComponent(localeHolder));
|
127
129
|
} else if (DBFunc.SERVER.equals(uuid)) {
|
128
|
-
users.add(
|
130
|
+
users.add(TranslatableCaption.of("info.console").toComponent(localeHolder));
|
129
131
|
} else {
|
130
132
|
players.add(uuid);
|
131
133
|
}
|
@@ -134,7 +136,7 @@ public abstract class PlayerManager<P extends PlotPlayer<? extends T>, T> {
|
|
134
136
|
try {
|
135
137
|
for (final UUIDMapping mapping : PlotSquared.get().getImpromptuUUIDPipeline()
|
136
138
|
.getNames(players).get(Settings.UUID.BLOCKING_TIMEOUT, TimeUnit.MILLISECONDS)) {
|
137
|
-
users.add(mapping.
|
139
|
+
users.add(Component.text(mapping.username()));
|
138
140
|
}
|
139
141
|
} catch (final Exception e) {
|
140
142
|
e.printStackTrace();
|
@@ -144,64 +146,20 @@ public abstract class PlayerManager<P extends PlotPlayer<? extends T>, T> {
|
|
144
146
|
TextComponent.Builder list = Component.text();
|
145
147
|
for (int x = 0; x < users.size(); x++) {
|
146
148
|
if (x + 1 == uuids.size()) {
|
147
|
-
list.append(MINI_MESSAGE.
|
149
|
+
list.append(MINI_MESSAGE.deserialize(c, TagResolver.resolver(
|
150
|
+
"user",
|
151
|
+
Tag.inserting(users.get(x))
|
152
|
+
)));
|
148
153
|
} else {
|
149
|
-
list.append(MINI_MESSAGE.
|
154
|
+
list.append(MINI_MESSAGE.deserialize(c + ", ", TagResolver.resolver(
|
155
|
+
"user",
|
156
|
+
Tag.inserting(users.get(x))
|
157
|
+
)));
|
150
158
|
}
|
151
159
|
}
|
152
160
|
return list.asComponent();
|
153
161
|
}
|
154
162
|
|
155
|
-
/**
|
156
|
-
* Get the name from a UUID.
|
157
|
-
*
|
158
|
-
* @param owner Owner UUID
|
159
|
-
* @return The player's name, None, Everyone or Unknown
|
160
|
-
* @deprecated Use {@link #resolveName(UUID)}
|
161
|
-
*/
|
162
|
-
@Deprecated(forRemoval = true, since = "6.4.0")
|
163
|
-
public static @NonNull String getName(final @Nullable UUID owner) {
|
164
|
-
return getName(owner, true);
|
165
|
-
}
|
166
|
-
|
167
|
-
/**
|
168
|
-
* Get the name from a UUID.
|
169
|
-
*
|
170
|
-
* @param owner Owner UUID
|
171
|
-
* @param blocking Whether or not the operation can be blocking
|
172
|
-
* @return The player's name, None, Everyone or Unknown
|
173
|
-
* @deprecated Use {@link #resolveName(UUID, boolean)}
|
174
|
-
*/
|
175
|
-
@Deprecated(forRemoval = true, since = "6.4.0")
|
176
|
-
public static @NonNull String getName(final @Nullable UUID owner, final boolean blocking) {
|
177
|
-
if (owner == null) {
|
178
|
-
TranslatableCaption.of("info.none");
|
179
|
-
}
|
180
|
-
if (owner.equals(DBFunc.EVERYONE)) {
|
181
|
-
TranslatableCaption.of("info.everyone");
|
182
|
-
}
|
183
|
-
if (owner.equals(DBFunc.SERVER)) {
|
184
|
-
TranslatableCaption.of("info.server");
|
185
|
-
}
|
186
|
-
final String name;
|
187
|
-
if (blocking) {
|
188
|
-
name = PlotSquared.get().getImpromptuUUIDPipeline()
|
189
|
-
.getSingle(owner, Settings.UUID.BLOCKING_TIMEOUT);
|
190
|
-
} else {
|
191
|
-
final UUIDMapping uuidMapping =
|
192
|
-
PlotSquared.get().getImpromptuUUIDPipeline().getImmediately(owner);
|
193
|
-
if (uuidMapping != null) {
|
194
|
-
name = uuidMapping.getUsername();
|
195
|
-
} else {
|
196
|
-
name = null;
|
197
|
-
}
|
198
|
-
}
|
199
|
-
if (name == null) {
|
200
|
-
TranslatableCaption.of("info.unknown");
|
201
|
-
}
|
202
|
-
return name;
|
203
|
-
}
|
204
|
-
|
205
163
|
/**
|
206
164
|
* Attempts to resolve the username by an uuid
|
207
165
|
* <p>
|
@@ -242,7 +200,7 @@ public abstract class PlayerManager<P extends PlotPlayer<? extends T>, T> {
|
|
242
200
|
final UUIDMapping uuidMapping =
|
243
201
|
PlotSquared.get().getImpromptuUUIDPipeline().getImmediately(owner);
|
244
202
|
if (uuidMapping != null) {
|
245
|
-
name = uuidMapping.
|
203
|
+
name = uuidMapping.username();
|
246
204
|
} else {
|
247
205
|
name = null;
|
248
206
|
}
|
@@ -1,34 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* PlotSquared, a land and world management plugin for Minecraft.
|
3
|
-
* Copyright (C) IntellectualSites <https://intellectualsites.com>
|
4
|
-
* Copyright (C) IntellectualSites team and contributors
|
5
|
-
*
|
6
|
-
* This program is free software: you can redistribute it and/or modify
|
7
|
-
* it under the terms of the GNU General Public License as published by
|
8
|
-
* the Free Software Foundation, either version 3 of the License, or
|
9
|
-
* (at your option) any later version.
|
10
|
-
*
|
11
|
-
* This program is distributed in the hope that it will be useful,
|
12
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
-
* GNU General Public License for more details.
|
15
|
-
*
|
16
|
-
* You should have received a copy of the GNU General Public License
|
17
|
-
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
18
|
-
*/
|
19
|
-
package com.plotsquared.core.util;
|
20
|
-
|
21
|
-
import java.util.HashMap;
|
22
|
-
import java.util.Map;
|
23
|
-
import java.util.regex.Pattern;
|
24
|
-
|
25
|
-
@Deprecated(since = "6.6.2", forRemoval = true)
|
26
|
-
public class RegExUtil {
|
27
|
-
|
28
|
-
public static Map<String, Pattern> compiledPatterns;
|
29
|
-
|
30
|
-
static {
|
31
|
-
compiledPatterns = new HashMap<>();
|
32
|
-
}
|
33
|
-
|
34
|
-
}
|
@@ -272,7 +272,8 @@ public abstract class RegionManager {
|
|
272
272
|
fromQueue1.addReadChunks(new CuboidRegion(pos1.getBlockVector3(), pos2.getBlockVector3()).getChunks());
|
273
273
|
fromQueue2.addReadChunks(new CuboidRegion(
|
274
274
|
swapPos.getBlockVector3(),
|
275
|
-
BlockVector3.at(
|
275
|
+
BlockVector3.at(
|
276
|
+
swapPos.getX() + pos2.getX() - pos1.getX(),
|
276
277
|
pos1.getY(),
|
277
278
|
swapPos.getZ() + pos2.getZ() - pos1.getZ()
|
278
279
|
)
|
@@ -372,17 +373,6 @@ public abstract class RegionManager {
|
|
372
373
|
});
|
373
374
|
}
|
374
375
|
|
375
|
-
@Deprecated(forRemoval = true, since = "6.6.0")
|
376
|
-
public void setBiome(
|
377
|
-
final CuboidRegion region,
|
378
|
-
final int extendBiome,
|
379
|
-
final BiomeType biome,
|
380
|
-
final String world,
|
381
|
-
final Runnable whenDone
|
382
|
-
) {
|
383
|
-
setBiome(region, extendBiome, biome, PlotSquared.get().getPlotAreaManager().getPlotAreas(world, region)[0], whenDone);
|
384
|
-
}
|
385
|
-
|
386
376
|
/**
|
387
377
|
* Set a region to a biome type.
|
388
378
|
*
|
@@ -19,12 +19,10 @@
|
|
19
19
|
package com.plotsquared.core.util;
|
20
20
|
|
21
21
|
import com.plotsquared.core.location.Location;
|
22
|
-
import com.sk89q.worldedit.math.BlockVector2;
|
23
22
|
import com.sk89q.worldedit.math.BlockVector3;
|
24
23
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
25
24
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
26
25
|
|
27
|
-
import java.awt.geom.Rectangle2D;
|
28
26
|
import java.util.Collection;
|
29
27
|
import java.util.Iterator;
|
30
28
|
|
@@ -68,11 +66,6 @@ public class RegionUtil {
|
|
68
66
|
return new CuboidRegion(min, max);
|
69
67
|
}
|
70
68
|
|
71
|
-
@Deprecated(forRemoval = true, since = "6.6.0")
|
72
|
-
public static CuboidRegion createRegion(int pos1x, int pos2x, int pos1z, int pos2z) {
|
73
|
-
return createRegion(pos1x, pos2x, 0, 255, pos1z, pos2z);
|
74
|
-
}
|
75
|
-
|
76
69
|
public static CuboidRegion createRegion(
|
77
70
|
int pos1x, int pos2x, int pos1y, int pos2y, int pos1z,
|
78
71
|
int pos2z
|
@@ -95,16 +88,6 @@ public class RegionUtil {
|
|
95
88
|
.getY() && y <= max.getY();
|
96
89
|
}
|
97
90
|
|
98
|
-
/**
|
99
|
-
* @deprecated Unused internally. Scheduled for removal in next major release.
|
100
|
-
*/
|
101
|
-
@Deprecated(forRemoval = true, since = "6.11.1")
|
102
|
-
public static @NonNull Rectangle2D toRectangle(final @NonNull CuboidRegion region) {
|
103
|
-
final BlockVector2 min = region.getMinimumPoint().toBlockVector2();
|
104
|
-
final BlockVector2 max = region.getMaximumPoint().toBlockVector2();
|
105
|
-
return new Rectangle2D.Double(min.getX(), min.getZ(), max.getX(), max.getZ());
|
106
|
-
}
|
107
|
-
|
108
91
|
// Because WorldEdit (not FastAsyncWorldEdit) lack this for CuboidRegion
|
109
92
|
public static boolean intersects(CuboidRegion region, CuboidRegion other) {
|
110
93
|
BlockVector3 regionMin = region.getMinimumPoint();
|
@@ -18,19 +18,13 @@
|
|
18
18
|
*/
|
19
19
|
package com.plotsquared.core.util;
|
20
20
|
|
21
|
-
import com.plotsquared.core.PlotSquared;
|
22
|
-
import com.plotsquared.core.configuration.caption.Caption;
|
23
21
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
24
22
|
|
25
|
-
import java.lang.reflect.Array;
|
26
23
|
import java.util.ArrayList;
|
27
24
|
import java.util.Arrays;
|
28
25
|
import java.util.Collection;
|
29
26
|
import java.util.Comparator;
|
30
|
-
import java.util.Iterator;
|
31
27
|
import java.util.List;
|
32
|
-
import java.util.Map;
|
33
|
-
import java.util.Map.Entry;
|
34
28
|
import java.util.Set;
|
35
29
|
import java.util.regex.Pattern;
|
36
30
|
|
@@ -39,31 +33,6 @@ public class StringMan {
|
|
39
33
|
// Stolen from https://stackoverflow.com/a/366532/12620913 | Debug: https://regex101.com/r/DudJLb/1
|
40
34
|
private static final Pattern STRING_SPLIT_PATTERN = Pattern.compile("[^\\s\"]+|\"([^\"]*)\"");
|
41
35
|
|
42
|
-
/**
|
43
|
-
* @deprecated Unused internally. Scheduled for removal in next major release.
|
44
|
-
*/
|
45
|
-
@Deprecated(forRemoval = true, since = "6.11.1")
|
46
|
-
public static String replaceFromMap(String string, Map<String, String> replacements) {
|
47
|
-
StringBuilder sb = new StringBuilder(string);
|
48
|
-
int size = string.length();
|
49
|
-
for (Entry<String, String> entry : replacements.entrySet()) {
|
50
|
-
if (size == 0) {
|
51
|
-
break;
|
52
|
-
}
|
53
|
-
String key = entry.getKey();
|
54
|
-
String value = entry.getValue();
|
55
|
-
int start = sb.indexOf(key, 0);
|
56
|
-
while (start > -1) {
|
57
|
-
int end = start + key.length();
|
58
|
-
int nextSearchStart = start + value.length();
|
59
|
-
sb.replace(start, end, value);
|
60
|
-
size -= end - start;
|
61
|
-
start = sb.indexOf(key, nextSearchStart);
|
62
|
-
}
|
63
|
-
}
|
64
|
-
return sb.toString();
|
65
|
-
}
|
66
|
-
|
67
36
|
public static int intersection(Set<String> options, String[] toCheck) {
|
68
37
|
int count = 0;
|
69
38
|
for (String check : toCheck) {
|
@@ -74,107 +43,6 @@ public class StringMan {
|
|
74
43
|
return count;
|
75
44
|
}
|
76
45
|
|
77
|
-
/**
|
78
|
-
* @deprecated Unused internally. Scheduled for removal in next major release.
|
79
|
-
*/
|
80
|
-
@Deprecated(forRemoval = true, since = "6.11.1")
|
81
|
-
public static String getString(Object obj) {
|
82
|
-
if (obj == null) {
|
83
|
-
return "null";
|
84
|
-
}
|
85
|
-
if (obj instanceof String) {
|
86
|
-
return (String) obj;
|
87
|
-
}
|
88
|
-
if (obj instanceof Caption) {
|
89
|
-
return ((Caption) obj).getComponent(PlotSquared.platform());
|
90
|
-
}
|
91
|
-
if (obj.getClass().isArray()) {
|
92
|
-
StringBuilder result = new StringBuilder();
|
93
|
-
String prefix = "";
|
94
|
-
|
95
|
-
for (int i = 0; i < Array.getLength(obj); i++) {
|
96
|
-
result.append(prefix).append(getString(Array.get(obj, i)));
|
97
|
-
prefix = ",";
|
98
|
-
}
|
99
|
-
return "( " + result + " )";
|
100
|
-
} else if (obj instanceof Collection<?>) {
|
101
|
-
StringBuilder result = new StringBuilder();
|
102
|
-
String prefix = "";
|
103
|
-
for (Object element : (Collection<?>) obj) {
|
104
|
-
result.append(prefix).append(getString(element));
|
105
|
-
prefix = ",";
|
106
|
-
}
|
107
|
-
return "[ " + result + " ]";
|
108
|
-
} else {
|
109
|
-
return obj.toString();
|
110
|
-
}
|
111
|
-
}
|
112
|
-
|
113
|
-
/**
|
114
|
-
* @deprecated Unused internally. Scheduled for removal in next major release.
|
115
|
-
*/
|
116
|
-
@Deprecated(forRemoval = true, since = "6.11.1")
|
117
|
-
public static String replaceFirst(char c, String s) {
|
118
|
-
if (s == null) {
|
119
|
-
return "";
|
120
|
-
}
|
121
|
-
if (s.isEmpty()) {
|
122
|
-
return s;
|
123
|
-
}
|
124
|
-
char[] chars = s.toCharArray();
|
125
|
-
char[] newChars = new char[chars.length];
|
126
|
-
int used = 0;
|
127
|
-
boolean found = false;
|
128
|
-
for (char cc : chars) {
|
129
|
-
if (!found && (c == cc)) {
|
130
|
-
found = true;
|
131
|
-
} else {
|
132
|
-
newChars[used++] = cc;
|
133
|
-
}
|
134
|
-
}
|
135
|
-
if (found) {
|
136
|
-
chars = new char[newChars.length - 1];
|
137
|
-
System.arraycopy(newChars, 0, chars, 0, chars.length);
|
138
|
-
return String.valueOf(chars);
|
139
|
-
}
|
140
|
-
return s;
|
141
|
-
}
|
142
|
-
|
143
|
-
/**
|
144
|
-
* @deprecated Unused internally. Scheduled for removal in next major release.
|
145
|
-
*/
|
146
|
-
@Deprecated(forRemoval = true, since = "6.11.1")
|
147
|
-
public static String replaceAll(String string, Object... pairs) {
|
148
|
-
StringBuilder sb = new StringBuilder(string);
|
149
|
-
for (int i = 0; i < pairs.length; i += 2) {
|
150
|
-
String key = pairs[i] + "";
|
151
|
-
String value = pairs[i + 1] + "";
|
152
|
-
int start = sb.indexOf(key, 0);
|
153
|
-
while (start > -1) {
|
154
|
-
int end = start + key.length();
|
155
|
-
int nextSearchStart = start + value.length();
|
156
|
-
sb.replace(start, end, value);
|
157
|
-
start = sb.indexOf(key, nextSearchStart);
|
158
|
-
}
|
159
|
-
}
|
160
|
-
return sb.toString();
|
161
|
-
}
|
162
|
-
|
163
|
-
/**
|
164
|
-
* @deprecated Unused internally. Scheduled for removal in next major release.
|
165
|
-
*/
|
166
|
-
@Deprecated(forRemoval = true, since = "6.11.1")
|
167
|
-
public static boolean isAlphanumeric(String str) {
|
168
|
-
for (int i = 0; i < str.length(); i++) {
|
169
|
-
char c = str.charAt(i);
|
170
|
-
if ((c < 0x30) || ((c >= 0x3a) && (c <= 0x40)) || ((c > 0x5a) && (c <= 0x60)) || (c
|
171
|
-
> 0x7a)) {
|
172
|
-
return false;
|
173
|
-
}
|
174
|
-
}
|
175
|
-
return true;
|
176
|
-
}
|
177
|
-
|
178
46
|
public static boolean isAlphanumericUnd(String str) {
|
179
47
|
for (int i = 0; i < str.length(); i++) {
|
180
48
|
char c = str.charAt(i);
|
@@ -185,20 +53,6 @@ public class StringMan {
|
|
185
53
|
return true;
|
186
54
|
}
|
187
55
|
|
188
|
-
/**
|
189
|
-
* @deprecated Unused internally. Scheduled for removal in next major release.
|
190
|
-
*/
|
191
|
-
@Deprecated(forRemoval = true, since = "6.11.1")
|
192
|
-
public static boolean isAlpha(String str) {
|
193
|
-
for (int i = 0; i < str.length(); i++) {
|
194
|
-
char c = str.charAt(i);
|
195
|
-
if ((c <= 0x40) || ((c > 0x5a) && (c <= 0x60)) || (c > 0x7a)) {
|
196
|
-
return false;
|
197
|
-
}
|
198
|
-
}
|
199
|
-
return true;
|
200
|
-
}
|
201
|
-
|
202
56
|
public static String join(Collection<?> collection, String delimiter) {
|
203
57
|
return join(collection.toArray(), delimiter);
|
204
58
|
}
|
@@ -209,35 +63,6 @@ public class StringMan {
|
|
209
63
|
return join(array, delimiter);
|
210
64
|
}
|
211
65
|
|
212
|
-
/**
|
213
|
-
* @deprecated Unused internally. Scheduled for removal in next major release.
|
214
|
-
*/
|
215
|
-
@Deprecated(forRemoval = true, since = "6.11.1")
|
216
|
-
public static String join(Collection<?> collection, char delimiter) {
|
217
|
-
return join(collection.toArray(), delimiter + "");
|
218
|
-
}
|
219
|
-
|
220
|
-
/**
|
221
|
-
* @deprecated Unused internally. Scheduled for removal in next major release.
|
222
|
-
*/
|
223
|
-
@Deprecated(forRemoval = true, since = "6.11.1")
|
224
|
-
public static boolean isAsciiPrintable(char c) {
|
225
|
-
return (c >= ' ') && (c < '');
|
226
|
-
}
|
227
|
-
|
228
|
-
/**
|
229
|
-
* @deprecated Unused internally. Scheduled for removal in next major release.
|
230
|
-
*/
|
231
|
-
@Deprecated(forRemoval = true, since = "6.11.1")
|
232
|
-
public static boolean isAsciiPrintable(String s) {
|
233
|
-
for (char c : s.toCharArray()) {
|
234
|
-
if (!isAsciiPrintable(c)) {
|
235
|
-
return false;
|
236
|
-
}
|
237
|
-
}
|
238
|
-
return true;
|
239
|
-
}
|
240
|
-
|
241
66
|
public static int getLevenshteinDistance(String s, String t) {
|
242
67
|
int n = s.length();
|
243
68
|
int m = t.length();
|
@@ -285,31 +110,6 @@ public class StringMan {
|
|
285
110
|
return result.toString();
|
286
111
|
}
|
287
112
|
|
288
|
-
/**
|
289
|
-
* @deprecated Unused internally. Scheduled for removal in next major release.
|
290
|
-
*/
|
291
|
-
@Deprecated(forRemoval = true, since = "6.11.1")
|
292
|
-
public static String join(int[] array, String delimiter) {
|
293
|
-
Integer[] wrapped = new Integer[array.length];
|
294
|
-
for (int i = 0; i < array.length; i++) {
|
295
|
-
wrapped[i] = array[i];
|
296
|
-
}
|
297
|
-
return join(wrapped, delimiter);
|
298
|
-
}
|
299
|
-
|
300
|
-
/**
|
301
|
-
* @deprecated Unused internally. Scheduled for removal in next major release.
|
302
|
-
*/
|
303
|
-
@Deprecated(forRemoval = true, since = "6.11.1")
|
304
|
-
public static boolean isEqualToAny(String a, String... args) {
|
305
|
-
for (String arg : args) {
|
306
|
-
if (StringMan.isEqual(a, arg)) {
|
307
|
-
return true;
|
308
|
-
}
|
309
|
-
}
|
310
|
-
return false;
|
311
|
-
}
|
312
|
-
|
313
113
|
public static boolean isEqualIgnoreCaseToAny(@NonNull String a, String... args) {
|
314
114
|
for (String arg : args) {
|
315
115
|
if (a.equalsIgnoreCase(arg)) {
|
@@ -328,53 +128,12 @@ public class StringMan {
|
|
328
128
|
return a.equals(b);
|
329
129
|
}
|
330
130
|
|
331
|
-
/**
|
332
|
-
* @deprecated Unused internally. Scheduled for removal in next major release.
|
333
|
-
*/
|
334
|
-
@Deprecated(forRemoval = true, since = "6.11.1")
|
335
|
-
public static boolean isEqualIgnoreCase(String a, String b) {
|
336
|
-
return a.equals(b) || ((a != null) && (b != null) && (a.length() == b.length()) && a
|
337
|
-
.equalsIgnoreCase(b));
|
338
|
-
}
|
339
|
-
|
340
131
|
public static String repeat(String s, int n) {
|
341
132
|
StringBuilder sb = new StringBuilder();
|
342
133
|
sb.append(String.valueOf(s).repeat(Math.max(0, n)));
|
343
134
|
return sb.toString();
|
344
135
|
}
|
345
136
|
|
346
|
-
/**
|
347
|
-
* @deprecated Unused internally. Scheduled for removal in next major release.
|
348
|
-
*/
|
349
|
-
@Deprecated(forRemoval = true, since = "6.11.1")
|
350
|
-
public static boolean contains(String name, char c) {
|
351
|
-
for (char current : name.toCharArray()) {
|
352
|
-
if (c == current) {
|
353
|
-
return true;
|
354
|
-
}
|
355
|
-
}
|
356
|
-
return false;
|
357
|
-
}
|
358
|
-
|
359
|
-
/**
|
360
|
-
* @deprecated Unused internally. Scheduled for removal in next major release.
|
361
|
-
*/
|
362
|
-
@Deprecated(forRemoval = true, since = "6.11.1")
|
363
|
-
public <T> Collection<T> match(Collection<T> col, String startsWith) {
|
364
|
-
if (col == null) {
|
365
|
-
return null;
|
366
|
-
}
|
367
|
-
startsWith = startsWith.toLowerCase();
|
368
|
-
Iterator<?> iterator = col.iterator();
|
369
|
-
while (iterator.hasNext()) {
|
370
|
-
Object item = iterator.next();
|
371
|
-
if (item == null || !item.toString().toLowerCase().startsWith(startsWith)) {
|
372
|
-
iterator.remove();
|
373
|
-
}
|
374
|
-
}
|
375
|
-
return col;
|
376
|
-
}
|
377
|
-
|
378
137
|
/**
|
379
138
|
* @param message an input string
|
380
139
|
* @return a list of strings
|
@@ -25,7 +25,6 @@ import com.plotsquared.core.command.Command;
|
|
25
25
|
import com.plotsquared.core.command.CommandCategory;
|
26
26
|
import com.plotsquared.core.command.RequiredType;
|
27
27
|
import com.plotsquared.core.configuration.Settings;
|
28
|
-
import com.plotsquared.core.player.ConsolePlayer;
|
29
28
|
import com.plotsquared.core.player.PlotPlayer;
|
30
29
|
import com.plotsquared.core.plot.Plot;
|
31
30
|
import com.plotsquared.core.plot.PlotArea;
|
@@ -67,23 +66,6 @@ public final class TabCompletions {
|
|
67
66
|
"This is a utility class and cannot be instantiated");
|
68
67
|
}
|
69
68
|
|
70
|
-
/**
|
71
|
-
* Get a list of tab completions corresponding to player names. This uses the UUID pipeline
|
72
|
-
* cache, so it will complete will all names known to PlotSquared
|
73
|
-
*
|
74
|
-
* @param input Command input
|
75
|
-
* @param existing Players that should not be included in completions
|
76
|
-
* @return List of completions
|
77
|
-
* @deprecated In favor {@link #completePlayers(PlotPlayer, String, List)}
|
78
|
-
*/
|
79
|
-
@Deprecated(forRemoval = true, since = "6.1.3")
|
80
|
-
public static @NonNull List<Command> completePlayers(
|
81
|
-
final @NonNull String input,
|
82
|
-
final @NonNull List<String> existing
|
83
|
-
) {
|
84
|
-
return completePlayers(ConsolePlayer.getConsole(), input, existing);
|
85
|
-
}
|
86
|
-
|
87
69
|
/**
|
88
70
|
* Get a list of tab completions corresponding to player names. This uses the UUID pipeline
|
89
71
|
* cache, so it will complete will all names known to PlotSquared
|
@@ -102,24 +84,6 @@ public final class TabCompletions {
|
|
102
84
|
return completePlayers("players", issuer, input, existing, uuid -> true);
|
103
85
|
}
|
104
86
|
|
105
|
-
/**
|
106
|
-
* Get a list of tab completions corresponding to player names added to the given plot.
|
107
|
-
*
|
108
|
-
* @param plot Plot to complete added players for
|
109
|
-
* @param input Command input
|
110
|
-
* @param existing Players that should not be included in completions
|
111
|
-
* @return List of completions
|
112
|
-
*
|
113
|
-
* @deprecated In favor {@link #completeAddedPlayers(PlotPlayer, Plot, String, List)}
|
114
|
-
*/
|
115
|
-
@Deprecated(forRemoval = true, since = "6.1.3")
|
116
|
-
public static @NonNull List<Command> completeAddedPlayers(
|
117
|
-
final @NonNull Plot plot,
|
118
|
-
final @NonNull String input, final @NonNull List<String> existing
|
119
|
-
) {
|
120
|
-
return completeAddedPlayers(ConsolePlayer.getConsole(), plot, input, existing);
|
121
|
-
}
|
122
|
-
|
123
87
|
/**
|
124
88
|
* Get a list of tab completions corresponding to player names added to the given plot.
|
125
89
|
*
|
@@ -251,24 +215,6 @@ public final class TabCompletions {
|
|
251
215
|
return Collections.unmodifiableList(completions);
|
252
216
|
}
|
253
217
|
|
254
|
-
/**
|
255
|
-
* @param cacheIdentifier Cache key
|
256
|
-
* @param input Command input
|
257
|
-
* @param existing Players that should not be included in completions
|
258
|
-
* @param uuidFilter Filter applied before caching values
|
259
|
-
* @return List of completions
|
260
|
-
* @deprecated In favor {@link #completePlayers(String, PlotPlayer, String, List, Predicate)}
|
261
|
-
*/
|
262
|
-
@SuppressWarnings("unused")
|
263
|
-
@Deprecated(forRemoval = true, since = "6.1.3")
|
264
|
-
private static List<Command> completePlayers(
|
265
|
-
final @NonNull String cacheIdentifier,
|
266
|
-
final @NonNull String input, final @NonNull List<String> existing,
|
267
|
-
final @NonNull Predicate<UUID> uuidFilter
|
268
|
-
) {
|
269
|
-
return completePlayers(cacheIdentifier, ConsolePlayer.getConsole(), input, existing, uuidFilter);
|
270
|
-
}
|
271
|
-
|
272
218
|
/**
|
273
219
|
* @param cacheIdentifier Cache key
|
274
220
|
* @param issuer The player who issued the tab completion
|
@@ -292,8 +238,8 @@ public final class TabCompletions {
|
|
292
238
|
PlotSquared.get().getImpromptuUUIDPipeline().getAllImmediately();
|
293
239
|
players = new ArrayList<>(mappings.size());
|
294
240
|
for (final UUIDMapping mapping : mappings) {
|
295
|
-
if (uuidFilter.test(mapping.
|
296
|
-
players.add(mapping.
|
241
|
+
if (uuidFilter.test(mapping.uuid())) {
|
242
|
+
players.add(mapping.username());
|
297
243
|
}
|
298
244
|
}
|
299
245
|
cachedCompletionValues.put(cacheIdentifier, players);
|
@@ -58,37 +58,6 @@ public class WEManager {
|
|
58
58
|
return false;
|
59
59
|
}
|
60
60
|
|
61
|
-
/**
|
62
|
-
* @deprecated Unused internally. Scheduled for removal in next major release.
|
63
|
-
*/
|
64
|
-
@Deprecated(forRemoval = true, since = "6.11.1")
|
65
|
-
public static boolean maskContains(Set<CuboidRegion> mask, double dx, double dy, double dz) {
|
66
|
-
int x = Math.toIntExact(Math.round(dx >= 0 ? dx - 0.5 : dx + 0.5));
|
67
|
-
int y = Math.toIntExact(Math.round(dy - 0.5));
|
68
|
-
int z = Math.toIntExact(Math.round(dz >= 0 ? dz - 0.5 : dz + 0.5));
|
69
|
-
for (CuboidRegion region : mask) {
|
70
|
-
if (RegionUtil.contains(region, x, y, z)) {
|
71
|
-
return true;
|
72
|
-
}
|
73
|
-
}
|
74
|
-
return false;
|
75
|
-
}
|
76
|
-
|
77
|
-
/**
|
78
|
-
* @deprecated Unused internally. Scheduled for removal in next major release.
|
79
|
-
*/
|
80
|
-
@Deprecated(forRemoval = true, since = "6.11.1")
|
81
|
-
public static boolean maskContains(Set<CuboidRegion> mask, double dx, double dz) {
|
82
|
-
int x = Math.toIntExact(Math.round(dx >= 0 ? dx - 0.5 : dx + 0.5));
|
83
|
-
int z = Math.toIntExact(Math.round(dz >= 0 ? dz - 0.5 : dz + 0.5));
|
84
|
-
for (CuboidRegion region : mask) {
|
85
|
-
if (RegionUtil.contains(region, x, z)) {
|
86
|
-
return true;
|
87
|
-
}
|
88
|
-
}
|
89
|
-
return false;
|
90
|
-
}
|
91
|
-
|
92
61
|
public static HashSet<CuboidRegion> getMask(PlotPlayer<?> player) {
|
93
62
|
HashSet<CuboidRegion> regions = new HashSet<>();
|
94
63
|
UUID uuid = player.getUUID();
|
@@ -124,25 +93,4 @@ public class WEManager {
|
|
124
93
|
return regions;
|
125
94
|
}
|
126
95
|
|
127
|
-
/**
|
128
|
-
* @deprecated Unused internally. Scheduled for removal in next major release.
|
129
|
-
*/
|
130
|
-
@Deprecated(forRemoval = true, since = "6.11.1")
|
131
|
-
public static boolean intersects(CuboidRegion region1, CuboidRegion region2) {
|
132
|
-
return RegionUtil.intersects(region1, region2);
|
133
|
-
}
|
134
|
-
|
135
|
-
/**
|
136
|
-
* @deprecated Unused internally. Scheduled for removal in next major release.
|
137
|
-
*/
|
138
|
-
@Deprecated(forRemoval = true, since = "6.11.1")
|
139
|
-
public static boolean regionContains(CuboidRegion selection, HashSet<CuboidRegion> mask) {
|
140
|
-
for (CuboidRegion region : mask) {
|
141
|
-
if (intersects(region, selection)) {
|
142
|
-
return true;
|
143
|
-
}
|
144
|
-
}
|
145
|
-
return false;
|
146
|
-
}
|
147
|
-
|
148
96
|
}
|
@@ -30,14 +30,13 @@ import com.sk89q.jnbt.NBTInputStream;
|
|
30
30
|
import com.sk89q.jnbt.NBTOutputStream;
|
31
31
|
import com.sk89q.jnbt.Tag;
|
32
32
|
import com.sk89q.worldedit.math.BlockVector2;
|
33
|
-
import com.sk89q.worldedit.math.BlockVector3;
|
34
33
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
35
34
|
import com.sk89q.worldedit.world.World;
|
36
35
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
37
36
|
import com.sk89q.worldedit.world.block.BlockState;
|
38
37
|
import com.sk89q.worldedit.world.block.BlockType;
|
39
38
|
import com.sk89q.worldedit.world.entity.EntityType;
|
40
|
-
import net.kyori.adventure.text.minimessage.
|
39
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
41
40
|
import org.checkerframework.checker.index.qual.NonNegative;
|
42
41
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
43
42
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
@@ -63,26 +62,6 @@ import java.util.zip.ZipOutputStream;
|
|
63
62
|
|
64
63
|
public abstract class WorldUtil {
|
65
64
|
|
66
|
-
/**
|
67
|
-
* Set the biome in a region
|
68
|
-
*
|
69
|
-
* @param world World name
|
70
|
-
* @param p1x Min X
|
71
|
-
* @param p1z Min Z
|
72
|
-
* @param p2x Max X
|
73
|
-
* @param p2z Max Z
|
74
|
-
* @param biome Biome
|
75
|
-
* @deprecated use {@link WorldUtil#setBiome(String, CuboidRegion, BiomeType)}
|
76
|
-
*/
|
77
|
-
@Deprecated(forRemoval = true)
|
78
|
-
public static void setBiome(String world, int p1x, int p1z, int p2x, int p2z, BiomeType biome) {
|
79
|
-
World weWorld = PlotSquared.platform().worldUtil().getWeWorld(world);
|
80
|
-
BlockVector3 pos1 = BlockVector2.at(p1x, p1z).toBlockVector3(weWorld.getMinY());
|
81
|
-
BlockVector3 pos2 = BlockVector2.at(p2x, p2z).toBlockVector3(weWorld.getMaxY());
|
82
|
-
CuboidRegion region = new CuboidRegion(pos1, pos2);
|
83
|
-
PlotSquared.platform().worldUtil().setBiomes(world, region, biome);
|
84
|
-
}
|
85
|
-
|
86
65
|
/**
|
87
66
|
* Set the biome in a region
|
88
67
|
*
|
@@ -155,7 +134,7 @@ public abstract class WorldUtil {
|
|
155
134
|
public abstract void setSign(
|
156
135
|
@NonNull Location location,
|
157
136
|
@NonNull Caption[] lines,
|
158
|
-
@NonNull
|
137
|
+
@NonNull TagResolver... replacements
|
159
138
|
);
|
160
139
|
|
161
140
|
/**
|
@@ -306,7 +285,8 @@ public abstract class WorldUtil {
|
|
306
285
|
int trz = top.getZ() >> 9;
|
307
286
|
Set<BlockVector2> files = getChunkChunks(bot.getWorldName());
|
308
287
|
for (BlockVector2 mca : files) {
|
309
|
-
if (mca.getX() >= brx && mca.getX() <= trx && mca.getZ() >= brz && mca.getZ() <= trz && !added.contains(
|
288
|
+
if (mca.getX() >= brx && mca.getX() <= trx && mca.getZ() >= brz && mca.getZ() <= trz && !added.contains(
|
289
|
+
mca)) {
|
310
290
|
final File file = getMcr(plot.getWorldName(), mca.getX(), mca.getZ());
|
311
291
|
if (file != null) {
|
312
292
|
//final String name = "r." + (x - cx) + "." + (z - cz) + ".mca";
|
@@ -20,33 +20,35 @@ package com.plotsquared.core.util.helpmenu;
|
|
20
20
|
|
21
21
|
import com.plotsquared.core.command.Argument;
|
22
22
|
import com.plotsquared.core.command.Command;
|
23
|
-
import com.plotsquared.core.configuration.caption.Templates;
|
24
23
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
25
24
|
import com.plotsquared.core.player.PlotPlayer;
|
26
25
|
import com.plotsquared.core.util.StringMan;
|
26
|
+
import net.kyori.adventure.text.Component;
|
27
|
+
import net.kyori.adventure.text.ComponentLike;
|
27
28
|
import net.kyori.adventure.text.minimessage.MiniMessage;
|
28
|
-
import net.kyori.adventure.text.minimessage.
|
29
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
30
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
31
|
+
import org.jetbrains.annotations.NotNull;
|
29
32
|
|
30
|
-
public class HelpObject {
|
33
|
+
public class HelpObject implements ComponentLike {
|
31
34
|
|
32
|
-
static final MiniMessage MINI_MESSAGE = MiniMessage.
|
35
|
+
static final MiniMessage MINI_MESSAGE = MiniMessage.miniMessage();
|
33
36
|
|
34
|
-
private final
|
37
|
+
private final Component rendered;
|
35
38
|
|
36
39
|
public HelpObject(final Command command, final String label, final PlotPlayer<?> audience) {
|
37
|
-
rendered = MINI_MESSAGE.
|
40
|
+
rendered = MINI_MESSAGE.deserialize(
|
38
41
|
TranslatableCaption.of("help.help_item").getComponent(audience),
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
return rendered;
|
42
|
+
TagResolver.builder()
|
43
|
+
.tag("usage", Tag.inserting(Component.text(command.getUsage().replace("{label}", label))))
|
44
|
+
.tag("alias", Tag.inserting(Component.text(
|
45
|
+
command.getAliases().isEmpty() ? "" : StringMan.join(command.getAliases(), " | ")
|
46
|
+
)))
|
47
|
+
.tag("desc", Tag.inserting(command.getDescription().toComponent(audience)))
|
48
|
+
.tag("arguments", Tag.inserting(Component.text(buildArgumentList(command.getRequiredArguments()))))
|
49
|
+
.tag("label", Tag.inserting(Component.text(label)))
|
50
|
+
.build()
|
51
|
+
);
|
50
52
|
}
|
51
53
|
|
52
54
|
private String buildArgumentList(final Argument<?>[] arguments) {
|
@@ -61,4 +63,9 @@ public class HelpObject {
|
|
61
63
|
return arguments.length > 0 ? builder.substring(0, builder.length() - 1) : "";
|
62
64
|
}
|
63
65
|
|
66
|
+
@Override
|
67
|
+
public @NotNull Component asComponent() {
|
68
|
+
return this.rendered;
|
69
|
+
}
|
70
|
+
|
64
71
|
}
|
@@ -22,50 +22,46 @@ import com.plotsquared.core.command.CommandCategory;
|
|
22
22
|
import com.plotsquared.core.configuration.caption.StaticCaption;
|
23
23
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
24
24
|
import com.plotsquared.core.player.PlotPlayer;
|
25
|
-
import com.plotsquared.core.util.
|
25
|
+
import com.plotsquared.core.util.ComponentHelper;
|
26
|
+
import net.kyori.adventure.text.Component;
|
26
27
|
import net.kyori.adventure.text.minimessage.MiniMessage;
|
27
|
-
import net.kyori.adventure.text.minimessage.
|
28
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
29
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
28
30
|
|
29
31
|
import java.util.ArrayList;
|
30
32
|
import java.util.List;
|
31
33
|
|
32
34
|
public class HelpPage {
|
33
35
|
|
34
|
-
private static final MiniMessage MINI_MESSAGE = MiniMessage.
|
36
|
+
private static final MiniMessage MINI_MESSAGE = MiniMessage.miniMessage();
|
35
37
|
private final List<HelpObject> helpObjects;
|
36
|
-
private final
|
37
|
-
private final Template curTemplate;
|
38
|
-
private final Template maxTemplate;
|
38
|
+
private final TagResolver pageHeaderResolver;
|
39
39
|
|
40
40
|
public HelpPage(CommandCategory category, int currentPage, int maxPages) {
|
41
41
|
this.helpObjects = new ArrayList<>();
|
42
|
-
this.
|
43
|
-
|
44
|
-
|
42
|
+
this.pageHeaderResolver = TagResolver.builder()
|
43
|
+
.tag("category", Tag.inserting(Component.text(category == null ? "ALL" : category.name())))
|
44
|
+
.tag("current", Tag.inserting(Component.text(currentPage + 1)))
|
45
|
+
.tag("max", Tag.inserting(Component.text(maxPages + 1)))
|
46
|
+
.build();
|
45
47
|
}
|
46
48
|
|
47
49
|
public void render(PlotPlayer<?> player) {
|
48
50
|
if (this.helpObjects.size() < 1) {
|
49
51
|
player.sendMessage(TranslatableCaption.of("help.no_permission"));
|
50
52
|
} else {
|
51
|
-
|
52
|
-
|
53
|
-
"page_header",
|
54
|
-
MINI_MESSAGE.parse(
|
53
|
+
TagResolver contentResolver = TagResolver.builder()
|
54
|
+
.tag("header", Tag.inserting(TranslatableCaption.of("help.help_header").toComponent(player)))
|
55
|
+
.tag("page_header", Tag.inserting(MINI_MESSAGE.deserialize(
|
55
56
|
TranslatableCaption.of("help.help_page_header").getComponent(player),
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
)
|
60
|
-
|
61
|
-
Template help_objects = Template.of("help_objects", StringMan.join(this.helpObjects, "\n"));
|
62
|
-
Template footer = Template.of("footer", TranslatableCaption.of("help.help_footer").getComponent(player));
|
57
|
+
pageHeaderResolver
|
58
|
+
)))
|
59
|
+
.tag("help_objects", Tag.inserting(ComponentHelper.join(this.helpObjects, Component.text("\n"))))
|
60
|
+
.tag("footer", Tag.inserting(TranslatableCaption.of("help.help_footer").toComponent(player)))
|
61
|
+
.build();
|
63
62
|
player.sendMessage(
|
64
63
|
StaticCaption.of("<header>\n<page_header>\n<help_objects>\n<footer>"),
|
65
|
-
|
66
|
-
page_header,
|
67
|
-
help_objects,
|
68
|
-
footer
|
64
|
+
contentResolver
|
69
65
|
);
|
70
66
|
}
|
71
67
|
}
|
@@ -35,7 +35,6 @@ import com.plotsquared.core.plot.flag.implementations.ServerPlotFlag;
|
|
35
35
|
import com.plotsquared.core.util.EventDispatcher;
|
36
36
|
import com.plotsquared.core.util.PlayerManager;
|
37
37
|
import net.kyori.adventure.text.Component;
|
38
|
-
import net.kyori.adventure.text.minimessage.MiniMessage;
|
39
38
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
40
39
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
41
40
|
|
@@ -74,8 +73,7 @@ public final class PlaceholderRegistry {
|
|
74
73
|
* @return a legacy-formatted string.
|
75
74
|
*/
|
76
75
|
private static String legacyComponent(TranslatableCaption caption, LocaleHolder localeHolder) {
|
77
|
-
|
78
|
-
return PlotSquared.platform().toLegacyPlatformString(component);
|
76
|
+
return PlotSquared.platform().toLegacyPlatformString(caption.toComponent(localeHolder).asComponent());
|
79
77
|
}
|
80
78
|
|
81
79
|
private void registerDefault() {
|
@@ -104,7 +102,7 @@ public final class PlaceholderRegistry {
|
|
104
102
|
return plot.getAlias();
|
105
103
|
});
|
106
104
|
this.createPlaceholder("currentplot_owner", (player, plot) -> {
|
107
|
-
if (plot.getFlag(ServerPlotFlag.class)){
|
105
|
+
if (plot.getFlag(ServerPlotFlag.class)) {
|
108
106
|
return legacyComponent(TranslatableCaption.of("info.server"), player);
|
109
107
|
}
|
110
108
|
final UUID plotOwner = plot.getOwnerAbs();
|
@@ -302,17 +300,9 @@ public final class PlaceholderRegistry {
|
|
302
300
|
/**
|
303
301
|
* Event called when a new {@link Placeholder} has been added
|
304
302
|
*/
|
305
|
-
public
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
public PlaceholderAddedEvent(Placeholder placeholder) {
|
310
|
-
this.placeholder = placeholder;
|
311
|
-
}
|
312
|
-
|
313
|
-
public Placeholder getPlaceholder() {
|
314
|
-
return this.placeholder;
|
315
|
-
}
|
303
|
+
public record PlaceholderAddedEvent(
|
304
|
+
Placeholder placeholder
|
305
|
+
) {
|
316
306
|
|
317
307
|
}
|
318
308
|
|
@@ -18,7 +18,6 @@
|
|
18
18
|
*/
|
19
19
|
package com.plotsquared.core.util.task;
|
20
20
|
|
21
|
-
import com.plotsquared.core.configuration.caption.Templates;
|
22
21
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
23
22
|
import com.plotsquared.core.events.PlotMergeEvent;
|
24
23
|
import com.plotsquared.core.events.Result;
|
@@ -29,6 +28,9 @@ import com.plotsquared.core.player.PlotPlayer;
|
|
29
28
|
import com.plotsquared.core.plot.Plot;
|
30
29
|
import com.plotsquared.core.plot.PlotArea;
|
31
30
|
import com.plotsquared.core.util.EventDispatcher;
|
31
|
+
import net.kyori.adventure.text.Component;
|
32
|
+
import net.kyori.adventure.text.minimessage.tag.Tag;
|
33
|
+
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
32
34
|
|
33
35
|
import java.util.concurrent.Callable;
|
34
36
|
|
@@ -68,7 +70,7 @@ public final class AutoClaimFinishTask implements Callable<Boolean> {
|
|
68
70
|
if (event.getEventResult() == Result.DENY) {
|
69
71
|
player.sendMessage(
|
70
72
|
TranslatableCaption.of("events.event_denied"),
|
71
|
-
|
73
|
+
TagResolver.resolver("value", Tag.inserting(Component.text("Auto Merge")))
|
72
74
|
);
|
73
75
|
} else {
|
74
76
|
if (plot.getPlotModificationManager().autoMerge(event.getDir(), event.getMax(), player.getUUID(), player, true)) {
|
@@ -67,8 +67,8 @@ public class CacheUUIDService implements UUIDService, Consumer<List<UUIDMapping>
|
|
67
67
|
@Override
|
68
68
|
public void accept(final @NonNull List<@NonNull UUIDMapping> uuidMappings) {
|
69
69
|
for (final UUIDMapping mapping : uuidMappings) {
|
70
|
-
this.uuidCache.put(mapping.
|
71
|
-
this.usernameCache.put(mapping.
|
70
|
+
this.uuidCache.put(mapping.uuid(), mapping);
|
71
|
+
this.usernameCache.put(mapping.username(), mapping);
|
72
72
|
}
|
73
73
|
}
|
74
74
|
|
@@ -20,53 +20,14 @@ package com.plotsquared.core.uuid;
|
|
20
20
|
|
21
21
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
22
22
|
|
23
|
-
import java.util.Objects;
|
24
23
|
import java.util.UUID;
|
25
24
|
|
26
25
|
/**
|
27
26
|
* A pair consisting of a UUID and a username
|
28
27
|
*/
|
29
|
-
public
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
public UUIDMapping(final @NonNull UUID uuid, final @NonNull String username) {
|
35
|
-
this.uuid = uuid;
|
36
|
-
this.username = username;
|
37
|
-
}
|
38
|
-
|
39
|
-
public @NonNull String getUsername() {
|
40
|
-
return this.username;
|
41
|
-
}
|
42
|
-
|
43
|
-
public @NonNull UUID getUuid() {
|
44
|
-
return this.uuid;
|
45
|
-
}
|
46
|
-
|
47
|
-
@Override
|
48
|
-
public boolean equals(final Object o) {
|
49
|
-
if (this == o) {
|
50
|
-
return true;
|
51
|
-
}
|
52
|
-
if (o == null || getClass() != o.getClass()) {
|
53
|
-
return false;
|
54
|
-
}
|
55
|
-
final UUIDMapping that = (UUIDMapping) o;
|
56
|
-
return uuid.equals(that.uuid) && username.equals(that.username);
|
57
|
-
}
|
58
|
-
|
59
|
-
@Override
|
60
|
-
public int hashCode() {
|
61
|
-
return Objects.hash(uuid, username);
|
62
|
-
}
|
63
|
-
|
64
|
-
/**
|
65
|
-
* @deprecated This method is not meant to be invoked or overridden, with no replacement.
|
66
|
-
*/
|
67
|
-
@Deprecated(forRemoval = true, since = "6.6.0")
|
68
|
-
protected boolean canEqual(final Object other) {
|
69
|
-
return other instanceof UUIDMapping;
|
70
|
-
}
|
28
|
+
public record UUIDMapping(
|
29
|
+
@NonNull UUID uuid,
|
30
|
+
@NonNull String username
|
31
|
+
) {
|
71
32
|
|
72
33
|
}
|
@@ -41,13 +41,10 @@ import java.util.UUID;
|
|
41
41
|
import java.util.concurrent.CompletableFuture;
|
42
42
|
import java.util.concurrent.ExecutionException;
|
43
43
|
import java.util.concurrent.Executor;
|
44
|
-
import java.util.concurrent.Executors;
|
45
|
-
import java.util.concurrent.ScheduledExecutorService;
|
46
44
|
import java.util.concurrent.TimeUnit;
|
47
45
|
import java.util.concurrent.TimeoutException;
|
48
46
|
import java.util.function.BiConsumer;
|
49
47
|
import java.util.function.Consumer;
|
50
|
-
import java.util.function.Function;
|
51
48
|
|
52
49
|
/**
|
53
50
|
* An UUID pipeline is essentially an ordered list of
|
@@ -65,7 +62,6 @@ public class UUIDPipeline {
|
|
65
62
|
private final Executor executor;
|
66
63
|
private final List<UUIDService> serviceList;
|
67
64
|
private final List<Consumer<List<UUIDMapping>>> consumerList;
|
68
|
-
private final ScheduledExecutorService timeoutExecutor;
|
69
65
|
|
70
66
|
/**
|
71
67
|
* Construct a new UUID pipeline
|
@@ -77,7 +73,6 @@ public class UUIDPipeline {
|
|
77
73
|
this.executor = executor;
|
78
74
|
this.serviceList = Lists.newLinkedList();
|
79
75
|
this.consumerList = Lists.newLinkedList();
|
80
|
-
this.timeoutExecutor = Executors.newSingleThreadScheduledExecutor();
|
81
76
|
}
|
82
77
|
|
83
78
|
/**
|
@@ -162,7 +157,7 @@ public class UUIDPipeline {
|
|
162
157
|
TimeUnit.MILLISECONDS
|
163
158
|
);
|
164
159
|
if (mappings.size() == 1) {
|
165
|
-
return mappings.get(0).
|
160
|
+
return mappings.get(0).uuid();
|
166
161
|
}
|
167
162
|
} catch (InterruptedException | ExecutionException e) {
|
168
163
|
e.printStackTrace();
|
@@ -187,7 +182,7 @@ public class UUIDPipeline {
|
|
187
182
|
try {
|
188
183
|
final List<UUIDMapping> mappings = this.getNames(Collections.singletonList(uuid)).get(timeout, TimeUnit.MILLISECONDS);
|
189
184
|
if (mappings.size() == 1) {
|
190
|
-
return mappings.get(0).
|
185
|
+
return mappings.get(0).username();
|
191
186
|
}
|
192
187
|
} catch (InterruptedException | ExecutionException e) {
|
193
188
|
e.printStackTrace();
|
@@ -207,16 +202,14 @@ public class UUIDPipeline {
|
|
207
202
|
* @param uuid UUID consumer
|
208
203
|
*/
|
209
204
|
public void getSingle(final @NonNull String username, final @NonNull BiConsumer<@Nullable UUID, @Nullable Throwable> uuid) {
|
210
|
-
this.getUUIDs(Collections.singletonList(username))
|
211
|
-
|
212
|
-
Function.identity()
|
213
|
-
)
|
205
|
+
this.getUUIDs(Collections.singletonList(username))
|
206
|
+
.orTimeout(Settings.UUID.NON_BLOCKING_TIMEOUT, TimeUnit.MILLISECONDS)
|
214
207
|
.whenComplete((uuids, throwable) -> {
|
215
208
|
if (throwable != null) {
|
216
209
|
uuid.accept(null, throwable);
|
217
210
|
} else {
|
218
211
|
if (!uuids.isEmpty()) {
|
219
|
-
uuid.accept(uuids.get(0).
|
212
|
+
uuid.accept(uuids.get(0).uuid(), null);
|
220
213
|
} else {
|
221
214
|
uuid.accept(null, null);
|
222
215
|
}
|
@@ -231,16 +224,14 @@ public class UUIDPipeline {
|
|
231
224
|
* @param username Username consumer
|
232
225
|
*/
|
233
226
|
public void getSingle(final @NonNull UUID uuid, final @NonNull BiConsumer<@Nullable String, @Nullable Throwable> username) {
|
234
|
-
this.getNames(Collections.singletonList(uuid))
|
235
|
-
|
236
|
-
Function.identity()
|
237
|
-
)
|
227
|
+
this.getNames(Collections.singletonList(uuid))
|
228
|
+
.orTimeout(Settings.UUID.NON_BLOCKING_TIMEOUT, TimeUnit.MILLISECONDS)
|
238
229
|
.whenComplete((uuids, throwable) -> {
|
239
230
|
if (throwable != null) {
|
240
231
|
username.accept(null, throwable);
|
241
232
|
} else {
|
242
233
|
if (!uuids.isEmpty()) {
|
243
|
-
username.accept(uuids.get(0).
|
234
|
+
username.accept(uuids.get(0).username(), null);
|
244
235
|
} else {
|
245
236
|
username.accept(null, null);
|
246
237
|
}
|
@@ -262,7 +253,7 @@ public class UUIDPipeline {
|
|
262
253
|
final @NonNull Collection<@NonNull UUID> requests,
|
263
254
|
final long timeout
|
264
255
|
) {
|
265
|
-
return this.getNames(requests).
|
256
|
+
return this.getNames(requests).orTimeout(timeout, TimeUnit.MILLISECONDS);
|
266
257
|
}
|
267
258
|
|
268
259
|
/**
|
@@ -279,13 +270,7 @@ public class UUIDPipeline {
|
|
279
270
|
final @NonNull Collection<String> requests,
|
280
271
|
final long timeout
|
281
272
|
) {
|
282
|
-
return this.getUUIDs(requests).
|
283
|
-
}
|
284
|
-
|
285
|
-
private @NonNull CompletableFuture<@NonNull List<@NonNull UUIDMapping>> timeoutAfter(final long timeout) {
|
286
|
-
final CompletableFuture<List<UUIDMapping>> result = new CompletableFuture<>();
|
287
|
-
this.timeoutExecutor.schedule(() -> result.completeExceptionally(new TimeoutException()), timeout, TimeUnit.MILLISECONDS);
|
288
|
-
return result;
|
273
|
+
return this.getUUIDs(requests).orTimeout(timeout, TimeUnit.MILLISECONDS);
|
289
274
|
}
|
290
275
|
|
291
276
|
/**
|
@@ -311,7 +296,7 @@ public class UUIDPipeline {
|
|
311
296
|
if (service.canBeSynchronous()) {
|
312
297
|
final List<UUIDMapping> completedRequests = service.getNames(remainingRequests);
|
313
298
|
for (final UUIDMapping mapping : completedRequests) {
|
314
|
-
remainingRequests.remove(mapping.
|
299
|
+
remainingRequests.remove(mapping.uuid());
|
315
300
|
}
|
316
301
|
mappings.addAll(completedRequests);
|
317
302
|
} else {
|
@@ -326,7 +311,7 @@ public class UUIDPipeline {
|
|
326
311
|
for (final UUIDService service : serviceList) {
|
327
312
|
final List<UUIDMapping> completedRequests = service.getNames(remainingRequests);
|
328
313
|
for (final UUIDMapping mapping : completedRequests) {
|
329
|
-
remainingRequests.remove(mapping.
|
314
|
+
remainingRequests.remove(mapping.uuid());
|
330
315
|
}
|
331
316
|
mappings.addAll(completedRequests);
|
332
317
|
if (remainingRequests.isEmpty()) {
|
@@ -345,7 +330,7 @@ public class UUIDPipeline {
|
|
345
330
|
for (final UUID uuid : remainingRequests) {
|
346
331
|
mappings.add(new UUIDMapping(
|
347
332
|
uuid,
|
348
|
-
MINI_MESSAGE.
|
333
|
+
MINI_MESSAGE.escapeTags(TranslatableCaption
|
349
334
|
.of("info.unknown")
|
350
335
|
.getComponent(ConsolePlayer.getConsole()))
|
351
336
|
));
|
@@ -380,7 +365,7 @@ public class UUIDPipeline {
|
|
380
365
|
if (service.canBeSynchronous()) {
|
381
366
|
final List<UUIDMapping> completedRequests = service.getUUIDs(remainingRequests);
|
382
367
|
for (final UUIDMapping mapping : completedRequests) {
|
383
|
-
remainingRequests.remove(mapping.
|
368
|
+
remainingRequests.remove(mapping.username());
|
384
369
|
}
|
385
370
|
mappings.addAll(completedRequests);
|
386
371
|
} else {
|
@@ -395,7 +380,7 @@ public class UUIDPipeline {
|
|
395
380
|
for (final UUIDService service : serviceList) {
|
396
381
|
final List<UUIDMapping> completedRequests = service.getUUIDs(remainingRequests);
|
397
382
|
for (final UUIDMapping mapping : completedRequests) {
|
398
|
-
remainingRequests.remove(mapping.
|
383
|
+
remainingRequests.remove(mapping.username());
|
399
384
|
}
|
400
385
|
mappings.addAll(completedRequests);
|
401
386
|
if (remainingRequests.isEmpty()) {
|
@@ -21,8 +21,8 @@
|
|
21
21
|
"web.generating_link": "<prefix><dark_aqua>Processing plot </dark_aqua><gold><plot></gold>",
|
22
22
|
"web.plot_merged": "<prefix><red>This plot is merged and therefore cannot be downloaded</red>",
|
23
23
|
"web.generating_link_failed": "<prefix><red>Failed to generate download link for plot <plot>!</red>",
|
24
|
-
"web.generation_link_success": "<prefix><gold>Download: <gray><click:open_url
|
25
|
-
"web.generation_link_success_legacy_world": "<prefix><gold>Download: <gray><click:open_url
|
24
|
+
"web.generation_link_success": "<prefix><gold>Download: <gray><click:open_url:'<download>'><download></click></gray> \n Deletion: <gray><click:open_url:'<delete>'><delete></click></gray>\n<red>Attention: Opening the deletion link will delete the file immediately.</red></gold>",
|
25
|
+
"web.generation_link_success_legacy_world": "<prefix><gold>Download: <gray><click:open_url:'<url>'><url></click></gray></gold>",
|
26
26
|
"web.save_failed": "<prefix><red>Failed to save.</red>",
|
27
27
|
"web.load_null": "<prefix><gray>Please use </gray><dark_aqua><command> </dark_aqua><gray>to get a list of schematics.</gray>",
|
28
28
|
"web.load_failed": "<prefix><red>Failed to load schematic.</red>",
|
@@ -41,7 +41,7 @@
|
|
41
41
|
"cluster.cluster_deleted": "<prefix><dark_aqua>Successfully deleted the cluster </dark_aqua><gold><cluster></gold><dark_aqua>.</dark_aqua>",
|
42
42
|
"cluster.cluster_resized": "<prefix><dark_aqua>Successfully resized the cluster.</dark_aqua>",
|
43
43
|
"cluster.cluster_added_user": "<prefix><dark_aqua>Successfully added user to the cluster.</dark_aqua>",
|
44
|
-
"cluster.cannot_kick_player": "<prefix><red>You cannot kick
|
44
|
+
"cluster.cannot_kick_player": "<prefix><red>You cannot kick the player <gray><name></gray>.</red>",
|
45
45
|
"cluster.cluster_invited": "<prefix><gold>You have been invited to the following cluster: </gold><gray><cluster>.</gray>",
|
46
46
|
"cluster.cluster_removed": "<prefix><gold>You have been removed from cluster: </gold><gray><cluster>.</gray>",
|
47
47
|
"cluster.cluster_kicked_user": "<prefix><dark_aqua>Successfully kicked the user from the cluster.</dark_aqua>",
|
@@ -59,7 +59,7 @@
|
|
59
59
|
"worldedit.worldedit_bypass": "<prefix><gray><italic>To bypass your restrictions use </gray><dark_aqua><command></dark_aqua></italic>",
|
60
60
|
"worldedit.worldedit_bypassed": "<prefix><gray>Currently bypassing WorldEdit restriction.</gray>",
|
61
61
|
"gamemode.gamemode_was_bypassed": "<prefix><gold>You bypassed the gamemode (</gold><gray><gamemode></gray><gold>) <gold>set for </gold><gray><plot>.</gray>",
|
62
|
-
"height.height_limit": "<prefix><gold>This plot area has building height limits: Min height: </gold><gray><
|
62
|
+
"height.height_limit": "<prefix><gold>This plot area has building height limits: Min height: </gold><gray><minheight></gray><gold>, Max height: </gold><gray><maxheight></gray>",
|
63
63
|
"notification.notify_enter": "<prefix><gray><player> entered your plot (</gray><gold><area>;<plot></gold><gray>).</gray>",
|
64
64
|
"notification.notify_leave": "<prefix><gray><player> left your plot (</gray><gold><area>;<plot></gold><gray>).</gray>",
|
65
65
|
"swap.swap_overlap": "<prefix><red>The proposed areas are not allowed to overlap.</red>",
|
@@ -124,7 +124,7 @@
|
|
124
124
|
"economy.cannot_afford_merge": "<prefix><red>You cannot afford to merge the plots. It costs <gold><money></gold>.</red>",
|
125
125
|
"economy.added_balance": "<prefix><gold><money> </gold><gray>has been added to your balance.</gray>",
|
126
126
|
"economy.removed_balance": "<prefix><gold><money> </gold><gray>has been taken from your balance.</gray>",
|
127
|
-
"economy.removed_granted_plot": "<prefix><gray>You used <
|
127
|
+
"economy.removed_granted_plot": "<prefix><gray>You used <used_grants> plot grant(s), you've got </gray><gold><remaining_grants></gold> <gray>left.</gray>",
|
128
128
|
"setup.choose_generator": "<gold>What generator do you want?</gold>",
|
129
129
|
"setup.setup_not_started": "<prefix><gold>No setup started.</gold>",
|
130
130
|
"setup.setup_init": "<prefix><gold>Usage: </gold><gray>/plot setup <value></gray>",
|
@@ -281,7 +281,7 @@
|
|
281
281
|
"debugexec.expiry_already_started": "<prefix><gold>Plot expiry task already started.</gold>",
|
282
282
|
"debugexec.script_list_item": "<dark_gray>[</dark_gray><gold><number></gold><dark_gray>]</dark_gray><gold> <name></gold>",
|
283
283
|
"debugexec.analyze_done": "<prefix><gold>Done. Use </gold><gray><command></gray><gold> for more information. ",
|
284
|
-
"expiry.expired_options_clicky": "<gold><num> <are_or_is> expired: </gold><click:run_command
|
284
|
+
"expiry.expired_options_clicky": "<gold><num> <are_or_is> expired: </gold><click:run_command:'<list_cmd>'><hover:show_text:'<list_cmd>'><gray><plot></gray></hover></click>\n<dark_gray> - </dark_gray><click:run_command:'<cmd_del>'><hover:show_text:'<cmd_del>'><gray>Delete this (<cmd_del>)</gray></hover></click>\n<dark_gray> - </dark_gray><click:run_command:'<cmd_keep_1d>'><hover:show_text:'<cmd_keep_1d>'><gray>Remind later (<cmd_keep_1d>)</gray></hover></click>\n<dark_gray> - </dark_gray><click:run_command:'<cmd_keep>'><hover:show_text:'<cmd_keep>'><gray>Keep this (<cmd_keep>)</gray></hover></click>\n<dark_gray> - </dark_gray><click:run_command:'<cmd_no_show_expir>'><hover:show_text:'<cmd_no_show_expir>'><gray>Don't show me this (<cmd_no_show_expir>)</gray></hover></click>",
|
285
285
|
"debugimportworlds.single_plot_area": "<prefix><red>Must be a single plot area.</red>",
|
286
286
|
"debugimportworlds.world_container": "<prefix><red>World container must be configured to be a separate directory to your base files.</red>",
|
287
287
|
"debugroadregen.regen_done": "<prefix><gold>Regenerating plot south/east roads: </gold><gray><value></gray>\n<dark_gray> - </dark_gray><gold>Result: </gold><green>Success!</green>",
|
@@ -373,20 +373,20 @@
|
|
373
373
|
"info.plot_no_description": "<gray>No description set.</gray>",
|
374
374
|
"info.plot_caps_header": "<dark_gray><strikethrough>--------- <reset><gold>CAPS </gold><dark_gray><strikethrough>---------<reset>",
|
375
375
|
"info.plot_caps_format": "<prefix><gray>- Cap Type: </gray><gold><cap> </gold><gray>| Status: </gray><gold><current></gold><gray>/</gray><gold><limit> </gold><gray>(</gray><gold><percentage>%</gold><gray>)</gray>",
|
376
|
-
"info.plot_list_item": "<click:run_command
|
376
|
+
"info.plot_list_item": "<click:run_command:'<command_tp>'><hover:show_text:'<command_tp>'><dark_gray>[</dark_gray><gold><number></gold><dark_gray>]</dark_gray></hover></click><click:run_command:'<command_info>'> <hover:show_text:'<hover_info>'><gold> <plot></gold></hover></click><gray> - </gray><players>",
|
377
377
|
"info.plot_list_no_owner": "<dark_gray><plot></dark_gray>",
|
378
378
|
"info.plot_list_owned_by": "<gold><plot></gold>",
|
379
379
|
"info.plot_list_added_to": "<dark_aqua><plot></dark_aqua>",
|
380
380
|
"info.plot_list_denied_on": "<gray><plot></gray>",
|
381
381
|
"info.plot_list_default": "<gold><plot></gold>",
|
382
|
-
"info.plot_list_player_online": "<dark_aqua><prefix></dark_aqua><hover:show_text
|
383
|
-
"info.plot_list_player_offline": "<dark_aqua><prefix></dark_aqua><hover:show_text
|
384
|
-
"info.plot_list_player_unknown": "<hover:show_text
|
385
|
-
"info.plot_list_player_server": "<hover:show_text
|
386
|
-
"info.plot_list_player_everyone": "<hover:show_text
|
382
|
+
"info.plot_list_player_online": "<dark_aqua><prefix></dark_aqua><hover:show_text:'<dark_aqua>Online</dark_aqua>'><gold><player></gold></hover>",
|
383
|
+
"info.plot_list_player_offline": "<dark_aqua><prefix></dark_aqua><hover:show_text:'<dark_gray>Offline</dark_gray>'><gold><player></gold></hover>",
|
384
|
+
"info.plot_list_player_unknown": "<hover:show_text:'<red>The owner of this plot is unknown</red>'><white><info.unknown></white></hover>",
|
385
|
+
"info.plot_list_player_server": "<hover:show_text:'<red>The plot is owned by the server</red>'><white><info.server></white></hover>",
|
386
|
+
"info.plot_list_player_everyone": "<hover:show_text:'<blue>The plot is owned by everyone</blue>'><white><info.everyone></white></hover>",
|
387
387
|
"info.area_info_format": "<header>\n<reset><gold>Name: </gold><gray><name></gray>\n<gold>Type: </gold><gray><type></gray>\n<gold>Terrain: </gold><gray><terrain></gray>\n<gold>Usage: </gold><gray><usage>%</gray>\n<gold>Claimed: </gold><gray><claimed></gray>\n<gold>Clusters: </gold><gray><clusters></gray>\n<gold>Region: </gold><gray><region></gray>\n<gold>Generator: </gold><gray><generator></gray>\n<footer>",
|
388
388
|
"info.area_list_tooltip": "<gold>Claimed=</gold><gray><claimed></gray>\n<gold>Usage=</gold><gray><usage></gray>\n<gold>Clusters=</gold><gray><clusters></gray>\n<gold>Region=</gold><gray><region></gray>\n<gold>Generator=</gold><gray><generator></gray>",
|
389
|
-
"info.area_list_item": "<click:run_command
|
389
|
+
"info.area_list_item": "<click:run_command:'<command_tp>'><hover:show_text:'<command_tp>'><dark_gray>[</dark_gray><gold><number></gold><dark_gray>]</dark_gray></hover></click> <click:run_command:'<command_info>'><hover:show_text:'<hover_info>'><gold><area_name></gold></hover></click><gray> - </gray><gray><area_type>:<area_terrain></gray>",
|
390
390
|
"working.generating_component": "<prefix><gold>Started generating component from your settings.</gold>",
|
391
391
|
"working.clearing_done": "<prefix><dark_aqua>Plot </dark_aqua><gold><plot></gold><dark_aqua> has been cleared! Took </dark_aqua><gold><amount>ms</gold><dark_aqua>.</dark_aqua>",
|
392
392
|
"working.deleting_done": "<prefix><dark_aqua>Plot </dark_aqua><gold><plot></gold><dark_aqua> has been deleted! Took </dark_aqua><gold><amount>ms</gold><dark_aqua>.</dark_aqua>",
|
@@ -403,7 +403,7 @@
|
|
403
403
|
"list.area_list_header_paged": "<gray>(Page </gray><gold><cur></gold><gray>/</gray><gold><max></gold><gray>) </gray><gold>List of <amount> areas</gold>",
|
404
404
|
"list.plot_list_header_paged": "<gray>(Page </gray><gold><cur></gold><gray>/</gray><gold><max></gold><gray>) </gray><gold>List of <amount> plots</gold>",
|
405
405
|
"list.plot_list_header": "<prefix><gold>List of <word> plots.</gold>",
|
406
|
-
"list.page_turn": "<gold><click:run_command
|
406
|
+
"list.page_turn": "<gold><click:run_command:'<command1>'>Back</gold><dark_gray> | </dark_gray><gold><click:run_command:'<command2>'>Next</click></gold><gray><clickable></gray>",
|
407
407
|
"chat.plot_chat_spy_format": "<gray>[<gold>Plot Spy</gold>] [<gold><world>;<plot_id></gold>] <gold><sender></gold>: <gold><msg></gold></gray>",
|
408
408
|
"chat.plot_chat_format": "<gray>[<gold>Plot Chat</gold>] [<gold><world>;<plot_id></gold>] <gold><sender></gold>: <gold><msg></gold></gray>",
|
409
409
|
"chat.plot_chat_forced": "<prefix><gray>This world forces everyone to use plot chat.</gray>",
|
@@ -411,6 +411,8 @@
|
|
411
411
|
"deny.no_enter": "<prefix><red>You are denied from the plot <red><gold><plot></gold><red> and therefore not allowed to enter.</red>",
|
412
412
|
"deny.you_got_denied": "<prefix><red>You are denied from the plot you were previously on, and got teleported to spawn.</red>",
|
413
413
|
"deny.cant_remove_owner": "<prefix><red>You can't remove the plot owner.</red>",
|
414
|
+
"kick.player_not_in_plot": "<prefix><red>The player <gray><player></gray> is not on this plot.</red>",
|
415
|
+
"kick.cannot_kick_player": "<prefix><red>You cannot kick the player <gray><player></gray>.</red>",
|
414
416
|
"kick.you_got_kicked": "<prefix><dark_aqua>You got kicked from the plot!</dark_aqua>",
|
415
417
|
"trusted.trusted_added": "<prefix><dark_aqua>You successfully trusted a user to the plot.</dark_aqua>",
|
416
418
|
"trusted.plot_removed_user": "<prefix><red>Plot <plot> of which you were added to has been deleted due to owner inactivity.</red>",
|
@@ -437,7 +439,7 @@
|
|
437
439
|
"help.help_footer": "<dark_gray><strikethrough>---------<reset> <gold>PlotSquared Help </gold><dark_gray><strikethrough>---------<reset>",
|
438
440
|
"help.help_info_item": "<gold><command> <gray><category> </gray><dark_gray>- </dark_gray><gray><category_desc></gray>",
|
439
441
|
"help.help_item": "<gold><usage> <gray>[<gold><alias></gold>]</gray>\n <dark_gray>- </dark_gray><gray><desc></gray>\n",
|
440
|
-
"help.help_display_all_commands": "<
|
442
|
+
"help.help_display_all_commands": "<gray>Display all commands.</gray>",
|
441
443
|
"help.direction": "<prefix><gold>Current direction: </gold><gray><dir></gray>",
|
442
444
|
"help.no_permission": "<prefix><red>You have no permission to access commands of that sub category, hence you cannot access the help page.</red>",
|
443
445
|
"category.command_category_claiming": "<gray>Claiming</gray>",
|
@@ -486,7 +488,7 @@
|
|
486
488
|
"single.get_position": "<prefix><gold>Go to the first corner and use: <gray><command> to create position 1.</gold>",
|
487
489
|
"single.delete_world_region": "<prefix><red>Stop the server and delete: <world>/region.</red>",
|
488
490
|
"single.regeneration_complete": "<prefix><gold>Regeneration complete.</gold>",
|
489
|
-
"single.worldcreation_location": "<prefix><gold>World creation settings may be stored in multiple locations:</gold>\n<dark_gray> - </dark_gray><gray>bukkit.yml in your server's root folder.</gray>\n<dark_gray> - </dark_gray><gray>PlotSquared's
|
491
|
+
"single.worldcreation_location": "<prefix><gold>World creation settings may be stored in multiple locations:</gold>\n<dark_gray> - </dark_gray><gray>bukkit.yml in your server's root folder.</gray>\n<dark_gray> - </dark_gray><gray>PlotSquared's worlds.yml</gray>\n<dark_gray> - </dark_gray><gray>Hyperverse's worlds.yml (or any world management plugin)</gray>\n<dark_gray> - </dark_gray><red>Stop the server and delete it from these locations.</red>",
|
490
492
|
"legacyconfig.legacy_config_found": "<prefix><green>A legacy configuration file was detected. Conversion will be attempted.</green>",
|
491
493
|
"legacyconfig.legacy_config_backup": "<prefix><gold>A copy of worlds.yml has been saved in the file worlds.yml.old</gold>.",
|
492
494
|
"legacyconfig.legacy_config_replaced": "<prefix><gray><value1> has been replaced with <value2></gray>",
|
@@ -510,11 +512,11 @@
|
|
510
512
|
"flag.flag_info_header": "<dark_gray><strikethrough>---------<reset> <gold>PlotSquared Flags </gold><dark_gray><strikethrough>---------<reset>",
|
511
513
|
"flag.flag_info_footer": "<dark_gray><strikethrough>---------<reset> <gold>PlotSquared Flags </gold><dark_gray><strikethrough>---------<reset>",
|
512
514
|
"flag.flag_list_categories": "<gold><category>: </gold>",
|
513
|
-
"flag.flag_list_flag": "<click:run_command
|
515
|
+
"flag.flag_list_flag": "<click:run_command:'<command>'><hover:show_text:'<gray>Click to view information about the flag.</gray>'><gray><flag></gray></hover></click><gray><suffix></gray>",
|
514
516
|
"flag.flag_info_name": "<gray>Name: <gold><flag></gold></gray>",
|
515
517
|
"flag.flag_info_category": "<gray>Category: </gray><gold><value></gold>",
|
516
518
|
"flag.flag_info_description": "<gray>Description: </gray>",
|
517
|
-
"flag.flag_info_example": "<gray>Example: <click:
|
519
|
+
"flag.flag_info_example": "<gray>Example: <click:run_command:'<command> <flag> <value>'><gold><command> <flag> <value></gold></click></gray>",
|
518
520
|
"flag.flag_info_default_value": "<gray>Default Value: <value></gray>",
|
519
521
|
"flags.flag_category_string": "<gray>String Flags</gray>",
|
520
522
|
"flags.flag_category_integers": "<gray>Integer Flags</gray>",
|
@@ -572,6 +574,7 @@
|
|
572
574
|
"flags.flag_description_misc_break": "<gray>Set to `true` to allow guests to break miscellaneous items.</gray>",
|
573
575
|
"flags.flag_description_misc_cap": "<gray>Set to an integer value to limit the amount of miscellaneous entities on the plot.</gray>",
|
574
576
|
"flags.flag_description_misc_interact": "<gray>Set to `true` to allow guests to interact with miscellaneous items.</gray>",
|
577
|
+
"flags.flag_description_sculk_sensor_interact": "<gray>Set to `true` to allow guests to interact with sculk sensors.</gray>",
|
575
578
|
"flags.flag_description_misc_place": "<gray>Set to `true` to allow guests to place miscellaneous items.</gray>",
|
576
579
|
"flags.flag_description_mob_break": "<gray>Set to `true` to allow mobs to break blocks within the plot.</gray>",
|
577
580
|
"flags.flag_description_mob_cap": "<gray>Set to an integer value to limit the amount of mobs on the plot.</gray>",
|
@@ -128,4 +128,5 @@ public class FlagTest {
|
|
128
128
|
((TranslatableCaption) exception.getErrorMessage()).getKey()
|
129
129
|
);
|
130
130
|
}
|
131
|
+
|
131
132
|
}
|
@@ -107,4 +107,5 @@ public class PlotRangeIteratorTest {
|
|
107
107
|
Assertions.assertFalse(range.hasNext());
|
108
108
|
Assertions.assertThrows(NoSuchElementException.class, range::next);
|
109
109
|
}
|
110
|
+
|
110
111
|
}
|
@@ -51,4 +51,5 @@ class LockRepositoryTest {
|
|
51
51
|
}));
|
52
52
|
Assertions.assertFalse(lock.isLocked());
|
53
53
|
}
|
54
|
+
|
54
55
|
}
|
@@ -33,8 +33,10 @@ public class StringManTest {
|
|
33
33
|
new Message("title \"sub title\"", List.of("title", "sub title")),
|
34
34
|
new Message("\"a title\" subtitle", List.of("a title", "subtitle")),
|
35
35
|
new Message("\"title\" \"subtitle\"", List.of("title", "subtitle")),
|
36
|
-
new Message(
|
37
|
-
|
36
|
+
new Message(
|
37
|
+
"\"How <bold>bold</bold> of you\" \"to assume I like <rainbow>rainbows</rainbow>\"",
|
38
|
+
List.of("How <bold>bold</bold> of you", "to assume I like <rainbow>rainbows</rainbow>")
|
39
|
+
)
|
38
40
|
);
|
39
41
|
|
40
42
|
for (Message message : messages) {
|
@@ -53,4 +55,5 @@ public class StringManTest {
|
|
53
55
|
private record Message(String input, List<String> expected) {
|
54
56
|
|
55
57
|
}
|
58
|
+
|
56
59
|
}
|
@@ -4,14 +4,14 @@
|
|
4
4
|
|
5
5
|
---
|
6
6
|
|
7
|
-
PlotSquared is a land and world management plugin for Minecraft.
|
8
|
-
It includes several highly configurable world generators.
|
7
|
+
PlotSquared is a land and world management plugin for Minecraft.
|
8
|
+
It includes several highly configurable world generators.
|
9
9
|
You can create plots of land in existing worlds using plot clusters, or you can have a full world of plots.
|
10
10
|
|
11
11
|
For the end user, PlotSquared is packed with a tonne of cool features.
|
12
|
-
It allows you to merge plots, and build together with your friends.
|
12
|
+
It allows you to merge plots, and build together with your friends.
|
13
13
|
You can also change a lot of plot specific settings in the form of
|
14
|
-
flags. Such as: weather, time, game modes, pvp status.
|
14
|
+
flags. Such as: weather, time, game modes, pvp status.
|
15
15
|
|
16
16
|
Whilst we provide a whole load of unique features, the biggest focus
|
17
17
|
is to provide a lag-free and smooth experience.
|
@@ -27,17 +27,19 @@ is to provide a lag-free and smooth experience.
|
|
27
27
|
|
28
28
|
* [Download](https://www.spigotmc.org/resources/77506/)
|
29
29
|
* [Discord](https://discord.gg/intellectualsites)
|
30
|
-
* [Wiki](https://intellectualsites.
|
30
|
+
* [Wiki](https://intellectualsites.gitbook.io/plotsquared/)
|
31
31
|
* [Issues](https://github.com/IntellectualSites/PlotSquared/issues)
|
32
32
|
* [Translations](https://intellectualsites.crowdin.com/plotsquared/)
|
33
33
|
* [Contributing](https://github.com/IntellectualSites/.github/blob/main/CONTRIBUTING.md)
|
34
34
|
|
35
35
|
### Developer Resources
|
36
|
-
|
37
|
-
* [
|
38
|
-
* [
|
36
|
+
|
37
|
+
* [API Documentation](https://intellectualsites.gitbook.io/plotsquared/api/api-documentation)
|
38
|
+
* [Event API](https://intellectualsites.gitbook.io/plotsquared/api/event-api)
|
39
|
+
* [Flag API](https://intellectualsites.gitbook.io/plotsquared/api/flag-api)
|
39
40
|
|
40
41
|
# Official Addons
|
42
|
+
|
41
43
|
* [Plot2Dynmap](http://www.spigotmc.org/resources/plot2dynmap.1292/)
|
42
44
|
* [HoloPlots](https://www.spigotmc.org/resources/holoplots.4880/)
|
43
45
|
* [PlotHider](https://www.spigotmc.org/resources/plot-hider.20701/)
|
@@ -46,10 +48,14 @@ is to provide a lag-free and smooth experience.
|
|
46
48
|
|
47
49
|
Want to add new features to PlotSquared or fix bugs yourself? You can get the game running, with PlotSquared, from the code here:
|
48
50
|
|
49
|
-
For additional information about compiling PlotSquared,
|
51
|
+
For additional information about compiling PlotSquared,
|
52
|
+
see [CONTRIBUTING.md](https://github.com/IntellectualSites/.github/blob/main/CONTRIBUTING.md)
|
50
53
|
|
51
54
|
### Submitting Your Changes
|
52
|
-
|
55
|
+
|
56
|
+
PlotSquared is open source (specifically licensed under GPL v3), so note that your contributions will also be open source. The
|
57
|
+
best way to submit a change is to create a fork on GitHub, put your changes there, and then create a "pull request" on our
|
58
|
+
PlotSquared repository.
|
53
59
|
|
54
60
|
<a href="https://yourkit.com/">
|
55
61
|
<img src="https://www.yourkit.com/images/yklogo.png">
|
@@ -57,4 +63,6 @@ PlotSquared is open source (specifically licensed under GPL v3), so note that yo
|
|
57
63
|
|
58
64
|
Thank you to YourKit for supporting our product by providing us with their innovative and intelligent tools
|
59
65
|
for monitoring and profiling Java and .NET applications.
|
60
|
-
YourKit is the creator
|
66
|
+
YourKit is the creator
|
67
|
+
of [YourKit Java Profiler](https://www.yourkit.com/java/profiler/), [YourKit .NET Profiler](https://www.yourkit.com/.net/profiler/),
|
68
|
+
and [YourKit YouMonitor](https://www.yourkit.com/youmonitor/).
|
@@ -1,6 +1,7 @@
|
|
1
|
+
import com.diffplug.gradle.spotless.SpotlessPlugin
|
1
2
|
import com.github.jengelman.gradle.plugins.shadow.ShadowPlugin
|
2
3
|
import java.net.URI
|
3
|
-
import
|
4
|
+
import xyz.jpenilla.runpaper.task.RunServer
|
4
5
|
|
5
6
|
plugins {
|
6
7
|
java
|
@@ -15,10 +16,12 @@ plugins {
|
|
15
16
|
|
16
17
|
eclipse
|
17
18
|
idea
|
19
|
+
|
20
|
+
alias(libs.plugins.runPaper)
|
18
21
|
}
|
19
22
|
|
20
|
-
group = "com.plotsquared"
|
21
|
-
version = "
|
23
|
+
group = "com.intellectualsites.plotsquared"
|
24
|
+
version = "7.0.0"
|
22
25
|
|
23
26
|
if (!File("$rootDir/.git").exists()) {
|
24
27
|
logger.lifecycle("""
|
@@ -73,13 +76,9 @@ subprojects {
|
|
73
76
|
plugin<IdeaPlugin>()
|
74
77
|
}
|
75
78
|
|
76
|
-
dependencies {
|
77
|
-
implementation(platform("com.intellectualsites.bom:bom-1.18.x:1.24"))
|
78
|
-
}
|
79
|
-
|
80
79
|
dependencies {
|
81
80
|
// Tests
|
82
|
-
testImplementation("org.junit.jupiter:junit-jupiter:5.
|
81
|
+
testImplementation("org.junit.jupiter:junit-jupiter:5.10.0")
|
83
82
|
}
|
84
83
|
|
85
84
|
plugins.withId("java") {
|
@@ -207,7 +206,7 @@ subprojects {
|
|
207
206
|
}
|
208
207
|
|
209
208
|
nexusPublishing {
|
210
|
-
repositories {
|
209
|
+
this.repositories {
|
211
210
|
sonatype {
|
212
211
|
nexusUrl.set(URI.create("https://s01.oss.sonatype.org/service/local/"))
|
213
212
|
snapshotRepositoryUrl.set(URI.create("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
|
@@ -218,3 +217,17 @@ nexusPublishing {
|
|
218
217
|
tasks.getByName<Jar>("jar") {
|
219
218
|
enabled = false
|
220
219
|
}
|
220
|
+
|
221
|
+
val supportedVersions = listOf("1.16.5", "1.17", "1.17.1", "1.18.2", "1.19", "1.19.1", "1.19.2", "1.19.3", "1.19.4", "1.20")
|
222
|
+
tasks {
|
223
|
+
supportedVersions.forEach {
|
224
|
+
register<RunServer>("runServer-$it") {
|
225
|
+
minecraftVersion(it)
|
226
|
+
pluginJars(*project(":plotsquared-bukkit").getTasksByName("shadowJar", false).map { (it as Jar).archiveFile }
|
227
|
+
.toTypedArray())
|
228
|
+
jvmArgs("-DPaper.IgnoreJavaVersion=true", "-Dcom.mojang.eula.agree=true")
|
229
|
+
group = "run paper"
|
230
|
+
runDirectory.set(file("run-$it"))
|
231
|
+
}
|
232
|
+
}
|
233
|
+
}
|
@@ -1,34 +1,58 @@
|
|
1
1
|
[versions]
|
2
2
|
# Platform expectations
|
3
|
-
|
3
|
+
paper = "1.20.1-R0.1-SNAPSHOT"
|
4
|
+
guice = "7.0.0"
|
4
5
|
spotbugs = "4.7.3"
|
6
|
+
checkerqual = "3.37.0"
|
7
|
+
gson = "2.10"
|
8
|
+
guava = "31.1-jre"
|
9
|
+
snakeyaml = "2.0"
|
10
|
+
adventure = "4.14.0"
|
11
|
+
adventure-bukkit = "4.3.0"
|
12
|
+
log4j = "2.19.0"
|
5
13
|
|
6
14
|
# Plugins
|
7
|
-
worldedit = "7.2.
|
8
|
-
|
15
|
+
worldedit = "7.2.15"
|
16
|
+
fawe = "2.7.0"
|
17
|
+
placeholderapi = "2.11.3"
|
9
18
|
luckperms = "5.4"
|
10
|
-
essentialsx = "2.
|
19
|
+
essentialsx = "2.20.1"
|
11
20
|
mvdwapi = "3.1.1"
|
12
21
|
|
13
22
|
# Third party
|
14
23
|
prtree = "2.0.1"
|
15
24
|
aopalliance = "1.0"
|
16
|
-
cloud-services = "1.8.
|
25
|
+
cloud-services = "1.8.3"
|
17
26
|
arkitektonika = "2.1.2"
|
18
|
-
squirrelid = "0.3.
|
19
|
-
|
27
|
+
squirrelid = "0.3.2"
|
28
|
+
paster = "1.1.5"
|
29
|
+
bstats = "3.0.2"
|
30
|
+
paperlib = "1.0.8"
|
31
|
+
informative-annotations = "1.3"
|
32
|
+
vault = "1.7.1"
|
33
|
+
serverlib = "2.3.1"
|
20
34
|
|
21
35
|
# Gradle plugins
|
22
|
-
shadow = "
|
36
|
+
shadow = "8.1.1"
|
23
37
|
grgit = "4.1.1"
|
24
|
-
spotless = "6.
|
25
|
-
nexus = "1.
|
38
|
+
spotless = "6.20.0"
|
39
|
+
nexus = "1.3.0"
|
40
|
+
runPaper = "2.1.0"
|
26
41
|
|
27
42
|
[libraries]
|
28
43
|
# Platform expectations
|
44
|
+
paper = { group = "io.papermc.paper", name = "paper-api", version.ref = "paper" }
|
29
45
|
guice = { group = "com.google.inject", name = "guice", version.ref = "guice" }
|
30
46
|
guiceassistedinject = { group = "com.google.inject.extensions", name = "guice-assistedinject", version.ref = "guice" }
|
31
47
|
spotbugs = { group = "com.github.spotbugs", name = "spotbugs-annotations", version.ref = "spotbugs" }
|
48
|
+
checkerqual = { group = "org.checkerframework", name = "checker-qual", version.ref = "checkerqual" }
|
49
|
+
gson = { group = "com.google.code.gson", name = "gson", version.ref = "gson" }
|
50
|
+
guava = { group = "com.google.guava", name = "guava", version.ref = "guava" }
|
51
|
+
snakeyaml = { group = "org.yaml", name = "snakeyaml", version.ref = "snakeyaml" }
|
52
|
+
adventureApi = { group = "net.kyori", name = "adventure-api", version.ref = "adventure" }
|
53
|
+
adventureMiniMessage = { group = "net.kyori", name = "adventure-text-minimessage", version.ref = "adventure" }
|
54
|
+
adventureBukkit = { group = "net.kyori", name = "adventure-platform-bukkit", version.ref = "adventure-bukkit" }
|
55
|
+
log4j = { group = "org.apache.logging.log4j", name = "log4j-api", version.ref = "log4j" }
|
32
56
|
|
33
57
|
# Plugins
|
34
58
|
worldeditCore = { group = "com.sk89q.worldedit", name = "worldedit-core", version.ref = "worldedit" }
|
@@ -36,6 +60,8 @@ worldeditBukkit = { group = "com.sk89q.worldedit", name = "worldedit-bukkit", ve
|
|
36
60
|
placeholderapi = { group = "me.clip", name = "placeholderapi", version.ref = "placeholderapi" }
|
37
61
|
luckperms = { group = "net.luckperms", name = "api", version.ref = "luckperms" }
|
38
62
|
essentialsx = { group = "net.essentialsx", name = "EssentialsX", version.ref = "essentialsx" }
|
63
|
+
faweCore = { group = "com.fastasyncworldedit", name = "FastAsyncWorldEdit-Core", version.ref = "fawe" }
|
64
|
+
faweBukkit = { group = "com.fastasyncworldedit", name = "FastAsyncWorldEdit-Bukkit", version.ref = "fawe" }
|
39
65
|
|
40
66
|
# Third party
|
41
67
|
prtree = { group = "com.intellectualsites.prtree", name = "PRTree", version.ref = "prtree" }
|
@@ -44,10 +70,17 @@ cloudServices = { group = "cloud.commandframework", name = "cloud-services", ver
|
|
44
70
|
mvdwapi = { group = "com.intellectualsites.mvdwplaceholderapi", name = "MVdWPlaceholderAPI", version.ref = "mvdwapi" }
|
45
71
|
squirrelid = { group = "org.enginehub", name = "squirrelid", version.ref = "squirrelid" }
|
46
72
|
arkitektonika = { group = "com.intellectualsites.arkitektonika", name = "Arkitektonika-Client", version.ref = "arkitektonika" }
|
47
|
-
|
73
|
+
paster = { group = "com.intellectualsites.paster", name = "Paster", version.ref = "paster" }
|
74
|
+
bstatsBase = { group = "org.bstats", name = "bstats-base", version.ref = "bstats" }
|
75
|
+
bstatsBukkit = { group = "org.bstats", name = "bstats-bukkit", version.ref = "bstats" }
|
76
|
+
informativeAnnotations = { group = "com.intellectualsites.informative-annotations", name = "informative-annotations", version.ref = "informative-annotations" }
|
77
|
+
paperlib = { group = "io.papermc", name = "paperlib", version.ref = "paperlib" }
|
78
|
+
vault = { group = "com.github.MilkBowl", name = "VaultAPI", version.ref = "vault" }
|
79
|
+
serverlib = { group = "dev.notmyfault.serverlib", name = "ServerLib", version.ref = "serverlib" }
|
48
80
|
|
49
81
|
[plugins]
|
50
82
|
shadow = { id = "com.github.johnrengelman.shadow", version.ref = "shadow" }
|
51
83
|
grgit = { id = "org.ajoberstar.grgit", version.ref = "grgit" }
|
52
84
|
spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }
|
53
85
|
nexus = { id = "io.github.gradle-nexus.publish-plugin", version.ref = "nexus" }
|
86
|
+
runPaper = { id = "xyz.jpenilla.run-paper", version.ref = "runPaper" }
|
Binary file
|
@@ -1,6 +1,7 @@
|
|
1
1
|
distributionBase=GRADLE_USER_HOME
|
2
2
|
distributionPath=wrapper/dists
|
3
|
-
distributionUrl=https\://services.gradle.org/distributions/gradle-
|
3
|
+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
|
4
4
|
networkTimeout=10000
|
5
|
+
validateDistributionUrl=true
|
5
6
|
zipStoreBase=GRADLE_USER_HOME
|
6
7
|
zipStorePath=wrapper/dists
|
@@ -83,10 +83,8 @@ done
|
|
83
83
|
# This is normally unused
|
84
84
|
# shellcheck disable=SC2034
|
85
85
|
APP_BASE_NAME=${0##*/}
|
86
|
-
|
87
|
-
|
88
|
-
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
89
|
-
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
86
|
+
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
87
|
+
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
90
88
|
|
91
89
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
92
90
|
MAX_FD=maximum
|
@@ -133,10 +131,13 @@ location of your Java installation."
|
|
133
131
|
fi
|
134
132
|
else
|
135
133
|
JAVACMD=java
|
136
|
-
|
134
|
+
if ! command -v java >/dev/null 2>&1
|
135
|
+
then
|
136
|
+
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
137
137
|
|
138
138
|
Please set the JAVA_HOME variable in your environment to match the
|
139
139
|
location of your Java installation."
|
140
|
+
fi
|
140
141
|
fi
|
141
142
|
|
142
143
|
# Increase the maximum file descriptors if we can.
|
@@ -144,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
|
144
145
|
case $MAX_FD in #(
|
145
146
|
max*)
|
146
147
|
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
147
|
-
# shellcheck disable=SC3045
|
148
|
+
# shellcheck disable=SC3045
|
148
149
|
MAX_FD=$( ulimit -H -n ) ||
|
149
150
|
warn "Could not query maximum file descriptor limit"
|
150
151
|
esac
|
@@ -152,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
|
152
153
|
'' | soft) :;; #(
|
153
154
|
*)
|
154
155
|
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
155
|
-
# shellcheck disable=SC3045
|
156
|
+
# shellcheck disable=SC3045
|
156
157
|
ulimit -n "$MAX_FD" ||
|
157
158
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
158
159
|
esac
|
@@ -197,6 +198,10 @@ if "$cygwin" || "$msys" ; then
|
|
197
198
|
done
|
198
199
|
fi
|
199
200
|
|
201
|
+
|
202
|
+
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
203
|
+
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
204
|
+
|
200
205
|
# Collect all arguments for the java command;
|
201
206
|
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
202
207
|
# shell script including quotes and variable substitutions, so put them in
|
@@ -1,4 +1,4 @@
|
|
1
1
|
Javadocs generated for
|
2
|
-
<a
|
3
|
-
<a
|
4
|
-
Visit us on our <a
|
2
|
+
<a href="https://github.com/IntellectualSites/PlotSquared/" rel="noopener nofollow noreferrer" target="_blank"> PlotSquared</a> |
|
3
|
+
<a href="https://intellectualsites.gitbook.io/plotsquared/" rel="noopener nofollow noreferrer"> Documentation </a> |
|
4
|
+
Visit us on our <a href="https://discord.gg/intellectualsites" rel="noopener nofollow noreferrer"> Discord server</a> :)
|
@@ -1,10 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
3
|
-
"extends": [
|
4
|
-
"config:base",
|
5
|
-
":semanticCommitsDisabled"
|
6
|
-
],
|
7
|
-
"labels": ["dependencies"],
|
8
|
-
"rebaseWhen": "conflicted",
|
9
|
-
"schedule": ["on the first day of the week"]
|
10
|
-
}
|
@@ -2,7 +2,7 @@ rootProject.name = "PlotSquared"
|
|
2
2
|
|
3
3
|
include("Core", "Bukkit")
|
4
4
|
|
5
|
-
project(":Core").name = "
|
6
|
-
project(":Bukkit").name = "
|
5
|
+
project(":Core").name = "plotsquared-core"
|
6
|
+
project(":Bukkit").name = "plotsquared-bukkit"
|
7
7
|
|
8
8
|
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
|