mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-07-14 19:34:43 +02:00
Compare commits
22 Commits
Author | SHA1 | Date | |
---|---|---|---|
93d99630a9 | |||
47ae79e123 | |||
f9ad00c2c8 | |||
566af259db | |||
d9a6431078 | |||
e9c9375e78 | |||
7c99c8aabf | |||
88eb8f88a7 | |||
fd118c2c37 | |||
858b6b5471 | |||
f086826942 | |||
9c84dc2bc0 | |||
cba0f3ac1f | |||
b9a130ab00 | |||
688056352b | |||
2a40f52dea | |||
3ed369de19 | |||
bec51401a3 | |||
109f884b5f | |||
8f3fa419c4 | |||
a9f08bc885 | |||
a8923ec729 |
4
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
4
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
@ -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'
|
||||||
|
6
.github/workflows/build.yml
vendored
6
.github/workflows/build.yml
vendored
@ -7,11 +7,11 @@ jobs:
|
|||||||
runs-on: "ubuntu-20.04"
|
runs-on: "ubuntu-20.04"
|
||||||
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.4.0"
|
||||||
with:
|
with:
|
||||||
distribution: "temurin"
|
distribution: "temurin"
|
||||||
java-version: "17"
|
java-version: "17"
|
||||||
@ -27,7 +27,7 @@ jobs:
|
|||||||
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 }}"
|
||||||
|
@ -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/")
|
||||||
}
|
}
|
||||||
|
@ -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)
|
||||||
@ -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)
|
||||||
|
@ -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;
|
||||||
|
@ -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),
|
||||||
|
@ -208,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;
|
||||||
|
@ -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();
|
||||||
|
@ -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 {
|
||||||
|
@ -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
|
||||||
|
@ -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"),
|
||||||
|
@ -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);
|
||||||
|
@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -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();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -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;
|
@ -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++;
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
|
@ -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()) {
|
||||||
|
@ -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;
|
||||||
@ -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);
|
||||||
|
@ -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;
|
||||||
|
@ -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());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -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 {
|
||||||
|
|
||||||
|
@ -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());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ plugins {
|
|||||||
idea
|
idea
|
||||||
}
|
}
|
||||||
|
|
||||||
version = "6.1.4"
|
version = "6.2.1"
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
group = "com.plotsquared"
|
group = "com.plotsquared"
|
||||||
@ -67,8 +67,7 @@ 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") {
|
||||||
@ -236,7 +235,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())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
[versions]
|
[versions]
|
||||||
# Minecraft expectations
|
# Minecraft expectations
|
||||||
guava = "21.0" # Version set by Minecraft
|
|
||||||
gson = "2.8.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
|
# Platform expectations
|
||||||
paper = "1.17.1-R0.1-SNAPSHOT"
|
paper = "1.17.1-R0.1-SNAPSHOT"
|
||||||
checker-qual = "3.19.0"
|
checker-qual = "3.20.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.28" # Version set by Bukkit
|
||||||
@ -14,33 +14,33 @@ snakeyaml = "1.28" # Version set by Bukkit
|
|||||||
# Adventure & MiniMessage
|
# Adventure & MiniMessage
|
||||||
adventure-api = "4.9.3"
|
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.7"
|
worldedit = "7.2.8"
|
||||||
fawe = "1.17-390"
|
fawe = "1.17-419"
|
||||||
vault = "1.7.1"
|
vault = "1.7.1"
|
||||||
placeholderapi = "2.10.10"
|
placeholderapi = "2.10.10"
|
||||||
luckperms = "5.3"
|
luckperms = "5.3"
|
||||||
essentialsx = "2.18.2"
|
essentialsx = "2.19.0"
|
||||||
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.1"
|
||||||
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.0"
|
||||||
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" }
|
||||||
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -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.3-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.1-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
@ -15,5 +15,6 @@
|
|||||||
"on monday after 9am"
|
"on monday after 9am"
|
||||||
],
|
],
|
||||||
"labels": ["Renovate"],
|
"labels": ["Renovate"],
|
||||||
"commitMessagePrefix": "chore: "
|
"commitMessagePrefix": "build: ",
|
||||||
|
"rebaseWhen": "conflicted"
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user