Compare commits

..

67 Commits
6.1.3 ... 6.2.2

Author SHA1 Message Date
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
e9c9375e78 build: Release 6.2.0 2021-12-13 13:35:37 +01:00
7c99c8aabf build: Update dependency com.intellectualsites.arkitektonika:Arkitektonika-Client to v2.1.1 (#3365)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-12-13 11:31:15 +01:00
88eb8f88a7 build: Update com.fastasyncworldedit to v1.17-419
Closes #3363
2021-12-13 11:11:00 +01:00
fd118c2c37 build: Update com.sk89q.worldedit to v7.2.8 (#3364)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-12-13 10:42:47 +01:00
858b6b5471 tests: Move to JUnit 5 (#3357) 2021-12-13 10:41:36 +01:00
f086826942 refactor: Address MiniMessage deprecations (#3354)
* refactor: Address MiniMessage deprecations

* refactor: More MiniMessage deprecations

* Move away from our `Templates#of`

* Address comments

* style: Address migration style issues

* docs: Add javadoc link for MiniMessage
2021-12-13 09:48:34 +01:00
9c84dc2bc0 build: Update pipeline version to release build 2021-12-10 11:25:21 +01:00
cba0f3ac1f build: Switch PRTree GAV to our deployment (#3360)
* build: Switch PRTree repository

* build: Use our GAV
2021-12-09 18:30:35 +01:00
b9a130ab00 feat: Add -Post events firing after operational plot events (#3334)
* Create Post* events

* Address license violations

* address review

* standardize post event calls in EventDispatcher

* Add package-info.java

* Add @since-tag to Post* events

* fix licenser issue

Co-authored-by: Alex <mc.cache@web.de>
2021-12-06 19:50:04 +01:00
688056352b build: Update dependency net.kyori:adventure-platform-bukkit to v4.0.1 (#3356)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-12-06 14:33:04 +01:00
2a40f52dea docs: Update issue template to 1.18 2021-12-05 23:29:28 +01:00
3ed369de19 style: Add missing bracket for deny example (#3351) 2021-11-29 20:56:48 +01:00
bec51401a3 build: Update dependency org.junit.jupiter:junit-jupiter to v5.8.2 (#3350)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-11-29 11:25:01 +01:00
109f884b5f build: Update dependency io.papermc:paperlib to v1.0.7 (#3349)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-11-29 11:13:23 +01:00
8f3fa419c4 Fixes #3344, Wrong iterator algorithm in PlotRangeIterator (#3345) 2021-11-23 19:52:23 +00:00
a9f08bc885 build: Update dependencies
Closes #3330
2021-11-15 12:41:52 +01:00
a8923ec729 build: Back to snapshot for development 2021-11-11 23:01:37 +01:00
4eafd043a3 Release 6.1.4 2021-11-11 22:49:46 +01:00
826cc8c835 build: Update Gradle 2021-11-11 22:43:48 +01:00
d1dbf777a4 Don't check/set if a chunk should be saved if it's a world-plot 2021-11-11 17:57:59 +00:00
823e78377b feat: Better deciding of heights to use for generation and schematics (#3300)
* Better deciding of heights to use for generation and schematics
 - If bedrock is disabled, we should still be filling the space with something
 - Use minBuildHeight instead of hardcoding "1" for schematics (it is still 1 by default) to ensure all-encompassing schematics
 - Schematic generation/handling for roads etc. should be accounting for all of wall, road, and plot heights for deciding point of origin
 - Fixes #3269
 - Starts to address #3175

* Also do for HybridPlotManager clear
2021-11-11 17:33:38 +00:00
87a2e81ec3 Don't write biome data to schematics if it's not present 2021-11-10 19:51:14 +00:00
88775334b7 Schematic paths are configurable (#3303) 2021-11-09 10:32:07 +00:00
e126547e97 chore: Update com.fastasyncworldedit to v1.17-390 (#3324)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-11-09 10:00:14 +01:00
c1163cdb2e feat: Split configuration for teleport on claim/auto (#3308)
- Fixes #2953
2021-11-07 22:29:49 +01:00
30d06b7801 build: Reduce consumer dependencies 2021-11-05 11:57:58 +01:00
a5cf7bf2c2 Fix BlockLoc to the requirements for use as a home location
- Add home locations to #fromString
 - Switch to y=Integer#minValue more
 - May help with #3321
2021-11-04 20:47:56 +00:00
3d4d413de8 Minor adjustment to plot home location logic
- Allow "centre" spelling
 - ClassicPlotWorld contains the PLOT_HEIGHT config setting, not HPW
2021-11-02 15:41:16 +00:00
b97e843849 perf: Get rid of Guice overhead when accessing the plot area manager (#3315)
Fixes #3311
Co-authored-by: Jordan <dordsor21@gmail.com>
2021-11-02 13:38:48 +00:00
48c7a3e94e refactor: Use player friendly done message on restricted building (#3309) 2021-11-02 13:32:04 +00:00
7263290bbe fix: Untrusted visit flag not working with untrusted visit permission
Fixes #3317 
Co-authored-by: Alex <mc.cache@web.de>
2021-11-02 13:28:39 +00:00
e99c4e3289 chore: Update dependency org.checkerframework:checker-qual to v3.19.0 (#3320)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-11-01 21:51:53 +01:00
87cb26189f Closes #3313 2021-11-01 14:07:44 +01:00
2dae336a5f chore: Update com.fastasyncworldedit to v1.17-380 (#3312)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-11-01 14:06:47 +01:00
258ed1469b chore: Update dependency net.kyori:adventure-api to v4.9.3 (#3314)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-11-01 14:06:40 +01:00
6f3eabba0e feat: Don't display the default plot title if on a server-plot, unless configured otherwise. (#3305)
- If plot-title flag is set, title will still be displayed.
2021-11-01 11:23:53 +00:00
804228fa6c Allow pitch and yaw to be used in default home location (#3304) 2021-10-29 10:48:35 +01:00
be85708e5a feat: Add border bypass permission (#3302)
* Add border bypass permission
 - Fixes #3297

* Add permission to plots.admin permpack

* Implement messages on leaving/entering border area

* Rename to border.denied and make border msg red

* change too le/ge as tthey are likely to be equal to border when hit.
 - Since we check for being across the border beforehand, it will hopefully not be spammed too much?
 - If it's spammed then either we use meta to set if a player's left the border, or we just remove the come-back-in altogether because it's a little looong
2021-10-28 10:13:36 +02:00
f2368f97df chore: Update com.sk89q.worldedit to v7.2.7 (#3299)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-10-25 11:22:31 +02:00
df87bcb743 build: Back to snapshot for development 2021-10-18 20:30:28 +02:00
75 changed files with 1270 additions and 584 deletions

View File

@ -18,8 +18,6 @@ body:
options: options:
- Paper - Paper
- Spigot - Spigot
- Tuinity
- Purpur
validations: validations:
required: true required: true
@ -29,6 +27,8 @@ body:
description: Which server version version you using? If your server version is not listed, it is not supported. Update to a supported version first. description: Which server version version you using? If your server version is not listed, it is not supported. Update to a supported version first.
multiple: false multiple: false
options: options:
- '1.18.1'
- '1.18'
- '1.17.1' - '1.17.1'
- '1.16.5' - '1.16.5'
- '1.15.2' - '1.15.2'

2
.github/stale.yml vendored
View File

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

View File

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

View File

@ -1,4 +1,4 @@
name: "draft release" name: draft release
on: on:
push: push:
@ -7,8 +7,8 @@ on:
jobs: jobs:
update_release_draft: update_release_draft:
runs-on: "ubuntu-latest" runs-on: ubuntu-latest
steps: steps:
- uses: "release-drafter/release-drafter@v5.15.0" - uses: release-drafter/release-drafter@v5.15.0
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

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

@ -24,7 +24,7 @@ dependencies {
implementation(libs.bstats) implementation(libs.bstats)
// Paper // Paper
compileOnlyApi(libs.paper) compileOnly(libs.paper)
implementation(libs.paperlib) implementation(libs.paperlib)
// Plugins // Plugins
@ -32,7 +32,7 @@ dependencies {
exclude(group = "org.bukkit") exclude(group = "org.bukkit")
exclude(group = "org.spigotmc") exclude(group = "org.spigotmc")
} }
compileOnlyApi(libs.fastasyncworldeditBukkit) { isTransitive = false } compileOnly(libs.fastasyncworldeditBukkit) { isTransitive = false }
testImplementation(libs.fastasyncworldeditBukkit) { isTransitive = false } testImplementation(libs.fastasyncworldeditBukkit) { isTransitive = false }
compileOnly(libs.vault) { compileOnly(libs.vault) {
exclude(group = "org.bukkit") exclude(group = "org.bukkit")
@ -95,9 +95,9 @@ tasks {
withType<Javadoc> { withType<Javadoc> {
val opt = options as StandardJavadocDocletOptions val opt = options as StandardJavadocDocletOptions
opt.links("https://papermc.io/javadocs/paper/1.17/") opt.links("https://papermc.io/javadocs/paper/1.17/")
opt.links("https://docs.enginehub.org/javadoc/com.sk89q.worldedit/worldedit-core/7.2.6/") 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.6/") 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.1/") opt.links("https://jd.adventure.kyori.net/api/4.9.3/")
opt.links("https://google.github.io/guice/api-docs/5.0.1/javadoc/") opt.links("https://google.github.io/guice/api-docs/5.0.1/javadoc/")
opt.links("https://checkerframework.org/api/") opt.links("https://checkerframework.org/api/")
} }

View File

@ -1180,6 +1180,11 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
return this.injector; return this.injector;
} }
@Override
public @NonNull PlotAreaManager plotAreaManager() {
return this.plotAreaManager;
}
@NonNull @NonNull
@Override @Override
public Locale getLocale() { public Locale getLocale() {

View File

@ -318,8 +318,7 @@ public class BlockEventListener implements Listener {
} else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) { } else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.of("done.building_restricted")
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
); );
event.setCancelled(true); event.setCancelled(true);
return; return;
@ -401,8 +400,7 @@ public class BlockEventListener implements Listener {
} else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) { } else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_OTHER)) { if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
plotPlayer.sendMessage( plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.of("done.building_restricted")
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_OTHER))
); );
event.setCancelled(true); event.setCancelled(true);
return; return;

View File

@ -32,6 +32,7 @@ import com.plotsquared.core.location.Location;
import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.plot.world.PlotAreaManager; import com.plotsquared.core.plot.world.PlotAreaManager;
import com.plotsquared.core.plot.world.SinglePlotArea;
import com.plotsquared.core.util.ReflectionUtils.RefClass; import com.plotsquared.core.util.ReflectionUtils.RefClass;
import com.plotsquared.core.util.ReflectionUtils.RefField; import com.plotsquared.core.util.ReflectionUtils.RefField;
import com.plotsquared.core.util.ReflectionUtils.RefMethod; import com.plotsquared.core.util.ReflectionUtils.RefMethod;
@ -295,7 +296,7 @@ public class ChunkListener implements Listener {
Chunk chunk = event.getChunk(); Chunk chunk = event.getChunk();
if (Settings.Chunk_Processor.AUTO_TRIM) { if (Settings.Chunk_Processor.AUTO_TRIM) {
String world = chunk.getWorld().getName(); String world = chunk.getWorld().getName();
if (this.plotAreaManager.hasPlotArea(world)) { if ((!Settings.Enabled_Components.WORLDS || !SinglePlotArea.isSinglePlotWorld(world)) && this.plotAreaManager.hasPlotArea(world)) {
if (unloadChunk(world, chunk, true)) { if (unloadChunk(world, chunk, true)) {
return; return;
} }
@ -365,8 +366,7 @@ public class ChunkListener implements Listener {
} }
private void cleanChunk(final Chunk chunk) { private void cleanChunk(final Chunk chunk) {
TaskManager.index.incrementAndGet(); final int currentIndex = TaskManager.index.incrementAndGet();
final int currentIndex = TaskManager.index.get();
PlotSquaredTask task = TaskManager.runTaskRepeat(() -> { PlotSquaredTask task = TaskManager.runTaskRepeat(() -> {
if (!chunk.isLoaded()) { if (!chunk.isLoaded()) {
Objects.requireNonNull(TaskManager.removeTask(currentIndex)).cancel(); Objects.requireNonNull(TaskManager.removeTask(currentIndex)).cancel();

View File

@ -371,14 +371,14 @@ public class EntityEventListener implements Listener {
if (shooter instanceof Player) { if (shooter instanceof Player) {
PlotPlayer<?> pp = BukkitUtil.adapt((Player) shooter); PlotPlayer<?> pp = BukkitUtil.adapt((Player) shooter);
if (plot == null) { if (plot == null) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_PROJECTILE_UNOWNED)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED)) {
entity.remove(); entity.remove();
event.setCancelled(true); event.setCancelled(true);
} }
return; return;
} }
if (plot.isAdded(pp.getUUID()) || Permissions if (plot.isAdded(pp.getUUID()) || Permissions
.hasPermission(pp, Permission.PERMISSION_PROJECTILE_OTHER)) { .hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_OTHER)) {
return; return;
} }
entity.remove(); entity.remove();

View File

@ -75,8 +75,7 @@ public class EntitySpawnListener implements Listener {
public static void testCreate(final Entity entity) { public static void testCreate(final Entity entity) {
@NonNull World world = entity.getWorld(); @NonNull World world = entity.getWorld();
if (areaName == world.getName()) { if (!world.getName().equals(areaName)) {
} else {
areaName = world.getName(); areaName = world.getName();
hasPlotArea = PlotSquared.get().getPlotAreaManager().hasPlotArea(areaName); hasPlotArea = PlotSquared.get().getPlotAreaManager().hasPlotArea(areaName);
} }

View File

@ -39,11 +39,13 @@ import com.plotsquared.core.command.MainCommand;
import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.location.Location; import com.plotsquared.core.location.Location;
import com.plotsquared.core.permissions.Permission;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.plot.flag.implementations.DoneFlag; import com.plotsquared.core.plot.flag.implementations.DoneFlag;
import com.plotsquared.core.plot.world.PlotAreaManager; import com.plotsquared.core.plot.world.PlotAreaManager;
import com.plotsquared.core.util.Permissions;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.Template;
import org.bukkit.Chunk; import org.bukkit.Chunk;
import org.bukkit.block.Block; import org.bukkit.block.Block;
@ -53,7 +55,6 @@ import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile; import org.bukkit.entity.Projectile;
import org.bukkit.entity.Slime; import org.bukkit.entity.Slime;
import org.bukkit.entity.ThrownPotion;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
@ -321,9 +322,6 @@ public class PaperListener implements Listener {
return; return;
} }
Projectile entity = event.getProjectile(); Projectile entity = event.getProjectile();
if (!(entity instanceof ThrownPotion)) {
return;
}
ProjectileSource shooter = entity.getShooter(); ProjectileSource shooter = entity.getShooter();
if (!(shooter instanceof Player)) { if (!(shooter instanceof Player)) {
return; return;
@ -332,12 +330,37 @@ public class PaperListener implements Listener {
if (!this.plotAreaManager.hasPlotArea(location.getWorldName())) { if (!this.plotAreaManager.hasPlotArea(location.getWorldName())) {
return; return;
} }
PlotPlayer<?> pp = BukkitUtil.adapt((Player) shooter); PlotPlayer<Player> pp = BukkitUtil.adapt((Player) shooter);
Plot plot = location.getOwnedPlot(); Plot plot = location.getOwnedPlot();
if (plot != null && !plot.isAdded(pp.getUUID())) {
if (plot == null) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_ROAD)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_ROAD))
);
entity.remove(); entity.remove();
event.setCancelled(true); event.setCancelled(true);
} }
} else if (!plot.hasOwner()) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED))
);
entity.remove();
event.setCancelled(true);
}
} else if (!plot.isAdded(pp.getUUID())) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_OTHER)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_OTHER))
);
entity.remove();
event.setCancelled(true);
}
}
} }
@EventHandler @EventHandler

View File

@ -127,7 +127,6 @@ import org.bukkit.event.player.PlayerBucketFillEvent;
import org.bukkit.event.player.PlayerChangedWorldEvent; import org.bukkit.event.player.PlayerChangedWorldEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerDropItemEvent; import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerEggThrowEvent;
import org.bukkit.event.player.PlayerEvent; import org.bukkit.event.player.PlayerEvent;
import org.bukkit.event.player.PlayerInteractAtEntityEvent; import org.bukkit.event.player.PlayerInteractAtEntityEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEntityEvent;
@ -418,8 +417,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
.getHomeSynchronous() .getHomeSynchronous()
.equals(BukkitUtil.adaptComplete(to)))) { .equals(BukkitUtil.adaptComplete(to)))) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.of("deny.no_enter"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_ENTRY_DENIED)) Template.of("plot", plot.toString())
); );
event.setCancelled(true); event.setCancelled(true);
} }
@ -552,8 +551,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
ForceFieldListener.handleForcefield(player, pp, now); ForceFieldListener.handleForcefield(player, pp, now);
} else if (!plotEntry(pp, now) && this.tmpTeleport) { } else if (!plotEntry(pp, now) && this.tmpTeleport) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.of("deny.no_enter"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_ENTRY_DENIED)) Template.of("plot", now.toString())
); );
this.tmpTeleport = false; this.tmpTeleport = false;
to.setX(from.getBlockX()); to.setX(from.getBlockX());
@ -564,19 +563,31 @@ public class PlayerEventListener extends PlotListener implements Listener {
return; return;
} }
int border = area.getBorder(); int border = area.getBorder();
int x1;
if (x2 > border && this.tmpTeleport) { if (x2 > border && this.tmpTeleport) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
to.setX(border - 1); to.setX(border - 1);
this.tmpTeleport = false; this.tmpTeleport = false;
player.teleport(event.getTo()); player.teleport(event.getTo());
this.tmpTeleport = true; this.tmpTeleport = true;
pp.sendMessage(TranslatableCaption.of("border.border")); pp.sendMessage(TranslatableCaption.of("border.denied"));
} else {
pp.sendMessage(TranslatableCaption.of("border.bypass.exited"));
} }
if (x2 < -border && this.tmpTeleport) { } else if (x2 < -border && this.tmpTeleport) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
to.setX(-border + 1); to.setX(-border + 1);
this.tmpTeleport = false; this.tmpTeleport = false;
player.teleport(event.getTo()); player.teleport(event.getTo());
this.tmpTeleport = true; this.tmpTeleport = true;
pp.sendMessage(TranslatableCaption.of("border.border")); pp.sendMessage(TranslatableCaption.of("border.denied"));
} else {
pp.sendMessage(TranslatableCaption.of("border.bypass.exited"));
}
} else if (((x1 = MathMan.roundInt(from.getX())) >= border && x2 <= border) || (x1 <= -border && x2 >= -border)) {
if (Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
pp.sendMessage(TranslatableCaption.of("border.bypass.entered"));
}
} }
} }
int z2; int z2;
@ -601,13 +612,13 @@ public class PlayerEventListener extends PlotListener implements Listener {
} }
return; return;
} }
Plot now = area.getPlot(location); Plot plot = area.getPlot(location);
Plot lastPlot; Plot lastPlot;
try (final MetaDataAccess<Plot> lastPlotAccess = try (final MetaDataAccess<Plot> lastPlotAccess =
pp.accessTemporaryMetaData(PlayerMetaDataKeys.TEMPORARY_LAST_PLOT)) { pp.accessTemporaryMetaData(PlayerMetaDataKeys.TEMPORARY_LAST_PLOT)) {
lastPlot = lastPlotAccess.get().orElse(null); lastPlot = lastPlotAccess.get().orElse(null);
} }
if (now == null) { if (plot == null) {
try (final MetaDataAccess<Boolean> kickAccess = try (final MetaDataAccess<Boolean> kickAccess =
pp.accessTemporaryMetaData(PlayerMetaDataKeys.TEMPORARY_KICK)) { pp.accessTemporaryMetaData(PlayerMetaDataKeys.TEMPORARY_KICK)) {
if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport && !kickAccess.get().orElse(false)) { if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport && !kickAccess.get().orElse(false)) {
@ -626,12 +637,12 @@ public class PlayerEventListener extends PlotListener implements Listener {
return; return;
} }
} }
} else if (now.equals(lastPlot)) { } else if (plot.equals(lastPlot)) {
ForceFieldListener.handleForcefield(player, pp, now); ForceFieldListener.handleForcefield(player, pp, plot);
} else if (!plotEntry(pp, now) && this.tmpTeleport) { } else if (!plotEntry(pp, plot) && this.tmpTeleport) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.of("deny.no_enter"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_ENTRY_DENIED)) Template.of("plot", plot.toString())
); );
this.tmpTeleport = false; this.tmpTeleport = false;
player.teleport(from); player.teleport(from);
@ -643,18 +654,31 @@ public class PlayerEventListener extends PlotListener implements Listener {
return; return;
} }
int border = area.getBorder(); int border = area.getBorder();
int z1;
if (z2 > border && this.tmpTeleport) { if (z2 > border && this.tmpTeleport) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
to.setZ(border - 1); to.setZ(border - 1);
this.tmpTeleport = false; this.tmpTeleport = false;
player.teleport(event.getTo()); player.teleport(event.getTo());
this.tmpTeleport = true; this.tmpTeleport = true;
pp.sendMessage(TranslatableCaption.of("border.border")); pp.sendMessage(TranslatableCaption.of("border.denied"));
} else {
pp.sendMessage(TranslatableCaption.of("border.bypass.exited"));
}
} else if (z2 < -border && this.tmpTeleport) { } else if (z2 < -border && this.tmpTeleport) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
to.setZ(-border + 1); to.setZ(-border + 1);
this.tmpTeleport = false; this.tmpTeleport = false;
player.teleport(event.getTo()); player.teleport(event.getTo());
this.tmpTeleport = true; this.tmpTeleport = true;
pp.sendMessage(TranslatableCaption.of("border.border")); pp.sendMessage(TranslatableCaption.of("border.denied"));
} else {
pp.sendMessage(TranslatableCaption.of("border.bypass.exited"));
}
} else if (((z1 = MathMan.roundInt(from.getZ())) >= border && z2 <= border) || (z1 <= -border && z2 >= -border)) {
if (Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
pp.sendMessage(TranslatableCaption.of("border.bypass.entered"));
}
} }
} }
} }
@ -960,8 +984,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) { if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.of("done.building_restricted")
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
); );
e.setCancelled(true); e.setCancelled(true);
return; return;
@ -1215,13 +1238,6 @@ public class PlayerEventListener extends PlotListener implements Listener {
); );
event.setCancelled(true); event.setCancelled(true);
} else if (!plot.isAdded(pp.getUUID())) { } else if (!plot.isAdded(pp.getUUID())) {
List<BlockTypeWrapper> use = plot.getFlag(UseFlag.class);
final BlockType blockType = BukkitAdapter.asBlockType(block.getType());
for (final BlockTypeWrapper blockTypeWrapper : use) {
if (blockTypeWrapper.accepts(blockType)) {
return;
}
}
if (Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) { if (Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
return; return;
} }
@ -1233,8 +1249,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
} else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) { } else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.of("done.building_restricted")
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
); );
event.setCancelled(true); event.setCancelled(true);
} }
@ -1288,14 +1303,6 @@ public class PlayerEventListener extends PlotListener implements Listener {
); );
event.setCancelled(true); event.setCancelled(true);
} else if (!plot.isAdded(plotPlayer.getUUID())) { } else if (!plot.isAdded(plotPlayer.getUUID())) {
List<BlockTypeWrapper> use = plot.getFlag(UseFlag.class);
Block block = event.getBlockClicked();
final BlockType blockType = BukkitAdapter.asBlockType(block.getType());
for (final BlockTypeWrapper blockTypeWrapper : use) {
if (blockTypeWrapper.accepts(blockType)) {
return;
}
}
if (Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_OTHER)) { if (Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
return; return;
} }
@ -1307,8 +1314,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
} else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) { } else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_OTHER)) { if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
plotPlayer.sendMessage( plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.of("done.building_restricted")
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
); );
event.setCancelled(true); event.setCancelled(true);
} }
@ -1588,43 +1594,6 @@ public class PlayerEventListener extends PlotListener implements Listener {
} }
} }
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPlayerEggThrow(PlayerEggThrowEvent event) {
Location location = BukkitUtil.adapt(event.getEgg().getLocation());
PlotArea area = location.getPlotArea();
if (area == null) {
return;
}
Player player = event.getPlayer();
BukkitPlayer plotPlayer = BukkitUtil.adapt(player);
Plot plot = area.getPlot(location);
if (plot == null) {
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PROJECTILE_ROAD)) {
plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_ROAD))
);
event.setHatching(false);
}
} else if (!plot.hasOwner()) {
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED)) {
plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED))
);
event.setHatching(false);
}
} else if (!plot.isAdded(plotPlayer.getUUID())) {
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PROJECTILE_OTHER)) {
plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_OTHER))
);
event.setHatching(false);
}
}
}
@EventHandler @EventHandler
public void onItemDrop(PlayerDropItemEvent event) { public void onItemDrop(PlayerDropItemEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();

View File

@ -28,6 +28,7 @@ package com.plotsquared.bukkit.listener;
import com.google.inject.Inject; import com.google.inject.Inject;
import com.plotsquared.bukkit.util.BukkitEntityUtil; import com.plotsquared.bukkit.util.BukkitEntityUtil;
import com.plotsquared.bukkit.util.BukkitUtil; import com.plotsquared.bukkit.util.BukkitUtil;
import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.location.Location; import com.plotsquared.core.location.Location;
import com.plotsquared.core.permissions.Permission; import com.plotsquared.core.permissions.Permission;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
@ -36,6 +37,7 @@ import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.plot.PlotHandler; import com.plotsquared.core.plot.PlotHandler;
import com.plotsquared.core.plot.world.PlotAreaManager; import com.plotsquared.core.plot.world.PlotAreaManager;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
import net.kyori.adventure.text.minimessage.Template;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -96,9 +98,6 @@ public class ProjectileEventListener implements Listener {
@EventHandler @EventHandler
public void onProjectileLaunch(ProjectileLaunchEvent event) { public void onProjectileLaunch(ProjectileLaunchEvent event) {
Projectile entity = event.getEntity(); Projectile entity = event.getEntity();
if (!(entity instanceof ThrownPotion)) {
return;
}
ProjectileSource shooter = entity.getShooter(); ProjectileSource shooter = entity.getShooter();
if (!(shooter instanceof Player)) { if (!(shooter instanceof Player)) {
return; return;
@ -109,10 +108,35 @@ public class ProjectileEventListener implements Listener {
} }
PlotPlayer<Player> pp = BukkitUtil.adapt((Player) shooter); PlotPlayer<Player> pp = BukkitUtil.adapt((Player) shooter);
Plot plot = location.getOwnedPlot(); Plot plot = location.getOwnedPlot();
if (plot != null && !plot.isAdded(pp.getUUID())) {
if (plot == null) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_ROAD)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_ROAD))
);
entity.remove(); entity.remove();
event.setCancelled(true); event.setCancelled(true);
} }
} else if (!plot.hasOwner()) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED))
);
entity.remove();
event.setCancelled(true);
}
} else if (!plot.isAdded(pp.getUUID())) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_OTHER)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_OTHER))
);
entity.remove();
event.setCancelled(true);
}
}
} }
@EventHandler @EventHandler
@ -131,14 +155,14 @@ public class ProjectileEventListener implements Listener {
if (shooter instanceof Player) { if (shooter instanceof Player) {
PlotPlayer<?> pp = BukkitUtil.adapt((Player) shooter); PlotPlayer<?> pp = BukkitUtil.adapt((Player) shooter);
if (plot == null) { if (plot == null) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_PROJECTILE_UNOWNED)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED)) {
entity.remove(); entity.remove();
event.setCancelled(true); event.setCancelled(true);
} }
return; return;
} }
if (plot.isAdded(pp.getUUID()) || Permissions if (plot.isAdded(pp.getUUID()) || Permissions
.hasPermission(pp, Permission.PERMISSION_PROJECTILE_OTHER)) { .hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_OTHER)) {
return; return;
} }
entity.remove(); entity.remove();

