-
-
Notifications
You must be signed in to change notification settings - Fork 755
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ref: height limit check #4427
Ref: height limit check #4427
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,7 +60,6 @@ | |
import com.sk89q.worldedit.WorldEdit; | ||
import com.sk89q.worldedit.bukkit.BukkitAdapter; | ||
import com.sk89q.worldedit.world.block.BlockType; | ||
import net.kyori.adventure.text.Component; | ||
import net.kyori.adventure.text.minimessage.tag.Tag; | ||
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver; | ||
import org.bukkit.Bukkit; | ||
|
@@ -164,13 +163,6 @@ public void blockCreate(BlockPlaceEvent event) { | |
if (plot != null) { | ||
if (area.notifyIfOutsideBuildArea(pp, location.getY())) { | ||
event.setCancelled(true); | ||
pp.sendMessage( | ||
TranslatableCaption.of("height.height_limit"), | ||
TagResolver.builder() | ||
.tag("minheight", Tag.inserting(Component.text(area.getMinBuildHeight()))) | ||
.tag("maxheight", Tag.inserting(Component.text(area.getMaxBuildHeight()))) | ||
.build() | ||
); | ||
return; | ||
} | ||
if (!plot.hasOwner()) { | ||
|
@@ -262,13 +254,6 @@ public void blockDestroy(BlockBreakEvent event) { | |
} | ||
} else if (area.notifyIfOutsideBuildArea(plotPlayer, location.getY())) { | ||
event.setCancelled(true); | ||
plotPlayer.sendMessage( | ||
TranslatableCaption.of("height.height_limit"), | ||
TagResolver.builder() | ||
.tag("minheight", Tag.inserting(Component.text(area.getMinBuildHeight()))) | ||
.tag("maxheight", Tag.inserting(Component.text(area.getMaxBuildHeight()))) | ||
.build() | ||
); | ||
return; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Duplicated message sending: already included in |
||
} | ||
if (!plot.hasOwner()) { | ||
|
@@ -1224,18 +1209,9 @@ public void onBlockMultiPlace(BlockMultiPlaceEvent event) { | |
if (pp.hasPermission(Permission.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) { | ||
continue; | ||
} | ||
if (currentLocation.getY() >= area.getMaxBuildHeight() || currentLocation.getY() < area.getMinBuildHeight()) { | ||
pp.sendMessage( | ||
TranslatableCaption.of("height.height_limit"), | ||
TagResolver.builder() | ||
.tag("minheight", Tag.inserting(Component.text(area.getMinBuildHeight()))) | ||
.tag("maxheight", Tag.inserting(Component.text(area.getMaxBuildHeight()))) | ||
.build() | ||
); | ||
if (area.notifyIfOutsideBuildArea(pp, currentLocation.getY())) { | ||
event.setCancelled(true); | ||
break; | ||
} | ||
if (area.notifyIfOutsideBuildArea(pp, currentLocation.getY())) { | ||
event.setCancelled(true); | ||
break; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The check in line Line
/Core/src/main/java/com/plotsquared/core/plot/PlotArea.java#L676-L677: public boolean notifyIfOutsideBuildArea(PlotPlayer<?> player, int y) {
if (!buildRangeContainsY(y) && !player.hasPermission(Permission.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) {
...
// Return true if "failed" as the method will always be inverted otherwise
return true;
}
return false;
} |
||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicated message sending: already included in
notifyIfOutsideBuildArea()