Skip to content

Commit 23f7db2

Browse files
committed
prevent breaking blocks in survival
1 parent b6407bc commit 23f7db2

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/index.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,16 @@ world.beforeEvents.itemUseOn.subscribe((ev) => {
6565
safeCall(updateBlockProperty, player, ev.block);
6666
});
6767

68+
// Players should not be able to break blocks using
69+
// the debug stick in survival
70+
//
71+
// TODO: explore other alternatives
72+
world.beforeEvents.playerBreakBlock.subscribe((ev) => {
73+
if (ev.itemStack?.typeId != DEBUG_STICK_ID)
74+
return;
75+
ev.cancel = true;
76+
})
77+
6878

6979
/*============================================================================*\
7080
+* Action functions

0 commit comments

Comments
 (0)