Implement build height limits into more events

This commit is contained in:
dordsor21
2022-06-18 17:23:29 +01:00
parent 7279862def
commit ca7e9c9bd8
4 changed files with 112 additions and 38 deletions

View File

@ -332,6 +332,16 @@ public class EventDispatcher {
) {
PlotArea area = location.getPlotArea();
assert area != null;
if ((location.getY() >= area.getMaxBuildHeight() || location.getY() < area
.getMinBuildHeight()) && !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);
if (plot != null) {
if (plot.isAdded(player.getUUID())) {