mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-07-03 22:24:43 +02:00
Compare commits
107 Commits
Author | SHA1 | Date | |
---|---|---|---|
4c0ad148bf | |||
5c7bfb988c | |||
b46f486680 | |||
05797d0c78 | |||
36ef2cf9ba | |||
26ec31a012 | |||
fd4a542062 | |||
dc13f2565f | |||
9f632af0ae | |||
d698c6a1e5 | |||
40e1bd9897 | |||
75f31c5bf6 | |||
954c813cef | |||
05e055e9cf | |||
2ea21c150f | |||
c2fd4edad5 | |||
78b8696778 | |||
e653961385 | |||
b21d12fd52 | |||
7557df96c7 | |||
61797c3aff | |||
78125ff1e2 | |||
d7c8715b25 | |||
34f005c244 | |||
6fbd1376ca | |||
951767dc64 | |||
16928b05f1 | |||
fff14b05cb | |||
e619c867e9 | |||
543284e016 | |||
0d78ba5f35 | |||
9ba2b62fc2 | |||
f10ee27fdd | |||
3278ce1fe9 | |||
fefb0334bd | |||
d06a827e31 | |||
10bb520f3a | |||
126aa53b61 | |||
ac71046feb | |||
7c290e6bd0 | |||
4d297cc829 | |||
5ab410a5c5 | |||
1f28bac955 | |||
92c54de5e9 | |||
ff5d79699d | |||
a0594c19ee | |||
da41c136fe | |||
6a5859ee0f | |||
59e0b4b67a | |||
5fc153d896 | |||
a003836dbc | |||
42bf413528 | |||
827f46566c | |||
6f4d2f6d5a | |||
6073b96317 | |||
74a490f9f0 | |||
3a752db698 | |||
7cdde5a822 | |||
8b6e7b2f2b | |||
06f0b42a97 | |||
9a85080bf6 | |||
d14d2caa2d | |||
bcfe7c58dd | |||
289f0f3bfd | |||
6fc4005c72 | |||
8f7c2e4c02 | |||
b43d08f4aa | |||
2c55c6a92e | |||
31f48cc7d1 | |||
4b77f1ab28 | |||
7cc38b5fa8 | |||
0c76d08b10 | |||
9c474570c8 | |||
7e1d56c849 | |||
07d0f124b4 | |||
8d6c621763 | |||
cef7098014 | |||
e1efa7266e | |||
f363941719 | |||
25095f4546 | |||
fd0c2050d8 | |||
07fdc94dd8 | |||
b501a81e21 | |||
eb334b3aac | |||
a77a51b6f2 | |||
7d981bc610 | |||
3eb485e900 | |||
9f4af889f7 | |||
2559c889e2 | |||
2cf268b99c | |||
e6fad8309c | |||
7551450cf9 | |||
e042566bb7 | |||
1f26808c7b | |||
a7026047d0 | |||
af2613202d | |||
3da1e9255a | |||
9394906a79 | |||
d881cb6084 | |||
b9d43897af | |||
76b58485a9 | |||
7002df0bc7 | |||
958aac3cb1 | |||
a93402e27b | |||
92f41f43c5 | |||
392ee9fa07 | |||
8859871e89 |
3
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
3
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
@ -7,7 +7,7 @@ body:
|
|||||||
attributes:
|
attributes:
|
||||||
value: |
|
value: |
|
||||||
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.
|
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.
|
||||||
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://github.com/IntellectualSites/PlotSquared-Documentation/wiki).
|
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.github.io/plotsquared-documentation/).
|
||||||
Do NOT use the public issue tracker to report security vulnerabilities! They are disclosed using [this](https://forms.gle/btgdRn9yhGtzEiGW8) form!
|
Do NOT use the public issue tracker to report security vulnerabilities! They are disclosed using [this](https://forms.gle/btgdRn9yhGtzEiGW8) form!
|
||||||
|
|
||||||
- type: dropdown
|
- type: dropdown
|
||||||
@ -27,6 +27,7 @@ body:
|
|||||||
description: Which server version version you using? If your server version is not listed, it is not supported. Update to a supported version first.
|
description: Which server version version you using? If your server version is not listed, it is not supported. Update to a supported version first.
|
||||||
multiple: false
|
multiple: false
|
||||||
options:
|
options:
|
||||||
|
- '1.18.2'
|
||||||
- '1.18.1'
|
- '1.18.1'
|
||||||
- '1.18'
|
- '1.18'
|
||||||
- '1.17.1'
|
- '1.17.1'
|
||||||
|
2
.github/ISSUE_TEMPLATE/config.yml
vendored
2
.github/ISSUE_TEMPLATE/config.yml
vendored
@ -4,5 +4,5 @@ contact_links:
|
|||||||
url: https://discord.gg/intellectualsites
|
url: https://discord.gg/intellectualsites
|
||||||
about: Our support Discord, please ask questions and seek support here.
|
about: Our support Discord, please ask questions and seek support here.
|
||||||
- name: PlotSquared Wiki
|
- name: PlotSquared Wiki
|
||||||
url: https://github.com/IntellectualSites/PlotSquared-Documentation/wiki
|
url: https://intellectualsites.github.io/plotsquared-documentation/
|
||||||
about: Take a look at the wiki page for instructions how to setup PlotSquared and use its commands.
|
about: Take a look at the wiki page for instructions how to setup PlotSquared and use its commands.
|
||||||
|
2
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
2
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
@ -7,7 +7,7 @@ body:
|
|||||||
attributes:
|
attributes:
|
||||||
value: |
|
value: |
|
||||||
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.
|
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.
|
||||||
For anything else than a feature request, use: [our Discord server](https://discord.gg/intellectualsites) or [the wiki](https://github.com/IntellectualSites/PlotSquared-Documentation/wiki).
|
For anything else than a feature request, use: [our Discord server](https://discord.gg/intellectualsites) or [the wiki](https://intellectualsites.github.io/plotsquared-documentation/).
|
||||||
|
|
||||||
- type: textarea
|
- type: textarea
|
||||||
attributes:
|
attributes:
|
||||||
|
2
.github/stale.yml
vendored
2
.github/stale.yml
vendored
@ -1,4 +1,4 @@
|
|||||||
daysUntilStale: 60
|
daysUntilStale: 30
|
||||||
daysUntilClose: 7
|
daysUntilClose: 7
|
||||||
only: issues
|
only: issues
|
||||||
exemptLabels:
|
exemptLabels:
|
||||||
|
55
.github/workflows/build.yml
vendored
55
.github/workflows/build.yml
vendored
@ -1,41 +1,42 @@
|
|||||||
name: "build"
|
name: build
|
||||||
|
|
||||||
on: [ "pull_request", "push" ]
|
on: [ pull_request, push ]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: "ubuntu-20.04"
|
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: "Checkout Repository"
|
- name: Checkout Repository
|
||||||
uses: "actions/checkout@v2.4.0"
|
uses: actions/checkout@v3
|
||||||
- name: "Validate Gradle Wrapper"
|
- name: Validate Gradle Wrapper"
|
||||||
uses: "gradle/wrapper-validation-action@v1.0.4"
|
uses: gradle/wrapper-validation-action@v1
|
||||||
- name: "Setup Java"
|
- name: Setup Java
|
||||||
uses: "actions/setup-java@v2.4.0"
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
distribution: "temurin"
|
distribution: temurin
|
||||||
java-version: "17"
|
java-version: 17
|
||||||
- name: "Clean Build"
|
- name: Clean Build
|
||||||
run: "./gradlew clean build"
|
run: ./gradlew clean build
|
||||||
- name: "Determine release status"
|
- name: Determine release status
|
||||||
if: "${{ runner.os == 'Linux' }}"
|
if: ${{ runner.os == 'Linux' }}
|
||||||
run: |
|
run: |
|
||||||
if [ "$(./gradlew properties | awk '/^version:/ { print $2; }' | grep '\-SNAPSHOT')" ]; then
|
if [ "$(./gradlew properties | awk '/^version:/ { print $2; }' | grep '\-SNAPSHOT')" ]; then
|
||||||
echo "STATUS=snapshot" >> $GITHUB_ENV
|
echo "STATUS=snapshot" >> $GITHUB_ENV
|
||||||
else
|
else
|
||||||
echo "STATUS=release" >> $GITHUB_ENV
|
echo "STATUS=release" >> $GITHUB_ENV
|
||||||
fi
|
fi
|
||||||
- name: "Publish Release"
|
- name: Publish Release
|
||||||
if: "${{ runner.os == 'Linux' && env.STATUS == 'release' && github.event_name == 'push' && github.ref == 'refs/heads/v6'}}"
|
if: ${{ runner.os == 'Linux' && env.STATUS == 'release' && github.event_name == 'push' && github.ref == 'refs/heads/v6'}}
|
||||||
run: "./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository"
|
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository
|
||||||
env:
|
env:
|
||||||
ORG_GRADLE_PROJECT_sonatypeUsername: "${{ secrets.SONATYPE_USERNAME }}"
|
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
|
||||||
ORG_GRADLE_PROJECT_sonatypePassword: "${{ secrets.SONATYPE_PASSWORD }}"
|
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
|
||||||
ORG_GRADLE_PROJECT_signingKey: "${{ secrets.SIGNING_KEY }}"
|
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
|
||||||
ORG_GRADLE_PROJECT_signingPassword: "${{ secrets.SIGNING_PASSWORD }}"
|
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}
|
||||||
- name: "Publish Snapshot"
|
- name: Publish Snapshot
|
||||||
if: "${{ runner.os == 'Linux' && env.STATUS != 'release' && github.event_name == 'push' && github.ref == 'refs/heads/v6' }}"
|
if: ${{ runner.os == 'Linux' && env.STATUS != 'release' && github.event_name == 'push' && github.ref == 'refs/heads/v6' }}
|
||||||
run: "./gradlew publishToSonatype"
|
run: ./gradlew publishToSonatype
|
||||||
env:
|
env:
|
||||||
ORG_GRADLE_PROJECT_sonatypeUsername: "${{ secrets.SONATYPE_USERNAME }}"
|
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
|
||||||
ORG_GRADLE_PROJECT_sonatypePassword: "${{ secrets.SONATYPE_PASSWORD }}"
|
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
|
||||||
|
37
.github/workflows/codeql.yml
vendored
Normal file
37
.github/workflows/codeql.yml
vendored
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
name: "CodeQL"
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ v6 ]
|
||||||
|
pull_request:
|
||||||
|
# The branches below must be a subset of the branches above
|
||||||
|
branches: [ v6 ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
analyze:
|
||||||
|
name: Analyze
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
actions: read
|
||||||
|
contents: read
|
||||||
|
security-events: write
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
language: [ 'java' ]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Initialize CodeQL
|
||||||
|
uses: github/codeql-action/init@v1
|
||||||
|
with:
|
||||||
|
languages: ${{ matrix.language }}
|
||||||
|
|
||||||
|
- name: Autobuild
|
||||||
|
uses: github/codeql-action/autobuild@v1
|
||||||
|
|
||||||
|
- name: Perform CodeQL Analysis
|
||||||
|
uses: github/codeql-action/analyze@v1
|
11
.github/workflows/release-drafter.yml
vendored
11
.github/workflows/release-drafter.yml
vendored
@ -1,14 +1,19 @@
|
|||||||
name: "draft release"
|
name: draft release
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- v6
|
- v6
|
||||||
|
pull_request:
|
||||||
|
types: [ opened, reopened, synchronize ]
|
||||||
|
pull_request_target:
|
||||||
|
types: [ opened, reopened, synchronize ]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
update_release_draft:
|
update_release_draft:
|
||||||
runs-on: "ubuntu-latest"
|
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: "release-drafter/release-drafter@v5.15.0"
|
- uses: release-drafter/release-drafter@v5
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
4
.lift.toml
Normal file
4
.lift.toml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
jdkVersion = "17"
|
||||||
|
build = "gradle clean build -x test"
|
||||||
|
tools = ["findsecbugs", "ErrorProne", "Semgrep", "Detekt", "Infer"]
|
||||||
|
ignoreRules = ["CatchAndPrintStackTrace", "ReferenceEquality", "FallThrough", "FutureReturnValueIgnored", "MixedMutabilityReturnType", "EmptyCatch", "MissingCasesInEnumSwitch", "OperatorPrecedence", "StaticAssignmentInConstructor", "ReferenceEquality", "EqualsHashCode", "EqualsGetClass", "TypeParameterUnusedInFormals", "StringSplitter", "InlineMeSuggester", "NULL_DEREFERENCE"]
|
@ -40,7 +40,6 @@ dependencies {
|
|||||||
compileOnly(libs.placeholderapi)
|
compileOnly(libs.placeholderapi)
|
||||||
compileOnly(libs.luckperms)
|
compileOnly(libs.luckperms)
|
||||||
compileOnly(libs.essentialsx)
|
compileOnly(libs.essentialsx)
|
||||||
compileOnly(libs.hyperverse) { isTransitive = false }
|
|
||||||
compileOnly(libs.mvdwapi) { isTransitive = false }
|
compileOnly(libs.mvdwapi) { isTransitive = false }
|
||||||
|
|
||||||
// Other libraries
|
// Other libraries
|
||||||
@ -75,7 +74,8 @@ tasks.named<ShadowJar>("shadowJar") {
|
|||||||
relocate("org.khelekore.prtree", "com.plotsquared.prtree")
|
relocate("org.khelekore.prtree", "com.plotsquared.prtree")
|
||||||
relocate("com.google.inject", "com.plotsquared.google")
|
relocate("com.google.inject", "com.plotsquared.google")
|
||||||
relocate("org.aopalliance", "com.plotsquared.core.aopalliance")
|
relocate("org.aopalliance", "com.plotsquared.core.aopalliance")
|
||||||
relocate("com.intellectualsites.services", "com.plotsquared.core.services")
|
relocate("cloud.commandframework.services", "com.plotsquared.core.services")
|
||||||
|
relocate("io.leangen.geantyref", "com.plotsquared.core.geantyref")
|
||||||
relocate("com.intellectualsites.arkitektonika", "com.plotsquared.core.arkitektonika")
|
relocate("com.intellectualsites.arkitektonika", "com.plotsquared.core.arkitektonika")
|
||||||
relocate("com.intellectualsites.http", "com.plotsquared.core.http")
|
relocate("com.intellectualsites.http", "com.plotsquared.core.http")
|
||||||
relocate("com.intellectualsites.paster", "com.plotsquared.core.paster")
|
relocate("com.intellectualsites.paster", "com.plotsquared.core.paster")
|
||||||
@ -83,6 +83,7 @@ tasks.named<ShadowJar>("shadowJar") {
|
|||||||
relocate("org.jetbrains", "com.plotsquared.core.annotations")
|
relocate("org.jetbrains", "com.plotsquared.core.annotations")
|
||||||
relocate("org.intellij.lang", "com.plotsquared.core.intellij.annotations")
|
relocate("org.intellij.lang", "com.plotsquared.core.intellij.annotations")
|
||||||
relocate("javax.annotation", "com.plotsquared.core.annotation")
|
relocate("javax.annotation", "com.plotsquared.core.annotation")
|
||||||
|
relocate("com.google.code.findbugs", "com.plotsquared.core.findbugs")
|
||||||
relocate("javax.inject", "com.plotsquared.core.annotation.inject")
|
relocate("javax.inject", "com.plotsquared.core.annotation.inject")
|
||||||
|
|
||||||
// Get rid of all the libs which are 100% unused.
|
// Get rid of all the libs which are 100% unused.
|
||||||
@ -94,11 +95,11 @@ tasks.named<ShadowJar>("shadowJar") {
|
|||||||
tasks {
|
tasks {
|
||||||
withType<Javadoc> {
|
withType<Javadoc> {
|
||||||
val opt = options as StandardJavadocDocletOptions
|
val opt = options as StandardJavadocDocletOptions
|
||||||
opt.links("https://papermc.io/javadocs/paper/1.17/")
|
opt.links("https://papermc.io/javadocs/paper/1.18/")
|
||||||
opt.links("https://docs.enginehub.org/javadoc/com.sk89q.worldedit/worldedit-core/7.2.7/")
|
opt.links("https://docs.enginehub.org/javadoc/com.sk89q.worldedit/worldedit-bukkit/" + libs.worldeditBukkit.get().versionConstraint.toString())
|
||||||
opt.links("https://docs.enginehub.org/javadoc/com.sk89q.worldedit/worldedit-bukkit/7.2.7/")
|
opt.links("https://javadoc.io/doc/com.plotsquared/PlotSquared-Core/latest/")
|
||||||
opt.links("https://jd.adventure.kyori.net/api/4.9.3/")
|
opt.links("https://jd.adventure.kyori.net/api/" + libs.adventure.get().versionConstraint.toString())
|
||||||
opt.links("https://google.github.io/guice/api-docs/5.0.1/javadoc/")
|
opt.links("https://google.github.io/guice/api-docs/" + libs.guice.get().versionConstraint.toString() + "/javadoc/")
|
||||||
opt.links("https://checkerframework.org/api/")
|
opt.links("https://checkerframework.org/api/")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -147,6 +147,8 @@ import java.io.File;
|
|||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
@ -216,6 +218,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
private PlatformWorldManager<World> worldManager;
|
private PlatformWorldManager<World> worldManager;
|
||||||
private Locale serverLocale;
|
private Locale serverLocale;
|
||||||
|
|
||||||
|
@SuppressWarnings("StringSplitter")
|
||||||
@Override
|
@Override
|
||||||
public int @NonNull [] serverVersion() {
|
public int @NonNull [] serverVersion() {
|
||||||
if (this.version == null) {
|
if (this.version == null) {
|
||||||
@ -235,6 +238,16 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
return this.version;
|
return this.version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int versionMinHeight() {
|
||||||
|
return serverVersion()[1] >= 18 ? -64 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int versionMaxHeight() {
|
||||||
|
return serverVersion()[1] >= 18 ? 319 : 255;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NonNull String serverImplementation() {
|
public @NonNull String serverImplementation() {
|
||||||
return Bukkit.getVersion();
|
return Bukkit.getVersion();
|
||||||
@ -266,7 +279,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
faweHook = true;
|
faweHook = true;
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
LOGGER.error("Incompatible version of FAWE to enable hook, please upgrade: https://ci.athion" +
|
LOGGER.error("Incompatible version of FAWE to enable hook, please upgrade: https://ci.athion" +
|
||||||
".net/job/FastAsyncWorldEdit-1.17/");
|
".net/job/FastAsyncWorldEdit/");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -321,8 +334,6 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
// Comments
|
// Comments
|
||||||
CommentManager.registerDefaultInboxes();
|
CommentManager.registerDefaultInboxes();
|
||||||
|
|
||||||
plotSquared.startExpiryTasks();
|
|
||||||
|
|
||||||
// Do stuff that was previously done in PlotSquared
|
// Do stuff that was previously done in PlotSquared
|
||||||
// Kill entities
|
// Kill entities
|
||||||
if (Settings.Enabled_Components.KILL_ROAD_MOBS || Settings.Enabled_Components.KILL_ROAD_VEHICLES) {
|
if (Settings.Enabled_Components.KILL_ROAD_MOBS || Settings.Enabled_Components.KILL_ROAD_VEHICLES) {
|
||||||
@ -419,6 +430,8 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
}, TaskTime.ticks(1L));
|
}, TaskTime.ticks(1L));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
plotSquared.startExpiryTasks();
|
||||||
|
|
||||||
// Once the server has loaded force updating all generators known to P2
|
// Once the server has loaded force updating all generators known to P2
|
||||||
TaskManager.runTaskLater(() -> PlotSquared.platform().setupUtils().updateGenerators(true), TaskTime.ticks(1L));
|
TaskManager.runTaskLater(() -> PlotSquared.platform().setupUtils().updateGenerators(true), TaskTime.ticks(1L));
|
||||||
|
|
||||||
@ -968,7 +981,6 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
}
|
}
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
entity.remove();
|
entity.remove();
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -980,7 +992,6 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
}
|
}
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
entity.remove();
|
entity.remove();
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1141,8 +1152,10 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
@Override
|
@Override
|
||||||
public @NonNull String pluginsFormatted() {
|
public @NonNull String pluginsFormatted() {
|
||||||
StringBuilder msg = new StringBuilder();
|
StringBuilder msg = new StringBuilder();
|
||||||
Plugin[] plugins = Bukkit.getServer().getPluginManager().getPlugins();
|
List<Plugin> plugins = new ArrayList<>();
|
||||||
msg.append("Plugins (").append(plugins.length).append("): \n");
|
Collections.addAll(plugins, Bukkit.getServer().getPluginManager().getPlugins());
|
||||||
|
plugins.sort(Comparator.comparing(Plugin::getName));
|
||||||
|
msg.append("Plugins (").append(plugins.size()).append("): \n");
|
||||||
for (Plugin p : plugins) {
|
for (Plugin p : plugins) {
|
||||||
msg.append(" - ").append(p.getName()).append(":").append("\n")
|
msg.append(" - ").append(p.getName()).append(":").append("\n")
|
||||||
.append(" • Version: ").append(p.getDescription().getVersion()).append("\n")
|
.append(" • Version: ").append(p.getDescription().getVersion()).append("\n")
|
||||||
@ -1156,6 +1169,21 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
return msg.toString();
|
return msg.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SuppressWarnings("ConstantConditions")
|
||||||
|
public @NonNull String worldEditImplementations() {
|
||||||
|
StringBuilder msg = new StringBuilder();
|
||||||
|
if (Bukkit.getPluginManager().getPlugin("FastAsyncWorldEdit") != null) {
|
||||||
|
msg.append("FastAsyncWorldEdit: ").append(Bukkit.getPluginManager().getPlugin("FastAsyncWorldEdit").getDescription().getVersion());
|
||||||
|
} else if (Bukkit.getPluginManager().getPlugin("AsyncWorldEdit") != null) {
|
||||||
|
msg.append("AsyncWorldEdit: ").append(Bukkit.getPluginManager().getPlugin("AsyncWorldEdit").getDescription().getVersion()).append("\n");
|
||||||
|
msg.append("WorldEdit: ").append(Bukkit.getPluginManager().getPlugin("WorldEdit").getDescription().getVersion());
|
||||||
|
} else {
|
||||||
|
msg.append("WorldEdit: ").append(Bukkit.getPluginManager().getPlugin("WorldEdit").getDescription().getVersion());
|
||||||
|
}
|
||||||
|
return msg.toString();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public com.plotsquared.core.location.@NonNull World<?> getPlatformWorld(final @NonNull String worldName) {
|
public com.plotsquared.core.location.@NonNull World<?> getPlatformWorld(final @NonNull String worldName) {
|
||||||
return BukkitWorld.of(worldName);
|
return BukkitWorld.of(worldName);
|
||||||
@ -1204,7 +1232,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@NonNull
|
@NonNull
|
||||||
@SuppressWarnings("ALL")
|
@SuppressWarnings("unchecked")
|
||||||
public PlayerManager<? extends PlotPlayer<Player>, ? extends Player> playerManager() {
|
public PlayerManager<? extends PlotPlayer<Player>, ? extends Player> playerManager() {
|
||||||
return (PlayerManager<BukkitPlayer, Player>) injector().getInstance(PlayerManager.class);
|
return (PlayerManager<BukkitPlayer, Player>) injector().getInstance(PlayerManager.class);
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -461,6 +461,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
|||||||
this.tamed.tamed = tamed.isTamed();
|
this.tamed.tamed = tamed.isTamed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation") // Paper deprecation
|
||||||
@Override
|
@Override
|
||||||
public Entity spawn(World world, int xOffset, int zOffset) {
|
public Entity spawn(World world, int xOffset, int zOffset) {
|
||||||
Location location = new Location(world, this.getX() + xOffset, this.getY(), this.z + zOffset);
|
Location location = new Location(world, this.getX() + xOffset, this.getY(), this.z + zOffset);
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -65,7 +65,10 @@ final class BlockStatePopulator extends BlockPopulator {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final ChunkWrapper wrap = new ChunkWrapper(area.getWorldName(), source.getX(), source.getZ());
|
final ChunkWrapper wrap = new ChunkWrapper(area.getWorldName(), source.getX(), source.getZ());
|
||||||
final ScopedQueueCoordinator chunk = this.queue.getForChunk(wrap.x, wrap.z);
|
final ScopedQueueCoordinator chunk = this.queue.getForChunk(wrap.x, wrap.z,
|
||||||
|
com.plotsquared.bukkit.util.BukkitWorld.getMinWorldHeight(world),
|
||||||
|
com.plotsquared.bukkit.util.BukkitWorld.getMaxWorldHeight(world) - 1
|
||||||
|
);
|
||||||
if (this.plotGenerator.populateChunk(chunk, area)) {
|
if (this.plotGenerator.populateChunk(chunk, area)) {
|
||||||
this.queue.enqueue();
|
this.queue.enqueue();
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -27,6 +27,7 @@ package com.plotsquared.bukkit.generator;
|
|||||||
|
|
||||||
import com.plotsquared.bukkit.queue.GenChunk;
|
import com.plotsquared.bukkit.queue.GenChunk;
|
||||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||||
|
import com.plotsquared.bukkit.util.BukkitWorld;
|
||||||
import com.plotsquared.core.PlotSquared;
|
import com.plotsquared.core.PlotSquared;
|
||||||
import com.plotsquared.core.generator.GeneratorWrapper;
|
import com.plotsquared.core.generator.GeneratorWrapper;
|
||||||
import com.plotsquared.core.generator.IndependentPlotGenerator;
|
import com.plotsquared.core.generator.IndependentPlotGenerator;
|
||||||
@ -159,12 +160,14 @@ public class BukkitPlotGenerator extends ChunkGenerator
|
|||||||
@NonNull BiomeGrid biome
|
@NonNull BiomeGrid biome
|
||||||
) {
|
) {
|
||||||
|
|
||||||
GenChunk result = new GenChunk();
|
int minY = BukkitWorld.getMinWorldHeight(world);
|
||||||
|
int maxY = BukkitWorld.getMaxWorldHeight(world);
|
||||||
|
GenChunk result = new GenChunk(minY, maxY);
|
||||||
if (this.getPlotGenerator() instanceof SingleWorldGenerator) {
|
if (this.getPlotGenerator() instanceof SingleWorldGenerator) {
|
||||||
if (result.getChunkData() != null) {
|
if (result.getChunkData() != null) {
|
||||||
for (int chunkX = 0; chunkX < 16; chunkX++) {
|
for (int chunkX = 0; chunkX < 16; chunkX++) {
|
||||||
for (int chunkZ = 0; chunkZ < 16; chunkZ++) {
|
for (int chunkZ = 0; chunkZ < 16; chunkZ++) {
|
||||||
for (int y = 0; y < world.getMaxHeight(); y++) {
|
for (int y = minY; y < maxY; y++) {
|
||||||
biome.setBiome(chunkX, y, chunkZ, Biome.PLAINS);
|
biome.setBiome(chunkX, y, chunkZ, Biome.PLAINS);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -29,7 +29,6 @@ import com.google.inject.AbstractModule;
|
|||||||
import com.google.inject.Provides;
|
import com.google.inject.Provides;
|
||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
import com.plotsquared.bukkit.managers.BukkitWorldManager;
|
import com.plotsquared.bukkit.managers.BukkitWorldManager;
|
||||||
import com.plotsquared.bukkit.managers.HyperverseWorldManager;
|
|
||||||
import com.plotsquared.bukkit.managers.MultiverseWorldManager;
|
import com.plotsquared.bukkit.managers.MultiverseWorldManager;
|
||||||
import com.plotsquared.core.util.PlatformWorldManager;
|
import com.plotsquared.core.util.PlatformWorldManager;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -37,12 +36,11 @@ import org.bukkit.World;
|
|||||||
|
|
||||||
public class WorldManagerModule extends AbstractModule {
|
public class WorldManagerModule extends AbstractModule {
|
||||||
|
|
||||||
|
@SuppressWarnings("removal") // Internal use only
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
PlatformWorldManager<World> provideWorldManager() {
|
PlatformWorldManager<World> provideWorldManager() {
|
||||||
if (Bukkit.getPluginManager().getPlugin("Hyperverse") != null) {
|
if (Bukkit.getPluginManager().getPlugin("Multiverse-Core") != null) {
|
||||||
return new HyperverseWorldManager();
|
|
||||||
} else if (Bukkit.getPluginManager().getPlugin("Multiverse-Core") != null) {
|
|
||||||
return new MultiverseWorldManager();
|
return new MultiverseWorldManager();
|
||||||
} else {
|
} else {
|
||||||
return new BukkitWorldManager();
|
return new BukkitWorldManager();
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -74,6 +74,7 @@ import org.bukkit.GameMode;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Fireball;
|
import org.bukkit.entity.Fireball;
|
||||||
@ -92,6 +93,7 @@ import org.bukkit.event.block.BlockFormEvent;
|
|||||||
import org.bukkit.event.block.BlockFromToEvent;
|
import org.bukkit.event.block.BlockFromToEvent;
|
||||||
import org.bukkit.event.block.BlockGrowEvent;
|
import org.bukkit.event.block.BlockGrowEvent;
|
||||||
import org.bukkit.event.block.BlockIgniteEvent;
|
import org.bukkit.event.block.BlockIgniteEvent;
|
||||||
|
import org.bukkit.event.block.BlockMultiPlaceEvent;
|
||||||
import org.bukkit.event.block.BlockPhysicsEvent;
|
import org.bukkit.event.block.BlockPhysicsEvent;
|
||||||
import org.bukkit.event.block.BlockPistonExtendEvent;
|
import org.bukkit.event.block.BlockPistonExtendEvent;
|
||||||
import org.bukkit.event.block.BlockPistonRetractEvent;
|
import org.bukkit.event.block.BlockPistonRetractEvent;
|
||||||
@ -166,7 +168,7 @@ public class BlockEventListener implements Listener {
|
|||||||
}
|
}
|
||||||
if (Settings.Redstone.DISABLE_OFFLINE) {
|
if (Settings.Redstone.DISABLE_OFFLINE) {
|
||||||
boolean disable = false;
|
boolean disable = false;
|
||||||
if (!plot.getOwner().equals(DBFunc.SERVER)) {
|
if (!DBFunc.SERVER.equals(plot.getOwner())) {
|
||||||
if (plot.isMerged()) {
|
if (plot.isMerged()) {
|
||||||
disable = true;
|
disable = true;
|
||||||
for (UUID owner : plot.getOwners()) {
|
for (UUID owner : plot.getOwners()) {
|
||||||
@ -277,7 +279,7 @@ public class BlockEventListener implements Listener {
|
|||||||
BukkitPlayer pp = BukkitUtil.adapt(player);
|
BukkitPlayer pp = BukkitUtil.adapt(player);
|
||||||
Plot plot = area.getPlot(location);
|
Plot plot = area.getPlot(location);
|
||||||
if (plot != null) {
|
if (plot != null) {
|
||||||
if ((location.getY() > area.getMaxBuildHeight() || location.getY() < area
|
if ((location.getY() >= area.getMaxBuildHeight() || location.getY() < area
|
||||||
.getMinBuildHeight()) && !Permissions
|
.getMinBuildHeight()) && !Permissions
|
||||||
.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) {
|
.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -352,7 +354,8 @@ public class BlockEventListener implements Listener {
|
|||||||
Plot plot = area.getPlot(location);
|
Plot plot = area.getPlot(location);
|
||||||
if (plot != null) {
|
if (plot != null) {
|
||||||
BukkitPlayer plotPlayer = BukkitUtil.adapt(player);
|
BukkitPlayer plotPlayer = BukkitUtil.adapt(player);
|
||||||
if (event.getBlock().getY() == 0) {
|
// == rather than <= as we only care about the "ground level" not being destroyed
|
||||||
|
if (event.getBlock().getY() == area.getMinGenHeight()) {
|
||||||
if (!Permissions
|
if (!Permissions
|
||||||
.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_DESTROY_GROUNDLEVEL)) {
|
.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_DESTROY_GROUNDLEVEL)) {
|
||||||
plotPlayer.sendMessage(
|
plotPlayer.sendMessage(
|
||||||
@ -362,7 +365,7 @@ public class BlockEventListener implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if ((location.getY() > area.getMaxBuildHeight() || location.getY() < area
|
} else if ((location.getY() >= area.getMaxBuildHeight() || location.getY() < area
|
||||||
.getMinBuildHeight()) && !Permissions
|
.getMinBuildHeight()) && !Permissions
|
||||||
.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) {
|
.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -647,7 +650,8 @@ public class BlockEventListener implements Listener {
|
|||||||
event.getBlock().breakNaturally();
|
event.getBlock().breakNaturally();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (location.getY() == 0) {
|
// == rather than <= as we only care about the "ground level" not being destroyed
|
||||||
|
if (location.getY() == area.getMinGenHeight()) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1208,4 +1212,51 @@ public class BlockEventListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* BlockMultiPlaceEvent is called unrelated to the BlockPlaceEvent itself and therefore doesn't respect the cancellation.
|
||||||
|
*/
|
||||||
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
|
||||||
|
public void onBlockMultiPlace(BlockMultiPlaceEvent event) {
|
||||||
|
// Check if the generic block place event would be cancelled
|
||||||
|
blockCreate(event);
|
||||||
|
if (event.isCancelled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
BukkitPlayer pp = BukkitUtil.adapt(event.getPlayer());
|
||||||
|
Location placedLocation = BukkitUtil.adapt(event.getBlockReplacedState().getLocation());
|
||||||
|
PlotArea area = placedLocation.getPlotArea();
|
||||||
|
if (area == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Plot plot = placedLocation.getPlot();
|
||||||
|
|
||||||
|
for (final BlockState state : event.getReplacedBlockStates()) {
|
||||||
|
Location currentLocation = BukkitUtil.adapt(state.getLocation());
|
||||||
|
if (!Permissions.hasPermission(
|
||||||
|
pp,
|
||||||
|
Permission.PERMISSION_ADMIN_BUILD_ROAD
|
||||||
|
) && !(Objects.equals(currentLocation.getPlot(), plot))) {
|
||||||
|
pp.sendMessage(
|
||||||
|
TranslatableCaption.of("permission.no_permission_event"),
|
||||||
|
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD))
|
||||||
|
);
|
||||||
|
event.setCancelled(true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (currentLocation.getY() >= area.getMaxBuildHeight() || currentLocation.getY() < area.getMinBuildHeight()) {
|
||||||
|
pp.sendMessage(
|
||||||
|
TranslatableCaption.of("height.height_limit"),
|
||||||
|
Template.of("minHeight", String.valueOf(area.getMinBuildHeight())),
|
||||||
|
Template.of("maxHeight", String.valueOf(area.getMaxBuildHeight()))
|
||||||
|
);
|
||||||
|
event.setCancelled(true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -108,41 +108,11 @@ public class ChunkListener implements Listener {
|
|||||||
this.isTrueForNotSave = false;
|
this.isTrueForNotSave = false;
|
||||||
} else {
|
} else {
|
||||||
this.mustSave = classChunk.getField("mustNotSave");
|
this.mustSave = classChunk.getField("mustNotSave");
|
||||||
/*
|
}
|
||||||
this.worldServer = classCraftWorld.getField("world");
|
|
||||||
this.methodGetChunkProvider = getRefClass("{nms}.WorldServer").getMethod("getChunkProvider");
|
|
||||||
this.playerChunkMap = getRefClass("{nms}.ChunkProviderServer").getField("playerChunkMap");
|
|
||||||
RefClass classPlayerChunkMap = getRefClass("{nms}.PlayerChunkMap");
|
|
||||||
if (PaperLib.isPaper() && version == 16) {
|
|
||||||
this.updatingChunks = classPlayerChunkMap.getField("updatingChunks");
|
|
||||||
this.methodGetVisibleMap = getRefClass("com.destroystokyo.paper.util.map.QueuedChangesMapLong2Object").getMethod(
|
|
||||||
"getVisibleMap");
|
|
||||||
} else {
|
} else {
|
||||||
this.visibleChunks = classPlayerChunkMap.getField("visibleChunks");
|
|
||||||
}
|
|
||||||
this.methodGetFullChunk = getRefClass("{nms}.PlayerChunk").getMethod("getFullChunk");
|
|
||||||
this.methodGetBukkitChunk = getRefClass("{nms}.Chunk").getMethod("getBukkitChunk");
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
} else if (version == 17) {
|
|
||||||
RefClass classChunk = getRefClass("net.minecraft.world.level.chunk.Chunk");
|
RefClass classChunk = getRefClass("net.minecraft.world.level.chunk.Chunk");
|
||||||
this.mustSave = classChunk.getField("mustNotSave");
|
this.mustSave = classChunk.getField("mustNotSave");
|
||||||
/*
|
|
||||||
this.worldServer = classCraftWorld.getField("world");
|
|
||||||
this.methodGetChunkProvider = getRefClass("net.minecraft.server.level.WorldServer").getMethod(
|
|
||||||
"getChunkProvider");
|
|
||||||
this.playerChunkMap = getRefClass("net.minecraft.server.level.ChunkProviderServer").getField("a");
|
|
||||||
RefClass classPlayerChunkMap = getRefClass("net.minecraft.server.level.PlayerChunkMap");
|
|
||||||
if (PaperLib.isPaper()) {
|
|
||||||
this.updatingChunks = classPlayerChunkMap.getField("updatingChunks");
|
|
||||||
this.methodGetVisibleMap = getRefClass("com.destroystokyo.paper.util.map.QueuedChangesMapLong2Object").getMethod(
|
|
||||||
"getVisibleMap");
|
|
||||||
} else {
|
|
||||||
this.visibleChunks = classPlayerChunkMap.getField("l");
|
|
||||||
}
|
|
||||||
this.methodGetFullChunk = getRefClass("net.minecraft.server.level.PlayerChunk").getMethod("getFullChunk");
|
|
||||||
this.methodGetBukkitChunk = getRefClass("net.minecraft.world.level.chunk.Chunk").getMethod("getBukkitChunk");
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
} catch (NoSuchFieldException e) {
|
} catch (NoSuchFieldException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -182,32 +152,7 @@ public class ChunkListener implements Listener {
|
|||||||
}
|
}
|
||||||
toUnload.add(chunk);
|
toUnload.add(chunk);
|
||||||
}
|
}
|
||||||
}/* else {
|
|
||||||
Object worldServer = this.worldServer.of(craftWorld).get();
|
|
||||||
Object chunkProviderServer = methodGetChunkProvider.of(worldServer).call();
|
|
||||||
Object playerChunkMap = this.playerChunkMap.of(chunkProviderServer).get();
|
|
||||||
Long2ObjectLinkedOpenHashMap<?> chunks;
|
|
||||||
if (PaperLib.isPaper() && version > 15) {
|
|
||||||
Object updatingChunks = this.updatingChunks.of(playerChunkMap).get();
|
|
||||||
chunks = (Long2ObjectLinkedOpenHashMap<?>) this.methodGetVisibleMap.of(updatingChunks).call();
|
|
||||||
} else {
|
|
||||||
chunks = (Long2ObjectLinkedOpenHashMap<?>) this.visibleChunks.of(playerChunkMap).get();
|
|
||||||
}
|
}
|
||||||
for (Object playerChunk : chunks.values()) {
|
|
||||||
Object nmsChunk = this.methodGetFullChunk.of(playerChunk).call();
|
|
||||||
if (nmsChunk == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
Chunk chunk = (Chunk) this.methodGetBukkitChunk.of(nmsChunk).call();
|
|
||||||
int x = chunk.getX();
|
|
||||||
int z = chunk.getZ();
|
|
||||||
if (!shouldSave(worldName, x, z)) {
|
|
||||||
unloadChunk(worldName, chunk, false);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
toUnload.add(chunk);
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
if (toUnload.isEmpty()) {
|
if (toUnload.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -48,6 +48,7 @@ import com.plotsquared.core.util.Permissions;
|
|||||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||||
import com.sk89q.worldedit.world.block.BlockType;
|
import com.sk89q.worldedit.world.block.BlockType;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Particle;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Ageable;
|
import org.bukkit.entity.Ageable;
|
||||||
@ -323,6 +324,10 @@ public class EntityEventListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
//Spawn Explosion Particles when enabled in settings
|
||||||
|
if (Settings.General.ALWAYS_SHOW_EXPLOSIONS) {
|
||||||
|
event.getLocation().getWorld().spawnParticle(Particle.EXPLOSION_HUGE, event.getLocation(), 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
@ -371,14 +376,14 @@ public class EntityEventListener implements Listener {
|
|||||||
if (shooter instanceof Player) {
|
if (shooter instanceof Player) {
|
||||||
PlotPlayer<?> pp = BukkitUtil.adapt((Player) shooter);
|
PlotPlayer<?> pp = BukkitUtil.adapt((Player) shooter);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_PROJECTILE_UNOWNED)) {
|
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED)) {
|
||||||
entity.remove();
|
entity.remove();
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (plot.isAdded(pp.getUUID()) || Permissions
|
if (plot.isAdded(pp.getUUID()) || Permissions
|
||||||
.hasPermission(pp, Permission.PERMISSION_PROJECTILE_OTHER)) {
|
.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_OTHER)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
entity.remove();
|
entity.remove();
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -36,6 +36,7 @@ import com.plotsquared.core.plot.flag.implementations.DoneFlag;
|
|||||||
import io.papermc.lib.PaperLib;
|
import io.papermc.lib.PaperLib;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.ArmorStand;
|
import org.bukkit.entity.ArmorStand;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
@ -60,7 +61,7 @@ import java.util.List;
|
|||||||
|
|
||||||
public class EntitySpawnListener implements Listener {
|
public class EntitySpawnListener implements Listener {
|
||||||
|
|
||||||
private final static String KEY = "P2";
|
private static final String KEY = "P2";
|
||||||
private static boolean ignoreTP = false;
|
private static boolean ignoreTP = false;
|
||||||
private static boolean hasPlotArea = false;
|
private static boolean hasPlotArea = false;
|
||||||
private static String areaName = null;
|
private static String areaName = null;
|
||||||
@ -75,8 +76,7 @@ public class EntitySpawnListener implements Listener {
|
|||||||
|
|
||||||
public static void testCreate(final Entity entity) {
|
public static void testCreate(final Entity entity) {
|
||||||
@NonNull World world = entity.getWorld();
|
@NonNull World world = entity.getWorld();
|
||||||
if (areaName == world.getName()) {
|
if (!world.getName().equals(areaName)) {
|
||||||
} else {
|
|
||||||
areaName = world.getName();
|
areaName = world.getName();
|
||||||
hasPlotArea = PlotSquared.get().getPlotAreaManager().hasPlotArea(areaName);
|
hasPlotArea = PlotSquared.get().getPlotAreaManager().hasPlotArea(areaName);
|
||||||
}
|
}
|
||||||
@ -192,8 +192,32 @@ public class EntitySpawnListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onTeleport(EntityTeleportEvent event) {
|
public void onTeleport(EntityTeleportEvent event) {
|
||||||
Entity ent = event.getEntity();
|
Entity entity = event.getEntity();
|
||||||
if (ent instanceof Vehicle || ent instanceof ArmorStand) {
|
Entity fromLocation = event.getEntity();
|
||||||
|
Block toLocation = event.getTo().getBlock();
|
||||||
|
final Location fromLocLocation = BukkitUtil.adapt(fromLocation.getLocation());
|
||||||
|
final PlotArea fromArea = fromLocLocation.getPlotArea();
|
||||||
|
Location toLocLocation = BukkitUtil.adapt(toLocation.getLocation());
|
||||||
|
PlotArea toArea = toLocLocation.getPlotArea();
|
||||||
|
|
||||||
|
if (toArea == null) {
|
||||||
|
if (fromLocation.getType() == EntityType.SHULKER && fromArea != null) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Plot toPlot = toArea.getOwnedPlot(toLocLocation);
|
||||||
|
if (fromLocation.getType() == EntityType.SHULKER && fromArea != null) {
|
||||||
|
final Plot fromPlot = fromArea.getOwnedPlot(fromLocLocation);
|
||||||
|
|
||||||
|
if (fromPlot != null || toPlot != null) {
|
||||||
|
if ((fromPlot == null || !fromPlot.equals(toPlot)) && (toPlot == null || !toPlot.equals(fromPlot))) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (entity instanceof Vehicle || entity instanceof ArmorStand) {
|
||||||
testNether(event.getEntity());
|
testNether(event.getEntity());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -39,11 +39,13 @@ import com.plotsquared.core.command.MainCommand;
|
|||||||
import com.plotsquared.core.configuration.Settings;
|
import com.plotsquared.core.configuration.Settings;
|
||||||
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||||
import com.plotsquared.core.location.Location;
|
import com.plotsquared.core.location.Location;
|
||||||
|
import com.plotsquared.core.permissions.Permission;
|
||||||
import com.plotsquared.core.player.PlotPlayer;
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
import com.plotsquared.core.plot.Plot;
|
import com.plotsquared.core.plot.Plot;
|
||||||
import com.plotsquared.core.plot.PlotArea;
|
import com.plotsquared.core.plot.PlotArea;
|
||||||
import com.plotsquared.core.plot.flag.implementations.DoneFlag;
|
import com.plotsquared.core.plot.flag.implementations.DoneFlag;
|
||||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||||
|
import com.plotsquared.core.util.Permissions;
|
||||||
import net.kyori.adventure.text.minimessage.Template;
|
import net.kyori.adventure.text.minimessage.Template;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
@ -53,7 +55,6 @@ import org.bukkit.entity.EntityType;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Projectile;
|
import org.bukkit.entity.Projectile;
|
||||||
import org.bukkit.entity.Slime;
|
import org.bukkit.entity.Slime;
|
||||||
import org.bukkit.entity.ThrownPotion;
|
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
@ -321,9 +322,6 @@ public class PaperListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Projectile entity = event.getProjectile();
|
Projectile entity = event.getProjectile();
|
||||||
if (!(entity instanceof ThrownPotion)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ProjectileSource shooter = entity.getShooter();
|
ProjectileSource shooter = entity.getShooter();
|
||||||
if (!(shooter instanceof Player)) {
|
if (!(shooter instanceof Player)) {
|
||||||
return;
|
return;
|
||||||
@ -332,12 +330,37 @@ public class PaperListener implements Listener {
|
|||||||
if (!this.plotAreaManager.hasPlotArea(location.getWorldName())) {
|
if (!this.plotAreaManager.hasPlotArea(location.getWorldName())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PlotPlayer<?> pp = BukkitUtil.adapt((Player) shooter);
|
PlotPlayer<Player> pp = BukkitUtil.adapt((Player) shooter);
|
||||||
Plot plot = location.getOwnedPlot();
|
Plot plot = location.getOwnedPlot();
|
||||||
if (plot != null && !plot.isAdded(pp.getUUID())) {
|
|
||||||
|
if (plot == null) {
|
||||||
|
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_ROAD)) {
|
||||||
|
pp.sendMessage(
|
||||||
|
TranslatableCaption.of("permission.no_permission_event"),
|
||||||
|
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_ROAD))
|
||||||
|
);
|
||||||
entity.remove();
|
entity.remove();
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
} else if (!plot.hasOwner()) {
|
||||||
|
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED)) {
|
||||||
|
pp.sendMessage(
|
||||||
|
TranslatableCaption.of("permission.no_permission_event"),
|
||||||
|
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED))
|
||||||
|
);
|
||||||
|
entity.remove();
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
} else if (!plot.isAdded(pp.getUUID())) {
|
||||||
|
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_OTHER)) {
|
||||||
|
pp.sendMessage(
|
||||||
|
TranslatableCaption.of("permission.no_permission_event"),
|
||||||
|
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_OTHER))
|
||||||
|
);
|
||||||
|
entity.remove();
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -36,7 +36,6 @@ import com.plotsquared.core.plot.world.PlotAreaManager;
|
|||||||
import net.kyori.adventure.text.minimessage.Template;
|
import net.kyori.adventure.text.minimessage.Template;
|
||||||
import org.bukkit.block.Banner;
|
import org.bukkit.block.Banner;
|
||||||
import org.bukkit.block.Beacon;
|
import org.bukkit.block.Beacon;
|
||||||
import org.bukkit.block.Bed;
|
|
||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.block.CommandBlock;
|
import org.bukkit.block.CommandBlock;
|
||||||
import org.bukkit.block.Comparator;
|
import org.bukkit.block.Comparator;
|
||||||
@ -51,6 +50,7 @@ import org.bukkit.block.Jukebox;
|
|||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
import org.bukkit.block.Skull;
|
import org.bukkit.block.Skull;
|
||||||
import org.bukkit.block.Structure;
|
import org.bukkit.block.Structure;
|
||||||
|
import org.bukkit.block.data.type.Bed;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -68,11 +68,9 @@ import com.plotsquared.core.plot.flag.implementations.PlayerInteractFlag;
|
|||||||
import com.plotsquared.core.plot.flag.implementations.PreventCreativeCopyFlag;
|
import com.plotsquared.core.plot.flag.implementations.PreventCreativeCopyFlag;
|
||||||
import com.plotsquared.core.plot.flag.implementations.TamedInteractFlag;
|
import com.plotsquared.core.plot.flag.implementations.TamedInteractFlag;
|
||||||
import com.plotsquared.core.plot.flag.implementations.UntrustedVisitFlag;
|
import com.plotsquared.core.plot.flag.implementations.UntrustedVisitFlag;
|
||||||
import com.plotsquared.core.plot.flag.implementations.UseFlag;
|
|
||||||
import com.plotsquared.core.plot.flag.implementations.VehicleBreakFlag;
|
import com.plotsquared.core.plot.flag.implementations.VehicleBreakFlag;
|
||||||
import com.plotsquared.core.plot.flag.implementations.VehicleUseFlag;
|
import com.plotsquared.core.plot.flag.implementations.VehicleUseFlag;
|
||||||
import com.plotsquared.core.plot.flag.implementations.VillagerInteractFlag;
|
import com.plotsquared.core.plot.flag.implementations.VillagerInteractFlag;
|
||||||
import com.plotsquared.core.plot.flag.types.BlockTypeWrapper;
|
|
||||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||||
import com.plotsquared.core.util.EventDispatcher;
|
import com.plotsquared.core.util.EventDispatcher;
|
||||||
import com.plotsquared.core.util.MathMan;
|
import com.plotsquared.core.util.MathMan;
|
||||||
@ -94,6 +92,7 @@ import org.bukkit.FluidCollisionMode;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.block.data.Waterlogged;
|
import org.bukkit.block.data.Waterlogged;
|
||||||
import org.bukkit.command.PluginCommand;
|
import org.bukkit.command.PluginCommand;
|
||||||
import org.bukkit.entity.ArmorStand;
|
import org.bukkit.entity.ArmorStand;
|
||||||
@ -127,7 +126,6 @@ import org.bukkit.event.player.PlayerBucketFillEvent;
|
|||||||
import org.bukkit.event.player.PlayerChangedWorldEvent;
|
import org.bukkit.event.player.PlayerChangedWorldEvent;
|
||||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||||
import org.bukkit.event.player.PlayerEggThrowEvent;
|
|
||||||
import org.bukkit.event.player.PlayerEvent;
|
import org.bukkit.event.player.PlayerEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
|
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||||
@ -225,6 +223,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("StringSplitter")
|
||||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
|
||||||
public void playerCommand(PlayerCommandPreprocessEvent event) {
|
public void playerCommand(PlayerCommandPreprocessEvent event) {
|
||||||
String msg = event.getMessage().toLowerCase().replaceAll("/", "").trim();
|
String msg = event.getMessage().toLowerCase().replaceAll("/", "").trim();
|
||||||
@ -380,6 +379,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
|||||||
this.eventDispatcher.doRespawnTask(pp);
|
this.eventDispatcher.doRespawnTask(pp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation") // We explicitly want #getHomeSynchronous here
|
||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onTeleport(PlayerTeleportEvent event) {
|
public void onTeleport(PlayerTeleportEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
@ -418,8 +418,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
|||||||
.getHomeSynchronous()
|
.getHomeSynchronous()
|
||||||
.equals(BukkitUtil.adaptComplete(to)))) {
|
.equals(BukkitUtil.adaptComplete(to)))) {
|
||||||
pp.sendMessage(
|
pp.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission_event"),
|
TranslatableCaption.of("deny.no_enter"),
|
||||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_ENTRY_DENIED))
|
Template.of("plot", plot.toString())
|
||||||
);
|
);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
@ -552,8 +552,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
|||||||
ForceFieldListener.handleForcefield(player, pp, now);
|
ForceFieldListener.handleForcefield(player, pp, now);
|
||||||
} else if (!plotEntry(pp, now) && this.tmpTeleport) {
|
} else if (!plotEntry(pp, now) && this.tmpTeleport) {
|
||||||
pp.sendMessage(
|
pp.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission_event"),
|
TranslatableCaption.of("deny.no_enter"),
|
||||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_ENTRY_DENIED))
|
Template.of("plot", now.toString())
|
||||||
);
|
);
|
||||||
this.tmpTeleport = false;
|
this.tmpTeleport = false;
|
||||||
to.setX(from.getBlockX());
|
to.setX(from.getBlockX());
|
||||||
@ -572,7 +572,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
|||||||
player.teleport(event.getTo());
|
player.teleport(event.getTo());
|
||||||
this.tmpTeleport = true;
|
this.tmpTeleport = true;
|
||||||
pp.sendMessage(TranslatableCaption.of("border.denied"));
|
pp.sendMessage(TranslatableCaption.of("border.denied"));
|
||||||
} else {
|
} else if (MathMan.roundInt(from.getX()) <= border) { // Only send if they just moved out of the border
|
||||||
pp.sendMessage(TranslatableCaption.of("border.bypass.exited"));
|
pp.sendMessage(TranslatableCaption.of("border.bypass.exited"));
|
||||||
}
|
}
|
||||||
} else if (x2 < -border && this.tmpTeleport) {
|
} else if (x2 < -border && this.tmpTeleport) {
|
||||||
@ -582,7 +582,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
|||||||
player.teleport(event.getTo());
|
player.teleport(event.getTo());
|
||||||
this.tmpTeleport = true;
|
this.tmpTeleport = true;
|
||||||
pp.sendMessage(TranslatableCaption.of("border.denied"));
|
pp.sendMessage(TranslatableCaption.of("border.denied"));
|
||||||
} else {
|
} else if (MathMan.roundInt(from.getX()) >= -border) { // Only send if they just moved out of the border
|
||||||
pp.sendMessage(TranslatableCaption.of("border.bypass.exited"));
|
pp.sendMessage(TranslatableCaption.of("border.bypass.exited"));
|
||||||
}
|
}
|
||||||
} else if (((x1 = MathMan.roundInt(from.getX())) >= border && x2 <= border) || (x1 <= -border && x2 >= -border)) {
|
} else if (((x1 = MathMan.roundInt(from.getX())) >= border && x2 <= border) || (x1 <= -border && x2 >= -border)) {
|
||||||
@ -613,13 +613,13 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Plot now = area.getPlot(location);
|
Plot plot = area.getPlot(location);
|
||||||
Plot lastPlot;
|
Plot lastPlot;
|
||||||
try (final MetaDataAccess<Plot> lastPlotAccess =
|
try (final MetaDataAccess<Plot> lastPlotAccess =
|
||||||
pp.accessTemporaryMetaData(PlayerMetaDataKeys.TEMPORARY_LAST_PLOT)) {
|
pp.accessTemporaryMetaData(PlayerMetaDataKeys.TEMPORARY_LAST_PLOT)) {
|
||||||
lastPlot = lastPlotAccess.get().orElse(null);
|
lastPlot = lastPlotAccess.get().orElse(null);
|
||||||
}
|
}
|
||||||
if (now == null) {
|
if (plot == null) {
|
||||||
try (final MetaDataAccess<Boolean> kickAccess =
|
try (final MetaDataAccess<Boolean> kickAccess =
|
||||||
pp.accessTemporaryMetaData(PlayerMetaDataKeys.TEMPORARY_KICK)) {
|
pp.accessTemporaryMetaData(PlayerMetaDataKeys.TEMPORARY_KICK)) {
|
||||||
if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport && !kickAccess.get().orElse(false)) {
|
if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport && !kickAccess.get().orElse(false)) {
|
||||||
@ -638,12 +638,12 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (now.equals(lastPlot)) {
|
} else if (plot.equals(lastPlot)) {
|
||||||
ForceFieldListener.handleForcefield(player, pp, now);
|
ForceFieldListener.handleForcefield(player, pp, plot);
|
||||||
} else if (!plotEntry(pp, now) && this.tmpTeleport) {
|
} else if (!plotEntry(pp, plot) && this.tmpTeleport) {
|
||||||
pp.sendMessage(
|
pp.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission_event"),
|
TranslatableCaption.of("deny.no_enter"),
|
||||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_ENTRY_DENIED))
|
Template.of("plot", plot.toString())
|
||||||
);
|
);
|
||||||
this.tmpTeleport = false;
|
this.tmpTeleport = false;
|
||||||
player.teleport(from);
|
player.teleport(from);
|
||||||
@ -663,7 +663,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
|||||||
player.teleport(event.getTo());
|
player.teleport(event.getTo());
|
||||||
this.tmpTeleport = true;
|
this.tmpTeleport = true;
|
||||||
pp.sendMessage(TranslatableCaption.of("border.denied"));
|
pp.sendMessage(TranslatableCaption.of("border.denied"));
|
||||||
} else {
|
} else if (MathMan.roundInt(from.getZ()) <= border) { // Only send if they just moved out of the border
|
||||||
pp.sendMessage(TranslatableCaption.of("border.bypass.exited"));
|
pp.sendMessage(TranslatableCaption.of("border.bypass.exited"));
|
||||||
}
|
}
|
||||||
} else if (z2 < -border && this.tmpTeleport) {
|
} else if (z2 < -border && this.tmpTeleport) {
|
||||||
@ -673,7 +673,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
|||||||
player.teleport(event.getTo());
|
player.teleport(event.getTo());
|
||||||
this.tmpTeleport = true;
|
this.tmpTeleport = true;
|
||||||
pp.sendMessage(TranslatableCaption.of("border.denied"));
|
pp.sendMessage(TranslatableCaption.of("border.denied"));
|
||||||
} else {
|
} else if (MathMan.roundInt(from.getZ()) >= -border) { // Only send if they just moved out of the border
|
||||||
pp.sendMessage(TranslatableCaption.of("border.bypass.exited"));
|
pp.sendMessage(TranslatableCaption.of("border.bypass.exited"));
|
||||||
}
|
}
|
||||||
} else if (((z1 = MathMan.roundInt(from.getZ())) >= border && z2 <= border) || (z1 <= -border && z2 >= -border)) {
|
} else if (((z1 = MathMan.roundInt(from.getZ())) >= border && z2 <= border) || (z1 <= -border && z2 >= -border)) {
|
||||||
@ -1064,9 +1064,13 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
|||||||
if (area == null) {
|
if (area == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PlayerBlockEventType eventType = null;
|
PlayerBlockEventType eventType;
|
||||||
BlockType blocktype1;
|
BlockType blocktype1;
|
||||||
Block block = event.getClickedBlock();
|
Block block = event.getClickedBlock();
|
||||||
|
if (block == null) {
|
||||||
|
// We do not care in this case, the player is likely interacting with air ("nothing").
|
||||||
|
return;
|
||||||
|
}
|
||||||
Location location = BukkitUtil.adapt(block.getLocation());
|
Location location = BukkitUtil.adapt(block.getLocation());
|
||||||
Action action = event.getAction();
|
Action action = event.getAction();
|
||||||
switch (action) {
|
switch (action) {
|
||||||
@ -1239,13 +1243,6 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
|||||||
);
|
);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
} else if (!plot.isAdded(pp.getUUID())) {
|
} else if (!plot.isAdded(pp.getUUID())) {
|
||||||
List<BlockTypeWrapper> use = plot.getFlag(UseFlag.class);
|
|
||||||
final BlockType blockType = BukkitAdapter.asBlockType(block.getType());
|
|
||||||
for (final BlockTypeWrapper blockTypeWrapper : use) {
|
|
||||||
if (blockTypeWrapper.accepts(blockType)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
|
if (Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1311,14 +1308,6 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
|||||||
);
|
);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
} else if (!plot.isAdded(plotPlayer.getUUID())) {
|
} else if (!plot.isAdded(plotPlayer.getUUID())) {
|
||||||
List<BlockTypeWrapper> use = plot.getFlag(UseFlag.class);
|
|
||||||
Block block = event.getBlockClicked();
|
|
||||||
final BlockType blockType = BukkitAdapter.asBlockType(block.getType());
|
|
||||||
for (final BlockTypeWrapper blockTypeWrapper : use) {
|
|
||||||
if (blockTypeWrapper.accepts(blockType)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
|
if (Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1610,43 +1599,6 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
|
||||||
public void onPlayerEggThrow(PlayerEggThrowEvent event) {
|
|
||||||
Location location = BukkitUtil.adapt(event.getEgg().getLocation());
|
|
||||||
PlotArea area = location.getPlotArea();
|
|
||||||
if (area == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Player player = event.getPlayer();
|
|
||||||
BukkitPlayer plotPlayer = BukkitUtil.adapt(player);
|
|
||||||
Plot plot = area.getPlot(location);
|
|
||||||
if (plot == null) {
|
|
||||||
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PROJECTILE_ROAD)) {
|
|
||||||
plotPlayer.sendMessage(
|
|
||||||
TranslatableCaption.of("permission.no_permission_event"),
|
|
||||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_ROAD))
|
|
||||||
);
|
|
||||||
event.setHatching(false);
|
|
||||||
}
|
|
||||||
} else if (!plot.hasOwner()) {
|
|
||||||
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED)) {
|
|
||||||
plotPlayer.sendMessage(
|
|
||||||
TranslatableCaption.of("permission.no_permission_event"),
|
|
||||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED))
|
|
||||||
);
|
|
||||||
event.setHatching(false);
|
|
||||||
}
|
|
||||||
} else if (!plot.isAdded(plotPlayer.getUUID())) {
|
|
||||||
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PROJECTILE_OTHER)) {
|
|
||||||
plotPlayer.sendMessage(
|
|
||||||
TranslatableCaption.of("permission.no_permission_event"),
|
|
||||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_OTHER))
|
|
||||||
);
|
|
||||||
event.setHatching(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onItemDrop(PlayerDropItemEvent event) {
|
public void onItemDrop(PlayerDropItemEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
@ -1720,6 +1672,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation") // #getLocate is needed for Spigot compatibility
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onLocaleChange(final PlayerLocaleChangeEvent event) {
|
public void onLocaleChange(final PlayerLocaleChangeEvent event) {
|
||||||
// The event is fired before the player is deemed online upon login
|
// The event is fired before the player is deemed online upon login
|
||||||
@ -1755,22 +1708,49 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPortalCreation(PortalCreateEvent event) {
|
public void onPortalCreation(PortalCreateEvent event) {
|
||||||
Location location = BukkitUtil.adapt(event.getEntity().getLocation());
|
String world = event.getWorld().getName();
|
||||||
|
if (PlotSquared.get().getPlotAreaManager().getPlotAreasSet(world).size() == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int minX = Integer.MAX_VALUE;
|
||||||
|
int maxX = Integer.MIN_VALUE;
|
||||||
|
int minZ = Integer.MAX_VALUE;
|
||||||
|
int maxZ = Integer.MIN_VALUE;
|
||||||
|
for (BlockState state : event.getBlocks()) {
|
||||||
|
minX = Math.min(state.getX(), minX);
|
||||||
|
maxX = Math.max(state.getX(), maxX);
|
||||||
|
minZ = Math.min(state.getZ(), minZ);
|
||||||
|
maxZ = Math.max(state.getZ(), maxZ);
|
||||||
|
}
|
||||||
|
int y = event.getBlocks().get(0).getY(); // Don't need to worry about this too much
|
||||||
|
for (Location location : Set.of( // Use Set to lazily avoid duplicate locations
|
||||||
|
Location.at(world, minX, y, maxX),
|
||||||
|
Location.at(world, minZ, y, maxZ),
|
||||||
|
Location.at(world, minX, y, maxZ),
|
||||||
|
Location.at(world, minZ, y, maxX)
|
||||||
|
)) {
|
||||||
PlotArea area = location.getPlotArea();
|
PlotArea area = location.getPlotArea();
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
return;
|
continue;
|
||||||
}
|
}
|
||||||
Plot plot = location.getOwnedPlot();
|
Plot plot = location.getOwnedPlot();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
if (area.isRoadFlags() && area.getRoadFlag(DenyPortalsFlag.class)) {
|
if (area.isRoadFlags() && area.getRoadFlag(DenyPortalsFlag.class)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (plot.getFlag(DenyPortalsFlag.class)) {
|
if (plot.getFlag(DenyPortalsFlag.class)) {
|
||||||
if (plot.getFlag(DenyPortalsFlag.class)) {
|
StringBuilder builder = new StringBuilder();
|
||||||
plot.debug(event.getEntity().getName() + " did not create a portal because of deny-portals = true");
|
if (event.getEntity() != null) {
|
||||||
|
builder.append(event.getEntity().getName()).append(" did not create a portal");
|
||||||
|
} else {
|
||||||
|
builder.append("Portal creation cancelled");
|
||||||
|
}
|
||||||
|
plot.debug(builder.append(" because of deny-portals = true").toString());
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -28,6 +28,7 @@ package com.plotsquared.bukkit.listener;
|
|||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.plotsquared.bukkit.util.BukkitEntityUtil;
|
import com.plotsquared.bukkit.util.BukkitEntityUtil;
|
||||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||||
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||||
import com.plotsquared.core.location.Location;
|
import com.plotsquared.core.location.Location;
|
||||||
import com.plotsquared.core.permissions.Permission;
|
import com.plotsquared.core.permissions.Permission;
|
||||||
import com.plotsquared.core.player.PlotPlayer;
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
@ -36,6 +37,7 @@ import com.plotsquared.core.plot.PlotArea;
|
|||||||
import com.plotsquared.core.plot.PlotHandler;
|
import com.plotsquared.core.plot.PlotHandler;
|
||||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||||
import com.plotsquared.core.util.Permissions;
|
import com.plotsquared.core.util.Permissions;
|
||||||
|
import net.kyori.adventure.text.minimessage.Template;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -96,9 +98,6 @@ public class ProjectileEventListener implements Listener {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onProjectileLaunch(ProjectileLaunchEvent event) {
|
public void onProjectileLaunch(ProjectileLaunchEvent event) {
|
||||||
Projectile entity = event.getEntity();
|
Projectile entity = event.getEntity();
|
||||||
if (!(entity instanceof ThrownPotion)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ProjectileSource shooter = entity.getShooter();
|
ProjectileSource shooter = entity.getShooter();
|
||||||
if (!(shooter instanceof Player)) {
|
if (!(shooter instanceof Player)) {
|
||||||
return;
|
return;
|
||||||
@ -109,10 +108,35 @@ public class ProjectileEventListener implements Listener {
|
|||||||
}
|
}
|
||||||
PlotPlayer<Player> pp = BukkitUtil.adapt((Player) shooter);
|
PlotPlayer<Player> pp = BukkitUtil.adapt((Player) shooter);
|
||||||
Plot plot = location.getOwnedPlot();
|
Plot plot = location.getOwnedPlot();
|
||||||
if (plot != null && !plot.isAdded(pp.getUUID())) {
|
|
||||||
|
if (plot == null) {
|
||||||
|
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_ROAD)) {
|
||||||
|
pp.sendMessage(
|
||||||
|
TranslatableCaption.of("permission.no_permission_event"),
|
||||||
|
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_ROAD))
|
||||||
|
);
|
||||||
entity.remove();
|
entity.remove();
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
} else if (!plot.hasOwner()) {
|
||||||
|
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED)) {
|
||||||
|
pp.sendMessage(
|
||||||
|
TranslatableCaption.of("permission.no_permission_event"),
|
||||||
|
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED))
|
||||||
|
);
|
||||||
|
entity.remove();
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
} else if (!plot.isAdded(pp.getUUID())) {
|
||||||
|
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_OTHER)) {
|
||||||
|
pp.sendMessage(
|
||||||
|
TranslatableCaption.of("permission.no_permission_event"),
|
||||||
|
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_OTHER))
|
||||||
|
);
|
||||||
|
entity.remove();
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -131,14 +155,14 @@ public class ProjectileEventListener implements Listener {
|
|||||||
if (shooter instanceof Player) {
|
if (shooter instanceof Player) {
|
||||||
PlotPlayer<?> pp = BukkitUtil.adapt((Player) shooter);
|
PlotPlayer<?> pp = BukkitUtil.adapt((Player) shooter);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_PROJECTILE_UNOWNED)) {
|
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED)) {
|
||||||
entity.remove();
|
entity.remove();
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (plot.isAdded(pp.getUUID()) || Permissions
|
if (plot.isAdded(pp.getUUID()) || Permissions
|
||||||
.hasPermission(pp, Permission.PERMISSION_PROJECTILE_OTHER)) {
|
.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_OTHER)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
entity.remove();
|
entity.remove();
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -43,7 +43,6 @@ import java.lang.reflect.Method;
|
|||||||
|
|
||||||
import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
|
import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
|
||||||
public class SingleWorldListener implements Listener {
|
public class SingleWorldListener implements Listener {
|
||||||
|
|
||||||
private final Method methodGetHandleChunk;
|
private final Method methodGetHandleChunk;
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -25,6 +25,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.managers;
|
package com.plotsquared.bukkit.managers;
|
||||||
|
|
||||||
|
/*
|
||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
@ -35,10 +36,9 @@ import se.hyperver.hyperverse.world.WorldConfigurationBuilder;
|
|||||||
import se.hyperver.hyperverse.world.WorldFeatures;
|
import se.hyperver.hyperverse.world.WorldFeatures;
|
||||||
import se.hyperver.hyperverse.world.WorldType;
|
import se.hyperver.hyperverse.world.WorldType;
|
||||||
|
|
||||||
/**
|
Hyperverse implementation is currently put on ice until Hyperverse is released on a stable line and deployed to the central
|
||||||
* Hyperverse specific manager that creates worlds
|
repository.
|
||||||
* using Hyperverse's API
|
|
||||||
*/
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class HyperverseWorldManager extends BukkitWorldManager {
|
public class HyperverseWorldManager extends BukkitWorldManager {
|
||||||
|
|
||||||
@ -67,3 +67,4 @@ public class HyperverseWorldManager extends BukkitWorldManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -38,7 +38,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
|||||||
* @deprecated Deprecated and scheduled for removal without replacement
|
* @deprecated Deprecated and scheduled for removal without replacement
|
||||||
* in favor of the build in setup wizard.
|
* in favor of the build in setup wizard.
|
||||||
*/
|
*/
|
||||||
@Deprecated(forRemoval = true)
|
@Deprecated(forRemoval = true, since = "6.0.0")
|
||||||
@Singleton
|
@Singleton
|
||||||
public class MultiverseWorldManager extends BukkitWorldManager {
|
public class MultiverseWorldManager extends BukkitWorldManager {
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -162,6 +162,7 @@ public class BukkitPlayer extends PlotPlayer<Player> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("StringSplitter")
|
||||||
@Override
|
@Override
|
||||||
@NonNegative
|
@NonNegative
|
||||||
public int hasPermissionRange(
|
public int hasPermissionRange(
|
||||||
@ -319,7 +320,7 @@ public class BukkitPlayer extends PlotPlayer<Player> {
|
|||||||
if (id == ItemTypes.AIR) {
|
if (id == ItemTypes.AIR) {
|
||||||
// Let's just stop all the discs because why not?
|
// Let's just stop all the discs because why not?
|
||||||
for (final Sound sound : Arrays.stream(Sound.values())
|
for (final Sound sound : Arrays.stream(Sound.values())
|
||||||
.filter(sound -> sound.name().contains("DISC")).collect(Collectors.toList())) {
|
.filter(sound -> sound.name().contains("DISC")).toList()) {
|
||||||
player.stopSound(sound);
|
player.stopSound(sound);
|
||||||
}
|
}
|
||||||
// this.player.playEffect(BukkitUtil.getLocation(location), Effect.RECORD_PLAY, Material.AIR);
|
// this.player.playEffect(BukkitUtil.getLocation(location), Effect.RECORD_PLAY, Material.AIR);
|
||||||
@ -331,6 +332,7 @@ public class BukkitPlayer extends PlotPlayer<Player> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation") // Needed for Spigot compatibility
|
||||||
@Override
|
@Override
|
||||||
public void kick(final String message) {
|
public void kick(final String message) {
|
||||||
this.player.kickPlayer(message);
|
this.player.kickPlayer(message);
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -74,8 +74,9 @@ public final class BukkitChunkCoordinator extends ChunkCoordinator {
|
|||||||
private final Consumer<Throwable> throwableConsumer;
|
private final Consumer<Throwable> throwableConsumer;
|
||||||
private final boolean unloadAfter;
|
private final boolean unloadAfter;
|
||||||
private final int totalSize;
|
private final int totalSize;
|
||||||
|
|
||||||
private final AtomicInteger expectedSize;
|
private final AtomicInteger expectedSize;
|
||||||
|
private final AtomicInteger loadingChunks = new AtomicInteger();
|
||||||
|
|
||||||
private int batchSize;
|
private int batchSize;
|
||||||
private PlotSquaredTask task;
|
private PlotSquaredTask task;
|
||||||
private boolean shouldCancel;
|
private boolean shouldCancel;
|
||||||
@ -150,6 +151,13 @@ public final class BukkitChunkCoordinator extends ChunkCoordinator {
|
|||||||
|
|
||||||
Chunk chunk = this.availableChunks.poll();
|
Chunk chunk = this.availableChunks.poll();
|
||||||
if (chunk == null) {
|
if (chunk == null) {
|
||||||
|
if (this.availableChunks.isEmpty()) {
|
||||||
|
if (this.requestedChunks.isEmpty() && loadingChunks.get() == 0) {
|
||||||
|
finish();
|
||||||
|
} else {
|
||||||
|
requestBatch();
|
||||||
|
}
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
long[] iterationTime = new long[2];
|
long[] iterationTime = new long[2];
|
||||||
@ -197,9 +205,11 @@ public final class BukkitChunkCoordinator extends ChunkCoordinator {
|
|||||||
BlockVector2 chunk;
|
BlockVector2 chunk;
|
||||||
for (int i = 0; i < this.batchSize && (chunk = this.requestedChunks.poll()) != null; i++) {
|
for (int i = 0; i < this.batchSize && (chunk = this.requestedChunks.poll()) != null; i++) {
|
||||||
// This required PaperLib to be bumped to version 1.0.4 to mark the request as urgent
|
// This required PaperLib to be bumped to version 1.0.4 to mark the request as urgent
|
||||||
|
loadingChunks.incrementAndGet();
|
||||||
PaperLib
|
PaperLib
|
||||||
.getChunkAtAsync(this.bukkitWorld, chunk.getX(), chunk.getZ(), true, true)
|
.getChunkAtAsync(this.bukkitWorld, chunk.getX(), chunk.getZ(), true, true)
|
||||||
.whenComplete((chunkObject, throwable) -> {
|
.whenComplete((chunkObject, throwable) -> {
|
||||||
|
loadingChunks.decrementAndGet();
|
||||||
if (throwable != null) {
|
if (throwable != null) {
|
||||||
throwable.printStackTrace();
|
throwable.printStackTrace();
|
||||||
// We want one less because this couldn't be processed
|
// We want one less because this couldn't be processed
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -51,7 +51,6 @@ import com.sk89q.worldedit.world.biome.BiomeType;
|
|||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Chunk;
|
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.Container;
|
import org.bukkit.block.Container;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
@ -112,8 +111,8 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator {
|
|||||||
public boolean enqueue() {
|
public boolean enqueue() {
|
||||||
final Clipboard regenClipboard;
|
final Clipboard regenClipboard;
|
||||||
if (isRegen()) {
|
if (isRegen()) {
|
||||||
BlockVector3 start = BlockVector3.at(getRegenStart()[0] << 4, 0, getRegenStart()[1] << 4);
|
BlockVector3 start = BlockVector3.at(getRegenStart()[0] << 4, getMinY(), getRegenStart()[1] << 4);
|
||||||
BlockVector3 end = BlockVector3.at((getRegenEnd()[0] << 4) + 15, 255, (getRegenEnd()[1] << 4) + 15);
|
BlockVector3 end = BlockVector3.at((getRegenEnd()[0] << 4) + 15, getMaxY(), (getRegenEnd()[1] << 4) + 15);
|
||||||
Region region = new CuboidRegion(start, end);
|
Region region = new CuboidRegion(start, end);
|
||||||
regenClipboard = new BlockArrayClipboard(region);
|
regenClipboard = new BlockArrayClipboard(region);
|
||||||
regenClipboard.setOrigin(start);
|
regenClipboard.setOrigin(start);
|
||||||
@ -135,7 +134,7 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator {
|
|||||||
int sx = blockVector2.getX() << 4;
|
int sx = blockVector2.getX() << 4;
|
||||||
int sz = blockVector2.getZ() << 4;
|
int sz = blockVector2.getZ() << 4;
|
||||||
if (isRegenChunk) {
|
if (isRegenChunk) {
|
||||||
for (int layer = 0; layer < 16; layer++) {
|
for (int layer = getMinLayer(); layer <= getMaxLayer(); layer++) {
|
||||||
for (int y = 0; y < 16; y++) {
|
for (int y = 0; y < 16; y++) {
|
||||||
for (int x = 0; x < 16; x++) {
|
for (int x = 0; x < 16; x++) {
|
||||||
for (int z = 0; z < 16; z++) {
|
for (int z = 0; z < 16; z++) {
|
||||||
@ -171,7 +170,7 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator {
|
|||||||
int lx = ChunkUtil.getX(j);
|
int lx = ChunkUtil.getX(j);
|
||||||
int lz = ChunkUtil.getZ(j);
|
int lz = ChunkUtil.getZ(j);
|
||||||
int x = sx + lx;
|
int x = sx + lx;
|
||||||
int y = ChunkUtil.getY(layer, j);
|
int y = ChunkUtil.getY(layer + localChunk.getMinSection(), j);
|
||||||
int z = sz + lz;
|
int z = sz + lz;
|
||||||
boolean edge = Settings.QUEUE.UPDATE_EDGES && isEdge(y >> 4, lx, y & 15, lz, blockVector2,
|
boolean edge = Settings.QUEUE.UPDATE_EDGES && isEdge(y >> 4, lx, y & 15, lz, blockVector2,
|
||||||
localChunk
|
localChunk
|
||||||
@ -180,7 +179,7 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int layer = 0; layer < localChunk.getBaseblocks().length; layer++) {
|
for (int layer = 0; layer < localChunk.getBiomes().length; layer++) {
|
||||||
BiomeType[] biomesLayer = localChunk.getBiomes()[layer];
|
BiomeType[] biomesLayer = localChunk.getBiomes()[layer];
|
||||||
if (biomesLayer == null) {
|
if (biomesLayer == null) {
|
||||||
continue;
|
continue;
|
||||||
@ -199,7 +198,7 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (localChunk.getTiles().size() > 0) {
|
if (localChunk.getTiles().size() > 0) {
|
||||||
localChunk.getTiles().forEach(((blockVector3, tag) -> {
|
localChunk.getTiles().forEach((blockVector3, tag) -> {
|
||||||
try {
|
try {
|
||||||
BaseBlock block = getWorld().getBlock(blockVector3).toBaseBlock(tag);
|
BaseBlock block = getWorld().getBlock(blockVector3).toBaseBlock(tag);
|
||||||
getWorld().setBlock(blockVector3, block, noSideEffectSet);
|
getWorld().setBlock(blockVector3, block, noSideEffectSet);
|
||||||
@ -207,7 +206,7 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator {
|
|||||||
StateWrapper sw = new StateWrapper(tag);
|
StateWrapper sw = new StateWrapper(tag);
|
||||||
sw.restoreTag(getWorld().getName(), blockVector3.getX(), blockVector3.getY(), blockVector3.getZ());
|
sw.restoreTag(getWorld().getName(), blockVector3.getX(), blockVector3.getY(), blockVector3.getZ());
|
||||||
}
|
}
|
||||||
}));
|
});
|
||||||
}
|
}
|
||||||
if (localChunk.getEntities().size() > 0) {
|
if (localChunk.getEntities().size() > 0) {
|
||||||
localChunk.getEntities().forEach((location, entity) -> getWorld().createEntity(location, entity));
|
localChunk.getEntities().forEach((location, entity) -> getWorld().createEntity(location, entity));
|
||||||
@ -238,6 +237,7 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator {
|
|||||||
/**
|
/**
|
||||||
* Set a block to the world. First tries WNA but defaults to normal block setting methods if that fails
|
* Set a block to the world. First tries WNA but defaults to normal block setting methods if that fails
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unused")
|
||||||
private void setWorldBlock(int x, int y, int z, @NonNull BaseBlock block, @NonNull BlockVector2 blockVector2, boolean edge) {
|
private void setWorldBlock(int x, int y, int z, @NonNull BaseBlock block, @NonNull BlockVector2 blockVector2, boolean edge) {
|
||||||
try {
|
try {
|
||||||
BlockVector3 loc = BlockVector3.at(x, y, z);
|
BlockVector3 loc = BlockVector3.at(x, y, z);
|
||||||
@ -266,9 +266,7 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator {
|
|||||||
} catch (WorldEditException ignored) {
|
} catch (WorldEditException ignored) {
|
||||||
// Fallback to not so nice method
|
// Fallback to not so nice method
|
||||||
BlockData blockData = BukkitAdapter.adapt(block);
|
BlockData blockData = BukkitAdapter.adapt(block);
|
||||||
Chunk chunk = getBukkitWorld().getChunkAt(blockVector2.getX(), blockVector2.getZ());
|
Block existing = getBukkitWorld().getBlockAt(x, y, z);
|
||||||
|
|
||||||
Block existing = chunk.getBlock(x, y, z);
|
|
||||||
final BlockState existingBaseBlock = BukkitAdapter.adapt(existing.getBlockData());
|
final BlockState existingBaseBlock = BukkitAdapter.adapt(existing.getBlockData());
|
||||||
if (BukkitBlockUtil.get(existing).equals(existingBaseBlock) && existing.getBlockData().matches(blockData)) {
|
if (BukkitBlockUtil.get(existing).equals(existingBaseBlock) && existing.getBlockData().matches(blockData)) {
|
||||||
return;
|
return;
|
||||||
@ -297,47 +295,48 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean isEdge(int layer, int x, int y, int z, BlockVector2 blockVector2, LocalChunk localChunk) {
|
private boolean isEdge(int layer, int x, int y, int z, BlockVector2 blockVector2, LocalChunk localChunk) {
|
||||||
if (layer == 0 || layer == localChunk.getBaseblocks().length - 1) {
|
int layerIndex = (layer - localChunk.getMinSection());
|
||||||
|
if (layer == localChunk.getMinSection() || layerIndex == localChunk.getBaseblocks().length - 1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (x == 0) {
|
if (x == 0) {
|
||||||
LocalChunk localChunkX = getBlockChunks().get(blockVector2.withX(blockVector2.getX() - 1));
|
LocalChunk localChunkX = getBlockChunks().get(blockVector2.withX(blockVector2.getX() - 1));
|
||||||
if (localChunkX == null || localChunkX.getBaseblocks()[layer] == null ||
|
if (localChunkX == null || localChunkX.getBaseblocks()[layerIndex] == null ||
|
||||||
localChunkX.getBaseblocks()[layer][ChunkUtil.getJ(15, y, z)] != null) {
|
localChunkX.getBaseblocks()[layerIndex][ChunkUtil.getJ(15, y, z)] != null) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else if (x == 15) {
|
} else if (x == 15) {
|
||||||
LocalChunk localChunkX = getBlockChunks().get(blockVector2.withX(blockVector2.getX() + 1));
|
LocalChunk localChunkX = getBlockChunks().get(blockVector2.withX(blockVector2.getX() + 1));
|
||||||
if (localChunkX == null || localChunkX.getBaseblocks()[layer] == null ||
|
if (localChunkX == null || localChunkX.getBaseblocks()[layerIndex] == null ||
|
||||||
localChunkX.getBaseblocks()[layer][ChunkUtil.getJ(0, y, z)] != null) {
|
localChunkX.getBaseblocks()[layerIndex][ChunkUtil.getJ(0, y, z)] != null) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (z == 0) {
|
if (z == 0) {
|
||||||
LocalChunk localChunkZ = getBlockChunks().get(blockVector2.withZ(blockVector2.getZ() - 1));
|
LocalChunk localChunkZ = getBlockChunks().get(blockVector2.withZ(blockVector2.getZ() - 1));
|
||||||
if (localChunkZ == null || localChunkZ.getBaseblocks()[layer] == null ||
|
if (localChunkZ == null || localChunkZ.getBaseblocks()[layerIndex] == null ||
|
||||||
localChunkZ.getBaseblocks()[layer][ChunkUtil.getJ(x, y, 15)] != null) {
|
localChunkZ.getBaseblocks()[layerIndex][ChunkUtil.getJ(x, y, 15)] != null) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else if (z == 15) {
|
} else if (z == 15) {
|
||||||
LocalChunk localChunkZ = getBlockChunks().get(blockVector2.withZ(blockVector2.getZ() + 1));
|
LocalChunk localChunkZ = getBlockChunks().get(blockVector2.withZ(blockVector2.getZ() + 1));
|
||||||
if (localChunkZ == null || localChunkZ.getBaseblocks()[layer] == null ||
|
if (localChunkZ == null || localChunkZ.getBaseblocks()[layerIndex] == null ||
|
||||||
localChunkZ.getBaseblocks()[layer][ChunkUtil.getJ(x, y, 0)] != null) {
|
localChunkZ.getBaseblocks()[layerIndex][ChunkUtil.getJ(x, y, 0)] != null) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (y == 0) {
|
if (y == 0) {
|
||||||
if (localChunk.getBaseblocks()[layer - 1] == null ||
|
if (localChunk.getBaseblocks()[layerIndex - 1] == null ||
|
||||||
localChunk.getBaseblocks()[layer][ChunkUtil.getJ(x, 15, z)] != null) {
|
localChunk.getBaseblocks()[layerIndex][ChunkUtil.getJ(x, 15, z)] != null) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else if (y == 15) {
|
} else if (y == 15) {
|
||||||
if (localChunk.getBaseblocks()[layer + 1] == null ||
|
if (localChunk.getBaseblocks()[layerIndex + 1] == null ||
|
||||||
localChunk.getBaseblocks()[layer][ChunkUtil.getJ(x, 0, z)] != null) {
|
localChunk.getBaseblocks()[layerIndex][ChunkUtil.getJ(x, 0, z)] != null) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BaseBlock[] baseBlocks = localChunk.getBaseblocks()[layer];
|
BaseBlock[] baseBlocks = localChunk.getBaseblocks()[layerIndex];
|
||||||
if (x > 0 && baseBlocks[ChunkUtil.getJ(x - 1, y, z)] == null) {
|
if (x > 0 && baseBlocks[ChunkUtil.getJ(x - 1, y, z)] == null) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -31,6 +31,7 @@ import com.plotsquared.bukkit.util.BukkitUtil;
|
|||||||
import com.plotsquared.core.location.ChunkWrapper;
|
import com.plotsquared.core.location.ChunkWrapper;
|
||||||
import com.plotsquared.core.location.Location;
|
import com.plotsquared.core.location.Location;
|
||||||
import com.plotsquared.core.queue.ScopedQueueCoordinator;
|
import com.plotsquared.core.queue.ScopedQueueCoordinator;
|
||||||
|
import com.plotsquared.core.util.AnnotationHelper;
|
||||||
import com.plotsquared.core.util.ChunkUtil;
|
import com.plotsquared.core.util.ChunkUtil;
|
||||||
import com.plotsquared.core.util.PatternUtil;
|
import com.plotsquared.core.util.PatternUtil;
|
||||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||||
@ -50,6 +51,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
|||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
@AnnotationHelper.ApiDescription(info = "Internal use only. Subject to changes at any time.")
|
||||||
public class GenChunk extends ScopedQueueCoordinator {
|
public class GenChunk extends ScopedQueueCoordinator {
|
||||||
|
|
||||||
public final Biome[] biomes;
|
public final Biome[] biomes;
|
||||||
@ -61,8 +63,14 @@ public class GenChunk extends ScopedQueueCoordinator {
|
|||||||
public int chunkZ;
|
public int chunkZ;
|
||||||
private ChunkData chunkData = null;
|
private ChunkData chunkData = null;
|
||||||
|
|
||||||
public GenChunk() {
|
/**
|
||||||
super(null, Location.at("", 0, 0, 0), Location.at("", 15, 255, 15));
|
* @param minY minimum world Y, inclusive
|
||||||
|
* @param maxY maximum world Y, inclusive
|
||||||
|
*
|
||||||
|
* @since 6.6.0
|
||||||
|
*/
|
||||||
|
public GenChunk(int minY, int maxY) {
|
||||||
|
super(null, Location.at("", 0, minY, 0), Location.at("", 15, maxY, 15));
|
||||||
this.biomes = Biome.values();
|
this.biomes = Biome.values();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,7 +125,7 @@ public class GenChunk extends ScopedQueueCoordinator {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Biome biome = BukkitAdapter.adapt(biomeType);
|
Biome biome = BukkitAdapter.adapt(biomeType);
|
||||||
for (int y = 0; y < 256; y++) {
|
for (int y = getMin().getY(); y <= getMax().getY(); y++) {
|
||||||
for (int x = 0; x < 16; x++) {
|
for (int x = 0; x < 16; x++) {
|
||||||
for (int z = 0; z < 16; z++) {
|
for (int z = 0; z < 16; z++) {
|
||||||
this.biomeGrid.setBiome(x, y, z, biome);
|
this.biomeGrid.setBiome(x, y, z, biome);
|
||||||
@ -130,7 +138,7 @@ public class GenChunk extends ScopedQueueCoordinator {
|
|||||||
public void setCuboid(@NonNull Location pos1, @NonNull Location pos2, @NonNull BlockState block) {
|
public void setCuboid(@NonNull Location pos1, @NonNull Location pos2, @NonNull BlockState block) {
|
||||||
if (result != null && pos1.getX() == 0 && pos1.getZ() == 0 && pos2.getX() == 15 && pos2.getZ() == 15) {
|
if (result != null && pos1.getX() == 0 && pos1.getZ() == 0 && pos2.getX() == 15 && pos2.getZ() == 15) {
|
||||||
for (int y = pos1.getY(); y <= pos2.getY(); y++) {
|
for (int y = pos1.getY(); y <= pos2.getY(); y++) {
|
||||||
int layer = y >> 4;
|
int layer = getLayerIndex(y);
|
||||||
BlockState[] data = result[layer];
|
BlockState[] data = result[layer];
|
||||||
if (data == null) {
|
if (data == null) {
|
||||||
result[layer] = data = new BlockState[4096];
|
result[layer] = data = new BlockState[4096];
|
||||||
@ -164,7 +172,7 @@ public class GenChunk extends ScopedQueueCoordinator {
|
|||||||
*/
|
*/
|
||||||
public boolean setBiome(int x, int z, @NonNull Biome biome) {
|
public boolean setBiome(int x, int z, @NonNull Biome biome) {
|
||||||
if (this.biomeGrid != null) {
|
if (this.biomeGrid != null) {
|
||||||
for (int y = 0; y < 256; y++) {
|
for (int y = getMin().getY(); y <= getMax().getY(); y++) {
|
||||||
this.setBiome(x, y, z, biome);
|
this.setBiome(x, y, z, biome);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -197,7 +205,7 @@ public class GenChunk extends ScopedQueueCoordinator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void storeCache(final int x, final int y, final int z, final @NonNull BlockState id) {
|
private void storeCache(final int x, final int y, final int z, final @NonNull BlockState id) {
|
||||||
int i = y >> 4;
|
int i = getLayerIndex(y);
|
||||||
BlockState[] v = this.result[i];
|
BlockState[] v = this.result[i];
|
||||||
if (v == null) {
|
if (v == null) {
|
||||||
this.result[i] = v = new BlockState[4096];
|
this.result[i] = v = new BlockState[4096];
|
||||||
@ -219,7 +227,7 @@ public class GenChunk extends ScopedQueueCoordinator {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @Nullable BlockState getBlock(int x, int y, int z) {
|
public @Nullable BlockState getBlock(int x, int y, int z) {
|
||||||
int i = y >> 4;
|
int i = getLayerIndex(y);
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
return BukkitBlockUtil.get(chunkData.getType(x, y, z));
|
return BukkitBlockUtil.get(chunkData.getType(x, y, z));
|
||||||
}
|
}
|
||||||
@ -246,16 +254,16 @@ public class GenChunk extends ScopedQueueCoordinator {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NonNull Location getMax() {
|
public @NonNull Location getMax() {
|
||||||
return Location.at(getWorld().getName(), 15 + (getX() << 4), 255, 15 + (getZ() << 4));
|
return Location.at(getWorld().getName(), 15 + (getX() << 4), super.getMax().getY(), 15 + (getZ() << 4));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NonNull Location getMin() {
|
public @NonNull Location getMin() {
|
||||||
return Location.at(getWorld().getName(), getX() << 4, 0, getZ() << 4);
|
return Location.at(getWorld().getName(), getX() << 4, super.getMin().getY(), getZ() << 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
public @NonNull GenChunk clone() {
|
public @NonNull GenChunk clone() {
|
||||||
GenChunk toReturn = new GenChunk();
|
GenChunk toReturn = new GenChunk(getMin().getY(), getMax().getY());
|
||||||
if (this.result != null) {
|
if (this.result != null) {
|
||||||
for (int i = 0; i < this.result.length; i++) {
|
for (int i = 0; i < this.result.length; i++) {
|
||||||
BlockState[] matrix = this.result[i];
|
BlockState[] matrix = this.result[i];
|
||||||
@ -269,4 +277,8 @@ public class GenChunk extends ScopedQueueCoordinator {
|
|||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int getLayerIndex(int y) {
|
||||||
|
return (y - getMin().getY()) >> 4;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -166,6 +166,7 @@ public class StateWrapper {
|
|||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation") // #setLine is needed for Spigot compatibility
|
||||||
public boolean restoreTag(String worldName, int x, int y, int z) {
|
public boolean restoreTag(String worldName, int x, int y, int z) {
|
||||||
if (this.tag == null) {
|
if (this.tag == null) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -42,6 +42,7 @@ import org.bukkit.inventory.InventoryView;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.PlayerInventory;
|
import org.bukkit.inventory.PlayerInventory;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -50,11 +51,15 @@ import java.util.stream.IntStream;
|
|||||||
@Singleton
|
@Singleton
|
||||||
public class BukkitInventoryUtil extends InventoryUtil {
|
public class BukkitInventoryUtil extends InventoryUtil {
|
||||||
|
|
||||||
private static ItemStack getItem(PlotItemStack item) {
|
private static @Nullable ItemStack getItem(PlotItemStack item) {
|
||||||
if (item == null) {
|
if (item == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
ItemStack stack = new ItemStack(BukkitAdapter.adapt(item.getType()), item.getAmount());
|
Material material = BukkitAdapter.adapt(item.getType());
|
||||||
|
if (material == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
ItemStack stack = new ItemStack(material, item.getAmount());
|
||||||
ItemMeta meta = null;
|
ItemMeta meta = null;
|
||||||
if (item.getName() != null) {
|
if (item.getName() != null) {
|
||||||
meta = stack.getItemMeta();
|
meta = stack.getItemMeta();
|
||||||
@ -77,6 +82,7 @@ public class BukkitInventoryUtil extends InventoryUtil {
|
|||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation") // Paper deprecation
|
||||||
@Override
|
@Override
|
||||||
public void open(PlotInventory inv) {
|
public void open(PlotInventory inv) {
|
||||||
BukkitPlayer bp = (BukkitPlayer) inv.getPlayer();
|
BukkitPlayer bp = (BukkitPlayer) inv.getPlayer();
|
||||||
@ -103,16 +109,22 @@ public class BukkitInventoryUtil extends InventoryUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setItem(PlotInventory inv, int index, PlotItemStack item) {
|
public boolean setItemChecked(PlotInventory inv, int index, PlotItemStack item) {
|
||||||
BukkitPlayer bp = (BukkitPlayer) inv.getPlayer();
|
BukkitPlayer bp = (BukkitPlayer) inv.getPlayer();
|
||||||
InventoryView opened = bp.player.getOpenInventory();
|
InventoryView opened = bp.player.getOpenInventory();
|
||||||
if (!inv.isOpen()) {
|
ItemStack stack = getItem(item);
|
||||||
return;
|
if (stack == null) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
opened.setItem(index, getItem(item));
|
if (!inv.isOpen()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
opened.setItem(index, stack);
|
||||||
bp.player.updateInventory();
|
bp.player.updateInventory();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation") // Paper deprecation
|
||||||
public PlotItemStack getItem(ItemStack item) {
|
public PlotItemStack getItem(ItemStack item) {
|
||||||
if (item == null) {
|
if (item == null) {
|
||||||
return null;
|
return null;
|
||||||
@ -145,6 +157,7 @@ public class BukkitInventoryUtil extends InventoryUtil {
|
|||||||
.toArray(PlotItemStack[]::new);
|
.toArray(PlotItemStack[]::new);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation") // #getTitle is needed for Spigot compatibility
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpen(PlotInventory plotInventory) {
|
public boolean isOpen(PlotInventory plotInventory) {
|
||||||
if (!plotInventory.isOpen()) {
|
if (!plotInventory.isOpen()) {
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -40,7 +40,6 @@ import com.plotsquared.core.queue.QueueCoordinator;
|
|||||||
import com.plotsquared.core.queue.ScopedQueueCoordinator;
|
import com.plotsquared.core.queue.ScopedQueueCoordinator;
|
||||||
import com.plotsquared.core.util.ChunkManager;
|
import com.plotsquared.core.util.ChunkManager;
|
||||||
import com.plotsquared.core.util.RegionManager;
|
import com.plotsquared.core.util.RegionManager;
|
||||||
import com.plotsquared.core.util.RegionUtil;
|
|
||||||
import com.plotsquared.core.util.WorldUtil;
|
import com.plotsquared.core.util.WorldUtil;
|
||||||
import com.plotsquared.core.util.entity.EntityCategories;
|
import com.plotsquared.core.util.entity.EntityCategories;
|
||||||
import com.plotsquared.core.util.task.RunnableVal;
|
import com.plotsquared.core.util.task.RunnableVal;
|
||||||
@ -261,7 +260,7 @@ public class BukkitRegionManager extends RegionManager {
|
|||||||
if (checkX2 && checkZ2) {
|
if (checkX2 && checkZ2) {
|
||||||
map.saveRegion(world, xxt2, xxt, zzt2, zzt); //
|
map.saveRegion(world, xxt2, xxt, zzt2, zzt); //
|
||||||
}
|
}
|
||||||
CuboidRegion currentPlotClear = RegionUtil.createRegion(pos1.getX(), pos2.getX(), pos1.getZ(), pos2.getZ());
|
CuboidRegion currentPlotClear = new CuboidRegion(pos1.getBlockVector3(), pos2.getBlockVector3());
|
||||||
map.saveEntitiesOut(Bukkit.getWorld(world.getName()).getChunkAt(x, z), currentPlotClear);
|
map.saveEntitiesOut(Bukkit.getWorld(world.getName()).getChunkAt(x, z), currentPlotClear);
|
||||||
AugmentedUtils.bypass(
|
AugmentedUtils.bypass(
|
||||||
ignoreAugment,
|
ignoreAugment,
|
||||||
@ -276,7 +275,9 @@ public class BukkitRegionManager extends RegionManager {
|
|||||||
PlotLoc plotLoc = new PlotLoc(bx + x1, bz + z1);
|
PlotLoc plotLoc = new PlotLoc(bx + x1, bz + z1);
|
||||||
BaseBlock[] ids = map.allBlocks.get(plotLoc);
|
BaseBlock[] ids = map.allBlocks.get(plotLoc);
|
||||||
if (ids != null) {
|
if (ids != null) {
|
||||||
for (int y = 0; y < Math.min(128, ids.length); y++) {
|
int minY = value.getMin().getY();
|
||||||
|
for (int yIndex = 0; yIndex < ids.length; yIndex++) {
|
||||||
|
int y = yIndex + minY;
|
||||||
BaseBlock id = ids[y];
|
BaseBlock id = ids[y];
|
||||||
if (id != null) {
|
if (id != null) {
|
||||||
value.setBlock(x1, y, z1, id);
|
value.setBlock(x1, y, z1, id);
|
||||||
@ -284,12 +285,6 @@ public class BukkitRegionManager extends RegionManager {
|
|||||||
value.setBlock(x1, y, z1, BlockTypes.AIR.getDefaultState());
|
value.setBlock(x1, y, z1, BlockTypes.AIR.getDefaultState());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int y = Math.min(128, ids.length); y < ids.length; y++) {
|
|
||||||
BaseBlock id = ids[y];
|
|
||||||
if (id != null) {
|
|
||||||
value.setBlock(x1, y, z1, id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -297,7 +292,7 @@ public class BukkitRegionManager extends RegionManager {
|
|||||||
}, world.getName(), chunk)
|
}, world.getName(), chunk)
|
||||||
);
|
);
|
||||||
//map.restoreBlocks(worldObj, 0, 0);
|
//map.restoreBlocks(worldObj, 0, 0);
|
||||||
map.restoreEntities(Bukkit.getWorld(world.getName()), 0, 0);
|
map.restoreEntities(Bukkit.getWorld(world.getName()));
|
||||||
});
|
});
|
||||||
regenQueue.setCompleteTask(whenDone);
|
regenQueue.setCompleteTask(whenDone);
|
||||||
queue.setCompleteTask(regenQueue::enqueue);
|
queue.setCompleteTask(regenQueue::enqueue);
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -44,7 +44,6 @@ import com.plotsquared.core.util.task.TaskManager;
|
|||||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||||
import com.sk89q.worldedit.bukkit.BukkitWorld;
|
import com.sk89q.worldedit.bukkit.BukkitWorld;
|
||||||
import com.sk89q.worldedit.math.BlockVector2;
|
import com.sk89q.worldedit.math.BlockVector2;
|
||||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
|
||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
import com.sk89q.worldedit.world.block.BlockCategories;
|
import com.sk89q.worldedit.world.block.BlockCategories;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
@ -61,7 +60,6 @@ import org.bukkit.Bukkit;
|
|||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Biome;
|
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
@ -246,7 +244,9 @@ public class BukkitUtil extends WorldUtil {
|
|||||||
final World bukkitWorld = Objects.requireNonNull(getWorld(world));
|
final World bukkitWorld = Objects.requireNonNull(getWorld(world));
|
||||||
// Skip top and bottom block
|
// Skip top and bottom block
|
||||||
int air = 1;
|
int air = 1;
|
||||||
for (int y = bukkitWorld.getMaxHeight() - 1; y >= 0; y--) {
|
int maxY = com.plotsquared.bukkit.util.BukkitWorld.getMaxWorldHeight(bukkitWorld);
|
||||||
|
int minY = com.plotsquared.bukkit.util.BukkitWorld.getMinWorldHeight(bukkitWorld);
|
||||||
|
for (int y = maxY - 1; y >= minY; y--) {
|
||||||
Block block = bukkitWorld.getBlockAt(x, y, z);
|
Block block = bukkitWorld.getBlockAt(x, y, z);
|
||||||
Material type = block.getType();
|
Material type = block.getType();
|
||||||
if (type.isSolid()) {
|
if (type.isSolid()) {
|
||||||
@ -273,7 +273,9 @@ public class BukkitUtil extends WorldUtil {
|
|||||||
final World bukkitWorld = Objects.requireNonNull(getWorld(world));
|
final World bukkitWorld = Objects.requireNonNull(getWorld(world));
|
||||||
// Skip top and bottom block
|
// Skip top and bottom block
|
||||||
int air = 1;
|
int air = 1;
|
||||||
for (int y = bukkitWorld.getMaxHeight() - 1; y >= 0; y--) {
|
int maxY = com.plotsquared.bukkit.util.BukkitWorld.getMaxWorldHeight(bukkitWorld);
|
||||||
|
int minY = com.plotsquared.bukkit.util.BukkitWorld.getMinWorldHeight(bukkitWorld);
|
||||||
|
for (int y = maxY - 1; y >= minY; y--) {
|
||||||
Block block = bukkitWorld.getBlockAt(x, y, z);
|
Block block = bukkitWorld.getBlockAt(x, y, z);
|
||||||
Material type = block.getType();
|
Material type = block.getType();
|
||||||
if (type.isSolid()) {
|
if (type.isSolid()) {
|
||||||
@ -371,7 +373,7 @@ public class BukkitUtil extends WorldUtil {
|
|||||||
sign.setLine(i, LEGACY_COMPONENT_SERIALIZER
|
sign.setLine(i, LEGACY_COMPONENT_SERIALIZER
|
||||||
.serialize(MINI_MESSAGE.parse(lines[i].getComponent(LocaleHolder.console()), replacements)));
|
.serialize(MINI_MESSAGE.parse(lines[i].getComponent(LocaleHolder.console()), replacements)));
|
||||||
}
|
}
|
||||||
sign.update(true);
|
sign.update(true, false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -382,27 +384,6 @@ public class BukkitUtil extends WorldUtil {
|
|||||||
return new StringComparison<BlockState>().new ComparisonResult(1, state);
|
return new StringComparison<BlockState>().new ComparisonResult(1, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setBiomes(
|
|
||||||
final @NonNull String worldName,
|
|
||||||
final @NonNull CuboidRegion region,
|
|
||||||
final @NonNull BiomeType biomeType
|
|
||||||
) {
|
|
||||||
final World world = getWorld(worldName);
|
|
||||||
if (world == null) {
|
|
||||||
LOGGER.warn("An error occurred while setting the biome because the world was null", new RuntimeException());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
final Biome biome = BukkitAdapter.adapt(biomeType);
|
|
||||||
for (int x = region.getMinimumPoint().getX(); x <= region.getMaximumPoint().getX(); x++) {
|
|
||||||
for (int z = region.getMinimumPoint().getZ(); z <= region.getMaximumPoint().getZ(); z++) {
|
|
||||||
if (world.getBiome(x, z) != biome) {
|
|
||||||
world.setBiome(x, z, biome);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public com.sk89q.worldedit.world.@NonNull World getWeWorld(final @NonNull String world) {
|
public com.sk89q.worldedit.world.@NonNull World getWeWorld(final @NonNull String world) {
|
||||||
return new BukkitWorld(Bukkit.getWorld(world));
|
return new BukkitWorld(Bukkit.getWorld(world));
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -36,6 +36,18 @@ import java.util.Objects;
|
|||||||
public class BukkitWorld implements World<org.bukkit.World> {
|
public class BukkitWorld implements World<org.bukkit.World> {
|
||||||
|
|
||||||
private static final Map<String, BukkitWorld> worldMap = Maps.newHashMap();
|
private static final Map<String, BukkitWorld> worldMap = Maps.newHashMap();
|
||||||
|
private static final boolean HAS_MIN_Y;
|
||||||
|
|
||||||
|
static {
|
||||||
|
boolean temp;
|
||||||
|
try {
|
||||||
|
org.bukkit.World.class.getMethod("getMinHeight");
|
||||||
|
temp = true;
|
||||||
|
} catch (NoSuchMethodException e) {
|
||||||
|
temp = false;
|
||||||
|
}
|
||||||
|
HAS_MIN_Y = temp;
|
||||||
|
}
|
||||||
|
|
||||||
private final org.bukkit.World world;
|
private final org.bukkit.World world;
|
||||||
|
|
||||||
@ -73,6 +85,24 @@ public class BukkitWorld implements World<org.bukkit.World> {
|
|||||||
return bukkitWorld;
|
return bukkitWorld;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the min world height from a Bukkit {@link org.bukkit.World}. Inclusive
|
||||||
|
*
|
||||||
|
* @since 6.6.0
|
||||||
|
*/
|
||||||
|
public static int getMinWorldHeight(org.bukkit.World world) {
|
||||||
|
return HAS_MIN_Y ? world.getMinHeight() : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the max world height from a Bukkit {@link org.bukkit.World}. Exclusive
|
||||||
|
*
|
||||||
|
* @since 6.6.0
|
||||||
|
*/
|
||||||
|
public static int getMaxWorldHeight(org.bukkit.World world) {
|
||||||
|
return HAS_MIN_Y ? world.getMaxHeight() : 256;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public org.bukkit.World getPlatformWorld() {
|
public org.bukkit.World getPlatformWorld() {
|
||||||
return this.world;
|
return this.world;
|
||||||
@ -83,34 +113,41 @@ public class BukkitWorld implements World<org.bukkit.World> {
|
|||||||
return this.world.getName();
|
return this.world.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean equals(final Object o) {
|
@Override
|
||||||
if (o == this) {
|
public int getMinHeight() {
|
||||||
return true;
|
return getMinWorldHeight(world);
|
||||||
}
|
|
||||||
if (!(o instanceof final BukkitWorld other)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!other.canEqual(this)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!Objects.equals(this.world, other.world)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMaxHeight() {
|
||||||
|
return getMaxWorldHeight(world) - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(final Object o) {
|
||||||
|
if (this == o) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (o == null || getClass() != o.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final BukkitWorld that = (BukkitWorld) o;
|
||||||
|
return world.equals(that.world);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return world.hashCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated This method is not meant to be invoked or overridden, with no replacement.
|
||||||
|
*/
|
||||||
|
@Deprecated(forRemoval = true, since = "6.6.0")
|
||||||
protected boolean canEqual(final Object other) {
|
protected boolean canEqual(final Object other) {
|
||||||
return other instanceof BukkitWorld;
|
return other instanceof BukkitWorld;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int hashCode() {
|
|
||||||
final int PRIME = 59;
|
|
||||||
int result = 1;
|
|
||||||
final Object $world = this.world;
|
|
||||||
result = result * PRIME + ($world == null ? 43 : $world.hashCode());
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "BukkitWorld(world=" + this.world + ")";
|
return "BukkitWorld(world=" + this.world + ")";
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -70,7 +70,7 @@ public class ContentMap {
|
|||||||
}
|
}
|
||||||
for (int x = x1; x <= x2; x++) {
|
for (int x = x1; x <= x2; x++) {
|
||||||
for (int z = z1; z <= z2; z++) {
|
for (int z = z1; z <= z2; z++) {
|
||||||
saveBlocks(world, 256, x, z, 0, 0);
|
saveBlocks(world, x, z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -92,14 +92,7 @@ public class ContentMap {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void saveEntitiesIn(Chunk chunk, CuboidRegion region) {
|
void saveEntitiesIn(Chunk chunk, CuboidRegion region, boolean delete) {
|
||||||
saveEntitiesIn(chunk, region, 0, 0, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void saveEntitiesIn(
|
|
||||||
Chunk chunk, CuboidRegion region, int offsetX, int offsetZ,
|
|
||||||
boolean delete
|
|
||||||
) {
|
|
||||||
for (Entity entity : chunk.getEntities()) {
|
for (Entity entity : chunk.getEntities()) {
|
||||||
Location location = BukkitUtil.adapt(entity.getLocation());
|
Location location = BukkitUtil.adapt(entity.getLocation());
|
||||||
int x = location.getX();
|
int x = location.getX();
|
||||||
@ -111,8 +104,6 @@ public class ContentMap {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
EntityWrapper wrap = new ReplicatingEntityWrapper(entity, (short) 2);
|
EntityWrapper wrap = new ReplicatingEntityWrapper(entity, (short) 2);
|
||||||
wrap.x += offsetX;
|
|
||||||
wrap.z += offsetZ;
|
|
||||||
wrap.saveEntity();
|
wrap.saveEntity();
|
||||||
this.entities.add(wrap);
|
this.entities.add(wrap);
|
||||||
if (delete) {
|
if (delete) {
|
||||||
@ -123,10 +114,10 @@ public class ContentMap {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void restoreEntities(World world, int xOffset, int zOffset) {
|
void restoreEntities(World world) {
|
||||||
for (EntityWrapper entity : this.entities) {
|
for (EntityWrapper entity : this.entities) {
|
||||||
try {
|
try {
|
||||||
entity.spawn(world, xOffset, zOffset);
|
entity.spawn(world, 0, 0);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error("Failed to restore entity", e);
|
LOGGER.error("Failed to restore entity", e);
|
||||||
}
|
}
|
||||||
@ -134,15 +125,13 @@ public class ContentMap {
|
|||||||
this.entities.clear();
|
this.entities.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo optimize maxY
|
private void saveBlocks(BukkitWorld world, int x, int z) {
|
||||||
void saveBlocks(BukkitWorld world, int maxY, int x, int z, int offsetX, int offsetZ) {
|
BaseBlock[] ids = new BaseBlock[world.getMaxY() - world.getMinY() + 1];
|
||||||
maxY = Math.min(255, maxY);
|
for (short yIndex = 0; yIndex <= world.getMaxY() - world.getMinY(); yIndex++) {
|
||||||
BaseBlock[] ids = new BaseBlock[maxY + 1];
|
BaseBlock block = world.getFullBlock(BlockVector3.at(x, yIndex + world.getMinY(), z));
|
||||||
for (short y = 0; y <= maxY; y++) {
|
ids[yIndex] = block;
|
||||||
BaseBlock block = world.getFullBlock(BlockVector3.at(x, y, z));
|
|
||||||
ids[y] = block;
|
|
||||||
}
|
}
|
||||||
PlotLoc loc = new PlotLoc(x + offsetX, z + offsetZ);
|
PlotLoc loc = new PlotLoc(x, z);
|
||||||
this.allBlocks.put(loc, ids);
|
this.allBlocks.put(loc, ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -61,6 +61,7 @@ public class UpdateUtility implements Listener {
|
|||||||
internalVersion = PlotSquared.get().getVersion();
|
internalVersion = PlotSquared.get().getVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({"deprecation", "DefaultCharset"}) // Suppress Json deprecation, we can't use features from gson 2.8.1 and newer yet
|
||||||
public void updateChecker() {
|
public void updateChecker() {
|
||||||
task = Bukkit.getScheduler().runTaskTimerAsynchronously(this.javaPlugin, () -> {
|
task = Bukkit.getScheduler().runTaskTimerAsynchronously(this.javaPlugin, () -> {
|
||||||
try {
|
try {
|
||||||
@ -68,7 +69,7 @@ public class UpdateUtility implements Listener {
|
|||||||
"https://api.spigotmc.org/simple/0.1/index.php?action=getResource&id=77506")
|
"https://api.spigotmc.org/simple/0.1/index.php?action=getResource&id=77506")
|
||||||
.openConnection();
|
.openConnection();
|
||||||
connection.setRequestMethod("GET");
|
connection.setRequestMethod("GET");
|
||||||
JsonObject result = (new JsonParser())
|
JsonObject result = new JsonParser()
|
||||||
.parse(new JsonReader(new InputStreamReader(connection.getInputStream())))
|
.parse(new JsonReader(new InputStreamReader(connection.getInputStream())))
|
||||||
.getAsJsonObject();
|
.getAsJsonObject();
|
||||||
spigotVersion = result.get("current_version").getAsString();
|
spigotVersion = result.get("current_version").getAsString();
|
||||||
@ -91,7 +92,7 @@ public class UpdateUtility implements Listener {
|
|||||||
notify = false;
|
notify = false;
|
||||||
LOGGER.info("Congratulations! You are running the latest PlotSquared version");
|
LOGGER.info("Congratulations! You are running the latest PlotSquared version");
|
||||||
}
|
}
|
||||||
}, 0L, Settings.UpdateChecker.POLL_RATE * 60 * 20);
|
}, 0L, (long) Settings.UpdateChecker.POLL_RATE * 60 * 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cancelTask() {
|
private void cancelTask() {
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -110,6 +110,11 @@ public class FaweRegionManager extends BukkitRegionManager {
|
|||||||
delegate.setBiome(region, extendBiome, biome, world, whenDone);
|
delegate.setBiome(region, extendBiome, biome, world, whenDone);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setBiome(CuboidRegion region, int extendBiome, BiomeType biome, PlotArea area, Runnable whenDone) {
|
||||||
|
delegate.setBiome(region, extendBiome, biome, area.getWorldName(), whenDone);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean copyRegion(
|
public boolean copyRegion(
|
||||||
final @NonNull Location pos1,
|
final @NonNull Location pos1,
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -75,6 +75,7 @@ public class FaweSchematicHandler extends SchematicHandler {
|
|||||||
return delegate.save(tag, path);
|
return delegate.save(tag, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("removal") // Just the override
|
||||||
@Override
|
@Override
|
||||||
public void upload(final CompoundTag tag, final UUID uuid, final String file, final RunnableVal<URL> whenDone) {
|
public void upload(final CompoundTag tag, final UUID uuid, final String file, final RunnableVal<URL> whenDone) {
|
||||||
delegate.upload(tag, uuid, file, whenDone);
|
delegate.upload(tag, uuid, file, whenDone);
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -22,7 +22,7 @@ dependencies {
|
|||||||
api(libs.guiceassistedinject) {
|
api(libs.guiceassistedinject) {
|
||||||
exclude("com.google.inject", "guice")
|
exclude("com.google.inject", "guice")
|
||||||
}
|
}
|
||||||
compileOnlyApi(libs.findbugs)
|
api(libs.findbugs)
|
||||||
|
|
||||||
// Plugins
|
// Plugins
|
||||||
compileOnly(libs.worldeditCore) {
|
compileOnly(libs.worldeditCore) {
|
||||||
@ -40,9 +40,7 @@ dependencies {
|
|||||||
// Other libraries
|
// Other libraries
|
||||||
api(libs.prtree)
|
api(libs.prtree)
|
||||||
api(libs.aopalliance)
|
api(libs.aopalliance)
|
||||||
api(libs.rorledning) {
|
api(libs.cloudServices)
|
||||||
exclude(group = "com.google.guava")
|
|
||||||
}
|
|
||||||
api(libs.arkitektonika)
|
api(libs.arkitektonika)
|
||||||
api(libs.paster)
|
api(libs.paster)
|
||||||
}
|
}
|
||||||
@ -56,3 +54,13 @@ tasks.processResources {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks {
|
||||||
|
withType<Javadoc> {
|
||||||
|
val opt = options as StandardJavadocDocletOptions
|
||||||
|
opt.links("https://docs.enginehub.org/javadoc/com.sk89q.worldedit/worldedit-core/" + libs.worldeditCore.get().versionConstraint.toString())
|
||||||
|
opt.links("https://jd.adventure.kyori.net/api/" + libs.adventure.get().versionConstraint.toString())
|
||||||
|
opt.links("https://google.github.io/guice/api-docs/" + libs.guice.get().versionConstraint.toString() + "/javadoc/")
|
||||||
|
opt.links("https://checkerframework.org/api/")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -25,10 +25,10 @@
|
|||||||
*/
|
*/
|
||||||
package com.plotsquared.core;
|
package com.plotsquared.core;
|
||||||
|
|
||||||
|
import cloud.commandframework.services.ServicePipeline;
|
||||||
import com.google.inject.Injector;
|
import com.google.inject.Injector;
|
||||||
import com.google.inject.Key;
|
import com.google.inject.Key;
|
||||||
import com.google.inject.TypeLiteral;
|
import com.google.inject.TypeLiteral;
|
||||||
import com.intellectualsites.services.ServicePipeline;
|
|
||||||
import com.plotsquared.core.backup.BackupManager;
|
import com.plotsquared.core.backup.BackupManager;
|
||||||
import com.plotsquared.core.configuration.caption.LocaleHolder;
|
import com.plotsquared.core.configuration.caption.LocaleHolder;
|
||||||
import com.plotsquared.core.generator.GeneratorWrapper;
|
import com.plotsquared.core.generator.GeneratorWrapper;
|
||||||
@ -40,6 +40,7 @@ import com.plotsquared.core.permissions.PermissionHandler;
|
|||||||
import com.plotsquared.core.player.PlotPlayer;
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||||
import com.plotsquared.core.queue.GlobalBlockQueue;
|
import com.plotsquared.core.queue.GlobalBlockQueue;
|
||||||
|
import com.plotsquared.core.util.AnnotationHelper;
|
||||||
import com.plotsquared.core.util.ChunkManager;
|
import com.plotsquared.core.util.ChunkManager;
|
||||||
import com.plotsquared.core.util.EconHandler;
|
import com.plotsquared.core.util.EconHandler;
|
||||||
import com.plotsquared.core.util.PlatformWorldManager;
|
import com.plotsquared.core.util.PlatformWorldManager;
|
||||||
@ -97,6 +98,22 @@ public interface PlotPlatform<P> extends LocaleHolder {
|
|||||||
*/
|
*/
|
||||||
int[] serverVersion();
|
int[] serverVersion();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the default minimum world height for the version of Minecraft that the server is running.
|
||||||
|
*
|
||||||
|
* @return minimum world height
|
||||||
|
* @since 6.6.0
|
||||||
|
*/
|
||||||
|
int versionMinHeight();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the default maximum world height for the version of Minecraft that the server is running.
|
||||||
|
*
|
||||||
|
* @return maximum world height (inclusive)
|
||||||
|
* @since 6.6.0
|
||||||
|
*/
|
||||||
|
int versionMaxHeight();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the server implementation name and version
|
* Gets the server implementation name and version
|
||||||
*
|
*
|
||||||
@ -273,6 +290,7 @@ public interface PlotPlatform<P> extends LocaleHolder {
|
|||||||
* Get the {@link PlotAreaManager} implementation.
|
* Get the {@link PlotAreaManager} implementation.
|
||||||
*
|
*
|
||||||
* @return the PlotAreaManager
|
* @return the PlotAreaManager
|
||||||
|
* @since 6.1.4
|
||||||
*/
|
*/
|
||||||
@NonNull PlotAreaManager plotAreaManager();
|
@NonNull PlotAreaManager plotAreaManager();
|
||||||
|
|
||||||
@ -291,6 +309,15 @@ public interface PlotPlatform<P> extends LocaleHolder {
|
|||||||
*/
|
*/
|
||||||
@NonNull String pluginsFormatted();
|
@NonNull String pluginsFormatted();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the kind of WorldEdit implementation
|
||||||
|
*
|
||||||
|
* @return worldedit implementations
|
||||||
|
* @since 6.3.0
|
||||||
|
*/
|
||||||
|
@AnnotationHelper.ApiDescription(info = "Internal use only")
|
||||||
|
@NonNull String worldEditImplementations();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load the caption maps
|
* Load the caption maps
|
||||||
*/
|
*/
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -306,7 +306,7 @@ public class PlotSquared {
|
|||||||
*
|
*
|
||||||
* @param version First version
|
* @param version First version
|
||||||
* @param version2 Second version
|
* @param version2 Second version
|
||||||
* @return true if `version` is >= `version2`
|
* @return {@code true} if `version` is >= `version2`
|
||||||
*/
|
*/
|
||||||
public boolean checkVersion(
|
public boolean checkVersion(
|
||||||
final int[] version,
|
final int[] version,
|
||||||
@ -338,10 +338,13 @@ public class PlotSquared {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a global reference to a plot world.
|
* Add a global reference to a plot world.
|
||||||
|
* <p>
|
||||||
|
* You can remove the reference by calling {@link #removePlotArea(PlotArea)}
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @param plotArea the {@link PlotArea} to add.
|
* @param plotArea the {@link PlotArea} to add.
|
||||||
* @see #removePlotArea(PlotArea) To remove the reference
|
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public void addPlotArea(final @NonNull PlotArea plotArea) {
|
public void addPlotArea(final @NonNull PlotArea plotArea) {
|
||||||
HashMap<PlotId, Plot> plots;
|
HashMap<PlotId, Plot> plots;
|
||||||
if (plots_tmp == null || (plots = plots_tmp.remove(plotArea.toString())) == null) {
|
if (plots_tmp == null || (plots = plots_tmp.remove(plotArea.toString())) == null) {
|
||||||
@ -556,6 +559,7 @@ public class PlotSquared {
|
|||||||
*
|
*
|
||||||
* @param input an array of plots to sort
|
* @param input an array of plots to sort
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
private void sortPlotsByHash(final @NonNull Plot @NonNull [] input) {
|
private void sortPlotsByHash(final @NonNull Plot @NonNull [] input) {
|
||||||
List<Plot>[] bucket = new ArrayList[32];
|
List<Plot>[] bucket = new ArrayList[32];
|
||||||
Arrays.fill(bucket, new ArrayList<>());
|
Arrays.fill(bucket, new ArrayList<>());
|
||||||
@ -696,20 +700,12 @@ public class PlotSquared {
|
|||||||
ArrayList<Plot> toReturn = new ArrayList<>(plots.size());
|
ArrayList<Plot> toReturn = new ArrayList<>(plots.size());
|
||||||
for (PlotArea area : areas) {
|
for (PlotArea area : areas) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case CREATION_DATE:
|
case CREATION_DATE -> toReturn.addAll(sortPlotsByTemp(map.get(area)));
|
||||||
toReturn.addAll(sortPlotsByTemp(map.get(area)));
|
case CREATION_DATE_TIMESTAMP -> toReturn.addAll(sortPlotsByTimestamp(map.get(area)));
|
||||||
break;
|
case DISTANCE_FROM_ORIGIN -> toReturn.addAll(sortPlotsByHash(map.get(area)));
|
||||||
case CREATION_DATE_TIMESTAMP:
|
case LAST_MODIFIED -> toReturn.addAll(sortPlotsByModified(map.get(area)));
|
||||||
toReturn.addAll(sortPlotsByTimestamp(map.get(area)));
|
default -> {
|
||||||
break;
|
}
|
||||||
case DISTANCE_FROM_ORIGIN:
|
|
||||||
toReturn.addAll(sortPlotsByHash(map.get(area)));
|
|
||||||
break;
|
|
||||||
case LAST_MODIFIED:
|
|
||||||
toReturn.addAll(sortPlotsByModified(map.get(area)));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return toReturn;
|
return toReturn;
|
||||||
@ -739,7 +735,7 @@ public class PlotSquared {
|
|||||||
*
|
*
|
||||||
* @param plot the plot to remove
|
* @param plot the plot to remove
|
||||||
* @param callEvent If to call an event about the plot being removed
|
* @param callEvent If to call an event about the plot being removed
|
||||||
* @return true if plot existed | false if it didn't
|
* @return {@code true} if plot existed | {@code false} if it didn't
|
||||||
*/
|
*/
|
||||||
public boolean removePlot(
|
public boolean removePlot(
|
||||||
final @NonNull Plot plot,
|
final @NonNull Plot plot,
|
||||||
@ -1024,8 +1020,8 @@ public class PlotSquared {
|
|||||||
// save configuration
|
// save configuration
|
||||||
|
|
||||||
final List<String> validArguments = Arrays
|
final List<String> validArguments = Arrays
|
||||||
.asList("s=", "size=", "g=", "gap=", "h=", "height=", "f=", "floor=", "m=", "main=",
|
.asList("s=", "size=", "g=", "gap=", "h=", "height=", "minh=", "minheight=", "maxh=", "maxheight=",
|
||||||
"w=", "wall=", "b=", "border="
|
"f=", "floor=", "m=", "main=", "w=", "wall=", "b=", "border="
|
||||||
);
|
);
|
||||||
|
|
||||||
// Calculate the number of expected arguments
|
// Calculate the number of expected arguments
|
||||||
@ -1104,6 +1100,14 @@ public class PlotSquared {
|
|||||||
ConfigurationUtil.INTEGER.parseString(value).shortValue()
|
ConfigurationUtil.INTEGER.parseString(value).shortValue()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
case "minh", "minheight" -> this.worldConfiguration.set(
|
||||||
|
base + "world.min_gen_height",
|
||||||
|
ConfigurationUtil.INTEGER.parseString(value).shortValue()
|
||||||
|
);
|
||||||
|
case "maxh", "maxheight" -> this.worldConfiguration.set(
|
||||||
|
base + "world.max_gen_height",
|
||||||
|
ConfigurationUtil.INTEGER.parseString(value).shortValue()
|
||||||
|
);
|
||||||
case "f", "floor" -> this.worldConfiguration.set(
|
case "f", "floor" -> this.worldConfiguration.set(
|
||||||
base + "plot.floor",
|
base + "plot.floor",
|
||||||
ConfigurationUtil.BLOCK_BUCKET.parseString(value).toString()
|
ConfigurationUtil.BLOCK_BUCKET.parseString(value).toString()
|
||||||
@ -1482,7 +1486,7 @@ public class PlotSquared {
|
|||||||
*
|
*
|
||||||
* @param world World name
|
* @param world World name
|
||||||
* @param chunkCoordinates Chunk coordinates
|
* @param chunkCoordinates Chunk coordinates
|
||||||
* @return True if the chunk uses non-standard generation, false if not
|
* @return {@code true} if the chunk uses non-standard generation, {@code false} if not
|
||||||
*/
|
*/
|
||||||
public boolean isNonStandardGeneration(
|
public boolean isNonStandardGeneration(
|
||||||
final @NonNull String world,
|
final @NonNull String world,
|
||||||
@ -1527,10 +1531,12 @@ public class PlotSquared {
|
|||||||
/**
|
/**
|
||||||
* Get the caption map belonging to a namespace. If none exists, a dummy
|
* Get the caption map belonging to a namespace. If none exists, a dummy
|
||||||
* caption map will be returned.
|
* caption map will be returned.
|
||||||
|
* <p>
|
||||||
|
* You can register a caption map by calling {@link #registerCaptionMap(String, CaptionMap)}
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @param namespace Namespace
|
* @param namespace Namespace
|
||||||
* @return Map instance
|
* @return Map instance
|
||||||
* @see #registerCaptionMap(String, CaptionMap) To register a caption map
|
|
||||||
*/
|
*/
|
||||||
public @NonNull CaptionMap getCaptionMap(final @NonNull String namespace) {
|
public @NonNull CaptionMap getCaptionMap(final @NonNull String namespace) {
|
||||||
return this.captionMaps.computeIfAbsent(
|
return this.captionMaps.computeIfAbsent(
|
||||||
@ -1540,7 +1546,7 @@ public class PlotSquared {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a caption map. The namespace needs be equal to the namespace used for
|
* Register a caption map. The namespace needs to be equal to the namespace used for
|
||||||
* the {@link TranslatableCaption}s inside the map.
|
* the {@link TranslatableCaption}s inside the map.
|
||||||
*
|
*
|
||||||
* @param namespace Namespace
|
* @param namespace Namespace
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -122,7 +122,7 @@ public final class PlotVersion {
|
|||||||
* Compare a given version string with the one cached here.
|
* Compare a given version string with the one cached here.
|
||||||
*
|
*
|
||||||
* @param versionString the version to compare
|
* @param versionString the version to compare
|
||||||
* @return true if the given version is a "later" version
|
* @return {@code true} if the given version is a "later" version
|
||||||
*/
|
*/
|
||||||
public boolean isLaterVersion(final @NonNull String versionString) {
|
public boolean isLaterVersion(final @NonNull String versionString) {
|
||||||
int dash = versionString.indexOf('-');
|
int dash = versionString.indexOf('-');
|
||||||
@ -144,7 +144,7 @@ public final class PlotVersion {
|
|||||||
* Compare a given version with the one cached here.
|
* Compare a given version with the one cached here.
|
||||||
*
|
*
|
||||||
* @param verArray the version to compare
|
* @param verArray the version to compare
|
||||||
* @return true if the given version is a "later" version
|
* @return {@code true} if the given version is a "later" version
|
||||||
*/
|
*/
|
||||||
public boolean isLaterVersion(int[] verArray) {
|
public boolean isLaterVersion(int[] verArray) {
|
||||||
if (verArray[0] > version[0]) {
|
if (verArray[0] > version[0]) {
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -88,7 +88,7 @@ public interface BackupManager {
|
|||||||
* Returns true if (potentially) destructive actions should cause
|
* Returns true if (potentially) destructive actions should cause
|
||||||
* PlotSquared to create automatic plot backups
|
* PlotSquared to create automatic plot backups
|
||||||
*
|
*
|
||||||
* @return True if automatic backups are enabled
|
* @return {@code true} if automatic backups are enabled
|
||||||
*/
|
*/
|
||||||
boolean shouldAutomaticallyBackup();
|
boolean shouldAutomaticallyBackup();
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -29,7 +29,8 @@ import java.util.Arrays;
|
|||||||
|
|
||||||
public class ArrayUtil {
|
public class ArrayUtil {
|
||||||
|
|
||||||
public static final <T> T[] concatAll(T[] first, T[]... rest) {
|
@SuppressWarnings("unchecked")
|
||||||
|
public static <T> T[] concatAll(T[] first, T[]... rest) {
|
||||||
int totalLength = first.length;
|
int totalLength = first.length;
|
||||||
for (T[] array : rest) {
|
for (T[] array : rest) {
|
||||||
totalLength += array.length;
|
totalLength += array.length;
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -35,6 +35,7 @@ public class FlatRandomCollection<T> extends RandomCollection<T> {
|
|||||||
|
|
||||||
private final T[] values;
|
private final T[] values;
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public FlatRandomCollection(Map<T, Double> weights, Random random) {
|
public FlatRandomCollection(Map<T, Double> weights, Random random) {
|
||||||
super(weights, random);
|
super(weights, random);
|
||||||
int max = 0;
|
int max = 0;
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -241,6 +241,7 @@ public class QuadMap<T> {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public void recalculateSkip() {
|
public void recalculateSkip() {
|
||||||
QuadMap<T> map = null;
|
QuadMap<T> map = null;
|
||||||
for (QuadMap<T> current : new QuadMap[]{this.one, this.two, this.three, this.four}) {
|
for (QuadMap<T> current : new QuadMap[]{this.one, this.two, this.three, this.four}) {
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* | |
|
* | |
|
||||||
* |_|
|
* |_|
|
||||||
* PlotSquared plot management system for Minecraft
|
* PlotSquared plot management system for Minecraft
|
||||||
* Copyright (C) 2021 IntellectualSites
|
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -106,7 +106,7 @@ public class Add extends Command {
|
|||||||
.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_TRUST))) {
|
.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_TRUST))) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("errors.invalid_player"),
|
TranslatableCaption.of("errors.invalid_player"),
|
||||||
Template.of("value", PlayerManager.getName(uuid))
|
Template.of("value", PlayerManager.resolveName(uuid).getComponent(player))
|
||||||
);
|
);
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
continue;
|
continue;
|
||||||
@ -114,7 +114,7 @@ public class Add extends Command {
|
|||||||
if (plot.isOwner(uuid)) {
|
if (plot.isOwner(uuid)) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("member.already_added"),
|
TranslatableCaption.of("member.already_added"),
|
||||||
Template.of("player", PlayerManager.getName(uuid))
|
Template.of("player", PlayerManager.resolveName(uuid).getComponent(player))
|
||||||
);
|
);
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
continue;
|
continue;
|
||||||
@ -122,7 +122,7 @@ public class Add extends Command {
|
|||||||
if (plot.getMembers().contains(uuid)) {
|
if (plot.getMembers().contains(uuid)) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("member.already_added"),
|
TranslatableCaption.of("member.already_added"),
|
||||||
Template.of("player", PlayerManager.getName(uuid))
|
Template.of("player", PlayerManager.resolveName(uuid).getComponent(player))
|
||||||
);
|
);
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
continue;
|
continue;
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user