View File

@ -27,6 +27,7 @@ package com.plotsquared.bukkit.listener;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.plot.world.PlotAreaManager; import com.plotsquared.core.plot.world.PlotAreaManager;
import com.plotsquared.core.plot.world.SinglePlotArea;
import com.plotsquared.core.plot.world.SinglePlotAreaManager; import com.plotsquared.core.plot.world.SinglePlotAreaManager;
import com.plotsquared.core.util.ReflectionUtils; import com.plotsquared.core.util.ReflectionUtils;
import org.bukkit.Chunk; import org.bukkit.Chunk;
@ -86,7 +87,7 @@ public class SingleWorldListener implements Listener {
if (!(man instanceof SinglePlotAreaManager)) { if (!(man instanceof SinglePlotAreaManager)) {
return; return;
} }
if (!isPlotId(name)) { if (!SinglePlotArea.isSinglePlotWorld(name)) {
return; return;
} }
@ -103,31 +104,4 @@ public class SingleWorldListener implements Listener {
handle(event); handle(event);
} }
private boolean isPlotId(String worldName) {
int len = worldName.length();
int separator = 0;
for (int i = 0; i < len; i++) {
switch (worldName.charAt(i)) {
case '_':
separator++;
break;
case '-':
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
break;
default:
return false;
}
}
return separator == 1;
}
} }

View File

@ -178,8 +178,7 @@ public class BukkitEntityUtil {
if (!Permissions if (!Permissions
.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_OTHER)) { .hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
plotPlayer.sendMessage( plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.of("done.building_restricted")
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
); );
return false; return false;
} }

View File

@ -248,9 +248,12 @@ permissions:
plots.admin.components.other: true plots.admin.components.other: true
plots.admin.vehicle.break.unowned: true plots.admin.vehicle.break.unowned: true
plots.admin.pve.unowned: true plots.admin.pve.unowned: true
plots.admin.border.bypass: true
plots.teleport.delay.bypass: plots.teleport.delay.bypass:
default: op default: op
plots.admin.border.bypass:
default: op
plots.worldedit.bypass: plots.worldedit.bypass:
default: op default: op
plots.gamemode.bypass: plots.gamemode.bypass:

View File

@ -5,8 +5,8 @@ dependencies {
compileOnlyApi(libs.checkerqual) compileOnlyApi(libs.checkerqual)
// Minecraft expectations // Minecraft expectations
compileOnlyApi(libs.guava)
compileOnlyApi(libs.gson) compileOnlyApi(libs.gson)
compileOnly(libs.guava)
// Platform expectations // Platform expectations
compileOnlyApi(libs.snakeyaml) compileOnlyApi(libs.snakeyaml)
@ -25,13 +25,13 @@ dependencies {
compileOnlyApi(libs.findbugs) compileOnlyApi(libs.findbugs)
// Plugins // Plugins
compileOnlyApi(libs.worldeditCore) { compileOnly(libs.worldeditCore) {
exclude(group = "bukkit-classloader-check") exclude(group = "bukkit-classloader-check")
exclude(group = "mockito-core") exclude(group = "mockito-core")
exclude(group = "dummypermscompat") exclude(group = "dummypermscompat")
} }
testImplementation(libs.worldeditCore) testImplementation(libs.worldeditCore)
compileOnlyApi(libs.fastasyncworldeditCore) { isTransitive = false } compileOnly(libs.fastasyncworldeditCore) { isTransitive = false }
testImplementation(libs.fastasyncworldeditCore) { isTransitive = false } testImplementation(libs.fastasyncworldeditCore) { isTransitive = false }
// Logging // Logging
@ -40,7 +40,7 @@ dependencies {
// Other libraries // Other libraries
api(libs.prtree) api(libs.prtree)
api(libs.aopalliance) api(libs.aopalliance)
api(libs.pipeline) { api(libs.rorledning) {
exclude(group = "com.google.guava") exclude(group = "com.google.guava")
} }
api(libs.arkitektonika) api(libs.arkitektonika)

View File

@ -38,6 +38,7 @@ import com.plotsquared.core.inject.annotations.DefaultGenerator;
import com.plotsquared.core.location.World; import com.plotsquared.core.location.World;
import com.plotsquared.core.permissions.PermissionHandler; import com.plotsquared.core.permissions.PermissionHandler;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.world.PlotAreaManager;
import com.plotsquared.core.queue.GlobalBlockQueue; import com.plotsquared.core.queue.GlobalBlockQueue;
import com.plotsquared.core.util.ChunkManager; import com.plotsquared.core.util.ChunkManager;
import com.plotsquared.core.util.EconHandler; import com.plotsquared.core.util.EconHandler;
@ -268,6 +269,13 @@ public interface PlotPlatform<P> extends LocaleHolder {
return injector().getInstance(ChunkManager.class); return injector().getInstance(ChunkManager.class);
} }
/**
* Get the {@link PlotAreaManager} implementation.
*
* @return the PlotAreaManager
*/
@NonNull PlotAreaManager plotAreaManager();
/** /**
* Get the platform specific console {@link Audience} * Get the platform specific console {@link Audience}
* *

View File

@ -283,7 +283,7 @@ public class PlotSquared {
* @return Plot area manager * @return Plot area manager
*/ */
public @NonNull PlotAreaManager getPlotAreaManager() { public @NonNull PlotAreaManager getPlotAreaManager() {
return this.platform.injector().getInstance(PlotAreaManager.class); return this.platform.plotAreaManager();
} }
public void startExpiryTasks() { public void startExpiryTasks() {
@ -758,6 +758,9 @@ public class PlotSquared {
if (this_max < last_max) { if (this_max < last_max) {
plot.getArea().setMeta("lastPlot", plot.getId()); plot.getArea().setMeta("lastPlot", plot.getId());
} }
if (callEvent) {
eventDispatcher.callPostDelete(plot);
}
return true; return true;
} }
return false; return false;

View File

@ -193,7 +193,15 @@ public class PlayerBackupProfile implements BackupProfile {
future.completeExceptionally(new IllegalArgumentException( future.completeExceptionally(new IllegalArgumentException(
"The backup is non-existent or not in the correct format")); "The backup is non-existent or not in the correct format"));
} else { } else {
this.schematicHandler.paste(schematic, plot, 0, 1, 0, false, player, new RunnableVal<Boolean>() { this.schematicHandler.paste(
schematic,
plot,
0,
plot.getArea().getMinBuildHeight(),
0,
false,
player,
new RunnableVal<>() {
@Override @Override
public void run(Boolean value) { public void run(Boolean value) {
if (value) { if (value) {
@ -205,7 +213,8 @@ public class PlayerBackupProfile implements BackupProfile {
.getComponent(ConsolePlayer.getConsole())))); .getComponent(ConsolePlayer.getConsole()))));
} }
} }
}); }
);
} }
}); });
} }

View File

