Skip to content

Commit

Permalink
Added assertions for stack and move tools
Browse files Browse the repository at this point in the history
  • Loading branch information
SIsilicon committed Mar 7, 2024
1 parent 9e17645 commit 4205c15
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/server/tools/region_tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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);
}
};
Expand All @@ -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);
}
};
Expand Down

0 comments on commit 4205c15

Please sign in to comment.