forked from bdsx/bdsx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
launcher.ts
68 lines (53 loc) · 1.86 KB
/
launcher.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// launcher.ts is the launcher for BDS
// These scripts are run before launching BDS
// So there is no 'server' variable yet
// launcher.ts will import ./index.ts after launching BDS.
// install source map
import { install as installSourceMapSupport, remapAndPrintError } from "bdsx/source-map-support";
installSourceMapSupport();
import { disable } from 'colors';
if(process.env.COLOR && !(process.env.COLOR === 'true' || process.env.COLOR === 'on')) disable();
// check
import 'bdsx/check';
// install bdsx error handler
import { installErrorHandler } from "bdsx/errorhandler";
installErrorHandler();
// imports
require('bdsx/legacy');
import { installMinecraftAddons } from 'bdsx/addoninstaller';
import { bedrockServer } from "bdsx/launcher";
import { loadAllPlugins } from "bdsx/plugins";
import { events } from "bdsx/event";
import { _tickCallback } from "bdsx/util";
console.log(
" _____ _____ \n".green +
" \\ \\ / / \n".green +
" \\".green + "___ ".white + "\\".green + "__".white + "/".green + " ___".white + "/ \n".green +
" | _ ) \\/ __| \n".white +
" | _ \\ |) \\__ \\ \n".white +
" |___/___/|___/ \n".white +
" / / \\ \\ \n".green +
" /____/ \\____\\ \n".green
);
(async()=>{
events.serverClose.on(()=>{
console.log('[BDSX] bedrockServer closed');
setTimeout(()=>{
console.log('[BDSX] node.js is processing...');
}, 3000).unref();
});
await Promise.all([
loadAllPlugins(),
installMinecraftAddons()
]);
// launch BDS
console.log('[BDSX] bedrockServer is launching...');
await bedrockServer.launch();
/**
* send stdin to bedrockServer.executeCommandOnConsole
* without this, you need to control stdin manually
*/
bedrockServer.DefaultStdInHandler.install();
// run index
require('./index');
})().catch(remapAndPrintError);