u9g on op-thing
Added andriycraft's suggestion (compare)
u9g on op-thing
Commands(OP): Make player non-c… (compare)
js
player.on('connected', () => {
this.cancelled = true;
});
js
serv.on('changeTime', (data, cancelled, cancelCount) => {
cancelled = true;
});
for example but im not sure if it'd actually work
server._events
if there is a listener on pre_{event}, emit an event and await the result of that event whether its true or false to decide whether to do that action
js
module.exports.server = function(serv) { // Create your server events here
serv.onItemPlace('stone', () => {
console.log('stone');
});
};
I get TypeError: serv.onItemPlace is not a function
73dd100d6f29c9e8b053e6f176da339254df102f/src/lib/plugins/redstone.js
111 const notifyEndOfLine = async (world, pos, dir, tick) => {
112 const blockPos = pos.plus(dir)
113 const block = await world.getBlock(blockPos)
114 if (isSolid(block) && await isWireDirectedIn(world, pos, dir)) {
115 serv.updateBlock(world, blockPos, tick, tick)
116 serv.notifyNeighborsOfStateChangeDirectional(world, pos, dir, tick, tick)
117 }
118 }
119
>120 serv.on('asap', () => {
121 serv.onItemPlace('redstone', () => {
122 return { id: redstoneWireType, data: 0 }
123 })
124
125 serv.onItemPlace('redstone_torch', ({ direction }) => {
126 const directionToData = [0, 5, 4, 3, 2, 1]
127 // Placing an unlit torch allows to detect change on the first update
128 // and reduce the block updates
129 return { id: unlitRedstoneTorchType, data: directionToData[direction] }