mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-07-04 06:34:42 +02:00
Compare commits
3 Commits
fix-unload
...
feature/v6
Author | SHA1 | Date | |
---|---|---|---|
ca42da4bec | |||
738f89f5dd | |||
ca7e9c9bd8 |
@ -265,8 +265,7 @@ public class BlockEventListener implements Listener {
|
|||||||
BukkitPlayer pp = BukkitUtil.adapt(player);
|
BukkitPlayer pp = BukkitUtil.adapt(player);
|
||||||
Plot plot = area.getPlot(location);
|
Plot plot = area.getPlot(location);
|
||||||
if (plot != null) {
|
if (plot != null) {
|
||||||
if ((location.getY() >= area.getMaxBuildHeight() || location.getY() < area
|
if (!area.buildRangeContainsY(location.getY()) && !Permissions
|
||||||
.getMinBuildHeight()) && !Permissions
|
|
||||||
.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) {
|
.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
pp.sendMessage(
|
pp.sendMessage(
|
||||||
@ -274,6 +273,7 @@ public class BlockEventListener implements Listener {
|
|||||||
Template.of("minHeight", String.valueOf(area.getMinBuildHeight())),
|
Template.of("minHeight", String.valueOf(area.getMinBuildHeight())),
|
||||||
Template.of("maxHeight", String.valueOf(area.getMaxBuildHeight()))
|
Template.of("maxHeight", String.valueOf(area.getMaxBuildHeight()))
|
||||||
);
|
);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_UNOWNED)) {
|
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_UNOWNED)) {
|
||||||
@ -351,8 +351,7 @@ public class BlockEventListener implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if ((location.getY() >= area.getMaxBuildHeight() || location.getY() < area
|
} else if (!area.buildRangeContainsY(location.getY()) && !Permissions
|
||||||
.getMinBuildHeight()) && !Permissions
|
|
||||||
.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) {
|
.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
plotPlayer.sendMessage(
|
plotPlayer.sendMessage(
|
||||||
@ -360,6 +359,7 @@ public class BlockEventListener implements Listener {
|
|||||||
Template.of("minHeight", String.valueOf(area.getMinBuildHeight())),
|
Template.of("minHeight", String.valueOf(area.getMinBuildHeight())),
|
||||||
Template.of("maxHeight", String.valueOf(area.getMaxBuildHeight()))
|
Template.of("maxHeight", String.valueOf(area.getMaxBuildHeight()))
|
||||||
);
|
);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
if (!Permissions
|
if (!Permissions
|
||||||
@ -537,7 +537,7 @@ public class BlockEventListener implements Listener {
|
|||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (location.getY() >= area.getMaxBuildHeight() || location.getY() < area.getMinBuildHeight()) {
|
if (!area.buildRangeContainsY(location.getY())) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -739,7 +739,7 @@ public class BlockEventListener implements Listener {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (toLocation.getY() >= toArea.getMaxBuildHeight() || toLocation.getY() < toArea.getMinBuildHeight()) {
|
if (!toArea.buildRangeContainsY(toLocation.getY())) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -813,6 +813,11 @@ public class BlockEventListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!area.buildRangeContainsY(location.getY())) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Plot plot = location.getOwnedPlot();
|
Plot plot = location.getOwnedPlot();
|
||||||
if (plot == null || !plot.getFlag(CropGrowFlag.class)) {
|
if (plot == null || !plot.getFlag(CropGrowFlag.class)) {
|
||||||
if (plot != null) {
|
if (plot != null) {
|
||||||
@ -856,15 +861,16 @@ public class BlockEventListener implements Listener {
|
|||||||
}
|
}
|
||||||
for (Block block1 : event.getBlocks()) {
|
for (Block block1 : event.getBlocks()) {
|
||||||
Location bloc = BukkitUtil.adapt(block1.getLocation());
|
Location bloc = BukkitUtil.adapt(block1.getLocation());
|
||||||
if (!area.contains(bloc.getX(), bloc.getZ()) || !area.contains(
|
Location newLoc = bloc.add(relative.getBlockX(), relative.getBlockY(), relative.getBlockZ());
|
||||||
bloc.getX() + relative.getBlockX(),
|
if (!area.contains(bloc.getX(), bloc.getZ()) || !area.contains(newLoc)) {
|
||||||
bloc.getZ() + relative.getBlockZ()
|
|
||||||
)) {
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!plot.equals(area.getOwnedPlot(bloc)) || !plot
|
if (!plot.equals(area.getOwnedPlot(bloc)) || !plot.equals(area.getOwnedPlot(newLoc))) {
|
||||||
.equals(area.getOwnedPlot(bloc.add(relative.getBlockX(), relative.getBlockY(), relative.getBlockZ())))) {
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!area.buildRangeContainsY(bloc.getY()) || !area.buildRangeContainsY(newLoc.getY())) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -890,9 +896,8 @@ public class BlockEventListener implements Listener {
|
|||||||
}
|
}
|
||||||
for (Block block1 : event.getBlocks()) {
|
for (Block block1 : event.getBlocks()) {
|
||||||
Location bloc = BukkitUtil.adapt(block1.getLocation());
|
Location bloc = BukkitUtil.adapt(block1.getLocation());
|
||||||
if (bloc.isPlotArea() || bloc
|
Location newLoc = bloc.add(relative.getBlockX(), relative.getBlockY(), relative.getBlockZ());
|
||||||
.add(relative.getBlockX(), relative.getBlockY(), relative.getBlockZ())
|
if (bloc.isPlotArea() || newLoc.isPlotArea()) {
|
||||||
.isPlotArea()) {
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -906,15 +911,16 @@ public class BlockEventListener implements Listener {
|
|||||||
}
|
}
|
||||||
for (Block block1 : event.getBlocks()) {
|
for (Block block1 : event.getBlocks()) {
|
||||||
Location bloc = BukkitUtil.adapt(block1.getLocation());
|
Location bloc = BukkitUtil.adapt(block1.getLocation());
|
||||||
if (!area.contains(bloc.getX(), bloc.getZ()) || !area.contains(
|
Location newLoc = bloc.add(relative.getBlockX(), relative.getBlockY(), relative.getBlockZ());
|
||||||
bloc.getX() + relative.getBlockX(),
|
if (!area.contains(bloc.getX(), bloc.getZ()) || !area.contains(newLoc)) {
|
||||||
bloc.getZ() + relative.getBlockZ()
|
|
||||||
)) {
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!plot.equals(area.getOwnedPlot(bloc)) || !plot
|
if (!plot.equals(area.getOwnedPlot(bloc)) || !plot.equals(area.getOwnedPlot(newLoc))) {
|
||||||
.equals(area.getOwnedPlot(bloc.add(relative.getBlockX(), relative.getBlockY(), relative.getBlockZ())))) {
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!area.buildRangeContainsY(bloc.getY()) || !area.buildRangeContainsY(newLoc.getY())) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -938,6 +944,11 @@ public class BlockEventListener implements Listener {
|
|||||||
Location location = BukkitUtil.adapt(event.getBlock().getRelative(targetFace).getLocation());
|
Location location = BukkitUtil.adapt(event.getBlock().getRelative(targetFace).getLocation());
|
||||||
if (location.isPlotRoad()) {
|
if (location.isPlotRoad()) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
PlotArea area = location.getPlotArea();
|
||||||
|
if (area != null && !area.buildRangeContainsY(location.getY())) {
|
||||||
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -977,6 +988,10 @@ public class BlockEventListener implements Listener {
|
|||||||
Plot plot = area.getOwnedPlot(location);
|
Plot plot = area.getOwnedPlot(location);
|
||||||
if (!Objects.equals(plot, origin)) {
|
if (!Objects.equals(plot, origin)) {
|
||||||
event.getBlocks().remove(i);
|
event.getBlocks().remove(i);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!area.buildRangeContainsY(location.getY())) {
|
||||||
|
event.getBlocks().remove(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1068,6 +1083,16 @@ public class BlockEventListener implements Listener {
|
|||||||
Plot plot = area.getOwnedPlot(location1);
|
Plot plot = area.getOwnedPlot(location1);
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
BukkitPlayer pp = BukkitUtil.adapt(player);
|
BukkitPlayer pp = BukkitUtil.adapt(player);
|
||||||
|
if (!area.buildRangeContainsY(location1.getY()) && !Permissions
|
||||||
|
.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
pp.sendMessage(
|
||||||
|
TranslatableCaption.of("height.height_limit"),
|
||||||
|
Template.of("minHeight", String.valueOf(area.getMinBuildHeight())),
|
||||||
|
Template.of("maxHeight", String.valueOf(area.getMaxBuildHeight()))
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_ROAD)) {
|
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_ROAD)) {
|
||||||
pp.sendMessage(
|
pp.sendMessage(
|
||||||
@ -1175,7 +1200,10 @@ public class BlockEventListener implements Listener {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Plot plot = area.getOwnedPlot(blockLocation);
|
Plot plot = area.getOwnedPlot(blockLocation);
|
||||||
return !Objects.equals(plot, origin);
|
if (!Objects.equals(plot, origin)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return !area.buildRangeContainsY(location.getY());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (blocks.isEmpty()) {
|
if (blocks.isEmpty()) {
|
||||||
@ -1220,7 +1248,7 @@ public class BlockEventListener implements Listener {
|
|||||||
if (Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) {
|
if (Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (currentLocation.getY() >= area.getMaxBuildHeight() || currentLocation.getY() < area.getMinBuildHeight()) {
|
if (!area.buildRangeContainsY(currentLocation.getY())) {
|
||||||
pp.sendMessage(
|
pp.sendMessage(
|
||||||
TranslatableCaption.of("height.height_limit"),
|
TranslatableCaption.of("height.height_limit"),
|
||||||
Template.of("minHeight", String.valueOf(area.getMinBuildHeight())),
|
Template.of("minHeight", String.valueOf(area.getMinBuildHeight())),
|
||||||
|
@ -21,11 +21,15 @@ package com.plotsquared.bukkit.listener;
|
|||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.plotsquared.bukkit.player.BukkitPlayer;
|
import com.plotsquared.bukkit.player.BukkitPlayer;
|
||||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||||
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||||
import com.plotsquared.core.location.Location;
|
import com.plotsquared.core.location.Location;
|
||||||
|
import com.plotsquared.core.permissions.Permission;
|
||||||
import com.plotsquared.core.plot.Plot;
|
import com.plotsquared.core.plot.Plot;
|
||||||
import com.plotsquared.core.plot.PlotArea;
|
import com.plotsquared.core.plot.PlotArea;
|
||||||
import com.plotsquared.core.plot.flag.implementations.CopperOxideFlag;
|
import com.plotsquared.core.plot.flag.implementations.CopperOxideFlag;
|
||||||
import com.plotsquared.core.plot.flag.implementations.MiscInteractFlag;
|
import com.plotsquared.core.plot.flag.implementations.MiscInteractFlag;
|
||||||
|
import com.plotsquared.core.util.Permissions;
|
||||||
|
import net.kyori.adventure.text.minimessage.Template;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
@ -80,10 +84,25 @@ public class BlockEventListener117 implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BukkitPlayer plotPlayer = null;
|
||||||
|
|
||||||
|
if (entity instanceof Player player) {
|
||||||
|
plotPlayer = BukkitUtil.adapt(player);
|
||||||
|
if (!area.buildRangeContainsY(location.getY()) && !Permissions
|
||||||
|
.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
plotPlayer.sendMessage(
|
||||||
|
TranslatableCaption.of("height.height_limit"),
|
||||||
|
Template.of("minHeight", String.valueOf(area.getMinBuildHeight())),
|
||||||
|
Template.of("maxHeight", String.valueOf(area.getMaxBuildHeight()))
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Plot plot = location.getOwnedPlot();
|
Plot plot = location.getOwnedPlot();
|
||||||
if (plot == null || !plot.getFlag(MiscInteractFlag.class)) {
|
if (plot == null || !plot.getFlag(MiscInteractFlag.class)) {
|
||||||
if (entity instanceof Player player) {
|
if (plotPlayer != null) {
|
||||||
BukkitPlayer plotPlayer = BukkitUtil.adapt(player);
|
|
||||||
if (plot != null) {
|
if (plot != null) {
|
||||||
if (!plot.isAdded(plotPlayer.getUUID())) {
|
if (!plot.isAdded(plotPlayer.getUUID())) {
|
||||||
plot.debug(plotPlayer.getName() + " couldn't trigger sculk sensors because misc-interact = false");
|
plot.debug(plotPlayer.getName() + " couldn't trigger sculk sensors because misc-interact = false");
|
||||||
@ -115,12 +134,12 @@ public class BlockEventListener117 implements Listener {
|
|||||||
PlotArea area = location.getPlotArea();
|
PlotArea area = location.getPlotArea();
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
for (int i = blocks.size() - 1; i >= 0; i--) {
|
for (int i = blocks.size() - 1; i >= 0; i--) {
|
||||||
location = BukkitUtil.adapt(blocks.get(i).getLocation());
|
Location blockLocation = BukkitUtil.adapt(blocks.get(i).getLocation());
|
||||||
if (location.isPlotArea()) {
|
blockLocation = BukkitUtil.adapt(blocks.get(i).getLocation());
|
||||||
|
if (blockLocation.isPlotArea()) {
|
||||||
blocks.remove(i);
|
blocks.remove(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
} else {
|
} else {
|
||||||
Plot origin = area.getOwnedPlot(location);
|
Plot origin = area.getOwnedPlot(location);
|
||||||
if (origin == null) {
|
if (origin == null) {
|
||||||
@ -128,30 +147,22 @@ public class BlockEventListener117 implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (int i = blocks.size() - 1; i >= 0; i--) {
|
for (int i = blocks.size() - 1; i >= 0; i--) {
|
||||||
location = BukkitUtil.adapt(blocks.get(i).getLocation());
|
Location blockLocation = BukkitUtil.adapt(blocks.get(i).getLocation());
|
||||||
if (!area.contains(location.getX(), location.getZ())) {
|
if (!area.contains(blockLocation.getX(), blockLocation.getZ())) {
|
||||||
blocks.remove(i);
|
blocks.remove(i);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Plot plot = area.getOwnedPlot(location);
|
Plot plot = area.getOwnedPlot(blockLocation);
|
||||||
if (!Objects.equals(plot, origin)) {
|
if (!Objects.equals(plot, origin)) {
|
||||||
event.getBlocks().remove(i);
|
event.getBlocks().remove(i);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
if (!area.buildRangeContainsY(location.getY())) {
|
||||||
}
|
|
||||||
Plot origin = area.getPlot(location);
|
|
||||||
if (origin == null) {
|
|
||||||
event.setCancelled(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (int i = blocks.size() - 1; i >= 0; i--) {
|
|
||||||
location = BukkitUtil.adapt(blocks.get(i).getLocation());
|
|
||||||
Plot plot = area.getOwnedPlot(location);
|
|
||||||
if (!Objects.equals(plot, origin) && (!plot.isMerged() && !origin.isMerged())) {
|
|
||||||
event.getBlocks().remove(i);
|
event.getBlocks().remove(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onBlockForm(BlockFormEvent event) {
|
public void onBlockForm(BlockFormEvent event) {
|
||||||
|
@ -146,13 +146,11 @@ import org.bukkit.util.Vector;
|
|||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Player Events involving plots.
|
* Player Events involving plots.
|
||||||
@ -1719,6 +1717,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
|||||||
if (PlotSquared.get().getPlotAreaManager().getPlotAreasSet(world).size() == 0) {
|
if (PlotSquared.get().getPlotAreaManager().getPlotAreasSet(world).size() == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
BukkitPlayer pp = (event.getEntity() instanceof Player player) ? BukkitUtil.adapt(player) : null;
|
||||||
int minX = Integer.MAX_VALUE;
|
int minX = Integer.MAX_VALUE;
|
||||||
int maxX = Integer.MIN_VALUE;
|
int maxX = Integer.MIN_VALUE;
|
||||||
int minZ = Integer.MAX_VALUE;
|
int minZ = Integer.MAX_VALUE;
|
||||||
@ -1740,6 +1739,18 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
|||||||
if (area == null) {
|
if (area == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (pp != null && !area.buildRangeContainsY(location.getY()) && !Permissions.hasPermission(
|
||||||
|
pp,
|
||||||
|
Permission.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT
|
||||||
|
)) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
pp.sendMessage(
|
||||||
|
TranslatableCaption.of("height.height_limit"),
|
||||||
|
Template.of("minHeight", String.valueOf(area.getMinBuildHeight())),
|
||||||
|
Template.of("maxHeight", String.valueOf(area.getMaxBuildHeight()))
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
Plot plot = location.getOwnedPlot();
|
Plot plot = location.getOwnedPlot();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
if (area.isRoadFlags() && area.getRoadFlag(DenyPortalsFlag.class)) {
|
if (area.isRoadFlags() && area.getRoadFlag(DenyPortalsFlag.class)) {
|
||||||
|
@ -624,6 +624,16 @@ public abstract class PlotArea {
|
|||||||
getRegionAbs() == null || this.region.contains(location.getBlockVector3()));
|
getRegionAbs() == null || this.region.contains(location.getBlockVector3()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get if the PlotArea's build range (min build height -> max build height) contains the given y value
|
||||||
|
*
|
||||||
|
* @param y y height
|
||||||
|
* @return if build height contains y
|
||||||
|
*/
|
||||||
|
public boolean buildRangeContainsY(int y) {
|
||||||
|
return y >= minBuildHeight && y < maxBuildHeight;
|
||||||
|
}
|
||||||
|
|
||||||
public @NonNull Set<Plot> getPlotsAbs(final UUID uuid) {
|
public @NonNull Set<Plot> getPlotsAbs(final UUID uuid) {
|
||||||
if (uuid == null) {
|
if (uuid == null) {
|
||||||
return Collections.emptySet();
|
return Collections.emptySet();
|
||||||
|
@ -332,6 +332,15 @@ public class EventDispatcher {
|
|||||||
) {
|
) {
|
||||||
PlotArea area = location.getPlotArea();
|
PlotArea area = location.getPlotArea();
|
||||||
assert area != null;
|
assert area != null;
|
||||||
|
if (!area.buildRangeContainsY(location.getY()) && !Permissions
|
||||||
|
.hasPermission(player, Permission.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) {
|
||||||
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("height.height_limit"),
|
||||||
|
Template.of("minHeight", String.valueOf(area.getMinBuildHeight())),
|
||||||
|
Template.of("maxHeight", String.valueOf(area.getMaxBuildHeight()))
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
Plot plot = area.getPlot(location);
|
Plot plot = area.getPlot(location);
|
||||||
if (plot != null) {
|
if (plot != null) {
|
||||||
if (plot.isAdded(player.getUUID())) {
|
if (plot.isAdded(player.getUUID())) {
|
||||||
|
Reference in New Issue
Block a user