summaryrefslogtreecommitdiffstats
path: root/MCServer/Plugins/Debuggers
diff options
context:
space:
mode:
Diffstat (limited to 'MCServer/Plugins/Debuggers')
-rw-r--r--MCServer/Plugins/Debuggers/Debuggers.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/MCServer/Plugins/Debuggers/Debuggers.lua b/MCServer/Plugins/Debuggers/Debuggers.lua
index 076cec9ca..484ea88be 100644
--- a/MCServer/Plugins/Debuggers/Debuggers.lua
+++ b/MCServer/Plugins/Debuggers/Debuggers.lua
@@ -580,8 +580,17 @@ function HandleTestWndCmd(a_Split, a_Player)
return true;
end
+ -- Test out the OnClosing callback's ability to refuse to close the window
+ local attempt = 1;
+ local OnClosing = function(Window, Player)
+ Player:SendMessage("Window closing attempt #" .. attempt);
+ attempt = attempt + 1;
+ return (attempt <= 3); -- refuse twice, then allow
+ end
+
local Window = cLuaWindow(WindowType, WindowSizeX, WindowSizeY, "TestWnd");
Window:SetSlot(a_Player, 0, cItem(E_ITEM_DIAMOND, 64));
+ Window:SetOnClosing(OnClosing);
a_Player:OpenWindow(Window);