Skip to content

Commit

Permalink
prevent breaking blocks in survival
Browse files Browse the repository at this point in the history
  • Loading branch information
vytdev committed Sep 21, 2024
1 parent b6407bc commit 23f7db2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,16 @@ world.beforeEvents.itemUseOn.subscribe((ev) => {
safeCall(updateBlockProperty, player, ev.block);
});

// Players should not be able to break blocks using
// the debug stick in survival
//
// TODO: explore other alternatives
world.beforeEvents.playerBreakBlock.subscribe((ev) => {
if (ev.itemStack?.typeId != DEBUG_STICK_ID)
return;
ev.cancel = true;
})


/*============================================================================*\
+* Action functions
Expand Down

0 comments on commit 23f7db2

Please sign in to comment.