Compare commits

...

22 Commits
6.1.4 ... 6.2.1

Author SHA1 Message Date
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
32 changed files with 471 additions and 89 deletions

View File

@ -18,8 +18,6 @@ body:
options:
- Paper
- Spigot
- Tuinity
- Purpur
validations:
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.
multiple: false
options:
- '1.18.1'
- '1.18'
- '1.17.1'
- '1.16.5'
- '1.15.2'

View File

@ -7,11 +7,11 @@ jobs:
runs-on: "ubuntu-20.04"
steps:
- name: "Checkout Repository"
uses: "actions/checkout@v2.3.4"
uses: "actions/checkout@v2.4.0"
- name: "Validate Gradle Wrapper"
uses: "gradle/wrapper-validation-action@v1.0.4"
- name: "Setup Java"
uses: "actions/setup-java@v2.3.1"
uses: "actions/setup-java@v2.4.0"
with:
distribution: "temurin"
java-version: "17"
@ -27,7 +27,7 @@ jobs:
fi
- name: "Publish Release"
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:
ORG_GRADLE_PROJECT_sonatypeUsername: "${{ secrets.SONATYPE_USERNAME }}"
ORG_GRADLE_PROJECT_sonatypePassword: "${{ secrets.SONATYPE_PASSWORD }}"

View File

