mirror of
				https://github.com/IntellectualSites/PlotSquared.git
				synced 2025-11-04 11:13:45 +01:00 
			
		
		
		
	Ref: height limit check (#4427)
- The notifyIfOutsideBuildArea method checks the limits and already includes sending the height.height_limit message. This does not need to be called again in the code.
This commit is contained in:
		@@ -60,7 +60,6 @@ import com.plotsquared.core.util.task.TaskTime;
 | 
			
		||||
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 class BlockEventListener implements Listener {
 | 
			
		||||
        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 class BlockEventListener implements Listener {
 | 
			
		||||
                }
 | 
			
		||||
            } 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;
 | 
			
		||||
            }
 | 
			
		||||
            if (!plot.hasOwner()) {
 | 
			
		||||
@@ -1224,18 +1209,9 @@ public class BlockEventListener implements Listener {
 | 
			
		||||
            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;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user