Merge branch 'v6' into v7

This commit is contained in:
Alexander Brandes
2022-06-10 01:14:09 +02:00
9 changed files with 77 additions and 120 deletions

View File

@ -21,20 +21,20 @@ dependencies {
api(projects.plotsquaredCore)
// Metrics
implementation(libs.bstats)
implementation("org.bstats:bstats-bukkit")
// Paper
compileOnly(libs.paper)
implementation(libs.paperlib)
implementation("io.papermc:paperlib")
// Plugins
compileOnly(libs.worldeditBukkit) {
exclude(group = "org.bukkit")
exclude(group = "org.spigotmc")
}
compileOnly(libs.fastasyncworldeditBukkit) { isTransitive = false }
testImplementation(libs.fastasyncworldeditBukkit) { isTransitive = false }
compileOnly(libs.vault) {
compileOnly("com.fastasyncworldedit:FastAsyncWorldEdit-Bukkit") { isTransitive = false }
testImplementation("com.fastasyncworldedit:FastAsyncWorldEdit-Bukkit") { isTransitive = false }
compileOnly("com.github.MilkBowl:VaultAPI") {
exclude(group = "org.bukkit")
}
compileOnly(libs.placeholderapi)
@ -44,15 +44,15 @@ dependencies {
// Other libraries
implementation(libs.squirrelid) { isTransitive = false }
implementation(libs.serverlib)
implementation("dev.notmyfault.serverlib:ServerLib")
// Our libraries
implementation(libs.arkitektonika)
implementation(libs.http4j)
implementation(libs.paster)
implementation("com.intellectualsites.paster:Paster")
// Adventure
implementation(libs.adventurePlatformBukkit)
implementation("net.kyori:adventure-platform-bukkit")
}
tasks.processResources {
@ -97,7 +97,7 @@ tasks.named<ShadowJar>("shadowJar") {
tasks {
withType<Javadoc> {
val opt = options as StandardJavadocDocletOptions
opt.links("https://papermc.io/javadocs/paper/1.18/")
opt.links("https://jd.papermc.io/paper/1.18/")
opt.links("https://docs.enginehub.org/javadoc/com.sk89q.worldedit/worldedit-bukkit/" + libs.worldeditBukkit.get().versionConstraint.toString())
opt.links("https://javadoc.io/doc/com.plotsquared/PlotSquared-Core/latest/")
opt.links("https://jd.adventure.kyori.net/api/" + libs.adventure.get().versionConstraint.toString())

View File

@ -575,6 +575,10 @@ public class BlockEventListener implements Listener {
if (plot == null) {
return;
}
if (location.getY() >= area.getMaxBuildHeight() || location.getY() < area.getMinBuildHeight()) {
event.setCancelled(true);
return;
}
switch (event.getNewState().getType()) {
case SNOW:
case SNOW_BLOCK:
@ -774,62 +778,66 @@ public class BlockEventListener implements Listener {
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onChange(BlockFromToEvent event) {
Block from = event.getBlock();
Block fromBlock = event.getBlock();
// Check liquid flow flag inside of origin plot too
final Location fLocation = BukkitUtil.adapt(from.getLocation());
final PlotArea fromArea = fLocation.getPlotArea();
final Location fromLocation = BukkitUtil.adapt(fromBlock.getLocation());
final PlotArea fromArea = fromLocation.getPlotArea();
if (fromArea != null) {
final Plot plot = fromArea.getOwnedPlot(fLocation);
if (plot != null && plot.getFlag(LiquidFlowFlag.class) == LiquidFlowFlag.FlowStatus.DISABLED && event
final Plot fromPlot = fromArea.getOwnedPlot(fromLocation);
if (fromPlot != null && fromPlot.getFlag(LiquidFlowFlag.class) == LiquidFlowFlag.FlowStatus.DISABLED && event
.getBlock()
.isLiquid()) {
plot.debug("Liquid could not flow because liquid-flow = disabled");
fromPlot.debug("Liquid could not flow because liquid-flow = disabled");
event.setCancelled(true);
return;
}
}
Block to = event.getToBlock();
Location tLocation = BukkitUtil.adapt(to.getLocation());
PlotArea area = tLocation.getPlotArea();
if (area == null) {
if (from.getType() == Material.DRAGON_EGG && fromArea != null) {
Block toBlock = event.getToBlock();
Location toLocation = BukkitUtil.adapt(toBlock.getLocation());
PlotArea toArea = toLocation.getPlotArea();
if (toArea == null) {
if (fromBlock.getType() == Material.DRAGON_EGG && fromArea != null) {
event.setCancelled(true);
}
return;
}
Plot plot = area.getOwnedPlot(tLocation);
if (toLocation.getY() >= toArea.getMaxBuildHeight() || toLocation.getY() < toArea.getMinBuildHeight()) {
event.setCancelled(true);
return;
}
Plot toPlot = toArea.getOwnedPlot(toLocation);
if (from.getType() == Material.DRAGON_EGG && fromArea != null) {
final Plot fromPlot = fromArea.getOwnedPlot(fLocation);
if (fromBlock.getType() == Material.DRAGON_EGG && fromArea != null) {
final Plot fromPlot = fromArea.getOwnedPlot(fromLocation);
if (fromPlot != null || plot != null) {
if ((fromPlot == null || !fromPlot.equals(plot)) && (plot == null || !plot.equals(fromPlot))) {
if (fromPlot != null || toPlot != null) {
if ((fromPlot == null || !fromPlot.equals(toPlot)) && (toPlot == null || !toPlot.equals(fromPlot))) {
event.setCancelled(true);
return;
}
}
}
if (plot != null) {
if (!area.contains(fLocation.getX(), fLocation.getZ()) || !Objects.equals(plot, area.getOwnedPlot(fLocation))) {
if (toPlot != null) {
if (!toArea.contains(fromLocation.getX(), fromLocation.getZ()) || !Objects.equals(toPlot, toArea.getOwnedPlot(fromLocation))) {
event.setCancelled(true);
return;
}
if (plot.getFlag(LiquidFlowFlag.class) == LiquidFlowFlag.FlowStatus.ENABLED && event.getBlock().isLiquid()) {
if (toPlot.getFlag(LiquidFlowFlag.class) == LiquidFlowFlag.FlowStatus.ENABLED && event.getBlock().isLiquid()) {
return;
}
if (plot.getFlag(DisablePhysicsFlag.class)) {
plot.debug(event.getBlock().getType() + " could not update because disable-physics = true");
if (toPlot.getFlag(DisablePhysicsFlag.class)) {
toPlot.debug(event.getBlock().getType() + " could not update because disable-physics = true");
event.setCancelled(true);
return;
}
if (plot.getFlag(LiquidFlowFlag.class) == LiquidFlowFlag.FlowStatus.DISABLED && event.getBlock().isLiquid()) {
plot.debug("Liquid could not flow because liquid-flow = disabled");
if (toPlot.getFlag(LiquidFlowFlag.class) == LiquidFlowFlag.FlowStatus.DISABLED && event.getBlock().isLiquid()) {
toPlot.debug("Liquid could not flow because liquid-flow = disabled");
event.setCancelled(true);
}
} else if (!area.contains(fLocation.getX(), fLocation.getZ()) || !Objects.equals(null, area.getOwnedPlot(fLocation))) {
} else if (!toArea.contains(fromLocation.getX(), fromLocation.getZ()) || !Objects.equals(null, toArea.getOwnedPlot(fromLocation))) {
event.setCancelled(true);
} else if (event.getBlock().isLiquid()) {
final org.bukkit.Location location = event.getBlock().getLocation();