@ -29,6 +29,7 @@ import com.google.inject.Inject;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.ConfigurationSection; import com.plotsquared.core.configuration.ConfigurationSection;
import com.plotsquared.core.configuration.ConfigurationUtil; import com.plotsquared.core.configuration.ConfigurationUtil;
import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.configuration.caption.CaptionHolder; import com.plotsquared.core.configuration.caption.CaptionHolder;
import com.plotsquared.core.configuration.caption.Templates; import com.plotsquared.core.configuration.caption.Templates;
import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.configuration.caption.TranslatableCaption;
@ -222,7 +223,7 @@ public class Area extends SubCommand {
hybridPlotWorld.setAllowSigns(false); hybridPlotWorld.setAllowSigns(false);
final File parentFile = FileUtils.getFile( final File parentFile = FileUtils.getFile(
PlotSquared.platform().getDirectory(), PlotSquared.platform().getDirectory(),
"schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + hybridPlotWorld.getWorldName() + File.separator Settings.Paths.SCHEMATICS + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + hybridPlotWorld.getWorldName() + File.separator
+ hybridPlotWorld.getId() + hybridPlotWorld.getId()
); );
if (!parentFile.exists() && !parentFile.mkdirs()) { if (!parentFile.exists() && !parentFile.mkdirs()) {

View File

@ -344,6 +344,7 @@ public class Auto extends SubCommand {
continue; continue;
} }
plot.claim(player, !plotIterator.hasNext(), null, true, true); plot.claim(player, !plotIterator.hasNext(), null, true, true);
eventDispatcher.callPostAuto(player, plot);
} }
final PlotAutoMergeEvent mergeEvent = this.eventDispatcher.callAutoMerge( final PlotAutoMergeEvent mergeEvent = this.eventDispatcher.callAutoMerge(
plots.get(0), plots.get(0),

View File

@ -183,11 +183,13 @@ public class Claim extends SubCommand {
); );
} }
} }
if (!Permissions.hasPermission(player, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
int border = area.getBorder(); int border = area.getBorder();
if (border != Integer.MAX_VALUE && plot.getDistanceFromOrigin() > border && !force) { if (border != Integer.MAX_VALUE && plot.getDistanceFromOrigin() > border && !force) {
player.sendMessage(TranslatableCaption.of("border.border")); player.sendMessage(TranslatableCaption.of("border.denied"));
return false; return false;
} }
}
plot.setOwnerAbs(player.getUUID()); plot.setOwnerAbs(player.getUUID());
final String finalSchematic = schematic; final String finalSchematic = schematic;
DBFunc.createPlotSafe(plot, () -> { DBFunc.createPlotSafe(plot, () -> {
@ -206,13 +208,15 @@ public class Claim extends SubCommand {
Template.of("value", "Auto merge on claim") Template.of("value", "Auto merge on claim")
); );
} else { } else {
plot.getPlotModificationManager().autoMerge( if (plot.getPlotModificationManager().autoMerge(
mergeEvent.getDir(), mergeEvent.getDir(),
mergeEvent.getMax(), mergeEvent.getMax(),
player.getUUID(), player.getUUID(),
player, player,
true true
); )) {
eventDispatcher.callPostMerge(player, plot);
}
} }
} }
return null; return null;

View File

