Compare commits

...

76 Commits

Author SHA1 Message Date
03aa60b05d Always call plot events through the event dispatcher 2022-01-28 08:13:15 +01:00
126aa53b61 build: Back to snapshot for development 2022-01-27 14:00:51 +01:00
ac71046feb build: Release 6.4.0 2022-01-27 13:49:17 +01:00
7c290e6bd0 Align plugin's java version with API java version - Java 17 (#3468)
* refactor!: Align plugin's java version with API java version

* fix: Bump Guice to fix private injection on Java 17
2022-01-27 13:26:58 +01:00
4d297cc829 Separate linked javadocs per module (#3476)
* docs: Separate javadocs per module

* docs: Read javadoc version from Gradle version catalog
2022-01-27 13:26:27 +01:00
5ab410a5c5 fix: Don't ommit flag int input in no permission message (#3466) 2022-01-27 12:14:39 +01:00
1f28bac955 Fix: Plot#getOwner can be nullable, and redstone may be present on unowned plots (#3472) 2022-01-27 12:14:16 +01:00
92c54de5e9 fix: run whenDone on empty queue (#3474) 2022-01-27 12:13:55 +01:00
ff5d79699d docs: Add @since annotation for v6 changes (#3471) 2022-01-24 21:46:01 +01:00
a0594c19ee docs: Address dangling @see tags (#3469) 2022-01-24 21:43:35 +01:00
da41c136fe docs: Unify true/false style in @return (#3470) 2022-01-24 21:41:54 +01:00
6a5859ee0f build: Update release-drafter/release-drafter action to v5.17.6 (#3467)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-01-24 11:06:27 +01:00
59e0b4b67a feat: unknown owner(s) for plot expiry (#3452)
* feat: unknown owner(s) for plot expiry

* Sort plugins on `/plot debugpaste` alphabetically (#3447)

* feat: Sort plugins on debugpaste alphabetically

* Put (F[A])WE at the top

* feat: Add 1.18's music disc additions to `/plot music` (#3446)

* refactor: Prepare removal of our maven repository (#3451)

* Allow restoration of road schematic height calculation behaviour from pre 6.1.4 (#3444)

* refactor: Update SquirrelID GAV

* build: Release 6.3.0

* build: Back to snapshot for development

* fix: fallback method in BukkitQueueCoordinator uses world coordinates

* mark since tags as TODO

* fix: get the lowest diff for plot age

* fix: initialize with high value and better readability

* fix: no need for multiple age checks

* fix: address exceptions in plot analysis

* chore: address requested changes

* chore: Fix introduced violations

Co-authored-by: Alex <mc.cache@web.de>
Co-authored-by: Jordan <dordsor21@gmail.com>
2022-01-23 10:44:11 +01:00
5fc153d896 fix: PlayerInteractEvent does not necessarily interact with a block (#3463) 2022-01-22 17:25:41 +01:00
a003836dbc feat: plot-title flag value should allow single values (#3410) 2022-01-22 11:02:08 +01:00
42bf413528 chore: Address more violations 2022-01-20 21:01:38 +01:00
827f46566c draft: Address false positives in code style issues (#3461)
* chore: Address false positive code style issues

* chore: More work

* More work
2022-01-20 12:39:40 +01:00
6f4d2f6d5a Fix: Missing Component returns + plot info on unknown plot owner (#3449)
* Fix: getName should return something

* Fix caption typo

* Deprecate old getName methods + add new methods for username retrieval

* Remove wildcard import

* Use @since TODO instead of hard coded version

* chore: Update `@since` tags to TODO

Co-authored-by: NotMyFault <mc.cache@web.de>
2022-01-19 15:56:31 +01:00
6073b96317 feat: add worldname to the notify flags (#3457)
* feat: add worldname to the notify flags

* fix: change default message

* refactor: extract duplicated code

* fix: use area instead of world
2022-01-18 20:42:44 +01:00
74a490f9f0 build: Update release-drafter/release-drafter action to v5.17.5 (#3460)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-01-17 11:19:28 +01:00
3a752db698 build: Switch to Fawe release 2022-01-15 16:50:03 +01:00
7cdde5a822 build: Back to snapshot for development 2022-01-14 11:46:02 +01:00
8b6e7b2f2b build: Release 6.3.0 2022-01-14 11:14:00 +01:00
06f0b42a97 refactor: Update SquirrelID GAV 2022-01-14 10:58:44 +01:00
9a85080bf6 Allow restoration of road schematic height calculation behaviour from pre 6.1.4 (#3444) 2022-01-14 10:46:04 +01:00
d14d2caa2d refactor: Prepare removal of our maven repository (#3451) 2022-01-13 14:50:07 +01:00
bcfe7c58dd feat: Add 1.18's music disc additions to /plot music (#3446) 2022-01-12 22:22:01 +01:00
289f0f3bfd Sort plugins on /plot debugpaste alphabetically (#3447)
* feat: Sort plugins on debugpaste alphabetically

* Put (F[A])WE at the top
2022-01-12 22:21:51 +01:00
6fc4005c72 Fix for unwanted audio panning (#3430)
* Fixes https://github.com/IntellectualSites/PlotSquared/issues/3422

* Removed old code

Co-authored-by: Alex <mc.cache@web.de>
2022-01-11 11:02:23 +01:00
8f7c2e4c02 fix: /plot music being able to be used on unclaimed plots (#3432) 2022-01-11 11:01:36 +01:00
b43d08f4aa feat: Display explosion particles even after the event got canceled (with setting to control behavior) (#3436)
* feat: display explosion particles even after event cancel
And add settings option to change behavior

* refactor

* refactor: Change settings comment to clearer connect to it's purpose.
2022-01-10 13:18:19 +01:00
2c55c6a92e build: Update dependency org.checkerframework:checker-qual to v3.21.1 (#3441)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-01-10 11:26:53 +01:00
31f48cc7d1 Fix: 1.18 uses the same field as 1.17 for mustNotSave (#3428) 2022-01-05 21:22:09 +01:00
4b77f1ab28 Make road flags great again (#3420)
Fixes #3111
2022-01-05 21:21:58 +01:00
7cc38b5fa8 Fix: use ownersInclude instead of ownedBy where required (#3419)
* Fix: use ownersInclude instead of ownedBy where required
- Also account for multiple plot owners in Cluster player removal
- Add whereBasePlot to avoid merged plots listing multiple times if required
- Only use ownersInclude in visit if enabled in config
- Fixes #3143

* Remove static import
2022-01-05 21:21:48 +01:00
0c76d08b10 Only send border area exit message once (#3418)
Fixes #3335
2022-01-05 21:21:37 +01:00
9c474570c8 Fix: use portal corners to test for event cancellation as entity can be null (#3417)
* Fix: use portal corners to test for event cancellation as entity can be null

* Remove duplicate flag check?

* Simplify to Set#of
2022-01-05 21:21:25 +01:00
7e1d56c849 fix: Reimplement the "unknown owner" option to plot purge (#3412)
- Warn user that backgorund UUID caching may fix the issue
- Also correct the UUID set when purging based on "shared" (added) player
- Fixes #3353
2022-01-05 21:21:08 +01:00
07d0f124b4 ci: Let release drafter listen to forks too 2022-01-05 11:56:28 +01:00
8d6c621763 ci: Setup auto rebase (#3431) 2022-01-04 15:38:21 +01:00
cef7098014 build: Update plugin shadow to v7.1.2 (#3427)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-01-03 13:52:29 +01:00
e1efa7266e build: Update dependency cloud.commandframework:cloud-services to v1.6.1 (#3425)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-01-03 11:45:04 +01:00
f363941719 build: Update dependency org.apache.logging.log4j:log4j-api to v2.17.1 (#3426)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-01-03 11:14:52 +01:00
25095f4546 chore: Welcome 2022 2022-01-02 22:22:19 +01:00
fd0c2050d8 Refactor: Replace Rörledning with Cloud-Services (#3409)
* Refactor: Replace Rörledning with Cloud-Services

Cloud-Services is actually maintained, as opposed to Rörledning. Furthermore, Rörledning is available through Maven Central, whereas rörledning isn't.

This is a semi-breaking change, but because we relocate, it might be fine? Either way, this is a necessary change.

* build: Provide jsr at runtime

* Merge branch 'v6' into refactor/v6/cloud-services

Co-authored-by: NotMyFault <mc.cache@web.de>
2021-12-31 15:49:11 +01:00
07fdc94dd8 Account for mutability of plot objects when sending move/swap success messages (#3414)
Fixes #3337
2021-12-31 15:46:08 +01:00
b501a81e21 build: Exchange mvdwapi version to our ones 2021-12-31 01:29:30 +01:00
eb334b3aac Fix: add missing placeholders for plot info
Fixes #3339
2021-12-30 14:41:31 +00:00
a77a51b6f2 build: Back to snapshot for development 2021-12-30 10:31:08 +01:00
7d981bc610 build: Release 6.2.2 2021-12-30 10:14:15 +01:00
3eb485e900 refactor: Drop guava annotations and create annotation helper (#3389) 2021-12-29 16:18:19 +01:00
9f4af889f7 fix: npe thrown in entity spawn listener (#3399) 2021-12-27 11:01:28 +01:00
2559c889e2 build: Update dependency me.clip:placeholderapi to v2.11.1 (#3403)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-12-27 10:42:37 +01:00
2cf268b99c build: Update actions/setup-java action to v2.5.0 (#3404)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-12-27 10:42:07 +01:00
e6fad8309c build: Update dependency gradle to v7.3.3 (#3402)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-12-27 10:40:00 +01:00
7551450cf9 fix: Send user-friendly message on join of denied plot (#3388)
Also refactor local variable `now` to a more fitting name
2021-12-26 23:28:50 +01:00
e042566bb7 fix: Strip redundant space at flag collection (#3400) 2021-12-26 23:28:03 +01:00
1f26808c7b Don't return the "side" for world plots when accessing default home locations 2021-12-22 17:47:48 +00:00
a7026047d0 Adding gold at the end might stop the prefix weirdness? 2021-12-22 17:46:39 +00:00
af2613202d refactor: Satisfy Semgrep 2021-12-22 02:06:07 +01:00
3da1e9255a build: Update dependency me.clip:placeholderapi to v2.11.0 (#3395)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-12-21 10:49:47 +01:00
9394906a79 build: Update dependency org.checkerframework:checker-qual to v3.21.0 (#3394)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-12-20 13:47:16 +01:00
d881cb6084 build: Update dependency com.intellectualsites.paster:Paster to v1.1.3 (#3391)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-12-20 11:55:54 +01:00
b9d43897af build: Update dependency net.essentialsx:EssentialsX to v2.19.2 (#3392)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-12-20 11:55:46 +01:00
76b58485a9 build: Update actions/checkout action to v2.4.0 (#3393)
* build: Update actions/checkout action to v2.4.0

* chore: Invert bolt's status

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: NotMyFault <mc.cache@web.de>
2021-12-20 11:55:14 +01:00
7002df0bc7 build: Bump dependencies for 1.18 2021-12-18 23:10:41 +01:00
958aac3cb1 chore: Configure bolt 2021-12-18 13:12:00 +01:00
a93402e27b fix: Standardize projectile permissions (#3374)
* fix: Standardize projectile permissions

- Let all projectiles (not just splash potions) have a permissions check on throwing
- Fixes snowballs, eggs, etc. being able to be thrown when not added to the plot, etc.
- Fixes #2986 (splash potions only able being to be thrown when also added to the plot)
- Remove the specialized code for egg hatching as now eggs are cancelled entirely
- Remove the non-standard plots.projectile.unowned and plots.projectile.other permissions in favor of the standard admin ones

* docs: Add back deprecated projectile permissions

* docs: Update Core/src/main/java/com/plotsquared/core/permissions/Permission.java

Co-authored-by: Alex <mc.cache@web.de>

Co-authored-by: Alex <mc.cache@web.de>
2021-12-17 22:06:56 +01:00
92f41f43c5 fix: Ignore the use flag for liquid placement/removal (#3375)
Fixes #3069
2021-12-17 21:52:15 +01:00
392ee9fa07 ci: Escape workflow tasks 2021-12-17 21:36:56 +01:00
8859871e89 build: Back to snapshot for development 2021-12-14 23:14:35 +01:00
93d99630a9 build: Release 6.2.1 2021-12-14 23:06:55 +01:00
47ae79e123 Revert "refactor: Address MiniMessage deprecations (#3354)" (#3371)
This reverts commit f086826942.
2021-12-14 23:04:36 +01:00
f9ad00c2c8 build: Update dependency org.apache.logging.log4j:log4j-api to v2.16.0 (#3368)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-12-14 13:57:16 +01:00
566af259db build: Update dependency org.checkerframework:checker-qual to v3.20.0 (#3369)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-12-13 15:11:48 +01:00
d9a6431078 build: Back to snapshot for development 2021-12-13 13:47:28 +01:00
572 changed files with 2703 additions and 2223 deletions

2
.github/stale.yml vendored
View File

@ -1,4 +1,4 @@
daysUntilStale: 60
daysUntilStale: 30
daysUntilClose: 7
only: issues
exemptLabels:

View File

@ -1,41 +1,41 @@
name: "build"
name: build
on: [ "pull_request", "push" ]
on: [ pull_request, push ]
jobs:
build:
runs-on: "ubuntu-20.04"
runs-on: ubuntu-latest
steps:
- name: "Checkout Repository"
uses: "actions/checkout@v2.4.0"
- name: "Validate Gradle Wrapper"
uses: "gradle/wrapper-validation-action@v1.0.4"
- name: "Setup Java"
uses: "actions/setup-java@v2.4.0"
- name: Checkout Repository
uses: actions/checkout@v2.4.0
- name: Validate Gradle Wrapper"
uses: gradle/wrapper-validation-action@v1.0.4
- name: Setup Java
uses: actions/setup-java@v2.5.0
with:
distribution: "temurin"
java-version: "17"
- name: "Clean Build"
run: "./gradlew clean build"
- name: "Determine release status"
if: "${{ runner.os == 'Linux' }}"
distribution: temurin
java-version: 17
- name: Clean Build
run: ./gradlew clean build
- name: Determine release status
if: ${{ runner.os == 'Linux' }}
run: |
if [ "$(./gradlew properties | awk '/^version:/ { print $2; }' | grep '\-SNAPSHOT')" ]; then
echo "STATUS=snapshot" >> $GITHUB_ENV
else
echo "STATUS=release" >> $GITHUB_ENV
fi
- name: "Publish Release"
if: "${{ runner.os == 'Linux' && env.STATUS == 'release' && github.event_name == 'push' && github.ref == 'refs/heads/v6'}}"
run: "./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository"
- name: Publish Release
if: ${{ runner.os == 'Linux' && env.STATUS == 'release' && github.event_name == 'push' && github.ref == 'refs/heads/v6'}}
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository
env:
ORG_GRADLE_PROJECT_sonatypeUsername: "${{ secrets.SONATYPE_USERNAME }}"
ORG_GRADLE_PROJECT_sonatypePassword: "${{ secrets.SONATYPE_PASSWORD }}"
ORG_GRADLE_PROJECT_signingKey: "${{ secrets.SIGNING_KEY }}"
ORG_GRADLE_PROJECT_signingPassword: "${{ secrets.SIGNING_PASSWORD }}"
- name: "Publish Snapshot"
if: "${{ runner.os == 'Linux' && env.STATUS != 'release' && github.event_name == 'push' && github.ref == 'refs/heads/v6' }}"
run: "./gradlew publishToSonatype"
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}
- name: Publish Snapshot
if: ${{ runner.os == 'Linux' && env.STATUS != 'release' && github.event_name == 'push' && github.ref == 'refs/heads/v6' }}
run: ./gradlew publishToSonatype
env:
ORG_GRADLE_PROJECT_sonatypeUsername: "${{ secrets.SONATYPE_USERNAME }}"
ORG_GRADLE_PROJECT_sonatypePassword: "${{ secrets.SONATYPE_PASSWORD }}"
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}

20
.github/workflows/rebase.yml vendored Normal file
View File

@ -0,0 +1,20 @@
name: Rebase Pull Request
on:
issue_comment:
types: [created]
jobs:
rebase:
name: Rebase
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/rebase') && github.event.comment.author_association == 'MEMBER'
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2.4.0
with:
token: ${{ secrets.REBASE_TOKEN }}
fetch-depth: 0
- name: Automatic Rebase
uses: cirrus-actions/rebase@1.5
env:
GITHUB_TOKEN: ${{ secrets.REBASE_TOKEN }}

View File

@ -1,14 +1,18 @@
name: "draft release"
name: draft release
on:
push:
branches:
- v6
pull_request:
types: [ opened, reopened, synchronize ]
pull_request_target:
types: [ opened, reopened, synchronize ]
jobs:
update_release_draft:
runs-on: "ubuntu-latest"
runs-on: ubuntu-latest
steps:
- uses: "release-drafter/release-drafter@v5.15.0"
- uses: release-drafter/release-drafter@v5.17.6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

4
.lift.toml Normal file
View 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"]

13
.whitesource Normal file
View File

@ -0,0 +1,13 @@
{
"scanSettings": {
"baseBranches": ["v6"]
},
"checkRunSettings": {
"vulnerableCheckRunConclusionLevel": "success",
"displayMode": "diff"
},
"issueSettings": {
"minSeverityLevel": "LOW"
},
"enableRenovate": "true"
}

View File

@ -40,7 +40,6 @@ dependencies {
compileOnly(libs.placeholderapi)
compileOnly(libs.luckperms)
compileOnly(libs.essentialsx)
compileOnly(libs.hyperverse) { isTransitive = false }
compileOnly(libs.mvdwapi) { isTransitive = false }
// Other libraries
@ -75,7 +74,8 @@ tasks.named<ShadowJar>("shadowJar") {
relocate("org.khelekore.prtree", "com.plotsquared.prtree")
relocate("com.google.inject", "com.plotsquared.google")
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.http", "com.plotsquared.core.http")
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.intellij.lang", "com.plotsquared.core.intellij.annotations")
relocate("javax.annotation", "com.plotsquared.core.annotation")
relocate("com.google.code.findbugs", "com.plotsquared.core.findbugs")
relocate("javax.inject", "com.plotsquared.core.annotation.inject")
// Get rid of all the libs which are 100% unused.
@ -94,12 +95,11 @@ tasks.named<ShadowJar>("shadowJar") {
tasks {
withType<Javadoc> {
val opt = options as StandardJavadocDocletOptions
opt.links("https://papermc.io/javadocs/paper/1.17/")
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/7.2.7/")
opt.links("https://jd.adventure.kyori.net/api/4.9.3/")
opt.links("https://notmyfault.github.io/MiniMessage-Javadocs/") // Temporary hosting for 4.2.0-SNAPSHOT, exchange when we jump to 4.10.0
opt.links("https://google.github.io/guice/api-docs/5.0.1/javadoc/")
opt.links("https://papermc.io/javadocs/paper/1.18/")
opt.links("https://docs.enginehub.org/javadoc/com.sk89q.worldedit/worldedit-bukkit/" + libs.worldeditBukkit.get().versionConstraint.toString())
opt.links("https://javadoc.io/doc/com.plotsquared/PlotSquared-Core/latest/")
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/")
}
}

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* 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.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@ -216,6 +218,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
private PlatformWorldManager<World> worldManager;
private Locale serverLocale;
@SuppressWarnings("StringSplitter")
@Override
public int @NonNull [] serverVersion() {
if (this.version == null) {
@ -266,7 +269,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
faweHook = true;
} catch (Exception ignored) {
LOGGER.error("Incompatible version of FAWE to enable hook, please upgrade: https://ci.athion" +
".net/job/FastAsyncWorldEdit-1.17/");
".net/job/FastAsyncWorldEdit/");
}
}
}
@ -321,8 +324,6 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
// Comments
CommentManager.registerDefaultInboxes();
plotSquared.startExpiryTasks();
// Do stuff that was previously done in PlotSquared
// Kill entities
if (Settings.Enabled_Components.KILL_ROAD_MOBS || Settings.Enabled_Components.KILL_ROAD_VEHICLES) {
@ -419,6 +420,8 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
}, TaskTime.ticks(1L));
}
plotSquared.startExpiryTasks();
// Once the server has loaded force updating all generators known to P2
TaskManager.runTaskLater(() -> PlotSquared.platform().setupUtils().updateGenerators(true), TaskTime.ticks(1L));
@ -968,7 +971,6 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
}
iterator.remove();
entity.remove();
continue;
}
}
} else {
@ -980,7 +982,6 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
}
iterator.remove();
entity.remove();
continue;
}
}
}
@ -1141,8 +1142,10 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
@Override
public @NonNull String pluginsFormatted() {
StringBuilder msg = new StringBuilder();
Plugin[] plugins = Bukkit.getServer().getPluginManager().getPlugins();
msg.append("Plugins (").append(plugins.length).append("): \n");
List<Plugin> plugins = new ArrayList<>();
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) {
msg.append(" - ").append(p.getName()).append(":").append("\n")
.append(" • Version: ").append(p.getDescription().getVersion()).append("\n")
@ -1156,6 +1159,21 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
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
public com.plotsquared.core.location.@NonNull World<?> getPlatformWorld(final @NonNull String worldName) {
return BukkitWorld.of(worldName);
@ -1204,7 +1222,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
@Override
@NonNull
@SuppressWarnings("ALL")
@SuppressWarnings("unchecked")
public PlayerManager<? extends PlotPlayer<Player>, ? extends Player> playerManager() {
return (PlayerManager<BukkitPlayer, Player>) injector().getInstance(PlayerManager.class);
}

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* 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();
}
@SuppressWarnings("deprecation") // Paper deprecation
@Override
public Entity spawn(World world, int xOffset, int zOffset) {
Location location = new Location(world, this.getX() + xOffset, this.getY(), this.z + zOffset);

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* 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.Singleton;
import com.plotsquared.bukkit.managers.BukkitWorldManager;
import com.plotsquared.bukkit.managers.HyperverseWorldManager;
import com.plotsquared.bukkit.managers.MultiverseWorldManager;
import com.plotsquared.core.util.PlatformWorldManager;
import org.bukkit.Bukkit;
@ -37,12 +36,11 @@ import org.bukkit.World;
public class WorldManagerModule extends AbstractModule {
@SuppressWarnings("removal") // Internal use only
@Provides
@Singleton
PlatformWorldManager<World> provideWorldManager() {
if (Bukkit.getPluginManager().getPlugin("Hyperverse") != null) {
return new HyperverseWorldManager();
} else if (Bukkit.getPluginManager().getPlugin("Multiverse-Core") != null) {
if (Bukkit.getPluginManager().getPlugin("Multiverse-Core") != null) {
return new MultiverseWorldManager();
} else {
return new BukkitWorldManager();

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by
@ -166,7 +166,7 @@ public class BlockEventListener implements Listener {
}
if (Settings.Redstone.DISABLE_OFFLINE) {
boolean disable = false;
if (!plot.getOwner().equals(DBFunc.SERVER)) {
if (!DBFunc.SERVER.equals(plot.getOwner())) {
if (plot.isMerged()) {
disable = true;
for (UUID owner : plot.getOwners()) {
@ -283,15 +283,15 @@ public class BlockEventListener implements Listener {
event.setCancelled(true);
pp.sendMessage(
TranslatableCaption.of("height.height_limit"),
Template.template("minHeight", String.valueOf(area.getMinBuildHeight())),
Template.template("maxHeight", String.valueOf(area.getMaxBuildHeight()))
Template.of("minHeight", String.valueOf(area.getMinBuildHeight())),
Template.of("maxHeight", String.valueOf(area.getMaxBuildHeight()))
);
}
if (!plot.hasOwner()) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_UNOWNED)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.template("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED))
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED))
);
event.setCancelled(true);
return;
@ -308,7 +308,7 @@ public class BlockEventListener implements Listener {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.template("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
);
event.setCancelled(true);
plot.debug(player.getName() + " could not place " + event.getBlock().getType()
@ -335,7 +335,7 @@ public class BlockEventListener implements Listener {
} else if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_ROAD)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.template("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD))
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD))
);
event.setCancelled(true);
}
@ -357,7 +357,7 @@ public class BlockEventListener implements Listener {
.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_DESTROY_GROUNDLEVEL)) {
plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.template("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_GROUNDLEVEL))
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_GROUNDLEVEL))
);
event.setCancelled(true);
return;
@ -368,8 +368,8 @@ public class BlockEventListener implements Listener {
event.setCancelled(true);
plotPlayer.sendMessage(
TranslatableCaption.of("height.height_limit"),
Template.template("minHeight", String.valueOf(area.getMinBuildHeight())),
Template.template("maxHeight", String.valueOf(area.getMaxBuildHeight()))
Template.of("minHeight", String.valueOf(area.getMinBuildHeight())),
Template.of("maxHeight", String.valueOf(area.getMaxBuildHeight()))
);
}
if (!plot.hasOwner()) {
@ -394,7 +394,7 @@ public class BlockEventListener implements Listener {
}
plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.template("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_OTHER))
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_OTHER))
);
event.setCancelled(true);
} else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
@ -420,7 +420,7 @@ public class BlockEventListener implements Listener {
}
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.template("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_ROAD))
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_ROAD))
);
event.setCancelled(true);
}
@ -1095,7 +1095,7 @@ public class BlockEventListener implements Listener {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_ROAD)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.template("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD))
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD))
);
event.setCancelled(true);
}
@ -1103,7 +1103,7 @@ public class BlockEventListener implements Listener {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_UNOWNED)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.template("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED))
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED))
);
event.setCancelled(true);
}
@ -1111,7 +1111,7 @@ public class BlockEventListener implements Listener {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.template("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
);
event.setCancelled(true);
}

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* 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;
} else {
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 {
this.visibleChunks = classPlayerChunkMap.getField("visibleChunks");
}
this.methodGetFullChunk = getRefClass("{nms}.PlayerChunk").getMethod("getFullChunk");
this.methodGetBukkitChunk = getRefClass("{nms}.Chunk").getMethod("getBukkitChunk");
*/
}
} else if (version == 17) {
} else {
RefClass classChunk = getRefClass("net.minecraft.world.level.chunk.Chunk");
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) {
e.printStackTrace();
@ -182,32 +152,7 @@ public class ChunkListener implements Listener {
}
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()) {
return;

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* 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.world.block.BlockType;
import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.entity.Ageable;
@ -323,6 +324,10 @@ public class EntityEventListener implements Listener {
}
}
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)
@ -371,14 +376,14 @@ public class EntityEventListener implements Listener {
if (shooter instanceof Player) {
PlotPlayer<?> pp = BukkitUtil.adapt((Player) shooter);
if (plot == null) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_PROJECTILE_UNOWNED)) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED)) {
entity.remove();
event.setCancelled(true);
}
return;
}
if (plot.isAdded(pp.getUUID()) || Permissions
.hasPermission(pp, Permission.PERMISSION_PROJECTILE_OTHER)) {
.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_OTHER)) {
return;
}
entity.remove();

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by
@ -60,7 +60,7 @@ import java.util.List;
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 hasPlotArea = false;
private static String areaName = null;
@ -75,8 +75,7 @@ public class EntitySpawnListener implements Listener {
public static void testCreate(final Entity entity) {
@NonNull World world = entity.getWorld();
if (areaName == world.getName()) {
} else {
if (!world.getName().equals(areaName)) {
areaName = world.getName();
hasPlotArea = PlotSquared.get().getPlotAreaManager().hasPlotArea(areaName);
}

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* 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.caption.TranslatableCaption;
import com.plotsquared.core.location.Location;
import com.plotsquared.core.permissions.Permission;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.plot.flag.implementations.DoneFlag;
import com.plotsquared.core.plot.world.PlotAreaManager;
import com.plotsquared.core.util.Permissions;
import net.kyori.adventure.text.minimessage.Template;
import org.bukkit.Chunk;
import org.bukkit.block.Block;
@ -53,7 +55,6 @@ import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.entity.Slime;
import org.bukkit.entity.ThrownPotion;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
@ -302,7 +303,7 @@ public class PaperListener implements Listener {
final PlotPlayer<?> plotPlayer = BukkitUtil.adapt(event.getPlayer());
plotPlayer.sendMessage(
TranslatableCaption.of("errors.tile_entity_cap_reached"),
Template.template("amount", String.valueOf(Settings.Chunk_Processor.MAX_TILES))
Template.of("amount", String.valueOf(Settings.Chunk_Processor.MAX_TILES))
);
event.setCancelled(true);
event.setBuild(false);
@ -321,9 +322,6 @@ public class PaperListener implements Listener {
return;
}
Projectile entity = event.getProjectile();
if (!(entity instanceof ThrownPotion)) {
return;
}
ProjectileSource shooter = entity.getShooter();
if (!(shooter instanceof Player)) {
return;
@ -332,11 +330,36 @@ public class PaperListener implements Listener {
if (!this.plotAreaManager.hasPlotArea(location.getWorldName())) {
return;
}
PlotPlayer<?> pp = BukkitUtil.adapt((Player) shooter);
PlotPlayer<Player> pp = BukkitUtil.adapt((Player) shooter);
Plot plot = location.getOwnedPlot();
if (plot != null && !plot.isAdded(pp.getUUID())) {
entity.remove();
event.setCancelled(true);
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();
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);
}
}
}

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* 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 org.bukkit.block.Banner;
import org.bukkit.block.Beacon;
import org.bukkit.block.Bed;
import org.bukkit.block.BlockState;
import org.bukkit.block.CommandBlock;
import org.bukkit.block.Comparator;
@ -51,6 +50,7 @@ import org.bukkit.block.Jukebox;
import org.bukkit.block.Sign;
import org.bukkit.block.Skull;
import org.bukkit.block.Structure;
import org.bukkit.block.data.type.Bed;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.BlockPlaceEvent;
import org.checkerframework.checker.nullness.qual.NonNull;
@ -84,7 +84,7 @@ public class PaperListener113 extends PaperListener {
final PlotPlayer<?> plotPlayer = BukkitUtil.adapt(event.getPlayer());
plotPlayer.sendMessage(
TranslatableCaption.of("errors.tile_entity_cap_reached"),
Template.template("amount", String.valueOf(Settings.Chunk_Processor.MAX_TILES))
Template.of("amount", String.valueOf(Settings.Chunk_Processor.MAX_TILES))
);
event.setCancelled(true);
event.setBuild(false);

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* 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.TamedInteractFlag;
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.VehicleUseFlag;
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.util.EventDispatcher;
import com.plotsquared.core.util.MathMan;
@ -94,6 +92,7 @@ import org.bukkit.FluidCollisionMode;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockState;
import org.bukkit.block.data.Waterlogged;
import org.bukkit.command.PluginCommand;
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.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerEggThrowEvent;
import org.bukkit.event.player.PlayerEvent;
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
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)
public void playerCommand(PlayerCommandPreprocessEvent event) {
String msg = event.getMessage().toLowerCase().replaceAll("/", "").trim();
@ -364,9 +363,9 @@ public class PlayerEventListener extends PlotListener implements Listener {
&& PremiumVerification.isPremium() && UpdateUtility.hasUpdate) {
Caption boundary = TranslatableCaption.of("update.update_boundary");
Caption updateNotification = TranslatableCaption.of("update.update_notification");
Template internalVersion = Template.template("p2version", UpdateUtility.internalVersion.versionString());
Template spigotVersion = Template.template("spigotversion", UpdateUtility.spigotVersion);
Template downloadUrl = Template.template("downloadurl", "https://www.spigotmc.org/resources/77506/updates");
Template internalVersion = Template.of("p2version", UpdateUtility.internalVersion.versionString());
Template spigotVersion = Template.of("spigotversion", UpdateUtility.spigotVersion);
Template downloadUrl = Template.of("downloadurl", "https://www.spigotmc.org/resources/77506/updates");
pp.sendMessage(boundary);
pp.sendMessage(updateNotification, internalVersion, spigotVersion, downloadUrl);
pp.sendMessage(boundary);
@ -380,6 +379,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
this.eventDispatcher.doRespawnTask(pp);
}
@SuppressWarnings("deprecation") // We explicitly want #getHomeSynchronous here
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onTeleport(PlayerTeleportEvent event) {
Player player = event.getPlayer();
@ -418,8 +418,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
.getHomeSynchronous()
.equals(BukkitUtil.adaptComplete(to)))) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.template("node", String.valueOf(Permission.PERMISSION_ADMIN_ENTRY_DENIED))
TranslatableCaption.of("deny.no_enter"),
Template.of("plot", plot.toString())
);
event.setCancelled(true);
}
@ -535,7 +535,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport && !kickAccess.get().orElse(false)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.template("node", String.valueOf(Permission.PERMISSION_ADMIN_EXIT_DENIED))
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_EXIT_DENIED))
);
this.tmpTeleport = false;
if (lastPlot.equals(BukkitUtil.adapt(from).getPlot())) {
@ -552,8 +552,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
ForceFieldListener.handleForcefield(player, pp, now);
} else if (!plotEntry(pp, now) && this.tmpTeleport) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.template("node", String.valueOf(Permission.PERMISSION_ADMIN_ENTRY_DENIED))
TranslatableCaption.of("deny.no_enter"),
Template.of("plot", now.toString())
);
this.tmpTeleport = false;
to.setX(from.getBlockX());
@ -572,7 +572,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
player.teleport(event.getTo());
this.tmpTeleport = true;
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"));
}
} else if (x2 < -border && this.tmpTeleport) {
@ -582,7 +582,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
player.teleport(event.getTo());
this.tmpTeleport = true;
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"));
}
} else if (((x1 = MathMan.roundInt(from.getX())) >= border && x2 <= border) || (x1 <= -border && x2 >= -border)) {
@ -613,19 +613,19 @@ public class PlayerEventListener extends PlotListener implements Listener {
}
return;
}
Plot now = area.getPlot(location);
Plot plot = area.getPlot(location);
Plot lastPlot;
try (final MetaDataAccess<Plot> lastPlotAccess =
pp.accessTemporaryMetaData(PlayerMetaDataKeys.TEMPORARY_LAST_PLOT)) {
lastPlot = lastPlotAccess.get().orElse(null);
}
if (now == null) {
if (plot == null) {
try (final MetaDataAccess<Boolean> kickAccess =
pp.accessTemporaryMetaData(PlayerMetaDataKeys.TEMPORARY_KICK)) {
if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport && !kickAccess.get().orElse(false)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.template("node", String.valueOf(Permission.PERMISSION_ADMIN_EXIT_DENIED))
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_EXIT_DENIED))
);
this.tmpTeleport = false;
if (lastPlot.equals(BukkitUtil.adapt(from).getPlot())) {
@ -638,12 +638,12 @@ public class PlayerEventListener extends PlotListener implements Listener {
return;
}
}
} else if (now.equals(lastPlot)) {
ForceFieldListener.handleForcefield(player, pp, now);
} else if (!plotEntry(pp, now) && this.tmpTeleport) {
} else if (plot.equals(lastPlot)) {
ForceFieldListener.handleForcefield(player, pp, plot);
} else if (!plotEntry(pp, plot) && this.tmpTeleport) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.template("node", String.valueOf(Permission.PERMISSION_ADMIN_ENTRY_DENIED))
TranslatableCaption.of("deny.no_enter"),
Template.of("plot", plot.toString())
);
this.tmpTeleport = false;
player.teleport(from);
@ -663,7 +663,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
player.teleport(event.getTo());
this.tmpTeleport = true;
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"));
}
} else if (z2 < -border && this.tmpTeleport) {
@ -673,7 +673,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
player.teleport(event.getTo());
this.tmpTeleport = true;
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"));
}
} else if (((z1 = MathMan.roundInt(from.getZ())) >= border && z2 <= border) || (z1 <= -border && z2 >= -border)) {
@ -729,9 +729,9 @@ public class PlayerEventListener extends PlotListener implements Listener {
String worldName = plot.getWorldName();
Caption msg = TranslatableCaption.of("chat.plot_chat_format");
Template msgTemplate;
Template worldNameTemplate = Template.template("world", worldName);
Template plotTemplate = Template.template("plot_id", id.toString());
Template senderTemplate = Template.template("sender", sender);
Template worldNameTemplate = Template.of("world", worldName);
Template plotTemplate = Template.of("plot_id", id.toString());
Template senderTemplate = Template.of("sender", sender);
// If we do/don't want colour, we need to be careful about how to go about it, as players could attempt either <gold></gold> or &6 etc.
// In both cases, we want to use a Component Template to ensure that the player cannot use any placeholders in their message on purpose
// or accidentally, as component templates are done at the end. We also need to deserialize from legacy color codes to a Component if
@ -746,7 +746,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
))
);
} else {
msgTemplate = Template.template("msg", BukkitUtil.MINI_MESSAGE.deserialize(
msgTemplate = Template.of("msg", BukkitUtil.MINI_MESSAGE.deserialize(
ChatColor.stripColor(BukkitUtil.LEGACY_COMPONENT_SERIALIZER.serialize(Component.text(message)))));
}
for (PlotPlayer<?> receiver : plotRecipients) {
@ -754,18 +754,18 @@ public class PlayerEventListener extends PlotListener implements Listener {
}
if (!spies.isEmpty()) {
Caption spymsg = TranslatableCaption.of("chat.plot_chat_spy_format");
Template plotidTemplate = Template.template("plot_id", id.getX() + ";" + id.getY());
Template spysenderTemplate = Template.template("sender", sender);
Template spymessageTemplate = Template.template("msg", Component.text(message));
Template plotidTemplate = Template.of("plot_id", id.getX() + ";" + id.getY());
Template spysenderTemplate = Template.of("sender", sender);
Template spymessageTemplate = Template.of("msg", Component.text(message));
for (PlotPlayer<?> player : spies) {
player.sendMessage(spymsg, worldNameTemplate, plotidTemplate, spysenderTemplate, spymessageTemplate);
}
}
if (Settings.Chat.LOG_PLOTCHAT_TO_CONSOLE) {
Caption spymsg = TranslatableCaption.of("chat.plot_chat_spy_format");
Template plotidTemplate = Template.template("plot_id", id.getX() + ";" + id.getY());
Template spysenderTemplate = Template.template("sender", sender);
Template spymessageTemplate = Template.template("msg", Component.text(message));
Template plotidTemplate = Template.of("plot_id", id.getX() + ";" + id.getY());
Template spysenderTemplate = Template.of("sender", sender);
Template spymessageTemplate = Template.of("msg", Component.text(message));
ConsolePlayer.getConsole().sendMessage(spymsg, worldNameTemplate, plotidTemplate, spysenderTemplate,
spymessageTemplate
);
@ -921,7 +921,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_ROAD)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.template("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_ROAD))
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_ROAD))
);
cancelled = true;
}
@ -929,7 +929,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_UNOWNED)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.template("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_UNOWNED))
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_UNOWNED))
);
cancelled = true;
}
@ -939,7 +939,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_OTHER)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.template("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_OTHER))
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_OTHER))
);
cancelled = true;
}
@ -977,7 +977,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_ROAD)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.template("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_ROAD))
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_ROAD))
);
e.setCancelled(true);
}
@ -995,7 +995,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (!Permissions.hasPermission(pp, "plots.admin.interact.unowned")) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.template("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_UNOWNED))
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_UNOWNED))
);
e.setCancelled(true);
}
@ -1010,7 +1010,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_OTHER)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.template("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_OTHER))
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_OTHER))
);
e.setCancelled(true);
plot.debug(pp.getName() + " could not interact with " + entity.getType()
@ -1064,9 +1064,13 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (area == null) {
return;
}
PlayerBlockEventType eventType = null;
PlayerBlockEventType eventType;
BlockType blocktype1;
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());
Action action = event.getAction();
switch (action) {
@ -1226,7 +1230,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
}
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.template("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD))
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD))
);
event.setCancelled(true);
} else if (!plot.hasOwner()) {
@ -1235,23 +1239,16 @@ public class PlayerEventListener extends PlotListener implements Listener {
}
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.template("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED))
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED))
);
event.setCancelled(true);
} 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)) {
return;
}
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.template("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
);
event.setCancelled(true);
} else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
@ -1298,7 +1295,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
}
plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.template("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD))
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD))
);
event.setCancelled(true);
} else if (!plot.hasOwner()) {
@ -1307,24 +1304,16 @@ public class PlayerEventListener extends PlotListener implements Listener {
}
plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.template("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED))
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED))
);
event.setCancelled(true);
} 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)) {
return;
}
plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.template("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
);
event.setCancelled(true);
} else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
@ -1356,7 +1345,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_ROAD)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.template("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD))
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD))
);
event.setCancelled(true);
}
@ -1365,7 +1354,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_UNOWNED)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.template("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED))
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED))
);
event.setCancelled(true);
}
@ -1376,7 +1365,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.template("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
);
event.setCancelled(true);
}
@ -1405,7 +1394,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_DESTROY_ROAD)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.template("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_ROAD))
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_ROAD))
);
event.setCancelled(true);
}
@ -1413,7 +1402,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_DESTROY_UNOWNED)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.template("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_UNOWNED))
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_UNOWNED))
);
event.setCancelled(true);
}
@ -1424,7 +1413,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_DESTROY_OTHER)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.template("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_OTHER))
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_OTHER))
);
event.setCancelled(true);
plot.debug(p.getName()
@ -1446,7 +1435,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
.hasPermission(player, Permission.PERMISSION_ADMIN_DESTROY_UNOWNED)) {
player.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.template("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_UNOWNED))
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_UNOWNED))
);
event.setCancelled(true);
}
@ -1456,7 +1445,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
.hasPermission(player, Permission.PERMISSION_ADMIN_DESTROY_OTHER)) {
player.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.template("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_OTHER))
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_OTHER))
);
event.setCancelled(true);
plot.debug(player.getName()
@ -1488,7 +1477,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_ROAD)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.template("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_ROAD))
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_ROAD))
);
event.setCancelled(true);
}
@ -1496,7 +1485,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_UNOWNED)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.template("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_UNOWNED))
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_UNOWNED))
);
event.setCancelled(true);
}
@ -1554,7 +1543,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_OTHER)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.template("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_OTHER))
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_OTHER))
);
event.setCancelled(true);
}
@ -1576,7 +1565,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_ROAD)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.template("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_ROAD))
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_ROAD))
);
event.setCancelled(true);
}
@ -1585,7 +1574,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_UNOWNED)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.template("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_UNOWNED))
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_UNOWNED))
);
event.setCancelled(true);
return;
@ -1599,7 +1588,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_OTHER)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.template("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_OTHER))
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_OTHER))
);
event.setCancelled(true);
plot.debug(pp.getName()
@ -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.template("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.template("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.template("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_OTHER))
);
event.setHatching(false);
}
}
}
@EventHandler
public void onItemDrop(PlayerDropItemEvent event) {
Player player = event.getPlayer();
@ -1720,6 +1672,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
}
}
@SuppressWarnings("deprecation") // #getLocate is needed for Spigot compatibility
@EventHandler
public void onLocaleChange(final PlayerLocaleChangeEvent event) {
// The event is fired before the player is deemed online upon login
@ -1755,22 +1708,49 @@ public class PlayerEventListener extends PlotListener implements Listener {
@EventHandler
public void onPortalCreation(PortalCreateEvent event) {
Location location = BukkitUtil.adapt(event.getEntity().getLocation());
PlotArea area = location.getPlotArea();
if (area == null) {
String world = event.getWorld().getName();
if (PlotSquared.get().getPlotAreaManager().getPlotAreasSet(world).size() == 0) {
return;
}
Plot plot = location.getOwnedPlot();
if (plot == null) {
if (area.isRoadFlags() && area.getRoadFlag(DenyPortalsFlag.class)) {
event.setCancelled(true);
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();
if (area == null) {
continue;
}
Plot plot = location.getOwnedPlot();
if (plot == null) {
if (area.isRoadFlags() && area.getRoadFlag(DenyPortalsFlag.class)) {
event.setCancelled(true);
return;
}
continue;
}
return;
}
if (plot.getFlag(DenyPortalsFlag.class)) {
if (plot.getFlag(DenyPortalsFlag.class)) {
plot.debug(event.getEntity().getName() + " did not create a portal because of deny-portals = true");
StringBuilder builder = new StringBuilder();
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);
return;
}
}
}

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* 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.plotsquared.bukkit.util.BukkitEntityUtil;
import com.plotsquared.bukkit.util.BukkitUtil;
import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.location.Location;
import com.plotsquared.core.permissions.Permission;
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.world.PlotAreaManager;
import com.plotsquared.core.util.Permissions;
import net.kyori.adventure.text.minimessage.Template;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
@ -96,9 +98,6 @@ public class ProjectileEventListener implements Listener {
@EventHandler
public void onProjectileLaunch(ProjectileLaunchEvent event) {
Projectile entity = event.getEntity();
if (!(entity instanceof ThrownPotion)) {
return;
}
ProjectileSource shooter = entity.getShooter();
if (!(shooter instanceof Player)) {
return;
@ -109,9 +108,34 @@ public class ProjectileEventListener implements Listener {
}
PlotPlayer<Player> pp = BukkitUtil.adapt((Player) shooter);
Plot plot = location.getOwnedPlot();
if (plot != null && !plot.isAdded(pp.getUUID())) {
entity.remove();
event.setCancelled(true);
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();
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);
}
}
}
@ -131,14 +155,14 @@ public class ProjectileEventListener implements Listener {
if (shooter instanceof Player) {
PlotPlayer<?> pp = BukkitUtil.adapt((Player) shooter);
if (plot == null) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_PROJECTILE_UNOWNED)) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED)) {
entity.remove();
event.setCancelled(true);
}
return;
}
if (plot.isAdded(pp.getUUID()) || Permissions
.hasPermission(pp, Permission.PERMISSION_PROJECTILE_OTHER)) {
.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_OTHER)) {
return;
}
entity.remove();

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* 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;
@SuppressWarnings("unused")
public class SingleWorldListener implements Listener {
private final Method methodGetHandleChunk;

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by
@ -25,6 +25,7 @@
*/
package com.plotsquared.bukkit.managers;
/*
import com.google.inject.Singleton;
import org.bukkit.World;
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.WorldType;
/**
* Hyperverse specific manager that creates worlds
* using Hyperverse's API
*/
Hyperverse implementation is currently put on ice until Hyperverse is released on a stable line and deployed to the central
repository.
@Singleton
public class HyperverseWorldManager extends BukkitWorldManager {
@ -67,3 +67,4 @@ public class HyperverseWorldManager extends BukkitWorldManager {
}
}
*/

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by
@ -36,9 +36,9 @@ import org.checkerframework.checker.nullness.qual.Nullable;
* world creation by executing a console command
*
* @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
public class MultiverseWorldManager extends BukkitWorldManager {

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* 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
@NonNegative
public int hasPermissionRange(
@ -319,7 +320,7 @@ public class BukkitPlayer extends PlotPlayer<Player> {
if (id == ItemTypes.AIR) {
// Let's just stop all the discs because why not?
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);
}
// 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
public void kick(final String message) {
this.player.kickPlayer(message);

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* 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.BlockState;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
import org.bukkit.block.Block;
import org.bukkit.block.Container;
import org.bukkit.block.data.BlockData;
@ -199,7 +198,7 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator {
}
}
if (localChunk.getTiles().size() > 0) {
localChunk.getTiles().forEach(((blockVector3, tag) -> {
localChunk.getTiles().forEach((blockVector3, tag) -> {
try {
BaseBlock block = getWorld().getBlock(blockVector3).toBaseBlock(tag);
getWorld().setBlock(blockVector3, block, noSideEffectSet);
@ -207,7 +206,7 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator {
StateWrapper sw = new StateWrapper(tag);
sw.restoreTag(getWorld().getName(), blockVector3.getX(), blockVector3.getY(), blockVector3.getZ());
}
}));
});
}
if (localChunk.getEntities().size() > 0) {
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
*/
@SuppressWarnings("unused")
private void setWorldBlock(int x, int y, int z, @NonNull BaseBlock block, @NonNull BlockVector2 blockVector2, boolean edge) {
try {
BlockVector3 loc = BlockVector3.at(x, y, z);
@ -266,9 +266,7 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator {
} catch (WorldEditException ignored) {
// Fallback to not so nice method
BlockData blockData = BukkitAdapter.adapt(block);
Chunk chunk = getBukkitWorld().getChunkAt(blockVector2.getX(), blockVector2.getZ());
Block existing = chunk.getBlock(x, y, z);
Block existing = getBukkitWorld().getBlockAt(x, y, z);
final BlockState existingBaseBlock = BukkitAdapter.adapt(existing.getBlockData());
if (BukkitBlockUtil.get(existing).equals(existingBaseBlock) && existing.getBlockData().matches(blockData)) {
return;

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by
@ -166,6 +166,7 @@ public class StateWrapper {
return str;
}
@SuppressWarnings("deprecation") // #setLine is needed for Spigot compatibility
public boolean restoreTag(String worldName, int x, int y, int z) {
if (this.tag == null) {
return false;

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by
@ -188,7 +188,7 @@ public class BukkitEntityUtil {
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_DESTROY + "." + stub)) {
plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.template("node", Permission.PERMISSION_ADMIN_DESTROY + "." + stub)
Template.of("node", Permission.PERMISSION_ADMIN_DESTROY + "." + stub)
);
return false;
}
@ -200,7 +200,7 @@ public class BukkitEntityUtil {
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_DESTROY + "." + stub)) {
plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.template("node", Permission.PERMISSION_ADMIN_DESTROY + "." + stub)
Template.of("node", Permission.PERMISSION_ADMIN_DESTROY + "." + stub)
);
if (plot != null) {
plot.debug(player.getName()
@ -221,7 +221,7 @@ public class BukkitEntityUtil {
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVE + "." + stub)) {
plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.template("node", Permission.PERMISSION_ADMIN_PVE + "." + stub)
Template.of("node", Permission.PERMISSION_ADMIN_PVE + "." + stub)
);
if (plot != null) {
plot.debug(player.getName() + " could not attack " + entityType
@ -242,7 +242,7 @@ public class BukkitEntityUtil {
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVE + "." + stub)) {
plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.template("node", Permission.PERMISSION_ADMIN_PVE + "." + stub)
Template.of("node", Permission.PERMISSION_ADMIN_PVE + "." + stub)
);
if (plot != null) {
plot.debug(player.getName() + " could not attack " + entityType
@ -256,7 +256,7 @@ public class BukkitEntityUtil {
.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVP + "." + stub)) {
plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.template("node", Permission.PERMISSION_ADMIN_PVP + "." + stub)
Template.of("node", Permission.PERMISSION_ADMIN_PVP + "." + stub)
);
plot.debug(player.getName() + " could not attack " + entityType
+ " because pve = false");
@ -270,7 +270,7 @@ public class BukkitEntityUtil {
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVP + "." + stub)) {
plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.template("node", Permission.PERMISSION_ADMIN_PVP + "." + stub)
Template.of("node", Permission.PERMISSION_ADMIN_PVP + "." + stub)
);
return false;
}
@ -287,7 +287,7 @@ public class BukkitEntityUtil {
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVE + "." + stub)) {
plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.template("node", Permission.PERMISSION_ADMIN_PVE + "." + stub)
Template.of("node", Permission.PERMISSION_ADMIN_PVE + "." + stub)
);
if (plot != null) {
plot.debug(player.getName() + " could not attack " + entityType
@ -309,7 +309,7 @@ public class BukkitEntityUtil {
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVE + "." + stub)) {
plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.template("node", Permission.PERMISSION_ADMIN_PVE + "." + stub)
Template.of("node", Permission.PERMISSION_ADMIN_PVE + "." + stub)
);
if (plot != null) {
plot.debug(player.getName() + " could not attack " + entityType

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by
@ -77,6 +77,7 @@ public class BukkitInventoryUtil extends InventoryUtil {
return stack;
}
@SuppressWarnings("deprecation") // Paper deprecation
@Override
public void open(PlotInventory inv) {
BukkitPlayer bp = (BukkitPlayer) inv.getPlayer();
@ -113,6 +114,7 @@ public class BukkitInventoryUtil extends InventoryUtil {
bp.player.updateInventory();
}
@SuppressWarnings("deprecation") // Paper deprecation
public PlotItemStack getItem(ItemStack item) {
if (item == null) {
return null;
@ -145,6 +147,7 @@ public class BukkitInventoryUtil extends InventoryUtil {
.toArray(PlotItemStack[]::new);
}
@SuppressWarnings("deprecation") // #getTitle is needed for Spigot compatibility
@Override
public boolean isOpen(PlotInventory plotInventory) {
if (!plotInventory.isOpen()) {

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by
@ -54,7 +54,6 @@ import io.papermc.lib.PaperLib;
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
import net.kyori.adventure.text.minimessage.MiniMessage;
import net.kyori.adventure.text.minimessage.Template;
import net.kyori.adventure.text.minimessage.template.TemplateResolver;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -370,8 +369,7 @@ public class BukkitUtil extends WorldUtil {
if (blockstate instanceof final Sign sign) {
for (int i = 0; i < lines.length; i++) {
sign.setLine(i, LEGACY_COMPONENT_SERIALIZER
.serialize(MINI_MESSAGE.deserialize(lines[i].getComponent(LocaleHolder.console()),
TemplateResolver.templates(replacements))));
.serialize(MINI_MESSAGE.parse(lines[i].getComponent(LocaleHolder.console()), replacements)));
}
sign.update(true);
}

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* 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();
}
@SuppressWarnings({"deprecation", "DefaultCharset"}) // Suppress Json deprecation, we can't use features from gson 2.8.1 and newer yet
public void updateChecker() {
task = Bukkit.getScheduler().runTaskTimerAsynchronously(this.javaPlugin, () -> {
try {
@ -68,7 +69,7 @@ public class UpdateUtility implements Listener {
"https://api.spigotmc.org/simple/0.1/index.php?action=getResource&id=77506")
.openConnection();
connection.setRequestMethod("GET");
JsonObject result = (new JsonParser())
JsonObject result = new JsonParser()
.parse(new JsonReader(new InputStreamReader(connection.getInputStream())))
.getAsJsonObject();
spigotVersion = result.get("current_version").getAsString();
@ -91,7 +92,7 @@ public class UpdateUtility implements Listener {
notify = false;
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() {

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* 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);
}
@SuppressWarnings("removal") // Just the override
@Override
public void upload(final CompoundTag tag, final UUID uuid, final String file, final RunnableVal<URL> whenDone) {
delegate.upload(tag, uuid, file, whenDone);

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -22,7 +22,7 @@ dependencies {
api(libs.guiceassistedinject) {
exclude("com.google.inject", "guice")
}
compileOnlyApi(libs.findbugs)
api(libs.findbugs)
// Plugins
compileOnly(libs.worldeditCore) {
@ -40,9 +40,7 @@ dependencies {
// Other libraries
api(libs.prtree)
api(libs.aopalliance)
api(libs.rorledning) {
exclude(group = "com.google.guava")
}
api(libs.cloudServices)
api(libs.arkitektonika)
api(libs.paster)
}
@ -50,9 +48,19 @@ dependencies {
tasks.processResources {
filesMatching("plugin.properties") {
expand(
"version" to project.version.toString(),
"commit" to rootProject.grgit.head().abbreviatedId,
"date" to rootProject.grgit.head().dateTime.format(DateTimeFormatter.ofPattern("yy.MM.dd"))
"version" to project.version.toString(),
"commit" to rootProject.grgit.head().abbreviatedId,
"date" to rootProject.grgit.head().dateTime.format(DateTimeFormatter.ofPattern("yy.MM.dd"))
)
}
}
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/")
}
}

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by
@ -25,10 +25,10 @@
*/
package com.plotsquared.core;
import cloud.commandframework.services.ServicePipeline;
import com.google.inject.Injector;
import com.google.inject.Key;
import com.google.inject.TypeLiteral;
import com.intellectualsites.services.ServicePipeline;
import com.plotsquared.core.backup.BackupManager;
import com.plotsquared.core.configuration.caption.LocaleHolder;
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.plot.world.PlotAreaManager;
import com.plotsquared.core.queue.GlobalBlockQueue;
import com.plotsquared.core.util.AnnotationHelper;
import com.plotsquared.core.util.ChunkManager;
import com.plotsquared.core.util.EconHandler;
import com.plotsquared.core.util.PlatformWorldManager;
@ -273,6 +274,7 @@ public interface PlotPlatform<P> extends LocaleHolder {
* Get the {@link PlotAreaManager} implementation.
*
* @return the PlotAreaManager
* @since 6.1.4
*/
@NonNull PlotAreaManager plotAreaManager();
@ -291,6 +293,15 @@ public interface PlotPlatform<P> extends LocaleHolder {
*/
@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
*/

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* 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 version2 Second version
* @return true if `version` is &gt;= `version2`
* @return {@code true} if `version` is &gt;= `version2`
*/
public boolean checkVersion(
final int[] version,
@ -338,10 +338,13 @@ public class PlotSquared {
/**
* 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.
* @see #removePlotArea(PlotArea) To remove the reference
*/
@SuppressWarnings("unchecked")
public void addPlotArea(final @NonNull PlotArea plotArea) {
HashMap<PlotId, Plot> plots;
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
*/
@SuppressWarnings("unchecked")
private void sortPlotsByHash(final @NonNull Plot @NonNull [] input) {
List<Plot>[] bucket = new ArrayList[32];
Arrays.fill(bucket, new ArrayList<>());
@ -696,20 +700,12 @@ public class PlotSquared {
ArrayList<Plot> toReturn = new ArrayList<>(plots.size());
for (PlotArea area : areas) {
switch (type) {
case CREATION_DATE:
toReturn.addAll(sortPlotsByTemp(map.get(area)));
break;
case CREATION_DATE_TIMESTAMP:
toReturn.addAll(sortPlotsByTimestamp(map.get(area)));
break;
case DISTANCE_FROM_ORIGIN:
toReturn.addAll(sortPlotsByHash(map.get(area)));
break;
case LAST_MODIFIED:
toReturn.addAll(sortPlotsByModified(map.get(area)));
break;
default:
break;
case CREATION_DATE -> toReturn.addAll(sortPlotsByTemp(map.get(area)));
case CREATION_DATE_TIMESTAMP -> toReturn.addAll(sortPlotsByTimestamp(map.get(area)));
case DISTANCE_FROM_ORIGIN -> toReturn.addAll(sortPlotsByHash(map.get(area)));
case LAST_MODIFIED -> toReturn.addAll(sortPlotsByModified(map.get(area)));
default -> {
}
}
}
return toReturn;
@ -739,7 +735,7 @@ public class PlotSquared {
*
* @param plot the plot to remove
* @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(
final @NonNull Plot plot,
@ -1482,7 +1478,7 @@ public class PlotSquared {
*
* @param world World name
* @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(
final @NonNull String world,
@ -1527,10 +1523,12 @@ public class PlotSquared {
/**
* Get the caption map belonging to a namespace. If none exists, a dummy
* caption map will be returned.
* <p>
* You can register a caption map by calling {@link #registerCaptionMap(String, CaptionMap)}
* </p>
*
* @param namespace Namespace
* @return Map instance
* @see #registerCaptionMap(String, CaptionMap) To register a caption map
*/
public @NonNull CaptionMap getCaptionMap(final @NonNull String namespace) {
return this.captionMaps.computeIfAbsent(
@ -1540,7 +1538,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.
*
* @param namespace Namespace

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* 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.
*
* @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) {
int dash = versionString.indexOf('-');
@ -144,7 +144,7 @@ public final class PlotVersion {
* Compare a given version with the one cached here.
*
* @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) {
if (verArray[0] > version[0]) {

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* 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
* PlotSquared to create automatic plot backups
*
* @return True if automatic backups are enabled
* @return {@code true} if automatic backups are enabled
*/
boolean shouldAutomaticallyBackup();

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by
@ -107,7 +107,7 @@ public class SimpleBackupManager implements BackupManager {
if (player != null) {
player.sendMessage(
TranslatableCaption.of("backups.backup_automatic_started"),
Template.template("plot", plot.getId().toString())
Template.of("plot", plot.getId().toString())
);
}
profile.createBackup().whenComplete((backup, throwable) -> {

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* 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 static final <T> T[] concatAll(T[] first, T[]... rest) {
@SuppressWarnings("unchecked")
public static <T> T[] concatAll(T[] first, T[]... rest) {
int totalLength = first.length;
for (T[] array : rest) {
totalLength += array.length;

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* 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;
@SuppressWarnings("unchecked")
public FlatRandomCollection(Map<T, Double> weights, Random random) {
super(weights, random);
int max = 0;

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by
@ -241,6 +241,7 @@ public class QuadMap<T> {
return false;
}
@SuppressWarnings("unchecked")
public void recalculateSkip() {
QuadMap<T> map = null;
for (QuadMap<T> current : new QuadMap[]{this.one, this.two, this.three, this.four}) {

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by
@ -77,7 +77,7 @@ public class Add extends Command {
TranslatableCaption.of("permission.no_plot_perms")
);
checkTrue(args.length == 1, TranslatableCaption.of("commandconfig.command_syntax"),
Template.template("value", "/plot add <player | *>")
Template.of("value", "/plot add <player | *>")
);
final CompletableFuture<Boolean> future = new CompletableFuture<>();
PlayerManager.getUUIDsFromString(args[0], (uuids, throwable) -> {
@ -87,7 +87,7 @@ public class Add extends Command {
} else {
player.sendMessage(
TranslatableCaption.of("errors.invalid_player"),
Template.template("value", args[0])
Template.of("value", args[0])
);
}
future.completeExceptionally(throwable);
@ -95,7 +95,7 @@ public class Add extends Command {
} else {
try {
checkTrue(!uuids.isEmpty(), TranslatableCaption.of("errors.invalid_player"),
Template.template("value", args[0])
Template.of("value", args[0])
);
Iterator<UUID> iterator = uuids.iterator();
int size = plot.getTrusted().size() + plot.getMembers().size();
@ -106,7 +106,7 @@ public class Add extends Command {
.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_TRUST))) {
player.sendMessage(
TranslatableCaption.of("errors.invalid_player"),
Template.template("value", PlayerManager.getName(uuid))
Template.of("value", PlayerManager.resolveName(uuid).getComponent(player))
);
iterator.remove();
continue;
@ -114,7 +114,7 @@ public class Add extends Command {
if (plot.isOwner(uuid)) {
player.sendMessage(
TranslatableCaption.of("member.already_added"),
Template.template("player", PlayerManager.getName(uuid))
Template.of("player", PlayerManager.resolveName(uuid).getComponent(player))
);
iterator.remove();
continue;
@ -122,7 +122,7 @@ public class Add extends Command {
if (plot.getMembers().contains(uuid)) {
player.sendMessage(
TranslatableCaption.of("member.already_added"),
Template.template("player", PlayerManager.getName(uuid))
Template.of("player", PlayerManager.resolveName(uuid).getComponent(player))
);
iterator.remove();
continue;
@ -135,7 +135,7 @@ public class Add extends Command {
if (localAddSize >= maxAddSize) {
player.sendMessage(
TranslatableCaption.of("members.plot_max_members_added"),
Template.template("amount", String.valueOf(localAddSize))
Template.of("amount", String.valueOf(localAddSize))
);
return;
}

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by
@ -99,7 +99,7 @@ public class Alias extends SubCommand {
} else {
player.sendMessage(
TranslatableCaption.of("permission.no_permission"),
Template.template("node", String.valueOf(Permission.PERMISSION_ALIAS_SET))
Template.of("node", String.valueOf(Permission.PERMISSION_ALIAS_SET))
);
}
}
@ -115,7 +115,7 @@ public class Alias extends SubCommand {
} else {
player.sendMessage(
TranslatableCaption.of("permission.no_permission"),
Template.template("node", String.valueOf(Permission.PERMISSION_ALIAS_REMOVE))
Template.of("node", String.valueOf(Permission.PERMISSION_ALIAS_REMOVE))
);
}
}
@ -156,13 +156,13 @@ public class Alias extends SubCommand {
.anyMatch()) {
player.sendMessage(
TranslatableCaption.of("alias.alias_is_taken"),
Template.template("alias", alias)
Template.of("alias", alias)
);
return;
}
if (Settings.UUID.OFFLINE) {
plot.setAlias(alias);
player.sendMessage(TranslatableCaption.of("alias.alias_set_to"), Template.template("alias", alias));
player.sendMessage(TranslatableCaption.of("alias.alias_set_to"), Template.of("alias", alias));
return;
}
PlotSquared.get().getImpromptuUUIDPipeline().getSingle(alias, ((uuid, throwable) -> {
@ -171,13 +171,13 @@ public class Alias extends SubCommand {
} else if (uuid != null) {
player.sendMessage(
TranslatableCaption.of("alias.alias_is_taken"),
Template.template("alias", alias)
Template.of("alias", alias)
);
} else {
plot.setAlias(alias);
player.sendMessage(
TranslatableCaption.of("alias.alias_set_to"),
Template.template("alias", alias)
Template.of("alias", alias)
);
}
}));
@ -189,7 +189,7 @@ public class Alias extends SubCommand {
if (!plot.getAlias().isEmpty()) {
player.sendMessage(
TranslatableCaption.of("alias.alias_removed"),
Template.template("alias", alias)
Template.of("alias", alias)
);
} else {
player.sendMessage(

View File

@ -8,7 +8,7 @@
* | |
* |_|
* 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
* it under the terms of the GNU General Public License as published by
@ -76,7 +76,6 @@ import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.regions.Region;
import net.kyori.adventure.text.minimessage.Template;
import net.kyori.adventure.text.minimessage.template.TemplateResolver;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.io.File;
@ -148,14 +147,14 @@ public class Area extends SubCommand {
if (!Permissions.hasPermission(player, Permission.PERMISSION_AREA_CREATE)) {
player.sendMessage(
TranslatableCaption.of("permission.no_permission"),
Template.template("node", String.valueOf(Permission.PERMISSION_AREA_CREATE))
Template.of("node", String.valueOf(Permission.PERMISSION_AREA_CREATE))
);
return false;
}
if (args.length < 2) {
player.sendMessage(
TranslatableCaption.of("single.single_area_needs_name"),
Template.template("command", "/plot area single <name>")
Template.of("command", "/plot area single <name>")
);
return false;
}
@ -286,7 +285,7 @@ public class Area extends SubCommand {
} else {
player.sendMessage(
TranslatableCaption.of("errors.error_create"),
Template.template("world", hybridPlotWorld.getWorldName())
Template.of("world", hybridPlotWorld.getWorldName())
);
}
};
@ -297,7 +296,7 @@ public class Area extends SubCommand {
if (!Permissions.hasPermission(player, Permission.PERMISSION_AREA_CREATE)) {
player.sendMessage(
TranslatableCaption.of("permission.no_permission"),
Template.template("node", String.valueOf(Permission.PERMISSION_AREA_CREATE))
Template.of("node", String.valueOf(Permission.PERMISSION_AREA_CREATE))
);
return false;
}
@ -330,12 +329,12 @@ public class Area extends SubCommand {
);
player.sendMessage(
TranslatableCaption.of("set.set_attribute"),
Template.template("attribute", "area_pos1"),
Template.template("value", location.getX() + "," + location.getZ())
Template.of("attribute", "area_pos1"),
Template.of("value", location.getX() + "," + location.getZ())
);
player.sendMessage(
TranslatableCaption.of("area.set_pos2"),
Template.template("command", "/plot area create pos2")
Template.of("command", "/plot area create pos2")
);
return true;
}
@ -375,7 +374,7 @@ public class Area extends SubCommand {
if (!areas.isEmpty()) {
player.sendMessage(
TranslatableCaption.of("cluster.cluster_intersection"),
Template.template("cluster", areas.iterator().next().toString())
Template.of("cluster", areas.iterator().next().toString())
);
return false;
}
@ -414,7 +413,7 @@ public class Area extends SubCommand {
} else {
player.sendMessage(
TranslatableCaption.of("errors.error_create"),
Template.template("world", area.getWorldName())
Template.of("world", area.getWorldName())
);
}
};
@ -448,7 +447,7 @@ public class Area extends SubCommand {
if (other != null && Objects.equals(pa.getId(), other.getId())) {
player.sendMessage(
TranslatableCaption.of("setup.setup_world_taken"),
Template.template("value", pa.toString())
Template.of("value", pa.toString())
);
return false;
}
@ -463,8 +462,8 @@ public class Area extends SubCommand {
if (pair.length != 2) {
player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax_extended"),
Template.template("value1,", getCommandString()),
Template.template("value2", " create [world[:id]] [<modifier>=<value>]...")
Template.of("value1,", getCommandString()),
Template.of("value2", " create [world[:id]] [<modifier>=<value>]...")
);
return false;
}
@ -500,8 +499,8 @@ public class Area extends SubCommand {
default -> {
player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax_extended"),
Template.template("value1", getCommandString()),
Template.template("value2", " create [world[:id]] [<modifier>=<value>]...")
Template.of("value1", getCommandString()),
Template.of("value2", " create [world[:id]] [<modifier>=<value>]...")
);
return false;
}
@ -511,7 +510,7 @@ public class Area extends SubCommand {
if (this.worldUtil.isWorld(pa.getWorldName())) {
player.sendMessage(
TranslatableCaption.of("setup.setup_world_taken"),
Template.template("value", pa.getWorldName())
Template.of("value", pa.getWorldName())
);
return false;
}
@ -532,7 +531,7 @@ public class Area extends SubCommand {
} else {
player.sendMessage(
TranslatableCaption.of("errors.error_create"),
Template.template("world", pa.getWorldName())
Template.of("world", pa.getWorldName())
);
}
try {
@ -551,12 +550,12 @@ public class Area extends SubCommand {
if (pa.getId() == null) {
player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"),
Template.template("value", getUsage())
Template.of("value", getUsage())
);
player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax_extended"),
Template.template("value1", getCommandString()),
Template.template("value2", " create [world[:id]] [<modifier>=<value>]...")
Template.of("value1", getCommandString()),
Template.of("value2", " create [world[:id]] [<modifier>=<value>]...")
);
return false;
}
@ -573,7 +572,7 @@ public class Area extends SubCommand {
metaData.computeIfAbsent(player.getUUID(), missingUUID -> new HashMap<>()).put("area_create_area", pa);
player.sendMessage(
TranslatableCaption.of("single.get_position"),
Template.template("command", getCommandString())
Template.of("command", getCommandString())
);
break;
}
@ -583,7 +582,7 @@ public class Area extends SubCommand {
if (!Permissions.hasPermission(player, Permission.PERMISSION_AREA_INFO)) {
player.sendMessage(
TranslatableCaption.of("permission.no_permission"),
Template.template("node", String.valueOf(Permission.PERMISSION_AREA_INFO))
Template.of("node", String.valueOf(Permission.PERMISSION_AREA_INFO))
);
return false;
}
@ -594,15 +593,15 @@ public class Area extends SubCommand {
default -> {
player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax_extended"),
Template.template("value1", getCommandString()),
Template.template("value2", " info [area]")
Template.of("value1", getCommandString()),
Template.of("value2", " info [area]")
);
return false;
}
}
if (area == null) {
if (args.length == 2) {
player.sendMessage(TranslatableCaption.of("errors.not_valid_plot_world"), Template.template("value", args[1]));
player.sendMessage(TranslatableCaption.of("errors.not_valid_plot_world"), Template.of("value", args[1]));
} else {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world"));
}
@ -626,19 +625,19 @@ public class Area extends SubCommand {
percent = claimed == 0 ? 0 : 100d * claimed / Integer.MAX_VALUE;
region = "N/A";
}
Template headerTemplate = Template.template(
Template headerTemplate = Template.of(
"header",
TranslatableCaption.of("info.plot_info_header").getComponent(player)
);
Template nameTemplate = Template.template("name", name);
Template typeTemplate = Template.template("type", area.getType().name());
Template terrainTemplate = Template.template("terrain", area.getTerrain().name());
Template usageTemplate = Template.template("usage", String.format("%.2f", percent));
Template claimedTemplate = Template.template("claimed", String.valueOf(claimed));
Template clustersTemplate = Template.template("clusters", String.valueOf(clusters));
Template regionTemplate = Template.template("region", region);
Template generatorTemplate = Template.template("generator", generator);
Template footerTemplate = Template.template(
Template nameTemplate = Template.of("name", name);
Template typeTemplate = Template.of("type", area.getType().name());
Template terrainTemplate = Template.of("terrain", area.getTerrain().name());
Template usageTemplate = Template.of("usage", String.format("%.2f", percent));
Template claimedTemplate = Template.of("claimed", String.valueOf(claimed));
Template clustersTemplate = Template.of("clusters", String.valueOf(clusters));
Template regionTemplate = Template.of("region", region);
Template generatorTemplate = Template.of("generator", generator);
Template footerTemplate = Template.of(
"footer",
TranslatableCaption.of("info.plot_info_footer").getComponent(player)
);
@ -661,7 +660,7 @@ public class Area extends SubCommand {
if (!Permissions.hasPermission(player, Permission.PERMISSION_AREA_LIST)) {
player.sendMessage(
TranslatableCaption.of("permission.no_permission"),
Template.template("node", String.valueOf(Permission.PERMISSION_AREA_LIST))
Template.of("node", String.valueOf(Permission.PERMISSION_AREA_LIST))
);
return false;
}
@ -678,13 +677,13 @@ public class Area extends SubCommand {
default:
player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax_extended"),
Template.template("value1", getCommandString()),
Template.template("value2", " list [#]")
Template.of("value1", getCommandString()),
Template.of("value2", " list [#]")
);
return false;
}
final List<PlotArea> areas = new ArrayList<>(Arrays.asList(this.plotAreaManager.getAllPlotAreas()));
paginate(player, areas, 8, page, new RunnableVal3<>() {
paginate(player, areas, 8, page, new RunnableVal3<Integer, PlotArea, CaptionHolder>() {
@Override
public void run(Integer i, PlotArea area, CaptionHolder caption) {
String name;
@ -705,27 +704,27 @@ public class Area extends SubCommand {
percent = claimed == 0 ? 0 : (double) claimed / Short.MAX_VALUE * Short.MAX_VALUE;
region = "N/A";
}
Template claimedTemplate = Template.template("claimed", String.valueOf(claimed));
Template usageTemplate = Template.template("usage", String.format("%.2f", percent) + "%");
Template clustersTemplate = Template.template("clusters", String.valueOf(clusters));
Template regionTemplate = Template.template("region", region);
Template generatorTemplate = Template.template("generator", generator);
Template claimedTemplate = Template.of("claimed", String.valueOf(claimed));
Template usageTemplate = Template.of("usage", String.format("%.2f", percent) + "%");
Template clustersTemplate = Template.of("clusters", String.valueOf(clusters));
Template regionTemplate = Template.of("region", region);
Template generatorTemplate = Template.of("generator", generator);
String tooltip = MINI_MESSAGE.serialize(MINI_MESSAGE
.deserialize(
.parse(
TranslatableCaption.of("info.area_list_tooltip").getComponent(player),
TemplateResolver.templates(claimedTemplate,
usageTemplate,
clustersTemplate,
regionTemplate,
generatorTemplate)
claimedTemplate,
usageTemplate,
clustersTemplate,
regionTemplate,
generatorTemplate
));
Template tooltipTemplate = Template.template("hover_info", tooltip);
Template visitcmdTemplate = Template.template("command_tp", "/plot area tp " + area);
Template infocmdTemplate = Template.template("command_info", "/plot area info " + area);
Template numberTemplate = Template.template("number", String.valueOf(i));
Template nameTemplate = Template.template("area_name", name);
Template typeTemplate = Template.template("area_type", area.getType().name());
Template terrainTemplate = Template.template("area_terrain", area.getTerrain().name());
Template tooltipTemplate = Template.of("hover_info", tooltip);
Template visitcmdTemplate = Template.of("command_tp", "/plot area tp " + area);
Template infocmdTemplate = Template.of("command_info", "/plot area info " + area);
Template numberTemplate = Template.of("number", String.valueOf(i));
Template nameTemplate = Template.of("area_name", name);
Template typeTemplate = Template.of("area_type", area.getType().name());
Template terrainTemplate = Template.of("area_terrain", area.getTerrain().name());
caption.set(TranslatableCaption.of("info.area_list_item"));
caption.setTemplates(
tooltipTemplate,
@ -744,7 +743,7 @@ public class Area extends SubCommand {
if (!Permissions.hasPermission(player, Permission.PERMISSION_AREA_REGEN)) {
player.sendMessage(
TranslatableCaption.of("permission.no_permission"),
Template.template("node", String.valueOf(Permission.PERMISSION_AREA_REGEN))
Template.of("node", String.valueOf(Permission.PERMISSION_AREA_REGEN))
);
return false;
}
@ -756,7 +755,7 @@ public class Area extends SubCommand {
if (area.getType() != PlotAreaType.PARTIAL) {
player.sendMessage(
TranslatableCaption.of("single.delete_world_region"),
Template.template("world", area.getWorldName())
Template.of("world", area.getWorldName())
);
return false;
}
@ -777,20 +776,20 @@ public class Area extends SubCommand {
if (!Permissions.hasPermission(player, Permission.PERMISSION_AREA_TP)) {
player.sendMessage(
TranslatableCaption.of("permission.no_permission"),
Template.template("node", String.valueOf(Permission.PERMISSION_AREA_TP))
Template.of("node", String.valueOf(Permission.PERMISSION_AREA_TP))
);
return false;
}
if (args.length != 2) {
player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"),
Template.template("value", "/plot area tp [area]")
Template.of("value", "/plot area tp [area]")
);
return false;
}
PlotArea area = this.plotAreaManager.getPlotAreaByString(args[1]);
if (area == null) {
player.sendMessage(TranslatableCaption.of("errors.not_valid_plot_world"), Template.template("value", args[1]));
player.sendMessage(TranslatableCaption.of("errors.not_valid_plot_world"), Template.of("value", args[1]));
return false;
}
Location center;

Some files were not shown because too many files have changed in this diff Show More