Compare commits

...

6 Commits

Author SHA1 Message Date
Marcus Rokatis 14f0f3333f
Merge 1bfc6a9ac0 into c57d784df7 2024-04-23 02:10:54 +00:00
renovate[bot] c57d784df7 Update dependency xyz.jpenilla.run-paper to v2.2.4 2024-04-23 02:10:41 +00:00
Marcus Rokatis 1bfc6a9ac0
Merge branch 'main' into allow-pistons-breaking-blocks 2023-07-12 14:38:28 +02:00
Marcus Rokatis cd6e63a1ec Remove comments 2022-07-17 08:24:26 +02:00
Marcus Rokatis fcc7036423 Do not break blocks on the border
Only break if the pushed block is within plot or outside plot area
2022-07-17 08:22:06 +02:00
Marcus Rokatis e5ca8597da Allow pistons to break blocks at borders
Pistons are now able to break blocks when pushing against a plot border or plot area border
2022-07-16 14:49:40 +02:00
2 changed files with 5 additions and 4 deletions

View File

@ -71,6 +71,7 @@ import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockState;
import org.bukkit.block.PistonMoveReaction;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.type.Dispenser;
import org.bukkit.block.data.type.Farmland;
@ -929,7 +930,7 @@ public class BlockEventListener implements Listener {
Location bloc = BukkitUtil.adapt(block1.getLocation());
if (bloc.isPlotArea() || bloc
.add(relative.getBlockX(), relative.getBlockY(), relative.getBlockZ())
.isPlotArea()) {
.isPlotArea() && block1.getPistonMoveReaction() != PistonMoveReaction.BREAK) {
event.setCancelled(true);
return;
}
@ -949,11 +950,11 @@ public class BlockEventListener implements Listener {
for (Block block1 : event.getBlocks()) {
Location bloc = BukkitUtil.adapt(block1.getLocation());
Location newLoc = bloc.add(relative.getBlockX(), relative.getBlockY(), relative.getBlockZ());
if (!area.contains(bloc.getX(), bloc.getZ()) || !area.contains(newLoc)) {
if (!area.contains(bloc.getX(), bloc.getZ()) || !area.contains(newLoc) && block1.getPistonMoveReaction() != PistonMoveReaction.BREAK) {
event.setCancelled(true);
return;
}
if (!plot.equals(area.getOwnedPlot(bloc)) || !plot.equals(area.getOwnedPlot(newLoc))) {
if (!plot.equals(area.getOwnedPlot(bloc)) || !plot.equals(area.getOwnedPlot(newLoc)) && block1.getPistonMoveReaction() != PistonMoveReaction.BREAK) {
event.setCancelled(true);
return;
}

View File

@ -37,7 +37,7 @@ shadow = "8.1.1"
grgit = "4.1.1"
spotless = "6.25.0"
nexus = "2.0.0"
runPaper = "2.2.3"
runPaper = "2.2.4"
[libraries]
# Platform expectations