@ -130,6 +130,7 @@ public class Delete extends SubCommand {
Template.of("amount", String.valueOf(System.currentTimeMillis() - start)), Template.of("amount", String.valueOf(System.currentTimeMillis() - start)),
Template.of("plot", plot.getId().toString()) Template.of("plot", plot.getId().toString())
); );
eventDispatcher.callPostDelete(plot);
}); });
if (result) { if (result) {
plot.addRunning(); plot.addRunning();

View File

@ -52,7 +52,7 @@ import java.util.concurrent.TimeoutException;
@CommandDeclaration(command = "deny", @CommandDeclaration(command = "deny",
aliases = {"d", "ban"}, aliases = {"d", "ban"},
usage = "/plot deny <player", usage = "/plot deny <player>",
category = CommandCategory.SETTINGS, category = CommandCategory.SETTINGS,
requiredType = RequiredType.PLAYER) requiredType = RequiredType.PLAYER)
public class Deny extends SubCommand { public class Deny extends SubCommand {

View File

@ -149,7 +149,7 @@ public class Load extends SubCommand {
0, 0,
false, false,
player, player,
new RunnableVal<Boolean>() { new RunnableVal<>() {
@Override @Override
public void run(Boolean value) { public void run(Boolean value) {
plot.removeRunning(); plot.removeRunning();

View File

@ -274,7 +274,7 @@ public class MainCommand extends Command {
} }
tp = true; tp = true;
} else { } else {
player.sendMessage(TranslatableCaption.of("border.border")); player.sendMessage(TranslatableCaption.of("border.denied"));
} }
// Trim command // Trim command
args = Arrays.copyOfRange(args, 1, args.length); args = Arrays.copyOfRange(args, 1, args.length);

View File

@ -189,6 +189,7 @@ public class Merge extends SubCommand {
); );
} }
player.sendMessage(TranslatableCaption.of("merge.success_merge")); player.sendMessage(TranslatableCaption.of("merge.success_merge"));
eventDispatcher.callPostMerge(player, plot);
return true; return true;
} }
player.sendMessage(TranslatableCaption.of("merge.no_available_automerge")); player.sendMessage(TranslatableCaption.of("merge.no_available_automerge"));
@ -225,6 +226,7 @@ public class Merge extends SubCommand {
); );
} }
player.sendMessage(TranslatableCaption.of("merge.success_merge")); player.sendMessage(TranslatableCaption.of("merge.success_merge"));
eventDispatcher.callPostMerge(player, plot);
return true; return true;
} }
Plot adjacent = plot.getRelative(direction); Plot adjacent = plot.getRelative(direction);
@ -272,6 +274,7 @@ public class Merge extends SubCommand {
); );
} }
player.sendMessage(TranslatableCaption.of("merge.success_merge")); player.sendMessage(TranslatableCaption.of("merge.success_merge"));
eventDispatcher.callPostMerge(player, plot);
}; };
if (!force && hasConfirmation(player)) { if (!force && hasConfirmation(player)) {
CmdConfirm.addPending(accepter, MINI_MESSAGE.serialize(MINI_MESSAGE CmdConfirm.addPending(accepter, MINI_MESSAGE.serialize(MINI_MESSAGE

View File

@ -44,6 +44,7 @@ import com.plotsquared.core.util.TabCompletions;
import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.task.TaskManager;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.Template;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
@ -76,6 +77,7 @@ public class Owner extends SetCommand {
); );
return false; return false;
} }
@Nullable final UUID oldOwner = plot.getOwnerAbs();
Set<Plot> plots = plot.getConnectedPlots(); Set<Plot> plots = plot.getConnectedPlots();
final Consumer<UUID> uuidConsumer = uuid -> { final Consumer<UUID> uuidConsumer = uuid -> {
@ -124,12 +126,15 @@ public class Owner extends SetCommand {
); );
return; return;
} }
plot.getPlotModificationManager().unlinkPlot(unlinkEvent.isCreateRoad(), unlinkEvent.isCreateRoad()); if (plot.getPlotModificationManager().unlinkPlot(unlinkEvent.isCreateRoad(), unlinkEvent.isCreateRoad())) {
eventDispatcher.callPostUnlink(plot, PlotUnlinkEvent.REASON.NEW_OWNER);
}
Set<Plot> connected = plot.getConnectedPlots(); Set<Plot> connected = plot.getConnectedPlots();
for (Plot current : connected) { for (Plot current : connected) {
current.unclaim(); current.unclaim();
current.getPlotModificationManager().removeSign(); current.getPlotModificationManager().removeSign();
} }
eventDispatcher.callPostOwnerChange(player, plot, oldOwner);
player.sendMessage(TranslatableCaption.of("owner.set_owner")); player.sendMessage(TranslatableCaption.of("owner.set_owner"));
return; return;
} }
@ -178,6 +183,7 @@ public class Owner extends SetCommand {
} }
plot.getPlotModificationManager().setSign(finalName); plot.getPlotModificationManager().setSign(finalName);
player.sendMessage(TranslatableCaption.of("owner.set_owner")); player.sendMessage(TranslatableCaption.of("owner.set_owner"));
eventDispatcher.callPostOwnerChange(player, plot, oldOwner);
if (other != null) { if (other != null) {
other.sendMessage( other.sendMessage(
TranslatableCaption.of("owner.now_owner"), TranslatableCaption.of("owner.now_owner"),

View File

@ -166,7 +166,7 @@ public class SchematicCmd extends SubCommand {
0, 0,
false, false,
player, player,
new RunnableVal<Boolean>() { new RunnableVal<>() {
@Override @Override
public void run(Boolean value) { public void run(Boolean value) {
SchematicCmd.this.running = false; SchematicCmd.this.running = false;

View File

@ -109,6 +109,7 @@ public class Unlink extends SubCommand {
return; return;
} }
player.sendMessage(TranslatableCaption.of("merge.unlink_success")); player.sendMessage(TranslatableCaption.of("merge.unlink_success"));
eventDispatcher.callPostUnlink(plot, PlotUnlinkEvent.REASON.PLAYER_COMMAND);
}; };
if (hasConfirmation(player)) { if (hasConfirmation(player)) {
CmdConfirm.addPending(player, "/plot unlink " + plot.getId(), runnable); CmdConfirm.addPending(player, "/plot unlink " + plot.getId(), runnable);

View File

@ -140,21 +140,16 @@ public class Visit extends Command {
return; return;
} }
} else { } else {
if (!Permissions.hasPermission(player, Permission.PERMISSION_VISIT_OTHER)) { // allow visit, if UntrustedVisit flag is set, or if the player has either the plot.visit.other or
// plot.admin.visit.untrusted permission
if (!plot.getFlag(UntrustedVisitFlag.class) && !Permissions.hasPermission(player, Permission.PERMISSION_VISIT_OTHER)
&& !Permissions.hasPermission(player, Permission.PERMISSION_ADMIN_VISIT_UNTRUSTED)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.of("permission.no_permission"),
Templates.of("node", "plots.visit.other") Templates.of("node", "plots.visit.other")
); );
return; return;
} }
if (!plot.getFlag(UntrustedVisitFlag.class) && !Permissions
.hasPermission(player, Permission.PERMISSION_ADMIN_VISIT_UNTRUSTED)) {
player.sendMessage(
TranslatableCaption.of("permission.no_permission"),
Templates.of("node", "plots.admin.visit.untrusted")
);
return;
}
if (plot.isDenied(player.getUUID())) { if (plot.isDenied(player.getUUID())) {
if (!Permissions.hasPermission(player, Permission.PERMISSION_VISIT_DENIED)) { if (!Permissions.hasPermission(player, Permission.PERMISSION_VISIT_DENIED)) {
player.sendMessage( player.sendMessage(

View File

@ -556,8 +556,10 @@ public class Settings extends Config {
public static boolean ON_DEATH = false; public static boolean ON_DEATH = false;
@Comment("Teleport to your plot on login") @Comment("Teleport to your plot on login")
public static boolean ON_LOGIN = false; public static boolean ON_LOGIN = false;
@Comment("Teleport to your plot on claim") @Comment("Teleport to your plot on claim (/plot claim)")
public static boolean ON_CLAIM = true; public static boolean ON_CLAIM = true;
@Comment("Teleport to your plot on auto (/plot auto)")
public static boolean ON_AUTO = true;
@Comment({"Add a delay to all teleport commands (in seconds)", @Comment({"Add a delay to all teleport commands (in seconds)",
"Assign `plots.teleport.delay.bypass` to bypass the cooldown"}) "Assign `plots.teleport.delay.bypass` to bypass the cooldown"})
public static int DELAY = 0; public static int DELAY = 0;
@ -708,6 +710,9 @@ public class Settings extends Config {
"If you would like to still show the owner of the plot, append the contents of \"titles.title_entered_plot_sub\" onto the " + "If you would like to still show the owner of the plot, append the contents of \"titles.title_entered_plot_sub\" onto the " +
"former lang key."}) "former lang key."})
public static boolean TITLES_AS_ACTIONBAR = false; public static boolean TITLES_AS_ACTIONBAR = false;
@Comment({"If the default title should be displayed on plots with server-plot flag set.",
"Titles will still be sent if the plot-title flag is set."})
public static boolean DISPLAY_DEFAULT_ON_SERVER_PLOT = false;
} }

View File

@ -2099,6 +2099,7 @@ public class SQLManager implements AbstractDB {
case "default": case "default":
case "0,0,0": case "0,0,0":
case "center": case "center":
case "centre":
break; break;
default: default:
try { try {
@ -2946,6 +2947,7 @@ public class SQLManager implements AbstractDB {
case "default": case "default":
case "0,0,0": case "0,0,0":
case "center": case "center":
case "centre":
break; break;
default: default:
try { try {

View File

@ -0,0 +1,51 @@
/*
* _____ _ _ _____ _
* | __ \| | | | / ____| | |
* | |__) | | ___ | |_| (___ __ _ _ _ __ _ _ __ ___ __| |
* | ___/| |/ _ \| __|\___ \ / _` | | | |/ _` | '__/ _ \/ _` |
* | | | | (_) | |_ ____) | (_| | |_| | (_| | | | __/ (_| |
* |_| |_|\___/ \__|_____/ \__, |\__,_|\__,_|_| \___|\__,_|
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2021 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.plotsquared.core.events.post;
import com.plotsquared.core.events.PlotPlayerEvent;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
/**
* Called after a plot was chosen for a player by {@code /plot auto}
* <br>
* Called after {@link com.plotsquared.core.events.PlayerAutoPlotEvent} and only, if no listener cancelled the action.
*
* @since 6.2.0
*/
public class PostPlayerAutoPlotEvent extends PlotPlayerEvent {
/**
* Instantiate a new PlayerAutoPlotPostEvent.
*
* @param plotPlayer The player who claims a new plot by {@code /plot auto}.
* @param plot The plot that is assigned to the player.
*/
public PostPlayerAutoPlotEvent(final PlotPlayer<?> plotPlayer, final Plot plot) {
super(plotPlayer, plot);
}
}

View File

@ -0,0 +1,80 @@
/*
* _____ _ _ _____ _
* | __ \| | | | / ____| | |
* | |__) | | ___ | |_| (___ __ _ _ _ __ _ _ __ ___ __| |
* | ___/| |/ _ \| __|\___ \ / _` | | | |/ _` | '__/ _ \/ _` |
* | | | | (_) | |_ ____) | (_| | |_| | (_| | | | __/ (_| |
* |_| |_|\___/ \__|_____/ \__, |\__,_|\__,_|_| \___|\__,_|
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2021 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.plotsquared.core.events.post;
import com.plotsquared.core.events.PlotPlayerEvent;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.UUID;
/**
* Called after the owner of a plot was updated.
*
* @since 6.2.0
*/
public class PostPlotChangeOwnerEvent extends PlotPlayerEvent {
@Nullable
private final UUID oldOwner;
/**
* Instantiate a new PlotChangedOwnerEvent.
*
* @param initiator The player who executed the owner change.
* @param plot The plot which owner was changed.
* @param oldOwner The previous owner - if present, otherwise {@code null}.
*/
public PostPlotChangeOwnerEvent(final PlotPlayer<?> initiator, final Plot plot, @Nullable UUID oldOwner) {
super(initiator, plot);
this.oldOwner = oldOwner;
}
/**
* @return the old owner of the plot - if present, otherwise {@code null}.
*/
public @Nullable UUID getOldOwner() {
return oldOwner;
}
/**
* @return {@code true} if the plot had an owner, {@code false} otherwise.
* @see #getOldOwner()
*/
public boolean hasOldOwner() {
return getOldOwner() != null;
}
/**
* @return {@code true} if the plot now has an owner, {@code false} otherwise.
* @see Plot#hasOwner()
*/
public boolean hasNewOwner() {
return getPlot().hasOwner();
}
}

View File

@ -0,0 +1,47 @@
/*
* _____ _ _ _____ _
* | __ \| | | | / ____| | |
* | |__) | | ___ | |_| (___ __ _ _ _ __ _ _ __ ___ __| |
* | ___/| |/ _ \| __|\___ \ / _` | | | |/ _` | '__/ _ \/ _` |
* | | | | (_) | |_ ____) | (_| | |_| | (_| | | | __/ (_| |
* |_| |_|\___/ \__|_____/ \__, |\__,_|\__,_|_| \___|\__,_|
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2021 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.plotsquared.core.events.post;
import com.plotsquared.core.events.PlotEvent;
import com.plotsquared.core.plot.Plot;
/**
* Called after a {@link Plot} was deleted.
*
* @since 6.2.0
*/
public class PostPlotDeleteEvent extends PlotEvent {
/**
* Instantiate a new PlotDeleteEvent.
*
* @param plot The plot which was deleted.
*/
public PostPlotDeleteEvent(final Plot plot) {
super(plot);
}
}

View File

@ -0,0 +1,49 @@
/*
* _____ _ _ _____ _
* | __ \| | | | / ____| | |
* | |__) | | ___ | |_| (___ __ _ _ _ __ _ _ __ ___ __| |
* | ___/| |/ _ \| __|\___ \ / _` | | | |/ _` | '__/ _ \/ _` |
* | | | | (_) | |_ ____) | (_| | |_| | (_| | | | __/ (_| |
* |_| |_|\___/ \__|_____/ \__, |\__,_|\__,_|_| \___|\__,_|
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2021 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.plotsquared.core.events.post;
import com.plotsquared.core.events.PlotPlayerEvent;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
/**
* Called after multiple plots were merged with another.
*
* @since 6.2.0
*/
public class PostPlotMergeEvent extends PlotPlayerEvent {
/**
* Instantiate a new PlotMergedEvent.
*
* @param plotPlayer The {@link PlotPlayer} that initiated the merge.
* @param plot The final merged plot.
*/
public PostPlotMergeEvent(final PlotPlayer<?> plotPlayer, final Plot plot) {
super(plotPlayer, plot);
}
}

View File

@ -0,0 +1,61 @@
/*
* _____ _ _ _____ _
* | __ \| | | | / ____| | |
* | |__) | | ___ | |_| (___ __ _ _ _ __ _ _ __ ___ __| |
* | ___/| |/ _ \| __|\___ \ / _` | | | |/ _` | '__/ _ \/ _` |
* | | | | (_) | |_ ____) | (_| | |_| | (_| | | | __/ (_| |
* |_| |_|\___/ \__|_____/ \__, |\__,_|\__,_|_| \___|\__,_|
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2021 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.plotsquared.core.events.post;
import com.plotsquared.core.events.PlotEvent;
import com.plotsquared.core.events.PlotUnlinkEvent;
import com.plotsquared.core.plot.Plot;
/**
* Called when several plots were unlinked.
*
* @since 6.2.0
*/
public class PostPlotUnlinkEvent extends PlotEvent {
private final PlotUnlinkEvent.REASON reason;
/**
* Instantiate a new PlotUnlinkedEvent.
*
* @param plot The unlinked plot.
* @param reason The reason for the unlink.
*/
public PostPlotUnlinkEvent(final Plot plot, PlotUnlinkEvent.REASON reason) {
super(plot);
this.reason = reason;
}
/**
* The original reason provided by {@link PlotUnlinkEvent}.
*
* @return The reason for the unlink.
*/
public PlotUnlinkEvent.REASON getReason() {
return reason;
}
}

View File

@ -0,0 +1,33 @@
/*
* _____ _ _ _____ _
* | __ \| | | | / ____| | |
* | |__) | | ___ | |_| (___ __ _ _ _ __ _ _ __ ___ __| |
* | ___/| |/ _ \| __|\___ \ / _` | | | |/ _` | '__/ _ \/ _` |
* | | | | (_) | |_ ____) | (_| | |_| | (_| | | | __/ (_| |
* |_| |_|\___/ \__|_____/ \__, |\__,_|\__,_|_| \___|\__,_|
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2021 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* Contains events which are fired after specific actions are completed.
* <br>
* E.g. {@link com.plotsquared.core.events.PlotDeleteEvent} is called <b>before</b> a plot is actually deleted and useful for
* cancelling the action itself. {@link com.plotsquared.core.events.post.PostPlotDeleteEvent} will be called after the plot was
* deleted.
*/
package com.plotsquared.core.events.post;

View File

@ -506,21 +506,37 @@ public class ClassicPlotManager extends SquarePlotManager {
Location.at( Location.at(
classicPlotWorld.getWorldName(), classicPlotWorld.getWorldName(),
sx, sx,
Math.min(classicPlotWorld.WALL_HEIGHT, classicPlotWorld.ROAD_HEIGHT) + 1, Math.min(
classicPlotWorld.PLOT_HEIGHT,
Math.min(classicPlotWorld.WALL_HEIGHT, classicPlotWorld.ROAD_HEIGHT)
) + 1,
sz + 1 sz + 1
), ),
Location.at(classicPlotWorld.getWorldName(), ex, maxY, ez - 1), BlockTypes.AIR.getDefaultState() Location.at(classicPlotWorld.getWorldName(), ex, maxY, ez - 1), BlockTypes.AIR.getDefaultState()
); );
if (classicPlotWorld.PLOT_BEDROCK) {
queue.setCuboid( queue.setCuboid(
Location.at(classicPlotWorld.getWorldName(), sx, 0, sz + 1), Location.at(classicPlotWorld.getWorldName(), sx, 0, sz + 1),
Location.at(classicPlotWorld.getWorldName(), ex, 0, ez - 1), Location.at(classicPlotWorld.getWorldName(), ex, 0, ez - 1),
BlockUtil.get((short) 7, (byte) 0) BlockTypes.BEDROCK.getDefaultState()
); );
queue.setCuboid( queue.setCuboid(
Location.at(classicPlotWorld.getWorldName(), sx, 1, sz + 1), Location.at(classicPlotWorld.getWorldName(), sx, 1, sz + 1),
Location.at(classicPlotWorld.getWorldName(), sx, classicPlotWorld.WALL_HEIGHT, ez - 1), Location.at(classicPlotWorld.getWorldName(), sx, classicPlotWorld.WALL_HEIGHT, ez - 1),
classicPlotWorld.WALL_FILLING.toPattern() classicPlotWorld.WALL_FILLING.toPattern()
); );
} else {
queue.setCuboid(
Location.at(classicPlotWorld.getWorldName(), sx, 0, sz + 1),
Location.at(classicPlotWorld.getWorldName(), sx, classicPlotWorld.WALL_HEIGHT, ez - 1),
classicPlotWorld.WALL_FILLING.toPattern()
);
}
queue.setCuboid(
Location.at(classicPlotWorld.getWorldName(), sx, 1, sz + 1),
Location.at(classicPlotWorld.getWorldName(), sx, classicPlotWorld.WALL_HEIGHT, ez - 1),
classicPlotWorld.WALL_FILLING.toPattern()
);
if (classicPlotWorld.PLACE_TOP_BLOCK) { if (classicPlotWorld.PLACE_TOP_BLOCK) {
queue.setCuboid( queue.setCuboid(
@ -568,7 +584,10 @@ public class ClassicPlotManager extends SquarePlotManager {
Location.at( Location.at(
classicPlotWorld.getWorldName(), classicPlotWorld.getWorldName(),
sx + 1, sx + 1,
Math.min(classicPlotWorld.WALL_HEIGHT, classicPlotWorld.ROAD_HEIGHT) + 1, Math.min(
classicPlotWorld.PLOT_HEIGHT,
Math.min(classicPlotWorld.WALL_HEIGHT, classicPlotWorld.ROAD_HEIGHT)
) + 1,
sz sz
), ),
Location.at(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.getPlotManager().getWorldHeight(), ez), Location.at(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.getPlotManager().getWorldHeight(), ez),
@ -663,7 +682,10 @@ public class ClassicPlotManager extends SquarePlotManager {
Location.at( Location.at(
classicPlotWorld.getWorldName(), classicPlotWorld.getWorldName(),
sx, sx,
Math.min(classicPlotWorld.PLOT_HEIGHT, classicPlotWorld.ROAD_HEIGHT) + 1, Math.min(
classicPlotWorld.PLOT_HEIGHT,
Math.min(classicPlotWorld.WALL_HEIGHT, classicPlotWorld.ROAD_HEIGHT)
) + 1,
sz sz
), ),
Location.at(classicPlotWorld.getWorldName(), ex, classicPlotWorld.getPlotManager().getWorldHeight(), ez), Location.at(classicPlotWorld.getWorldName(), ex, classicPlotWorld.getPlotManager().getWorldHeight(), ez),
@ -703,7 +725,10 @@ public class ClassicPlotManager extends SquarePlotManager {
Location.at( Location.at(
classicPlotWorld.getWorldName(), classicPlotWorld.getWorldName(),
sx, sx,
Math.min(classicPlotWorld.PLOT_HEIGHT, classicPlotWorld.ROAD_HEIGHT) + 1, Math.min(
classicPlotWorld.PLOT_HEIGHT,
Math.min(classicPlotWorld.WALL_HEIGHT, classicPlotWorld.ROAD_HEIGHT)
) + 1,
sz sz
), ),
Location.at(classicPlotWorld.getWorldName(), ex, classicPlotWorld.getPlotManager().getWorldHeight(), ez), Location.at(classicPlotWorld.getWorldName(), ex, classicPlotWorld.getPlotManager().getWorldHeight(), ez),
@ -742,7 +767,10 @@ public class ClassicPlotManager extends SquarePlotManager {
Location.at( Location.at(
classicPlotWorld.getWorldName(), classicPlotWorld.getWorldName(),
sx, sx,
Math.min(classicPlotWorld.PLOT_HEIGHT, classicPlotWorld.ROAD_HEIGHT) + 1, Math.min(
classicPlotWorld.PLOT_HEIGHT,
Math.min(classicPlotWorld.WALL_HEIGHT, classicPlotWorld.ROAD_HEIGHT)
) + 1,
sz sz
), ),
Location.at(classicPlotWorld.getWorldName(), ex, classicPlotWorld.getPlotManager().getWorldHeight(), ez), Location.at(classicPlotWorld.getWorldName(), ex, classicPlotWorld.getPlotManager().getWorldHeight(), ez),

View File

@ -63,7 +63,7 @@ public class HybridGen extends IndependentPlotGenerator {
&& Settings.Schematics.PASTE_ON_TOP)) { && Settings.Schematics.PASTE_ON_TOP)) {
minY = world.SCHEM_Y; minY = world.SCHEM_Y;
} else { } else {
minY = 1; minY = world.getMinBuildHeight();
} }
BaseBlock[] blocks = world.G_SCH.get(MathMan.pair(relativeX, relativeZ)); BaseBlock[] blocks = world.G_SCH.get(MathMan.pair(relativeX, relativeZ));
if (blocks != null) { if (blocks != null) {
@ -156,11 +156,12 @@ public class HybridGen extends IndependentPlotGenerator {
} }
} }
// generation // generation
int startY = hybridPlotWorld.PLOT_BEDROCK ? 1 : 0;
for (short x = 0; x < 16; x++) { for (short x = 0; x < 16; x++) {
if (insideRoadX[x]) { if (insideRoadX[x]) {
for (short z = 0; z < 16; z++) { for (short z = 0; z < 16; z++) {
// Road // Road
for (int y = 1; y <= hybridPlotWorld.ROAD_HEIGHT; y++) { for (int y = startY; y <= hybridPlotWorld.ROAD_HEIGHT; y++) {
result.setBlock(x, y, z, hybridPlotWorld.ROAD_BLOCK.toPattern()); result.setBlock(x, y, z, hybridPlotWorld.ROAD_BLOCK.toPattern());
} }
if (hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) { if (hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) {
@ -171,7 +172,7 @@ public class HybridGen extends IndependentPlotGenerator {
for (short z = 0; z < 16; z++) { for (short z = 0; z < 16; z++) {
if (insideRoadZ[z]) { if (insideRoadZ[z]) {
// road // road
for (int y = 1; y <= hybridPlotWorld.ROAD_HEIGHT; y++) { for (int y = startY; y <= hybridPlotWorld.ROAD_HEIGHT; y++) {
result.setBlock(x, y, z, hybridPlotWorld.ROAD_BLOCK.toPattern()); result.setBlock(x, y, z, hybridPlotWorld.ROAD_BLOCK.toPattern());
} }
if (hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) { if (hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) {
@ -181,7 +182,7 @@ public class HybridGen extends IndependentPlotGenerator {
} }
} else { } else {
// wall // wall
for (int y = 1; y <= hybridPlotWorld.WALL_HEIGHT; y++) { for (int y = startY; y <= hybridPlotWorld.WALL_HEIGHT; y++) {
result.setBlock(x, y, z, hybridPlotWorld.WALL_FILLING.toPattern()); result.setBlock(x, y, z, hybridPlotWorld.WALL_FILLING.toPattern());
} }
if (!hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) { if (!hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) {
@ -201,7 +202,7 @@ public class HybridGen extends IndependentPlotGenerator {
for (short z = 0; z < 16; z++) { for (short z = 0; z < 16; z++) {
if (insideRoadZ[z]) { if (insideRoadZ[z]) {
// road // road
for (int y = 1; y <= hybridPlotWorld.ROAD_HEIGHT; y++) { for (int y = startY; y <= hybridPlotWorld.ROAD_HEIGHT; y++) {
result.setBlock(x, y, z, hybridPlotWorld.ROAD_BLOCK.toPattern()); result.setBlock(x, y, z, hybridPlotWorld.ROAD_BLOCK.toPattern());
} }
if (hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) { if (hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) {
@ -211,7 +212,7 @@ public class HybridGen extends IndependentPlotGenerator {
} }
} else if (insideWallZ[z]) { } else if (insideWallZ[z]) {
// wall // wall
for (int y = 1; y <= hybridPlotWorld.WALL_HEIGHT; y++) { for (int y = startY; y <= hybridPlotWorld.WALL_HEIGHT; y++) {
result.setBlock(x, y, z, hybridPlotWorld.WALL_FILLING.toPattern()); result.setBlock(x, y, z, hybridPlotWorld.WALL_FILLING.toPattern());
} }
if (!hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) { if (!hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) {
@ -227,7 +228,7 @@ public class HybridGen extends IndependentPlotGenerator {
} }
} else { } else {
// plot // plot
for (int y = 1; y < hybridPlotWorld.PLOT_HEIGHT; y++) { for (int y = startY; y < hybridPlotWorld.PLOT_HEIGHT; y++) {
result.setBlock(x, y, z, hybridPlotWorld.MAIN_BLOCK.toPattern()); result.setBlock(x, y, z, hybridPlotWorld.MAIN_BLOCK.toPattern());
} }
result.setBlock(x, hybridPlotWorld.PLOT_HEIGHT, z, result.setBlock(x, hybridPlotWorld.PLOT_HEIGHT, z,

View File

@ -82,10 +82,12 @@ public class HybridPlotManager extends ClassicPlotManager {
Settings.Paths.TEMPLATES + "/tmp-data.yml", Settings.Paths.TEMPLATES + "/tmp-data.yml",
Template.getBytes(hybridPlotWorld) Template.getBytes(hybridPlotWorld)
)); ));
String dir = "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + hybridPlotWorld.getWorldName() + File.separator; String dir =
Settings.Paths.SCHEMATICS + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + hybridPlotWorld.getWorldName() + File.separator;
try { try {
File sideRoad = FileUtils.getFile(PlotSquared.platform().getDirectory(), dir + "sideroad.schem"); File sideRoad = FileUtils.getFile(PlotSquared.platform().getDirectory(), dir + "sideroad.schem");
String newDir = "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + "__TEMP_DIR__" + File.separator; String newDir =
Settings.Paths.SCHEMATICS + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + "__TEMP_DIR__" + File.separator;
if (sideRoad.exists()) { if (sideRoad.exists()) {
files.add(new FileBytes(newDir + "sideroad.schem", Files.readAllBytes(sideRoad.toPath()))); files.add(new FileBytes(newDir + "sideroad.schem", Files.readAllBytes(sideRoad.toPath())));
} }
@ -152,7 +154,7 @@ public class HybridPlotManager extends ClassicPlotManager {
if ((isRoad && Settings.Schematics.PASTE_ROAD_ON_TOP) || (!isRoad && Settings.Schematics.PASTE_ON_TOP)) { if ((isRoad && Settings.Schematics.PASTE_ROAD_ON_TOP) || (!isRoad && Settings.Schematics.PASTE_ON_TOP)) {
minY = hybridPlotWorld.SCHEM_Y; minY = hybridPlotWorld.SCHEM_Y;
} else { } else {
minY = 1; minY = hybridPlotWorld.getMinBuildHeight();
} }
BaseBlock airBlock = BlockTypes.AIR.getDefaultState().toBaseBlock(); BaseBlock airBlock = BlockTypes.AIR.getDefaultState().toBaseBlock();
for (int x = pos1.getX(); x <= pos2.getX(); x++) { for (int x = pos1.getX(); x <= pos2.getX(); x++) {
@ -249,12 +251,11 @@ public class HybridPlotManager extends ClassicPlotManager {
final Pattern plotfloor = hybridPlotWorld.TOP_BLOCK.toPattern(); final Pattern plotfloor = hybridPlotWorld.TOP_BLOCK.toPattern();
final Pattern filling = hybridPlotWorld.MAIN_BLOCK.toPattern(); final Pattern filling = hybridPlotWorld.MAIN_BLOCK.toPattern();
final BlockState bedrock; final Pattern bedrock;
final BlockState air = BlockTypes.AIR.getDefaultState();
if (hybridPlotWorld.PLOT_BEDROCK) { if (hybridPlotWorld.PLOT_BEDROCK) {
bedrock = BlockTypes.BEDROCK.getDefaultState(); bedrock = BlockTypes.BEDROCK.getDefaultState();
} else { } else {
bedrock = air; bedrock = hybridPlotWorld.MAIN_BLOCK.toPattern();
} }
final BiomeType biome = hybridPlotWorld.getPlotBiome(); final BiomeType biome = hybridPlotWorld.getPlotBiome();
@ -274,7 +275,7 @@ public class HybridPlotManager extends ClassicPlotManager {
// Each component has a different layer // Each component has a different layer
queue.setCuboid(pos1.withY(1), pos2.withY(hybridPlotWorld.PLOT_HEIGHT - 1), filling); queue.setCuboid(pos1.withY(1), pos2.withY(hybridPlotWorld.PLOT_HEIGHT - 1), filling);
queue.setCuboid(pos1.withY(hybridPlotWorld.PLOT_HEIGHT), pos2.withY(hybridPlotWorld.PLOT_HEIGHT), plotfloor); queue.setCuboid(pos1.withY(hybridPlotWorld.PLOT_HEIGHT), pos2.withY(hybridPlotWorld.PLOT_HEIGHT), plotfloor);
queue.setCuboid(pos1.withY(hybridPlotWorld.PLOT_HEIGHT + 1), pos2.withY(getWorldHeight()), air); queue.setCuboid(pos1.withY(hybridPlotWorld.PLOT_HEIGHT + 1), pos2.withY(getWorldHeight()), BlockTypes.AIR.getDefaultState());
queue.setBiomeCuboid(pos1, pos2, biome); queue.setBiomeCuboid(pos1, pos2, biome);
} else { } else {
queue.setRegenRegion(new CuboidRegion(pos1.getBlockVector3(), pos2.getBlockVector3())); queue.setRegenRegion(new CuboidRegion(pos1.getBlockVector3(), pos2.getBlockVector3()));

View File

@ -253,22 +253,32 @@ public class HybridPlotWorld extends ClassicPlotWorld {
int shift = this.ROAD_WIDTH / 2; int shift = this.ROAD_WIDTH / 2;
int oddshift = (this.ROAD_WIDTH & 1) == 0 ? 0 : 1; int oddshift = (this.ROAD_WIDTH & 1) == 0 ? 0 : 1;
SCHEM_Y = Math.min(PLOT_HEIGHT, ROAD_HEIGHT); SCHEM_Y = Math.min(PLOT_HEIGHT, Math.min(WALL_HEIGHT, ROAD_HEIGHT));
int plotY = PLOT_HEIGHT - SCHEM_Y; int plotY = PLOT_HEIGHT - SCHEM_Y;
int roadY = ROAD_HEIGHT - SCHEM_Y; int roadY = Math.min(ROAD_HEIGHT, WALL_HEIGHT) - SCHEM_Y;
if (schematic3 != null && schematic3.getClipboard().getDimensions().getY() == 256) { if (schematic3 != null) {
SCHEM_Y = 0; if (schematic3.getClipboard().getDimensions().getY() == 256) {
plotY = 0; SCHEM_Y = plotY = 0;
roadY = ROAD_HEIGHT; } else if (!Settings.Schematics.PASTE_ON_TOP) {
SCHEM_Y = plotY = getMinBuildHeight();
}
} }
if (schematic1 != null && schematic1.getClipboard().getDimensions().getY() == 256) { if (schematic1 != null) {
SCHEM_Y = 0; if (schematic1.getClipboard().getDimensions().getY() == 256) {
if (schematic3 != null && schematic3.getClipboard().getDimensions().getY() != 256) { SCHEM_Y = roadY = 0;
if (schematic3 != null && schematic3.getClipboard().getDimensions().getY() != 256
&& !Settings.Schematics.PASTE_ON_TOP) {
plotY = PLOT_HEIGHT; plotY = PLOT_HEIGHT;
} }
roadY = 0; } else if (!Settings.Schematics.PASTE_ROAD_ON_TOP) {
SCHEM_Y = roadY = getMinBuildHeight();
if (schematic3 != null && schematic3.getClipboard().getDimensions().getY() != 256
&& !Settings.Schematics.PASTE_ON_TOP) {
plotY = PLOT_HEIGHT;
}
}
} }
if (schematic3 != null) { if (schematic3 != null) {
@ -324,7 +334,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
LOGGER.info("- plot schematic: {}", schematic3File.getPath()); LOGGER.info("- plot schematic: {}", schematic3File.getPath());
} }
} }
if (schematic1 == null || schematic2 == null || this.ROAD_WIDTH == 0) { if ((schematic1 == null&& schematic2 == null) || this.ROAD_WIDTH == 0) {
if (Settings.DEBUG) { if (Settings.DEBUG) {
LOGGER.info("- schematic: false"); LOGGER.info("- schematic: false");
} }

View File

@ -504,9 +504,10 @@ public class HybridUtils {
Location top = plot.getTopAbs(); Location top = plot.getTopAbs();
final HybridPlotWorld plotworld = (HybridPlotWorld) plot.getArea(); final HybridPlotWorld plotworld = (HybridPlotWorld) plot.getArea();
PlotManager plotManager = plotworld.getPlotManager(); PlotManager plotManager = plotworld.getPlotManager();
int schemY = Math.min(plotworld.PLOT_HEIGHT, Math.min(plotworld.WALL_HEIGHT, plotworld.ROAD_HEIGHT));
int sx = bot.getX() - plotworld.ROAD_WIDTH + 1; int sx = bot.getX() - plotworld.ROAD_WIDTH + 1;
int sz = bot.getZ() + 1; int sz = bot.getZ() + 1;
int sy = Settings.Schematics.PASTE_ROAD_ON_TOP ? plotworld.ROAD_HEIGHT : 1; int sy = Settings.Schematics.PASTE_ROAD_ON_TOP ? schemY : plot.getArea().getMinBuildHeight();
int ex = bot.getX(); int ex = bot.getX();
int ez = top.getZ(); int ez = top.getZ();
int ey = get_ey(plotManager, queue, sx, ex, sz, ez, sy); int ey = get_ey(plotManager, queue, sx, ex, sz, ez, sy);
@ -517,7 +518,7 @@ public class HybridUtils {
final Set<CuboidRegion> sideRoad = Collections.singleton(RegionUtil.createRegion(sx, ex, sy, ey, sz, ez)); final Set<CuboidRegion> sideRoad = Collections.singleton(RegionUtil.createRegion(sx, ex, sy, ey, sz, ez));
final Set<CuboidRegion> intersection = Collections.singleton(RegionUtil.createRegion(sx, ex, sy, ty, bz, tz)); final Set<CuboidRegion> intersection = Collections.singleton(RegionUtil.createRegion(sx, ex, sy, ty, bz, tz));
final String dir = "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + plot final String dir = Settings.Paths.SCHEMATICS + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + plot
.getArea() .getArea()
.toString() + File.separator; .toString() + File.separator;

View File

@ -58,6 +58,7 @@ import com.plotsquared.core.plot.flag.implementations.MusicFlag;
import com.plotsquared.core.plot.flag.implementations.NotifyEnterFlag; import com.plotsquared.core.plot.flag.implementations.NotifyEnterFlag;
import com.plotsquared.core.plot.flag.implementations.NotifyLeaveFlag; import com.plotsquared.core.plot.flag.implementations.NotifyLeaveFlag;
import com.plotsquared.core.plot.flag.implementations.PlotTitleFlag; import com.plotsquared.core.plot.flag.implementations.PlotTitleFlag;
import com.plotsquared.core.plot.flag.implementations.ServerPlotFlag;
import com.plotsquared.core.plot.flag.implementations.TimeFlag; import com.plotsquared.core.plot.flag.implementations.TimeFlag;
import com.plotsquared.core.plot.flag.implementations.TitlesFlag; import com.plotsquared.core.plot.flag.implementations.TitlesFlag;
import com.plotsquared.core.plot.flag.implementations.WeatherFlag; import com.plotsquared.core.plot.flag.implementations.WeatherFlag;
@ -317,7 +318,7 @@ public class PlotListener {
subtitle = ""; subtitle = "";
fromFlag = false; fromFlag = false;
} }
// It's not actually possible for these to be null, but IntelliJ is dumb if (fromFlag || !plot.getFlag(ServerPlotFlag.class) || Settings.Titles.DISPLAY_DEFAULT_ON_SERVER_PLOT) {
TaskManager.runTaskLaterAsync(() -> { TaskManager.runTaskLaterAsync(() -> {
Plot lastPlot; Plot lastPlot;
try (final MetaDataAccess<Plot> lastPlotAccess = try (final MetaDataAccess<Plot> lastPlotAccess =
@ -363,6 +364,7 @@ public class PlotListener {
} }
}, TaskTime.seconds(1L)); }, TaskTime.seconds(1L));
} }
}
TimedFlag.Timed<Integer> feed = plot.getFlag(FeedFlag.class); TimedFlag.Timed<Integer> feed = plot.getFlag(FeedFlag.class);
if (feed.getInterval() != 0 && feed.getValue() != 0) { if (feed.getInterval() != 0 && feed.getValue() != 0) {

View File

@ -25,8 +25,14 @@
*/ */
package com.plotsquared.core.location; package com.plotsquared.core.location;
import com.plotsquared.core.util.StringMan;
public class BlockLoc { public class BlockLoc {
public static final BlockLoc ZERO = new BlockLoc(0, 0, 0);
public static final BlockLoc MINY = new BlockLoc(0, Integer.MIN_VALUE, 0);
private static final BlockLoc MIDDLE = new BlockLoc(Integer.MAX_VALUE, Integer.MIN_VALUE, Integer.MAX_VALUE);
private final int x; private final int x;
private final int y; private final int y;
private final int z; private final int z;
@ -34,6 +40,10 @@ public class BlockLoc {
private final float yaw; private final float yaw;
private final float pitch; private final float pitch;
public BlockLoc(int x, int y, int z) {
this(x, y, z, 0f, 0f);
}
public BlockLoc(int x, int y, int z, float yaw, float pitch) { public BlockLoc(int x, int y, int z, float yaw, float pitch) {
this.x = x; this.x = x;
this.y = y; this.y = y;
@ -43,11 +53,12 @@ public class BlockLoc {
this.pitch = pitch; this.pitch = pitch;
} }
public BlockLoc(int x, int y, int z) {
this(x, y, z, 0f, 0f);
}
public static BlockLoc fromString(String string) { public static BlockLoc fromString(String string) {
if (string == null || "side".equalsIgnoreCase(string)) {
return null;
} else if (StringMan.isEqualIgnoreCaseToAny(string, "center", "middle", "centre")) {
return MIDDLE;
} else {
String[] parts = string.split(","); String[] parts = string.split(",");
float yaw; float yaw;
@ -55,8 +66,11 @@ public class BlockLoc {
if (parts.length == 5) { if (parts.length == 5) {
yaw = Float.parseFloat(parts[3]); yaw = Float.parseFloat(parts[3]);
pitch = Float.parseFloat(parts[4]); pitch = Float.parseFloat(parts[4]);
} else if (parts.length == 3) {
yaw = 0;
pitch = 0;
} else { } else {
return new BlockLoc(0, 0, 0); return ZERO;
} }
int x = Integer.parseInt(parts[0]); int x = Integer.parseInt(parts[0]);
int y = Integer.parseInt(parts[1]); int y = Integer.parseInt(parts[1]);
@ -64,6 +78,7 @@ public class BlockLoc {
return new BlockLoc(x, y, z, yaw, pitch); return new BlockLoc(x, y, z, yaw, pitch);
} }
}
@Override @Override
public int hashCode() { public int hashCode() {
@ -88,12 +103,12 @@ public class BlockLoc {
} }
BlockLoc other = (BlockLoc) obj; BlockLoc other = (BlockLoc) obj;
return this.getX() == other.getX() && this.getY() == other.getY() && this.getZ() == other return this.getX() == other.getX() && this.getY() == other.getY() && this.getZ() == other
.getZ(); .getZ() && this.getYaw() == other.getYaw() && this.getPitch() == other.getPitch();
} }
@Override @Override
public String toString() { public String toString() {
if (this.getX() == 0 && this.getY() == 0 && this.getZ() == 0) { if (this.getX() == 0 && this.getY() == 0 && this.getZ() == 0 && this.getYaw() == 0 && this.getPitch() == 0) {
return ""; return "";
} }
return this.getX() + "," + this.getY() + ',' + this.getZ() + ',' + this.getYaw() + ',' return this.getX() + "," + this.getY() + ',' + this.getZ() + ',' + this.getYaw() + ','

View File

@ -56,7 +56,7 @@ public final class PlotLoc {
public static @Nullable PlotLoc fromString(final String input) { public static @Nullable PlotLoc fromString(final String input) {
if (input == null || "side".equalsIgnoreCase(input)) { if (input == null || "side".equalsIgnoreCase(input)) {
return null; return null;
} else if (StringMan.isEqualIgnoreCaseToAny(input, "center", "middle")) { } else if (StringMan.isEqualIgnoreCaseToAny(input, "center", "middle", "centre")) {
return new PlotLoc(Integer.MAX_VALUE, Integer.MAX_VALUE); return new PlotLoc(Integer.MAX_VALUE, Integer.MAX_VALUE);
} else { } else {
try { try {

View File

@ -37,7 +37,9 @@ public enum Permission {
PERMISSION_STAR("*"), PERMISSION_STAR("*"),
PERMISSION_ADMIN("plots.admin"), PERMISSION_ADMIN("plots.admin"),
PERMISSION_ADMIN_AREA_SUDO("plots.admin.area.sudo"), PERMISSION_ADMIN_AREA_SUDO("plots.admin.area.sudo"),
@Deprecated(forRemoval = true, since = "6.2.2")
PERMISSION_PROJECTILE_UNOWNED("plots.projectile.unowned"), PERMISSION_PROJECTILE_UNOWNED("plots.projectile.unowned"),
@Deprecated(forRemoval = true, since = "6.2.2")
PERMISSION_PROJECTILE_OTHER("plots.projectile.other"), PERMISSION_PROJECTILE_OTHER("plots.projectile.other"),
PERMISSION_ADMIN_INTERACT_BLOCKED_CMDS("plots.admin.interact.blockedcommands"), PERMISSION_ADMIN_INTERACT_BLOCKED_CMDS("plots.admin.interact.blockedcommands"),
PERMISSION_WORLDEDIT_BYPASS("plots.worldedit.bypass"), PERMISSION_WORLDEDIT_BYPASS("plots.worldedit.bypass"),
@ -204,7 +206,8 @@ public enum Permission {
PERMISSION_ADMIN_DEBUG_OTHER("plots.admin.debug.other"), PERMISSION_ADMIN_DEBUG_OTHER("plots.admin.debug.other"),
PERMISSION_RATE("plots.rate"), PERMISSION_RATE("plots.rate"),
PERMISSION_ADMIN_FLIGHT("plots.admin.flight"), PERMISSION_ADMIN_FLIGHT("plots.admin.flight"),
PERMISSION_ADMIN_COMPONENTS_OTHER("plots.admin.component.other"); PERMISSION_ADMIN_COMPONENTS_OTHER("plots.admin.component.other"),
PERMISSION_ADMIN_BYPASS_BORDER("plots.admin.border.bypass");
//</editor-fold> //</editor-fold>
private final String text; private final String text;

View File

@ -39,12 +39,11 @@ import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.database.DBFunc; import com.plotsquared.core.database.DBFunc;
import com.plotsquared.core.events.Result; import com.plotsquared.core.events.Result;
import com.plotsquared.core.events.TeleportCause; import com.plotsquared.core.events.TeleportCause;
import com.plotsquared.core.generator.HybridPlotWorld; import com.plotsquared.core.generator.ClassicPlotWorld;
import com.plotsquared.core.listener.PlotListener; import com.plotsquared.core.listener.PlotListener;
import com.plotsquared.core.location.BlockLoc; import com.plotsquared.core.location.BlockLoc;
import com.plotsquared.core.location.Direction; import com.plotsquared.core.location.Direction;
import com.plotsquared.core.location.Location; import com.plotsquared.core.location.Location;
import com.plotsquared.core.location.PlotLoc;
import com.plotsquared.core.permissions.Permission; import com.plotsquared.core.permissions.Permission;
import com.plotsquared.core.player.ConsolePlayer; import com.plotsquared.core.player.ConsolePlayer;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
@ -59,6 +58,7 @@ import com.plotsquared.core.plot.flag.implementations.KeepFlag;
import com.plotsquared.core.plot.flag.implementations.ServerPlotFlag; import com.plotsquared.core.plot.flag.implementations.ServerPlotFlag;
import com.plotsquared.core.plot.flag.types.DoubleFlag; import com.plotsquared.core.plot.flag.types.DoubleFlag;
import com.plotsquared.core.plot.schematic.Schematic; import com.plotsquared.core.plot.schematic.Schematic;
import com.plotsquared.core.plot.world.SinglePlotArea;
import com.plotsquared.core.queue.QueueCoordinator; import com.plotsquared.core.queue.QueueCoordinator;
import com.plotsquared.core.util.EventDispatcher; import com.plotsquared.core.util.EventDispatcher;
import com.plotsquared.core.util.MathMan; import com.plotsquared.core.util.MathMan;
@ -1329,7 +1329,7 @@ public class Plot {
return Location.at( return Location.at(
"", "",
0, 0,
this.getArea() instanceof HybridPlotWorld ? ((HybridPlotWorld) this.getArea()).PLOT_HEIGHT + 1 : 4, this.getArea() instanceof ClassicPlotWorld ? ((ClassicPlotWorld) this.getArea()).PLOT_HEIGHT + 1 : 4,
0 0
); );
} }
@ -1404,7 +1404,7 @@ public class Plot {
return Location.at( return Location.at(
"", "",
0, 0,
this.getArea() instanceof HybridPlotWorld ? ((HybridPlotWorld) this.getArea()).PLOT_HEIGHT + 1 : 4, this.getArea() instanceof ClassicPlotWorld ? ((ClassicPlotWorld) this.getArea()).PLOT_HEIGHT + 1 : 4,
0 0
); );
} }
@ -1443,7 +1443,7 @@ public class Plot {
result.accept(Location.at( result.accept(Location.at(
"", "",
0, 0,
this.getArea() instanceof HybridPlotWorld ? ((HybridPlotWorld) this.getArea()).PLOT_HEIGHT + 1 : 4, this.getArea() instanceof ClassicPlotWorld ? ((ClassicPlotWorld) this.getArea()).PLOT_HEIGHT + 1 : 4,
0 0
)); ));
return; return;
@ -1477,7 +1477,7 @@ public class Plot {
*/ */
public void setHome(BlockLoc location) { public void setHome(BlockLoc location) {
Plot plot = this.getBasePlot(false); Plot plot = this.getBasePlot(false);
if (location != null && new BlockLoc(0, 0, 0).equals(location)) { if (BlockLoc.ZERO.equals(location) || BlockLoc.MINY.equals(location)) {
return; return;
} }
plot.getSettings().setPosition(location); plot.getSettings().setPosition(location);
@ -1506,12 +1506,18 @@ public class Plot {
@Deprecated @Deprecated
public Location getDefaultHomeSynchronous(final boolean member) { public Location getDefaultHomeSynchronous(final boolean member) {
Plot plot = this.getBasePlot(false); Plot plot = this.getBasePlot(false);
PlotLoc loc = member ? area.getDefaultHome() : area.getNonmemberHome(); BlockLoc loc = member ? area.defaultHome() : area.nonmemberHome();
if (loc != null) { if (loc != null) {
int x; int x;
int z; int z;
if (loc.getX() == Integer.MAX_VALUE && loc.getZ() == Integer.MAX_VALUE) { if (loc.getX() == Integer.MAX_VALUE && loc.getZ() == Integer.MAX_VALUE) {
// center // center
if (getArea() instanceof SinglePlotArea) {
int y = loc.getY() == Integer.MIN_VALUE
? (isLoaded() ? this.worldUtil.getHighestBlockSynchronous(plot.getWorldName(), 0, 0) + 1 : 63)
: loc.getY();
return Location.at(plot.getWorldName(), 0, y, 0, 0, 0);
}
CuboidRegion largest = plot.getLargestRegion(); CuboidRegion largest = plot.getLargestRegion();
x = (largest.getMaximumPoint().getX() >> 1) - (largest.getMinimumPoint().getX() >> 1) + largest x = (largest.getMaximumPoint().getX() >> 1) - (largest.getMinimumPoint().getX() >> 1) + largest
.getMinimumPoint() .getMinimumPoint()
@ -1525,10 +1531,14 @@ public class Plot {
x = bot.getX() + loc.getX(); x = bot.getX() + loc.getX();
z = bot.getZ() + loc.getZ(); z = bot.getZ() + loc.getZ();
} }
int y = loc.getY() < 1 int y = loc.getY() == Integer.MIN_VALUE
? (isLoaded() ? this.worldUtil.getHighestBlockSynchronous(plot.getWorldName(), x, z) + 1 : 63) ? (isLoaded() ? this.worldUtil.getHighestBlockSynchronous(plot.getWorldName(), x, z) + 1 : 63)
: loc.getY(); : loc.getY();
return Location.at(plot.getWorldName(), x, y, z); return Location.at(plot.getWorldName(), x, y, z, loc.getYaw(), loc.getPitch());
}
if (getArea() instanceof SinglePlotArea) {
int y = isLoaded() ? this.worldUtil.getHighestBlockSynchronous(plot.getWorldName(), 0, 0) + 1 : 63;
return Location.at(plot.getWorldName(), 0, y, 0, 0, 0);
} }
// Side // Side
return plot.getSideSynchronous(); return plot.getSideSynchronous();
@ -1540,17 +1550,21 @@ public class Plot {
result.accept(Location.at( result.accept(Location.at(
"", "",
0, 0,
this.getArea() instanceof HybridPlotWorld ? ((HybridPlotWorld) this.getArea()).PLOT_HEIGHT + 1 : 4, this.getArea() instanceof ClassicPlotWorld ? ((ClassicPlotWorld) this.getArea()).PLOT_HEIGHT + 1 : 4,
0 0
)); ));
return; return;
} }
PlotLoc loc = member ? area.getDefaultHome() : area.getNonmemberHome(); BlockLoc loc = member ? area.defaultHome() : area.nonmemberHome();
if (loc != null) { if (loc != null) {
int x; int x;
int z; int z;
if (loc.getX() == Integer.MAX_VALUE && loc.getZ() == Integer.MAX_VALUE) { if (loc.getX() == Integer.MAX_VALUE && loc.getZ() == Integer.MAX_VALUE) {
// center // center
if (getArea() instanceof SinglePlotArea) {
x = 0;
z = 0;
} else {
CuboidRegion largest = plot.getLargestRegion(); CuboidRegion largest = plot.getLargestRegion();
x = (largest.getMaximumPoint().getX() >> 1) - (largest.getMinimumPoint().getX() >> 1) + largest x = (largest.getMaximumPoint().getX() >> 1) - (largest.getMinimumPoint().getX() >> 1) + largest
.getMinimumPoint() .getMinimumPoint()
@ -1558,13 +1572,14 @@ public class Plot {
z = (largest.getMaximumPoint().getZ() >> 1) - (largest.getMinimumPoint().getZ() >> 1) + largest z = (largest.getMaximumPoint().getZ() >> 1) - (largest.getMinimumPoint().getZ() >> 1) + largest
.getMinimumPoint() .getMinimumPoint()
.getZ(); .getZ();
}
} else { } else {
// specific // specific
Location bot = plot.getBottomAbs(); Location bot = plot.getBottomAbs();
x = bot.getX() + loc.getX(); x = bot.getX() + loc.getX();
z = bot.getZ() + loc.getZ(); z = bot.getZ() + loc.getZ();
} }
if (loc.getY() < 1) { if (loc.getY() == Integer.MIN_VALUE) {
if (isLoaded()) { if (isLoaded()) {
this.worldUtil.getHighestBlock( this.worldUtil.getHighestBlock(
plot.getWorldName(), plot.getWorldName(),
@ -1573,14 +1588,19 @@ public class Plot {
y -> result.accept(Location.at(plot.getWorldName(), x, y + 1, z)) y -> result.accept(Location.at(plot.getWorldName(), x, y + 1, z))
); );
} else { } else {
result.accept(Location.at(plot.getWorldName(), x, 63, z)); int y = this.getArea() instanceof ClassicPlotWorld ? ((ClassicPlotWorld) this.getArea()).PLOT_HEIGHT + 1 : 63;
result.accept(Location.at(plot.getWorldName(), x, y, z, loc.getYaw(), loc.getPitch()));
} }
} else { } else {
result.accept(Location.at(plot.getWorldName(), x, loc.getY(), z)); result.accept(Location.at(plot.getWorldName(), x, loc.getY(), z, loc.getYaw(), loc.getPitch()));
} }
return; return;
} }
// Side // Side
if (getArea() instanceof SinglePlotArea) {
int y = isLoaded() ? this.worldUtil.getHighestBlockSynchronous(plot.getWorldName(), 0, 0) + 1 : 63;
result.accept(Location.at(plot.getWorldName(), 0, y, 0, 0, 0));
}
plot.getSide(result); plot.getSide(result);
} }
@ -1707,9 +1727,14 @@ public class Plot {
} }
this.getPlotModificationManager().setSign(player.getName()); this.getPlotModificationManager().setSign(player.getName());
player.sendMessage(TranslatableCaption.of("working.claimed"), Template.of("plot", this.getId().toString())); player.sendMessage(TranslatableCaption.of("working.claimed"), Template.of("plot", this.getId().toString()));
if (teleport && Settings.Teleport.ON_CLAIM) { if (teleport) {
teleportPlayer(player, auto ? TeleportCause.COMMAND_AUTO : TeleportCause.COMMAND_CLAIM, result -> { if (!auto && Settings.Teleport.ON_CLAIM) {
teleportPlayer(player, TeleportCause.COMMAND_CLAIM, result -> {
}); });
} else if (auto && Settings.Teleport.ON_AUTO) {
teleportPlayer(player, TeleportCause.COMMAND_AUTO, result -> {
});
}
} }
PlotArea plotworld = getArea(); PlotArea plotworld = getArea();
if (plotworld.isSchematicOnClaim()) { if (plotworld.isSchematicOnClaim()) {
@ -1727,7 +1752,15 @@ public class Plot {
e.printStackTrace(); e.printStackTrace();
return true; return true;
} }
schematicHandler.paste(sch, this, 0, 1, 0, Settings.Schematics.PASTE_ON_TOP, player, new RunnableVal<>() { schematicHandler.paste(
sch,
this,
0,
getArea().getMinBuildHeight(),
0,
Settings.Schematics.PASTE_ON_TOP,
player,
new RunnableVal<>() {
@Override @Override
public void run(Boolean value) { public void run(Boolean value) {
if (value) { if (value) {
@ -1736,7 +1769,8 @@ public class Plot {
player.sendMessage(TranslatableCaption.of("schematics.schematic_paste_failed")); player.sendMessage(TranslatableCaption.of("schematics.schematic_paste_failed"));
} }
} }
}); }
);
} }
plotworld.getPlotManager().claimPlot(this, null); plotworld.getPlotManager().claimPlot(this, null);
return true; return true;
@ -2148,8 +2182,9 @@ public class Plot {
} }
/** /**
* Gets the set home location or 0,0,0 if no location is set<br> * Gets the set home location or 0,Integer#MIN_VALUE,0 if no location is set<br>
* - Does not take the default home location into account * - Does not take the default home location into account
* - PlotSquared will internally find the correct place to teleport to if y = Integer#MIN_VALUE when teleporting to the plot.
* *
* @return home location * @return home location
*/ */
@ -2821,7 +2856,7 @@ public class Plot {
flags = MINI_MESSAGE.parse(TranslatableCaption.of("info.none").getComponent(player)); flags = MINI_MESSAGE.parse(TranslatableCaption.of("info.none").getComponent(player));
} else { } else {
TextComponent.Builder flagBuilder = Component.text(); TextComponent.Builder flagBuilder = Component.text();
String prefix = " "; String prefix = "";
for (final PlotFlag<?, ?> flag : flagCollection) { for (final PlotFlag<?, ?> flag : flagCollection) {
Object value; Object value;
if (flag instanceof DoubleFlag && !Settings.General.SCIENTIFIC) { if (flag instanceof DoubleFlag && !Settings.General.SCIENTIFIC) {

View File

@ -41,6 +41,7 @@ import com.plotsquared.core.configuration.file.YamlConfiguration;
import com.plotsquared.core.generator.GridPlotWorld; import com.plotsquared.core.generator.GridPlotWorld;
import com.plotsquared.core.generator.IndependentPlotGenerator; import com.plotsquared.core.generator.IndependentPlotGenerator;
import com.plotsquared.core.inject.annotations.WorldConfig; import com.plotsquared.core.inject.annotations.WorldConfig;
import com.plotsquared.core.location.BlockLoc;
import com.plotsquared.core.location.Direction; import com.plotsquared.core.location.Direction;
import com.plotsquared.core.location.Location; import com.plotsquared.core.location.Location;
import com.plotsquared.core.location.PlotLoc; import com.plotsquared.core.location.PlotLoc;
@ -123,6 +124,7 @@ public abstract class PlotArea {
new FlagContainer(GlobalFlagContainer.getInstance()); new FlagContainer(GlobalFlagContainer.getInstance());
private final YamlConfiguration worldConfiguration; private final YamlConfiguration worldConfiguration;
private final GlobalBlockQueue globalBlockQueue; private final GlobalBlockQueue globalBlockQueue;
private final boolean roadFlags = false;
private boolean autoMerge = false; private boolean autoMerge = false;
private boolean allowSigns = true; private boolean allowSigns = true;
private boolean miscSpawnUnowned = false; private boolean miscSpawnUnowned = false;
@ -140,14 +142,13 @@ public abstract class PlotArea {
private PlotAreaType type = PlotAreaType.NORMAL; private PlotAreaType type = PlotAreaType.NORMAL;
private PlotAreaTerrainType terrain = PlotAreaTerrainType.NONE; private PlotAreaTerrainType terrain = PlotAreaTerrainType.NONE;
private boolean homeAllowNonmember = false; private boolean homeAllowNonmember = false;
private PlotLoc nonmemberHome; private BlockLoc nonmemberHome;
private PlotLoc defaultHome; private BlockLoc defaultHome;
private int maxBuildHeight = 256; private int maxBuildHeight = 256;
private int minBuildHeight = 1; private int minBuildHeight = 1;
private GameMode gameMode = GameModes.CREATIVE; private GameMode gameMode = GameModes.CREATIVE;
private Map<String, PlotExpression> prices = new HashMap<>(); private Map<String, PlotExpression> prices = new HashMap<>();
private List<String> schematics = new ArrayList<>(); private List<String> schematics = new ArrayList<>();
private final boolean roadFlags = false;
private boolean worldBorder = false; private boolean worldBorder = false;
private boolean useEconomy = false; private boolean useEconomy = false;
private int hash; private int hash;
@ -370,24 +371,24 @@ public abstract class PlotArea {
String homeNonMembers = config.getString("home.nonmembers"); String homeNonMembers = config.getString("home.nonmembers");
String homeDefault = config.getString("home.default"); String homeDefault = config.getString("home.default");
this.defaultHome = PlotLoc.fromString(homeDefault); this.defaultHome = BlockLoc.fromString(homeDefault);
this.homeAllowNonmember = homeNonMembers.equalsIgnoreCase(homeDefault); this.homeAllowNonmember = homeNonMembers.equalsIgnoreCase(homeDefault);
if (this.homeAllowNonmember) { if (this.homeAllowNonmember) {
this.nonmemberHome = defaultHome; this.nonmemberHome = defaultHome;
} else { } else {
this.nonmemberHome = PlotLoc.fromString(homeNonMembers); this.nonmemberHome = BlockLoc.fromString(homeNonMembers);
} }
if ("side".equalsIgnoreCase(homeDefault)) { if ("side".equalsIgnoreCase(homeDefault)) {
this.defaultHome = null; this.defaultHome = null;
} else if (StringMan.isEqualIgnoreCaseToAny(homeDefault, "center", "middle")) { } else if (StringMan.isEqualIgnoreCaseToAny(homeDefault, "center", "middle", "centre")) {
this.defaultHome = new PlotLoc(Integer.MAX_VALUE, Integer.MAX_VALUE); this.defaultHome = new BlockLoc(Integer.MAX_VALUE, Integer.MIN_VALUE, Integer.MAX_VALUE);
} else { } else {
try { try {
/*String[] split = homeDefault.split(","); /*String[] split = homeDefault.split(",");
this.DEFAULT_HOME = this.DEFAULT_HOME =
new PlotLoc(Integer.parseInt(split[0]), Integer.parseInt(split[1]));*/ new PlotLoc(Integer.parseInt(split[0]), Integer.parseInt(split[1]));*/
this.defaultHome = PlotLoc.fromString(homeDefault); this.defaultHome = BlockLoc.fromString(homeDefault);
} catch (NumberFormatException ignored) { } catch (NumberFormatException ignored) {
this.defaultHome = null; this.defaultHome = null;
} }
@ -1351,15 +1352,38 @@ public abstract class PlotArea {
return this.homeAllowNonmember; return this.homeAllowNonmember;
} }
public PlotLoc getNonmemberHome() { /**
* Get the location for non-members to be teleported to.
*/
public BlockLoc nonmemberHome() {
return this.nonmemberHome; return this.nonmemberHome;
} }
public PlotLoc getDefaultHome() { /**
* Get the default location for players to be teleported to. May be overriden by {@link #nonmemberHome} if the player is
* not a member of the plot.
*/
public BlockLoc defaultHome() {
return this.defaultHome; return this.defaultHome;
} }
protected void setDefaultHome(PlotLoc defaultHome) { /**
* @deprecated Use {@link #nonmemberHome}
*/
@Deprecated(forRemoval = true)
public PlotLoc getNonmemberHome() {
return new PlotLoc(this.defaultHome.getX(), this.defaultHome.getY(), this.defaultHome.getZ());
}
/**
* @deprecated Use {@link #defaultHome}
*/
@Deprecated(forRemoval = true)
public PlotLoc getDefaultHome() {
return new PlotLoc(this.defaultHome.getX(), this.defaultHome.getY(), this.defaultHome.getZ());
}
protected void setDefaultHome(BlockLoc defaultHome) {
this.defaultHome = defaultHome; this.defaultHome = defaultHome;
} }

View File

@ -302,7 +302,7 @@ public final class PlotId {
// first increase y, then x // first increase y, then x
if (this.y == this.end.getY()) { if (this.y == this.end.getY()) {
this.x++; this.x++;
this.y = 0; this.y = this.start.getY();
} else { } else {
this.y++; this.y++;
} }

View File

@ -229,8 +229,8 @@ public final class PlotModificationManager {
!isDelete, !isDelete,
isDelete ? PlotUnlinkEvent.REASON.DELETE : PlotUnlinkEvent.REASON.CLEAR isDelete ? PlotUnlinkEvent.REASON.DELETE : PlotUnlinkEvent.REASON.CLEAR
); );
if (event.getEventResult() != Result.DENY) { if (event.getEventResult() != Result.DENY && this.unlinkPlot(event.isCreateRoad(), event.isCreateSign())) {
this.unlinkPlot(event.isCreateRoad(), event.isCreateSign()); PlotSquared.get().getEventDispatcher().callPostUnlink(plot, event.getReason());
} }
final PlotManager manager = this.plot.getArea().getPlotManager(); final PlotManager manager = this.plot.getArea().getPlotManager();
Runnable run = new Runnable() { Runnable run = new Runnable() {
@ -502,7 +502,9 @@ public final class PlotModificationManager {
} }
return; return;
} }
plot.getPlotModificationManager().autoMerge(event.getDir(), event.getMax(), uuid, player, true); if (plot.getPlotModificationManager().autoMerge(event.getDir(), event.getMax(), uuid, player, true)) {
PlotSquared.get().getEventDispatcher().callPostMerge(player, plot);
}
} }
}); });
return true; return true;

View File

@ -107,7 +107,7 @@ public class PlotSettings {
public BlockLoc getPosition() { public BlockLoc getPosition() {
if (this.position == null) { if (this.position == null) {
return new BlockLoc(0, 0, 0); return BlockLoc.MINY;
} }
return this.position; return this.position;
} }

View File

@ -25,7 +25,6 @@
*/ */
package com.plotsquared.core.plot.comment; package com.plotsquared.core.plot.comment;
import com.google.common.annotations.Beta;
import com.google.inject.TypeLiteral; import com.google.inject.TypeLiteral;
import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.configuration.caption.StaticCaption; import com.plotsquared.core.configuration.caption.StaticCaption;
@ -44,7 +43,6 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
@Beta
public class CommentManager { public class CommentManager {
public static final HashMap<String, CommentInbox> inboxes = new HashMap<>(); public static final HashMap<String, CommentInbox> inboxes = new HashMap<>();

View File

@ -426,8 +426,11 @@ public class ExpireManager {
.callUnlink(plot.getArea(), plot, true, false, .callUnlink(plot.getArea(), plot, true, false,
PlotUnlinkEvent.REASON.EXPIRE_DELETE PlotUnlinkEvent.REASON.EXPIRE_DELETE
); );
if (event.getEventResult() != Result.DENY) { if (event.getEventResult() != Result.DENY && plot.getPlotModificationManager().unlinkPlot(
plot.getPlotModificationManager().unlinkPlot(event.isCreateRoad(), event.isCreateSign()); event.isCreateRoad(),
event.isCreateSign()
)) {
this.eventDispatcher.callPostUnlink(plot, PlotUnlinkEvent.REASON.EXPIRE_DELETE);
} }
} }
for (UUID helper : plot.getTrusted()) { for (UUID helper : plot.getTrusted()) {

View File

@ -28,11 +28,11 @@ package com.plotsquared.core.plot.flag;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.plotsquared.core.configuration.caption.CaptionUtility; import com.plotsquared.core.configuration.caption.CaptionUtility;
import com.plotsquared.core.util.AnnotationHelper;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
import org.jetbrains.annotations.ApiStatus;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
@ -349,7 +349,7 @@ public class FlagContainer {
* *
* @return a new Runnable that cleans up once the FlagContainer isn't needed anymore. * @return a new Runnable that cleans up once the FlagContainer isn't needed anymore.
*/ */
@ApiStatus.Internal @AnnotationHelper.ApiDescription(info = "This method should not be considered as public or API.")
public Runnable createCleanupHook() { public Runnable createCleanupHook() {
return () -> GlobalFlagContainer.getInstance().unsubscribe(unknownsRef); return () -> GlobalFlagContainer.getInstance().unsubscribe(unknownsRef);
} }

View File

@ -35,8 +35,8 @@ import com.plotsquared.core.generator.GridPlotWorld;
import com.plotsquared.core.generator.SingleWorldGenerator; import com.plotsquared.core.generator.SingleWorldGenerator;
import com.plotsquared.core.inject.annotations.WorldConfig; import com.plotsquared.core.inject.annotations.WorldConfig;
import com.plotsquared.core.listener.PlotListener; import com.plotsquared.core.listener.PlotListener;
import com.plotsquared.core.location.BlockLoc;
import com.plotsquared.core.location.Location; import com.plotsquared.core.location.Location;
import com.plotsquared.core.location.PlotLoc;
import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.PlotAreaType; import com.plotsquared.core.plot.PlotAreaType;
import com.plotsquared.core.plot.PlotId; import com.plotsquared.core.plot.PlotId;
@ -74,7 +74,39 @@ public class SinglePlotArea extends GridPlotWorld {
this.eventDispatcher = eventDispatcher; this.eventDispatcher = eventDispatcher;
this.plotListener = plotListener; this.plotListener = plotListener;
this.setAllowSigns(false); this.setAllowSigns(false);
this.setDefaultHome(new PlotLoc(Integer.MAX_VALUE, Integer.MAX_VALUE)); this.setDefaultHome(new BlockLoc(Integer.MAX_VALUE, Integer.MIN_VALUE, Integer.MAX_VALUE));
}
/**
* Returns true if the given string matches the naming system used to identify single plot worlds
* e.g. -1_5 represents plot id *;-1;5. "*" being the plot area name given to single plot world
* {@link com.plotsquared.core.plot.PlotArea}.
*/
public static boolean isSinglePlotWorld(String worldName) {
int len = worldName.length();
int separator = 0;
for (int i = 0; i < len; i++) {
switch (worldName.charAt(i)) {
case '_':
separator++;
break;
case '-':
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
break;
default:
return false;
}
}
return separator == 1;
} }
@NonNull @NonNull

View File

@ -0,0 +1,62 @@
/*
* _____ _ _ _____ _
* | __ \| | | | / ____| | |
* | |__) | | ___ | |_| (___ __ _ _ _ __ _ _ __ ___ __| |
* | ___/| |/ _ \| __|\___ \ / _` | | | |/ _` | '__/ _ \/ _` |
* | | | | (_) | |_ ____) | (_| | |_| | (_| | | | __/ (_| |
* |_| |_|\___/ \__|_____/ \__, |\__,_|\__,_|_| \___|\__,_|
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2021 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.plotsquared.core.util;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.MODULE;
import static java.lang.annotation.ElementType.PACKAGE;
import static java.lang.annotation.ElementType.RECORD_COMPONENT;
import static java.lang.annotation.ElementType.TYPE;
/**
* @since 6.2.2
*/
@AnnotationHelper.ApiDescription(info = "An internal class for custom annotations." +
"This is in no form part of the API and is subject to change at any time.")
public final class AnnotationHelper {
private AnnotationHelper() {
}
@Documented
@Retention(RetentionPolicy.CLASS)
@Target(value = {METHOD, PACKAGE, MODULE, RECORD_COMPONENT, TYPE})
public @interface ApiDescription {
/**
* Returns additional information how to use a class for the API
*
* @return the version string
* @since 6.2.2
*/
String info() default "";
}
}

View File

@ -51,6 +51,11 @@ import com.plotsquared.core.events.PlotMergeEvent;
import com.plotsquared.core.events.PlotRateEvent; import com.plotsquared.core.events.PlotRateEvent;
import com.plotsquared.core.events.PlotUnlinkEvent; import com.plotsquared.core.events.PlotUnlinkEvent;
import com.plotsquared.core.events.TeleportCause; import com.plotsquared.core.events.TeleportCause;
import com.plotsquared.core.events.post.PostPlayerAutoPlotEvent;
import com.plotsquared.core.events.post.PostPlotChangeOwnerEvent;
import com.plotsquared.core.events.post.PostPlotDeleteEvent;
import com.plotsquared.core.events.post.PostPlotMergeEvent;
import com.plotsquared.core.events.post.PostPlotUnlinkEvent;
import com.plotsquared.core.listener.PlayerBlockEventType; import com.plotsquared.core.listener.PlayerBlockEventType;
import com.plotsquared.core.location.Direction; import com.plotsquared.core.location.Direction;
import com.plotsquared.core.location.Location; import com.plotsquared.core.location.Location;
@ -78,13 +83,13 @@ import com.sk89q.worldedit.world.block.BlockTypes;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.Template;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
import org.jetbrains.annotations.ApiStatus;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
@ApiStatus.Internal @AnnotationHelper.ApiDescription(info = "This is an internal class used by PlotSquared to dispatch events." +
"This is in no form part of the API and is subject to change at any time.")
public class EventDispatcher { public class EventDispatcher {
private final EventBus eventBus = new EventBus("PlotSquaredEvents"); private final EventBus eventBus = new EventBus("PlotSquaredEvents");
@ -135,6 +140,12 @@ public class EventDispatcher {
return event; return event;
} }
public PostPlayerAutoPlotEvent callPostAuto(PlotPlayer<?> player, Plot plot) {
PostPlayerAutoPlotEvent event = new PostPlayerAutoPlotEvent(player, plot);
callEvent(event);
return event;
}
public PlayerAutoPlotsChosenEvent callAutoPlotsChosen( public PlayerAutoPlotsChosenEvent callAutoPlotsChosen(
PlotPlayer<?> player, List<Plot> plots PlotPlayer<?> player, List<Plot> plots
) { ) {
@ -174,6 +185,12 @@ public class EventDispatcher {
return event; return event;
} }
public PostPlotDeleteEvent callPostDelete(Plot plot) {
PostPlotDeleteEvent event = new PostPlotDeleteEvent(plot);
callEvent(event);
return event;
}
public PlotFlagAddEvent callFlagAdd(PlotFlag<?, ?> flag, Plot plot) { public PlotFlagAddEvent callFlagAdd(PlotFlag<?, ?> flag, Plot plot) {
PlotFlagAddEvent event = new PlotFlagAddEvent(flag, plot); PlotFlagAddEvent event = new PlotFlagAddEvent(flag, plot);
callEvent(event); callEvent(event);
@ -192,6 +209,12 @@ public class EventDispatcher {
return event; return event;
} }
public PostPlotMergeEvent callPostMerge(PlotPlayer<?> player, Plot plot) {
PostPlotMergeEvent event = new PostPlotMergeEvent(player, plot);
callEvent(event);
return event;
}
public PlotAutoMergeEvent callAutoMerge(Plot plot, List<PlotId> plots) { public PlotAutoMergeEvent callAutoMerge(Plot plot, List<PlotId> plots) {
PlotAutoMergeEvent event = new PlotAutoMergeEvent(plot.getWorldName(), plot, plots); PlotAutoMergeEvent event = new PlotAutoMergeEvent(plot.getWorldName(), plot, plots);
callEvent(event); callEvent(event);
@ -207,6 +230,12 @@ public class EventDispatcher {
return event; return event;
} }
public PostPlotUnlinkEvent callPostUnlink(Plot plot, PlotUnlinkEvent.REASON reason) {
PostPlotUnlinkEvent event = new PostPlotUnlinkEvent(plot, reason);
callEvent(event);
return event;
}
public PlayerEnterPlotEvent callEntry(PlotPlayer<?> player, Plot plot) { public PlayerEnterPlotEvent callEntry(PlotPlayer<?> player, Plot plot) {
PlayerEnterPlotEvent event = new PlayerEnterPlotEvent(player, plot); PlayerEnterPlotEvent event = new PlayerEnterPlotEvent(player, plot);
callEvent(event); callEvent(event);
@ -256,6 +285,12 @@ public class EventDispatcher {
return event; return event;
} }
public PostPlotChangeOwnerEvent callPostOwnerChange(PlotPlayer<?> player, Plot plot, @Nullable UUID oldOwner) {
PostPlotChangeOwnerEvent event = new PostPlotChangeOwnerEvent(player, plot, oldOwner);
callEvent(event);
return event;
}
public PlotRateEvent callRating(PlotPlayer<?> player, Plot plot, Rating rating) { public PlotRateEvent callRating(PlotPlayer<?> player, Plot plot, Rating rating) {
PlotRateEvent event = new PlotRateEvent(player, rating, plot); PlotRateEvent event = new PlotRateEvent(player, rating, plot);
eventBus.post(event); eventBus.post(event);

View File

@ -581,6 +581,10 @@ public abstract class SchematicHandler {
schematic.put("BlockData", new ByteArrayTag(buffer.toByteArray())); schematic.put("BlockData", new ByteArrayTag(buffer.toByteArray()));
schematic.put("BlockEntities", new ListTag(CompoundTag.class, tileEntities)); schematic.put("BlockEntities", new ListTag(CompoundTag.class, tileEntities));
if (biomeBuffer.size() == 0 || biomePalette.size() == 0) {
return;
}
schematic.put("BiomePaletteMax", new IntTag(biomePalette.size())); schematic.put("BiomePaletteMax", new IntTag(biomePalette.size()));
Map<String, Tag> biomePaletteTag = new HashMap<>(); Map<String, Tag> biomePaletteTag = new HashMap<>();

View File

@ -286,15 +286,13 @@ public class StringMan {
} }
public static boolean isEqualIgnoreCase(String a, String b) { public static boolean isEqualIgnoreCase(String a, String b) {
return (a == b) || ((a != null) && (b != null) && (a.length() == b.length()) && a return (a.equals(b)) || ((a != null) && (b != null) && (a.length() == b.length()) && a
.equalsIgnoreCase(b)); .equalsIgnoreCase(b));
} }
public static String repeat(String s, int n) { public static String repeat(String s, int n) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
for (int i = 0; i < n; i++) { sb.append(String.valueOf(s).repeat(Math.max(0, n)));
sb.append(s);
}
return sb.toString(); return sb.toString();
} }

View File

@ -69,6 +69,7 @@ public final class AutoClaimFinishTask implements Callable<Boolean> {
return false; return false;
} }
plot.claim(player, true, schematic, false, true); plot.claim(player, true, schematic, false, true);
eventDispatcher.callPostAuto(player, plot);
if (area.isAutoMerge()) { if (area.isAutoMerge()) {
PlotMergeEvent event = this.eventDispatcher.callMerge(plot, Direction.ALL, Integer.MAX_VALUE, player); PlotMergeEvent event = this.eventDispatcher.callMerge(plot, Direction.ALL, Integer.MAX_VALUE, player);
if (event.getEventResult() == Result.DENY) { if (event.getEventResult() == Result.DENY) {
@ -77,7 +78,9 @@ public final class AutoClaimFinishTask implements Callable<Boolean> {
Templates.of("value", "Auto Merge") Templates.of("value", "Auto Merge")
); );
} else { } else {
plot.getPlotModificationManager().autoMerge(event.getDir(), event.getMax(), player.getUUID(), player, true); if (plot.getPlotModificationManager().autoMerge(event.getDir(), event.getMax(), player.getUUID(), player, true)) {
eventDispatcher.callPostMerge(player, plot);
}
} }
} }
return true; return true;

View File

@ -22,7 +22,7 @@
"web.plot_merged": "<prefix><red>This plot is merged and therefore cannot be downloaded</red>", "web.plot_merged": "<prefix><red>This plot is merged and therefore cannot be downloaded</red>",
"web.generating_link_failed": "<prefix><red>Failed to generate download link for plot <plot>!</red>", "web.generating_link_failed": "<prefix><red>Failed to generate download link for plot <plot>!</red>",
"web.generation_link_success": "<prefix><gold>Download: <gray><click:open_url:<download>><download></click></gray> \n Deletion: <gray><click:open_url:<delete>><delete></click></gray>\n<red>Attention: Opening the deletion link will delete the file immediately.</red></gold>", "web.generation_link_success": "<prefix><gold>Download: <gray><click:open_url:<download>><download></click></gray> \n Deletion: <gray><click:open_url:<delete>><delete></click></gray>\n<red>Attention: Opening the deletion link will delete the file immediately.</red></gold>",
"web.generation_link_success_legacy_world": "<prefix><gold>Download: <gray><click:open_url:<url>><url></click></gray>", "web.generation_link_success_legacy_world": "<prefix><gold>Download: <gray><click:open_url:<url>><url></click></gray></gold>",
"web.save_failed": "<prefix><red>Failed to save.</red>", "web.save_failed": "<prefix><red>Failed to save.</red>",
"web.load_null": "<prefix><gray>Please use </gray><dark_aqua><command> </dark_aqua><gray>to get a list of schematics.</gray>", "web.load_null": "<prefix><gray>Please use </gray><dark_aqua><command> </dark_aqua><gray>to get a list of schematics.</gray>",
"web.load_failed": "<prefix><red>Failed to load schematic.</red>", "web.load_failed": "<prefix><red>Failed to load schematic.</red>",
@ -53,7 +53,9 @@
"cluster.cluster_regenerated": "<prefix><dark_aqua>Successfully started cluster regeneration.</dark_aqua>", "cluster.cluster_regenerated": "<prefix><dark_aqua>Successfully started cluster regeneration.</dark_aqua>",
"cluster.cluster_teleporting": "<prefix><dark_aqua>Teleporting...</dark_aqua>", "cluster.cluster_teleporting": "<prefix><dark_aqua>Teleporting...</dark_aqua>",
"cluster.cluster_info": "<prefix><gold>Current cluster: </gold><gray><id></gray>\n<gold>Name: </gold><gray><name></gray>\n<gold>Owner: </gold><gray><owner></gray>\n<gold>Size: </gold><gray><size></gray>\n<gold>Rights: </gold><gray><rights></gray>", "cluster.cluster_info": "<prefix><gold>Current cluster: </gold><gray><id></gray>\n<gold>Name: </gold><gray><name></gray>\n<gold>Owner: </gold><gray><owner></gray>\n<gold>Size: </gold><gray><size></gray>\n<gold>Rights: </gold><gray><rights></gray>",
"border.border": "<prefix><gray>You are outside the current map border.</gray>", "border.denied": "<prefix><red>You are outside the current map border.</red>",
"border.bypass.exited": "<prefix><red>You have bypassed the current map border area.</red>",
"border.bypass.entered": "<prefix><gray>You have re-entered the current map border area.</gray>",
"worldedit.worldedit_bypass": "<prefix><gray><italic>To bypass your restrictions use </gray><dark_aqua><command></dark_aqua></italic>", "worldedit.worldedit_bypass": "<prefix><gray><italic>To bypass your restrictions use </gray><dark_aqua><command></dark_aqua></italic>",
"worldedit.worldedit_bypassed": "<prefix><gray>Currently bypassing WorldEdit restriction.</gray>", "worldedit.worldedit_bypassed": "<prefix><gray>Currently bypassing WorldEdit restriction.</gray>",
"gamemode.gamemode_was_bypassed": "<prefix><gold>You bypassed the gamemode (</gold><gray><gamemode></gray><gold>) <gold>set for </gold><gray><plot>.</gray>", "gamemode.gamemode_was_bypassed": "<prefix><gold>You bypassed the gamemode (</gold><gray><gamemode></gray><gold>) <gold>set for </gold><gray><plot>.</gray>",
@ -92,6 +94,7 @@
"done.done_insufficient_complexity": "<prefix><red>This plot is too simple. Please add more detail before using this command.</red>", "done.done_insufficient_complexity": "<prefix><red>This plot is too simple. Please add more detail before using this command.</red>",
"done.done_success": "<prefix><gold>Successfully marked this plot as done.</gold>", "done.done_success": "<prefix><gold>Successfully marked this plot as done.</gold>",
"done.done_removed": "<prefix><gray>You may now continue building in this plot.</gray>", "done.done_removed": "<prefix><gray>You may now continue building in this plot.</gray>",
"done.building_restricted": "<prefix><gray>You can't build on plots marked as done.</gray>",
"ratings.ratings_purged": "<prefix><gray>Purged ratings for this plot.</gray>", "ratings.ratings_purged": "<prefix><gray>Purged ratings for this plot.</gray>",
"ratings.rating_not_valid": "<prefix><red>You need to specify a number between 1 and 10.</red>", "ratings.rating_not_valid": "<prefix><red>You need to specify a number between 1 and 10.</red>",
"ratings.rating_already_exists": "<prefix><gray>You have already rated plot <plot>.</gray>", "ratings.rating_already_exists": "<prefix><gray>You have already rated plot <plot>.</gray>",

View File

@ -30,14 +30,12 @@ import net.kyori.adventure.text.event.ClickEvent;
import net.kyori.adventure.text.event.HoverEvent; import net.kyori.adventure.text.event.HoverEvent;
import net.kyori.adventure.text.format.NamedTextColor; import net.kyori.adventure.text.format.NamedTextColor;
import net.kyori.adventure.text.format.TextDecoration; import net.kyori.adventure.text.format.TextDecoration;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import java.util.EnumSet; import java.util.EnumSet;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNull;
class ClickStripTransformTest { class ClickStripTransformTest {
@ -53,7 +51,7 @@ class ClickStripTransformTest {
) )
); );
var transformedComponent = transform.transform(component); var transformedComponent = transform.transform(component);
assertNull(transformedComponent.clickEvent()); Assertions.assertNull(transformedComponent.clickEvent());
} }
@Test @Test
@ -68,7 +66,7 @@ class ClickStripTransformTest {
var component = Component.text("Hello") var component = Component.text("Hello")
.clickEvent(originalClickEvent); .clickEvent(originalClickEvent);
var transformedComponent = transform.transform(component); var transformedComponent = transform.transform(component);
assertEquals(originalClickEvent, transformedComponent.clickEvent()); Assertions.assertEquals(originalClickEvent, transformedComponent.clickEvent());
} }
@Test @Test
@ -88,9 +86,9 @@ class ClickStripTransformTest {
inner.clickEvent(ClickEvent.clickEvent(ClickEvent.Action.OPEN_URL, "https://example.org")) inner.clickEvent(ClickEvent.clickEvent(ClickEvent.Action.OPEN_URL, "https://example.org"))
); );
var transformedComponent = transform.transform(component); var transformedComponent = transform.transform(component);
assertFalse(transformedComponent.children().isEmpty()); // child still exists Assertions.assertFalse(transformedComponent.children().isEmpty()); // child still exists
assertEquals(inner, transformedComponent.children().get(0)); // only the click event has changed Assertions.assertEquals(inner, transformedComponent.children().get(0)); // only the click event has changed
assertNull(transformedComponent.children().get(0).clickEvent()); Assertions.assertNull(transformedComponent.children().get(0).clickEvent());
} }
} }

View File

@ -32,10 +32,9 @@ import com.plotsquared.core.plot.flag.implementations.UseFlag;
import com.sk89q.worldedit.world.item.ItemType; import com.sk89q.worldedit.world.item.ItemType;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.junit.Before; import org.junit.jupiter.api.Assertions;
import org.junit.Test; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.junit.Assert.assertEquals;
public class FlagTest { public class FlagTest {
@ -43,7 +42,7 @@ public class FlagTest {
private ItemType testBlock; private ItemType testBlock;
@Before @BeforeEach
public void setUp() throws Exception { public void setUp() throws Exception {
//EventUtil.manager = new EventUtilTest(); //EventUtil.manager = new EventUtilTest();
DBFunc.dbManager = new AbstractDBTest(); DBFunc.dbManager = new AbstractDBTest();
@ -72,7 +71,7 @@ public class FlagTest {
@Test @Test
public void testFlagName() { public void testFlagName() {
String flagName = PlotFlag.getFlagName(UseFlag.class); String flagName = PlotFlag.getFlagName(UseFlag.class);
assertEquals("use", flagName); Assertions.assertEquals("use", flagName);
} }
} }

View File

@ -25,17 +25,13 @@
*/ */
package com.plotsquared.core.plot; package com.plotsquared.core.plot;
import org.junit.Test; import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.NoSuchElementException; import java.util.NoSuchElementException;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;
public class PlotRangeIteratorTest { public class PlotRangeIteratorTest {
@Test @Test
@ -43,10 +39,10 @@ public class PlotRangeIteratorTest {
// an iterator that should only contain the given plot // an iterator that should only contain the given plot
PlotId id = PlotId.of(3, 7); PlotId id = PlotId.of(3, 7);
PlotId.PlotRangeIterator range = PlotId.PlotRangeIterator.range(id, id); PlotId.PlotRangeIterator range = PlotId.PlotRangeIterator.range(id, id);
assertTrue(range.hasNext()); Assertions.assertTrue(range.hasNext());
assertEquals(id, range.next()); Assertions.assertEquals(id, range.next());
assertFalse(range.hasNext()); Assertions.assertFalse(range.hasNext());
assertThrows(NoSuchElementException.class, range::next); Assertions.assertThrows(NoSuchElementException.class, range::next);
} }
// the tests below assume a specific order (first increasing y, then increasing x) // the tests below assume a specific order (first increasing y, then increasing x)
@ -61,11 +57,11 @@ public class PlotRangeIteratorTest {
List<PlotId> all = Arrays.asList(id00, id01, id10, id11); List<PlotId> all = Arrays.asList(id00, id01, id10, id11);
PlotId.PlotRangeIterator range = PlotId.PlotRangeIterator.range(id00, id11); PlotId.PlotRangeIterator range = PlotId.PlotRangeIterator.range(id00, id11);
for (PlotId id : all) { for (PlotId id : all) {
assertTrue(range.hasNext()); Assertions.assertTrue(range.hasNext());
assertEquals(id, range.next()); Assertions.assertEquals(id, range.next());
} }
assertFalse(range.hasNext()); Assertions.assertFalse(range.hasNext());
assertThrows(NoSuchElementException.class, range::next); Assertions.assertThrows(NoSuchElementException.class, range::next);
} }
@Test @Test
@ -80,11 +76,11 @@ public class PlotRangeIteratorTest {
List<PlotId> all = Arrays.asList(id00, id01, id02, id10, id11, id12); List<PlotId> all = Arrays.asList(id00, id01, id02, id10, id11, id12);
PlotId.PlotRangeIterator range = PlotId.PlotRangeIterator.range(id00, id12); PlotId.PlotRangeIterator range = PlotId.PlotRangeIterator.range(id00, id12);
for (PlotId id : all) { for (PlotId id : all) {
assertTrue(range.hasNext()); Assertions.assertTrue(range.hasNext());
assertEquals(id, range.next()); Assertions.assertEquals(id, range.next());
} }
assertFalse(range.hasNext()); Assertions.assertFalse(range.hasNext());
assertThrows(NoSuchElementException.class, range::next); Assertions.assertThrows(NoSuchElementException.class, range::next);
} }
@Test @Test
@ -99,11 +95,23 @@ public class PlotRangeIteratorTest {
List<PlotId> all = Arrays.asList(id00, id01, id10, id11, id20, id21); List<PlotId> all = Arrays.asList(id00, id01, id10, id11, id20, id21);
PlotId.PlotRangeIterator range = PlotId.PlotRangeIterator.range(id00, id21); PlotId.PlotRangeIterator range = PlotId.PlotRangeIterator.range(id00, id21);
for (PlotId id : all) { for (PlotId id : all) {
assertTrue(range.hasNext()); Assertions.assertTrue(range.hasNext());
assertEquals(id, range.next()); Assertions.assertEquals(id, range.next());
} }
assertFalse(range.hasNext()); Assertions.assertFalse(range.hasNext());
assertThrows(NoSuchElementException.class, range::next); Assertions.assertThrows(NoSuchElementException.class, range::next);
} }
@Test
public void resetYOfIteratorToStart() {
PlotId id00 = PlotId.of(0, 1);
PlotId id01 = PlotId.of(1, 2);
PlotId.PlotRangeIterator range = PlotId.PlotRangeIterator.range(id00, id01);
for (int i = 0; i < 4; i++) {
Assertions.assertNotEquals(0, range.next().getY());
}
Assertions.assertFalse(range.hasNext());
Assertions.assertThrows(NoSuchElementException.class, range::next);
}
} }

View File

@ -28,7 +28,7 @@ package com.plotsquared.core.plot;
import com.plotsquared.core.PlotVersion; import com.plotsquared.core.PlotVersion;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.junit.Test; import org.junit.jupiter.api.Test;
public class PlotVersionTest { public class PlotVersionTest {

View File

@ -25,6 +25,7 @@
*/ */
package com.plotsquared.core.synchronization; package com.plotsquared.core.synchronization;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
@ -32,9 +33,6 @@ import org.junit.jupiter.api.Test;
import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.locks.ReentrantLock;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertThrows;
class LockRepositoryTest { class LockRepositoryTest {
private LockKey key; private LockKey key;
@ -55,11 +53,9 @@ class LockRepositoryTest {
throw new IllegalStateException("Expected a ReentrantLock"); throw new IllegalStateException("Expected a ReentrantLock");
} }
assertThrows(IllegalStateException.class, () -> { Assertions.assertThrows(IllegalStateException.class, () -> this.lockRepository.useLock(this.key, () -> {
this.lockRepository.useLock(this.key, () -> {
throw new IllegalStateException(); throw new IllegalStateException();
}); }));
}); Assertions.assertFalse(lock.isLocked());
assertFalse(lock.isLocked());
} }
} }

View File

@ -18,7 +18,7 @@ plugins {
idea idea
} }
version = "6.1.3" version = "6.2.2"
allprojects { allprojects {
group = "com.plotsquared" group = "com.plotsquared"
@ -67,16 +67,23 @@ val javadocDir = rootDir.resolve("docs").resolve("javadoc").resolve(project.name
allprojects { allprojects {
dependencies { dependencies {
// Tests // Tests
testImplementation("junit:junit:4.13.2") testImplementation("org.junit.jupiter:junit-jupiter:5.8.2")
testImplementation("org.junit.jupiter:junit-jupiter:5.8.1")
} }
plugins.withId("java") { plugins.withId("java") {
the<JavaPluginExtension>().toolchain { the<JavaPluginExtension>().toolchain {
languageVersion.set(JavaLanguageVersion.of(16)) languageVersion.set(JavaLanguageVersion.of(17))
} }
} }
tasks.compileJava.configure {
options.release.set(16)
}
configurations.all {
attributes.attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 17)
}
configure<LicenseExtension> { configure<LicenseExtension> {
header(rootProject.file("HEADER.txt")) header(rootProject.file("HEADER.txt"))
include("**/*.java") include("**/*.java")
@ -236,7 +243,7 @@ tasks {
val rootOptions = aggregatedJavadocs.options as StandardJavadocDocletOptions val rootOptions = aggregatedJavadocs.options as StandardJavadocDocletOptions
val subOptions = task.options as StandardJavadocDocletOptions val subOptions = task.options as StandardJavadocDocletOptions
rootOptions.links(*subOptions.links.orEmpty().minus(rootOptions.links.orEmpty()).toTypedArray()) rootOptions.links(*subOptions.links.orEmpty().minus(rootOptions.links.orEmpty().toSet()).toTypedArray())
} }
} }
} }

View File

@ -1,46 +1,46 @@
[versions] [versions]
# Minecraft expectations # Minecraft expectations
guava = "21.0" # Version set by Minecraft gson = "2.8.9" # Version set by Minecraft
gson = "2.8.0" # Version set by Minecraft log4j-api = "2.17.0" # Version set by Minecraft
log4j-api = "2.14.1" # Version set by Minecraft guava = "31.0.1-jre" # Version set by Minecraft
# Platform expectations # Platform expectations
paper = "1.17.1-R0.1-SNAPSHOT" paper = "1.18.1-R0.1-SNAPSHOT"
checker-qual = "3.18.1" checker-qual = "3.21.0"
guice = "5.0.1" guice = "5.0.1"
findbugs = "3.0.1" findbugs = "3.0.1"
snakeyaml = "1.28" # Version set by Bukkit snakeyaml = "1.30" # Version set by Bukkit
# Adventure & MiniMessage # Adventure & MiniMessage
adventure-api = "4.9.2" adventure-api = "4.9.3"
adventure-text-minimessage = "4.1.0-SNAPSHOT" adventure-text-minimessage = "4.1.0-SNAPSHOT"
adventure-platform-bukkit = "4.0.0" adventure-platform-bukkit = "4.0.1"
# Plugins # Plugins
worldedit = "7.2.6" worldedit = "7.2.8"
fawe = "1.17-343" fawe = "1.17-419"
vault = "1.7.1" vault = "1.7.1"
placeholderapi = "2.10.10" placeholderapi = "2.11.1"
luckperms = "5.3" luckperms = "5.3"
essentialsx = "2.18.2" essentialsx = "2.19.2"
hyperverse = "0.6.0-SNAPSHOT" hyperverse = "0.6.0-SNAPSHOT"
mvdwapi = "3.1.1" mvdwapi = "3.1.1"
# Third party # Third party
prtree = "1.5.0" prtree = "2.0.0"
aopalliance = "1.0" aopalliance = "1.0"
pipeline = "1.4.0-SNAPSHOT" rorledning = "1.4.0-SNAPSHOT"
arkitektonika = "2.1.0" arkitektonika = "2.1.1"
paster = "1.1.1" paster = "1.1.3"
bstats = "2.2.1" bstats = "2.2.1"
paperlib = "1.0.6" paperlib = "1.0.7"
squirrelid = "0.3.0" squirrelid = "0.3.0"
serverlib = "2.3.1" serverlib = "2.3.1"
http4j = "1.3" http4j = "1.3"
# Gradle plugins # Gradle plugins
shadow = "7.1.0" shadow = "7.1.1"
grgit = "4.1.0" grgit = "4.1.1"
licenser = "0.6.1" licenser = "0.6.1"
nexus = "1.1.0" nexus = "1.1.0"
@ -50,7 +50,6 @@ paper = { group = "io.papermc.paper", name = "paper-api", version.ref = "paper"
checkerqual = { group = "org.checkerframework", name = "checker-qual", version.ref = "checker-qual" } checkerqual = { group = "org.checkerframework", name = "checker-qual", version.ref = "checker-qual" }
# Minecraft expectations # Minecraft expectations
guava = { group = "com.google.guava", name = "guava", version.ref = "guava" }
gson = { group = "com.google.code.gson", name = "gson", version.ref = "gson" } gson = { group = "com.google.code.gson", name = "gson", version.ref = "gson" }
log4j = { group = "org.apache.logging.log4j", name = "log4j-api", version.ref = "log4j-api" } log4j = { group = "org.apache.logging.log4j", name = "log4j-api", version.ref = "log4j-api" }
@ -73,13 +72,13 @@ fastasyncworldeditCore = { group = "com.fastasyncworldedit", name = "FastAsyncWo
vault = { group = "com.github.MilkBowl", name = "VaultAPI", version.ref = "vault" } vault = { group = "com.github.MilkBowl", name = "VaultAPI", version.ref = "vault" }
placeholderapi = { group = "me.clip", name = "placeholderapi", version.ref = "placeholderapi" } placeholderapi = { group = "me.clip", name = "placeholderapi", version.ref = "placeholderapi" }
luckperms = { group = "net.luckperms", name = "api", version.ref = "luckperms" } luckperms = { group = "net.luckperms", name = "api", version.ref = "luckperms" }
essentialsx = { group = "net.ess3", name = "EssentialsX", version.ref = "essentialsx" } essentialsx = { group = "net.essentialsx", name = "EssentialsX", version.ref = "essentialsx" }
hyperverse = { group = "se.hyperver.hyperverse", name = "Core", version.ref = "hyperverse" } hyperverse = { group = "se.hyperver.hyperverse", name = "Core", version.ref = "hyperverse" }
# Third party # Third party
prtree = { group = "org.khelekore", name = "prtree", version.ref = "prtree" } prtree = { group = "com.intellectualsites.prtree", name = "PRTree", version.ref = "prtree" }
aopalliance = { group = "aopalliance", name = "aopalliance", version.ref = "aopalliance" } aopalliance = { group = "aopalliance", name = "aopalliance", version.ref = "aopalliance" }
pipeline = { group = "com.intellectualsites", name = "Pipeline", version.ref = "pipeline" } rorledning = { group = "com.intellectualsites", name = "Pipeline", version.ref = "rorledning" }
mvdwapi = { group = "be.maximvdw", name = "MVdWPlaceholderAPI", version.ref = "mvdwapi" } mvdwapi = { group = "be.maximvdw", name = "MVdWPlaceholderAPI", version.ref = "mvdwapi" }
squirrelid = { group = "org.enginehub", name = "squirrelid", version.ref = "squirrelid" } squirrelid = { group = "org.enginehub", name = "squirrelid", version.ref = "squirrelid" }
serverlib = { group = "dev.notmyfault.serverlib", name = "ServerLib", version.ref = "serverlib" } serverlib = { group = "dev.notmyfault.serverlib", name = "ServerLib", version.ref = "serverlib" }
@ -88,6 +87,7 @@ paperlib = { group = "io.papermc", name = "paperlib", version.ref = "paperlib" }
arkitektonika = { group = "com.intellectualsites.arkitektonika", name = "Arkitektonika-Client", version.ref = "arkitektonika" } arkitektonika = { group = "com.intellectualsites.arkitektonika", name = "Arkitektonika-Client", version.ref = "arkitektonika" }
http4j = { group = "com.intellectualsites.http", name = "HTTP4J", version.ref = "http4j" } http4j = { group = "com.intellectualsites.http", name = "HTTP4J", version.ref = "http4j" }
paster = { group = "com.intellectualsites.paster", name = "Paster", version.ref = "paster" } paster = { group = "com.intellectualsites.paster", name = "Paster", version.ref = "paster" }
guava = { group = "com.google.guava", name = "guava", version.ref = "guava" }
[plugins] [plugins]
shadow = { id = "com.github.johnrengelman.shadow", version.ref = "shadow" } shadow = { id = "com.github.johnrengelman.shadow", version.ref = "shadow" }

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

269
gradlew vendored
View File

@ -1,7 +1,7 @@
#!/usr/bin/env sh #!/bin/sh
# #
# Copyright 2015 the original author or authors. # Copyright © 2015-2021 the original authors.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -17,67 +17,101 @@
# #
############################################################################## ##############################################################################
## #
## Gradle start up script for UN*X # Gradle start up script for POSIX generated by Gradle.
## #
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
############################################################################## ##############################################################################
# Attempt to set APP_HOME # Attempt to set APP_HOME
# Resolve links: $0 may be a link # Resolve links: $0 may be a link
PRG="$0" app_path=$0
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do # Need this for daisy-chained symlinks.
ls=`ls -ld "$PRG"` while
link=`expr "$ls" : '.*-> \(.*\)$'` APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
if expr "$link" : '/.*' > /dev/null; then [ -h "$app_path" ]
PRG="$link" do
else ls=$( ls -ld "$app_path" )
PRG=`dirname "$PRG"`"/$link" link=${ls#*' -> '}
fi case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle" APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"` APP_BASE_NAME=${0##*/}
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum" MAX_FD=maximum
warn () { warn () {
echo "$*" echo "$*"
} } >&2
die () { die () {
echo echo
echo "$*" echo "$*"
echo echo
exit 1 exit 1
} } >&2
# OS specific support (must be 'true' or 'false'). # OS specific support (must be 'true' or 'false').
cygwin=false cygwin=false
msys=false msys=false
darwin=false darwin=false
nonstop=false nonstop=false
case "`uname`" in case "$( uname )" in #(
CYGWIN* ) CYGWIN* ) cygwin=true ;; #(
cygwin=true Darwin* ) darwin=true ;; #(
;; MSYS* | MINGW* ) msys=true ;; #(
Darwin* ) NONSTOP* ) nonstop=true ;;
darwin=true
;;
MSYS* | MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
if [ -n "$JAVA_HOME" ] ; then if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables # IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java" JAVACMD=$JAVA_HOME/jre/sh/java
else else
JAVACMD="$JAVA_HOME/bin/java" JAVACMD=$JAVA_HOME/bin/java
fi fi
if [ ! -x "$JAVACMD" ] ; then if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the
location of your Java installation." location of your Java installation."
fi fi
else else
JAVACMD="java" JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the Please set the JAVA_HOME variable in your environment to match the
@ -106,80 +140,95 @@ location of your Java installation."
fi fi
# Increase the maximum file descriptors if we can. # Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
MAX_FD_LIMIT=`ulimit -H -n` case $MAX_FD in #(
if [ $? -eq 0 ] ; then max*)
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then MAX_FD=$( ulimit -H -n ) ||
MAX_FD="$MAX_FD_LIMIT" warn "Could not query maximum file descriptor limit"
fi esac
ulimit -n $MAX_FD case $MAX_FD in #(
if [ $? -ne 0 ] ; then '' | soft) :;; #(
warn "Could not set maximum file descriptor limit: $MAX_FD" *)
fi ulimit -n "$MAX_FD" ||
else warn "Could not set maximum file descriptor limit to $MAX_FD"
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac esac
fi fi
# Escape application args # Collect all arguments for the java command, stacking in reverse order:
save () { # * args from the command line
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done # * the main class name
echo " " # * -classpath
} # * -D...appname settings
APP_ARGS=`save "$@"` # * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# Collect all arguments for the java command, following the shell quoting and substitution rules # For Cygwin or MSYS, switch paths to Windows format before running java
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@" exec "$JAVACMD" "$@"

View File

@ -6,6 +6,7 @@
"ignoreDeps": [ "ignoreDeps": [
"guava", "guava",
"com.google.guava:guava", "com.google.guava:guava",
"com.google.code.gson:gson",
"gson", "gson",
"snakeyaml" "snakeyaml"
], ],
@ -14,5 +15,6 @@
"on monday after 9am" "on monday after 9am"
], ],
"labels": ["Renovate"], "labels": ["Renovate"],
"commitMessagePrefix": "chore: " "commitMessagePrefix": "build: ",
"rebaseWhen": "conflicted"
} }