From 4205c156d3d8f02caf9876a10acb35d08c4b151c Mon Sep 17 00:00:00 2001 From: SIsilicon Date: Thu, 7 Mar 2024 18:04:39 -0500 Subject: [PATCH] Added assertions for stack and move tools --- src/server/tools/region_tools.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/server/tools/region_tools.ts b/src/server/tools/region_tools.ts index d4b75663d..f4b5e106b 100644 --- a/src/server/tools/region_tools.ts +++ b/src/server/tools/region_tools.ts @@ -3,6 +3,7 @@ import { Server } from "@notbeer-api"; import { PlayerSession } from "server/sessions"; import { Tool } from "./base_tool"; import { Tools } from "./tool_manager"; +import { assertCuboidSelection } from "@modules/assert"; class SelectionFillTool extends Tool { permission = "worldedit.region.replace"; @@ -63,10 +64,11 @@ Tools.register(SelectionHollowTool, "selection_hollow", "wedit:selection_hollow" class SelectionStackTool extends Tool { permission = "worldedit.region.stack"; - use = function (self: Tool, player: Player) { + use = function (self: Tool, player: Player, session: PlayerSession) { if (player.isSneaking) { Server.uiForms.show("$selectRegionMode", player); } else { + assertCuboidSelection(session); Server.uiForms.show("$stackAmount", player); } }; @@ -76,10 +78,11 @@ Tools.register(SelectionStackTool, "selection_stack", "wedit:selection_stack"); class SelectionMoveTool extends Tool { permission = "worldedit.region.move"; - use = function (self: Tool, player: Player) { + use = function (self: Tool, player: Player, session: PlayerSession) { if (player.isSneaking) { Server.uiForms.show("$selectRegionMode", player); } else { + assertCuboidSelection(session); Server.uiForms.show("$moveAmount", player); } };