@ -95,9 +95,9 @@ tasks {
withType<Javadoc> {
val opt = options as StandardJavadocDocletOptions
opt.links("https://papermc.io/javadocs/paper/1.17/")
opt.links("https://docs.enginehub.org/javadoc/com.sk89q.worldedit/worldedit-core/7.2.6/")
opt.links("https://docs.enginehub.org/javadoc/com.sk89q.worldedit/worldedit-bukkit/7.2.6/")
opt.links("https://jd.adventure.kyori.net/api/4.9.1/")
opt.links("https://docs.enginehub.org/javadoc/com.sk89q.worldedit/worldedit-core/7.2.7/")
opt.links("https://docs.enginehub.org/javadoc/com.sk89q.worldedit/worldedit-bukkit/7.2.7/")
opt.links("https://jd.adventure.kyori.net/api/4.9.3/")
opt.links("https://google.github.io/guice/api-docs/5.0.1/javadoc/")
opt.links("https://checkerframework.org/api/")
}

View File

@ -5,8 +5,8 @@ dependencies {
compileOnlyApi(libs.checkerqual)
// Minecraft expectations
compileOnlyApi(libs.guava)
compileOnlyApi(libs.gson)
compileOnly(libs.guava)
// Platform expectations
compileOnlyApi(libs.snakeyaml)
@ -40,7 +40,7 @@ dependencies {
// Other libraries
api(libs.prtree)
api(libs.aopalliance)
api(libs.pipeline) {
api(libs.rorledning) {
exclude(group = "com.google.guava")
}
api(libs.arkitektonika)

View File

@ -758,6 +758,9 @@ public class PlotSquared {
if (this_max < last_max) {
plot.getArea().setMeta("lastPlot", plot.getId());
}
if (callEvent) {
eventDispatcher.callPostDelete(plot);
}
return true;
}
return false;

View File

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

View File

@ -208,13 +208,15 @@ public class Claim extends SubCommand {
Template.of("value", "Auto merge on claim")
);
} else {
plot.getPlotModificationManager().autoMerge(
if (plot.getPlotModificationManager().autoMerge(
mergeEvent.getDir(),
mergeEvent.getMax(),
player.getUUID(),
player,
true
);
)) {
eventDispatcher.callPostMerge(player, plot);
}
}
}
return null;

View File

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

View File

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

View File

@ -189,6 +189,7 @@ public class Merge extends SubCommand {
);
}
player.sendMessage(TranslatableCaption.of("merge.success_merge"));
eventDispatcher.callPostMerge(player, plot);
return true;
}
player.sendMessage(TranslatableCaption.of("merge.no_available_automerge"));
@ -225,6 +226,7 @@ public class Merge extends SubCommand {
);
}
player.sendMessage(TranslatableCaption.of("merge.success_merge"));
eventDispatcher.callPostMerge(player, plot);
return true;
}
Plot adjacent = plot.getRelative(direction);
@ -272,6 +274,7 @@ public class Merge extends SubCommand {
);
}
player.sendMessage(TranslatableCaption.of("merge.success_merge"));
eventDispatcher.callPostMerge(player, plot);
};
if (!force && hasConfirmation(player)) {
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 net.kyori.adventure.text.minimessage.Template;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.Collection;
import java.util.Collections;
@ -76,6 +77,7 @@ public class Owner extends SetCommand {
);
return false;
}
@Nullable final UUID oldOwner = plot.getOwnerAbs();
Set<Plot> plots = plot.getConnectedPlots();
final Consumer<UUID> uuidConsumer = uuid -> {
@ -124,12 +126,15 @@ public class Owner extends SetCommand {
);
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();
for (Plot current : connected) {
current.unclaim();
current.getPlotModificationManager().removeSign();
}
eventDispatcher.callPostOwnerChange(player, plot, oldOwner);
player.sendMessage(TranslatableCaption.of("owner.set_owner"));
return;
}
@ -178,6 +183,7 @@ public class Owner extends SetCommand {
}
plot.getPlotModificationManager().setSign(finalName);
player.sendMessage(TranslatableCaption.of("owner.set_owner"));
eventDispatcher.callPostOwnerChange(player, plot, oldOwner);
if (other != null) {
other.sendMessage(
TranslatableCaption.of("owner.now_owner"),

View File

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

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

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

View File

@ -229,8 +229,8 @@ public final class PlotModificationManager {
!isDelete,
isDelete ? PlotUnlinkEvent.REASON.DELETE : PlotUnlinkEvent.REASON.CLEAR
);
if (event.getEventResult() != Result.DENY) {
this.unlinkPlot(event.isCreateRoad(), event.isCreateSign());
if (event.getEventResult() != Result.DENY && this.unlinkPlot(event.isCreateRoad(), event.isCreateSign())) {
PlotSquared.get().getEventDispatcher().callPostUnlink(plot, event.getReason());
}
final PlotManager manager = this.plot.getArea().getPlotManager();
Runnable run = new Runnable() {
@ -502,7 +502,9 @@ public final class PlotModificationManager {
}
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;

View File

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

View File

@ -51,6 +51,11 @@ import com.plotsquared.core.events.PlotMergeEvent;
import com.plotsquared.core.events.PlotRateEvent;
import com.plotsquared.core.events.PlotUnlinkEvent;
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.location.Direction;
import com.plotsquared.core.location.Location;
@ -135,6 +140,12 @@ public class EventDispatcher {
return event;
}
public PostPlayerAutoPlotEvent callPostAuto(PlotPlayer<?> player, Plot plot) {
PostPlayerAutoPlotEvent event = new PostPlayerAutoPlotEvent(player, plot);
callEvent(event);
return event;
}
public PlayerAutoPlotsChosenEvent callAutoPlotsChosen(
PlotPlayer<?> player, List<Plot> plots
) {
@ -174,6 +185,12 @@ public class EventDispatcher {
return event;
}
public PostPlotDeleteEvent callPostDelete(Plot plot) {
PostPlotDeleteEvent event = new PostPlotDeleteEvent(plot);
callEvent(event);
return event;
}
public PlotFlagAddEvent callFlagAdd(PlotFlag<?, ?> flag, Plot plot) {
PlotFlagAddEvent event = new PlotFlagAddEvent(flag, plot);
callEvent(event);
@ -192,6 +209,12 @@ public class EventDispatcher {
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) {
PlotAutoMergeEvent event = new PlotAutoMergeEvent(plot.getWorldName(), plot, plots);
callEvent(event);
@ -207,6 +230,12 @@ public class EventDispatcher {
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) {
PlayerEnterPlotEvent event = new PlayerEnterPlotEvent(player, plot);
callEvent(event);
@ -256,6 +285,12 @@ public class EventDispatcher {
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) {
PlotRateEvent event = new PlotRateEvent(player, rating, plot);
eventBus.post(event);

View File

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

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.format.NamedTextColor;
import net.kyori.adventure.text.format.TextDecoration;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
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 {
@ -53,7 +51,7 @@ class ClickStripTransformTest {
)
);
var transformedComponent = transform.transform(component);
assertNull(transformedComponent.clickEvent());
Assertions.assertNull(transformedComponent.clickEvent());
}
@Test
@ -68,7 +66,7 @@ class ClickStripTransformTest {
var component = Component.text("Hello")
.clickEvent(originalClickEvent);
var transformedComponent = transform.transform(component);
assertEquals(originalClickEvent, transformedComponent.clickEvent());
Assertions.assertEquals(originalClickEvent, transformedComponent.clickEvent());
}
@Test
@ -88,9 +86,9 @@ class ClickStripTransformTest {
inner.clickEvent(ClickEvent.clickEvent(ClickEvent.Action.OPEN_URL, "https://example.org"))
);
var transformedComponent = transform.transform(component);
assertFalse(transformedComponent.children().isEmpty()); // child still exists
assertEquals(inner, transformedComponent.children().get(0)); // only the click event has changed
assertNull(transformedComponent.children().get(0).clickEvent());
Assertions.assertFalse(transformedComponent.children().isEmpty()); // child still exists
Assertions.assertEquals(inner, transformedComponent.children().get(0)); // only the click event has changed
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 org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
public class FlagTest {
@ -43,7 +42,7 @@ public class FlagTest {
private ItemType testBlock;
@Before
@BeforeEach
public void setUp() throws Exception {
//EventUtil.manager = new EventUtilTest();
DBFunc.dbManager = new AbstractDBTest();
@ -72,7 +71,7 @@ public class FlagTest {
@Test
public void testFlagName() {
String flagName = PlotFlag.getFlagName(UseFlag.class);
assertEquals("use", flagName);
Assertions.assertEquals("use", flagName);
}
}

View File

@ -25,17 +25,13 @@
*/
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.List;
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 {
@Test
@ -43,10 +39,10 @@ public class PlotRangeIteratorTest {
// an iterator that should only contain the given plot
PlotId id = PlotId.of(3, 7);
PlotId.PlotRangeIterator range = PlotId.PlotRangeIterator.range(id, id);
assertTrue(range.hasNext());
assertEquals(id, range.next());
assertFalse(range.hasNext());
assertThrows(NoSuchElementException.class, range::next);
Assertions.assertTrue(range.hasNext());
Assertions.assertEquals(id, range.next());
Assertions.assertFalse(range.hasNext());
Assertions.assertThrows(NoSuchElementException.class, range::next);
}
// 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);
PlotId.PlotRangeIterator range = PlotId.PlotRangeIterator.range(id00, id11);
for (PlotId id : all) {
assertTrue(range.hasNext());
assertEquals(id, range.next());
Assertions.assertTrue(range.hasNext());
Assertions.assertEquals(id, range.next());
}
assertFalse(range.hasNext());
assertThrows(NoSuchElementException.class, range::next);
Assertions.assertFalse(range.hasNext());
Assertions.assertThrows(NoSuchElementException.class, range::next);
}
@Test
@ -80,11 +76,11 @@ public class PlotRangeIteratorTest {
List<PlotId> all = Arrays.asList(id00, id01, id02, id10, id11, id12);
PlotId.PlotRangeIterator range = PlotId.PlotRangeIterator.range(id00, id12);
for (PlotId id : all) {
assertTrue(range.hasNext());
assertEquals(id, range.next());
Assertions.assertTrue(range.hasNext());
Assertions.assertEquals(id, range.next());
}
assertFalse(range.hasNext());
assertThrows(NoSuchElementException.class, range::next);
Assertions.assertFalse(range.hasNext());
Assertions.assertThrows(NoSuchElementException.class, range::next);
}
@Test
@ -99,11 +95,23 @@ public class PlotRangeIteratorTest {
List<PlotId> all = Arrays.asList(id00, id01, id10, id11, id20, id21);
PlotId.PlotRangeIterator range = PlotId.PlotRangeIterator.range(id00, id21);
for (PlotId id : all) {
assertTrue(range.hasNext());
assertEquals(id, range.next());
Assertions.assertTrue(range.hasNext());
Assertions.assertEquals(id, range.next());
}
assertFalse(range.hasNext());
assertThrows(NoSuchElementException.class, range::next);
Assertions.assertFalse(range.hasNext());
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 org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.junit.Test;
import org.junit.jupiter.api.Test;
public class PlotVersionTest {

View File

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

View File

@ -18,7 +18,7 @@ plugins {
idea
}
version = "6.1.4"
version = "6.2.1"
allprojects {
group = "com.plotsquared"
@ -67,8 +67,7 @@ val javadocDir = rootDir.resolve("docs").resolve("javadoc").resolve(project.name
allprojects {
dependencies {
// Tests
testImplementation("junit:junit:4.13.2")
testImplementation("org.junit.jupiter:junit-jupiter:5.8.1")
testImplementation("org.junit.jupiter:junit-jupiter:5.8.2")
}
plugins.withId("java") {
@ -236,7 +235,7 @@ tasks {
val rootOptions = aggregatedJavadocs.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,12 +1,12 @@
[versions]
# Minecraft expectations
guava = "21.0" # Version set by Minecraft
gson = "2.8.0" # Version set by Minecraft
log4j-api = "2.14.1" # Version set by Minecraft
log4j-api = "2.16.0" # Version set by Minecraft
guava = "21.0" # Version set by Minecraft
# Platform expectations
paper = "1.17.1-R0.1-SNAPSHOT"
checker-qual = "3.19.0"
checker-qual = "3.20.0"
guice = "5.0.1"
findbugs = "3.0.1"
snakeyaml = "1.28" # Version set by Bukkit
@ -14,33 +14,33 @@ snakeyaml = "1.28" # Version set by Bukkit
# Adventure & MiniMessage
adventure-api = "4.9.3"
adventure-text-minimessage = "4.1.0-SNAPSHOT"
adventure-platform-bukkit = "4.0.0"
adventure-platform-bukkit = "4.0.1"
# Plugins
worldedit = "7.2.7"
fawe = "1.17-390"
worldedit = "7.2.8"
fawe = "1.17-419"
vault = "1.7.1"
placeholderapi = "2.10.10"
luckperms = "5.3"
essentialsx = "2.18.2"
essentialsx = "2.19.0"
hyperverse = "0.6.0-SNAPSHOT"
mvdwapi = "3.1.1"
# Third party
prtree = "1.5.0"
prtree = "2.0.0"
aopalliance = "1.0"
pipeline = "1.4.0-SNAPSHOT"
arkitektonika = "2.1.0"
rorledning = "1.4.0-SNAPSHOT"
arkitektonika = "2.1.1"
paster = "1.1.1"
bstats = "2.2.1"
paperlib = "1.0.6"
paperlib = "1.0.7"
squirrelid = "0.3.0"
serverlib = "2.3.1"
http4j = "1.3"
# Gradle plugins
shadow = "7.1.0"
grgit = "4.1.0"
grgit = "4.1.1"
licenser = "0.6.1"
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" }
# Minecraft expectations
guava = { group = "com.google.guava", name = "guava", version.ref = "guava" }
gson = { group = "com.google.code.gson", name = "gson", version.ref = "gson" }
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" }
placeholderapi = { group = "me.clip", name = "placeholderapi", version.ref = "placeholderapi" }
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" }
# 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" }
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" }
squirrelid = { group = "org.enginehub", name = "squirrelid", version.ref = "squirrelid" }
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" }
http4j = { group = "com.intellectualsites.http", name = "HTTP4J", version.ref = "http4j" }
paster = { group = "com.intellectualsites.paster", name = "Paster", version.ref = "paster" }
guava = { group = "com.google.guava", name = "guava", version.ref = "guava" }
[plugins]
shadow = { id = "com.github.johnrengelman.shadow", version.ref = "shadow" }

View File

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

View File

@ -15,5 +15,6 @@
"on monday after 9am"
],
"labels": ["Renovate"],
"commitMessagePrefix": "chore: "
"commitMessagePrefix": "build: ",
"rebaseWhen": "conflicted"
}