-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
commit 68f3f96d04057a184de4f5bc5b522f347666ca5b Author: Ic3Tank <[email protected]> Date: Wed Dec 7 15:16:03 2022 +0100 Squashed commit of the following: commit 39c1a0cab3696cab3cffa6c48b5bd1e8d4097e1d Author: Ic3Tank <[email protected]> Date: Wed Dec 7 15:10:10 2022 +0100 Add position spoofing commit 1877c2f Author: Ic3Tank <[email protected]> Date: Tue Dec 6 20:54:23 2022 +0100 Update gitignore commit 8913252 Author: Ic3Tank <[email protected]> Date: Sun Nov 13 21:12:20 2022 +0100 Add world caching support commit a7a5621 Merge: 960b0fc 4a7b1da Author: Ic3Tank <[email protected]> Date: Tue Dec 6 20:52:05 2022 +0100 Merge branch 'master' of https://github.com/IceTank/mineflayer-proxy-inspector commit 960b0fc Author: Ic3Tank <[email protected]> Date: Tue Dec 6 20:51:55 2022 +0100 Update gitignore commit a7394ef Author: Ic3Tank <[email protected]> Date: Wed Nov 2 19:19:39 2022 +0100 Add server close event
- Loading branch information
Showing
9 changed files
with
448 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
node_modules | ||
package-lock.json | ||
dist | ||
dist | ||
worlds/** | ||
nmp-cache/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,70 @@ | ||
const { InspectorProxy } = require('../') | ||
|
||
const readline = require('readline') | ||
const rl = readline.createInterface({ | ||
input: process.stdin, | ||
output: process.stdout | ||
}) | ||
// const readline = require('readline') | ||
// const rl = readline.createInterface({ | ||
// input: process.stdin, | ||
// output: process.stdout | ||
// }) | ||
|
||
rl.on('line', (line) => { | ||
line = line.trim().toLowerCase() | ||
if (line === 'stopserver') { | ||
proxy.stopServer() | ||
} else if (line === 'startserver') { | ||
proxy.startServer() | ||
} else if (line === 'stopbot') { | ||
proxy.stopBot() | ||
} else if (line === 'startbot') { | ||
proxy.startBot() | ||
} | ||
}) | ||
// rl.on('line', (line) => { | ||
// line = line.trim().toLowerCase() | ||
// if (line === 'stopserver') { | ||
// proxy.stopServer() | ||
// } else if (line === 'startserver') { | ||
// proxy.startServer() | ||
// } else if (line === 'stopbot') { | ||
// proxy.stopBot() | ||
// } else if (line === 'startbot') { | ||
// proxy.startBot() | ||
// } | ||
// }) | ||
|
||
let highestId = -Infinity | ||
|
||
/** @type { import('@rob9315/mcproxy').PacketMiddleware } */ | ||
const mapShowMiddleware = ({ meta, pclient, data }) => { | ||
if (meta.name !== 'map') return | ||
const mapId = data.itemDamage | ||
if (mapId !== 0 && mapId > highestId) highestId = mapId | ||
} | ||
|
||
const proxy = new InspectorProxy({ | ||
// host: 'localhost', | ||
// username: '[email protected]', | ||
host: 'localhost', | ||
username: 'proxyBot', | ||
version: '1.12.2' | ||
auth: 'offline', | ||
profilesFolder: './nmp-cache', | ||
version: '1.12.2', | ||
checkTimeoutInterval: 90_000, | ||
// port: 25567 | ||
}, { | ||
linkOnConnect: true, | ||
// linkOnConnect: true, | ||
botAutoStart: false, // start the bot when the proxy starts | ||
botStopOnLogoff: false, // Stop the bot when the last person leaves the proxy | ||
botStopOnLogoff: true, // Stop the bot when the last person leaves the proxy | ||
serverAutoStart: true, // start the server when the proxy starts | ||
serverStopOnBotStop: false, // Stop the server when the bot stops | ||
autoStartBotOnServerLogin: false | ||
autoStartBotOnServerLogin: true, | ||
toClientMiddlewares: [mapShowMiddleware] | ||
}) | ||
|
||
proxy.on('clientConnect', (client) => { | ||
console.info(`Client ${client.username} connected`) | ||
setInterval(() => { | ||
proxy.message(client, `Current id ${highestId}`, undefined, undefined, 2) | ||
}, 2000) | ||
}) | ||
|
||
proxy.on('clientDisconnect', () => { | ||
console.info('Client disconnected') | ||
}) | ||
|
||
proxy.on('serverStart', () => console.info('Server started')) | ||
proxy.on('serverClose', () => console.info('Server closed')) | ||
|
||
proxy.on('botStart', (conn) => { | ||
conn.bot.on('spawn', () => { | ||
console.info('Bot spawned') | ||
}) | ||
|
||
console.info('Bot spawned') | ||
|
||
proxy.on('clientChat', (client, line) => { | ||
if (line === 'test') { | ||
console.info(proxy.conn.receivingClients) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const writeLevel = require('prismarine-provider-anvil').level.writeLevel | ||
|
||
if (process.argv.length !== 3) { | ||
console.log('Usage : node example_write_level.js <level.dat>') | ||
process.exit(1) | ||
} | ||
|
||
writeLevel(process.argv[2], { RandomSeed: [123, 0] }) | ||
.catch(function (err) { console.log(err.stack) }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.