这个提交包含在:
2021-07-21 16:32:00 +08:00
父节点 82db6df158
当前提交 b8b02257ae
共有 106 个文件被更改,包括 5680 次插入 和 5678 次删除

90
MC.ts
查看文件

@ -1,46 +1,46 @@
import * as ws from "websocket";
import * as http from "http";
// import * as Core from "./Core";
import * as uuid from "uuid";
var HTTPServer = new http.Server();
var MCServer = new ws.server({
httpServer:HTTPServer
});
MCServer.on("connect",(con)=>{
console.log("A New Connect Coming!");
con.send(Buffer.from(JSON.stringify({
body:{
eventName:"PlayerMessage"
},
header:{
requestId:uuid.v1(),
messagePurpose:"unsubscribe",
version:1,
messageType:"commandRequest"
}
})));
con.send(Buffer.from(JSON.stringify({
body:{
origin:{
type:"player",
},
commandLine:"say [ONLINEAI]CONNECTED!",
version:1,
},
header:{
requestId:uuid.v1(),
messagePurpose:"commandRequest",
version:1,
messageType:"commandRequest"
}
})));
con.on("message",(data)=>{
console.log(data.utf8Data);
})
});
HTTPServer.listen(19131,"0.0.0.0",(()=>{
console.log("Server Start")
}));
MCServer.mount({
httpServer:HTTPServer
import * as ws from "websocket";
import * as http from "http";
// import * as Core from "./Core";
import * as uuid from "uuid";
var HTTPServer = new http.Server();
var MCServer = new ws.server({
httpServer:HTTPServer
});
MCServer.on("connect",(con)=>{
console.log("A New Connect Coming!");
con.send(Buffer.from(JSON.stringify({
body:{
eventName:"PlayerMessage"
},
header:{
requestId:uuid.v1(),
messagePurpose:"unsubscribe",
version:1,
messageType:"commandRequest"
}
})));
con.send(Buffer.from(JSON.stringify({
body:{
origin:{
type:"player",
},
commandLine:"say [ONLINEAI]CONNECTED!",
version:1,
},
header:{
requestId:uuid.v1(),
messagePurpose:"commandRequest",
version:1,
messageType:"commandRequest"
}
})));
con.on("message",(data)=>{
console.log(data.utf8Data);
})
});
HTTPServer.listen(19131,"0.0.0.0",(()=>{
console.log("Server Start")
}));
MCServer.mount({
httpServer:HTTPServer
})