forked from PrismarineJS/prismarine-web-client
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
135 changed files
with
3,487 additions
and
356 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
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 |
---|---|---|
|
@@ -8,6 +8,11 @@ jobs: | |
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@master | ||
- name: Setup Java JDK | ||
uses: actions/[email protected] | ||
with: | ||
java-version: 17 | ||
java-package: jre | ||
- name: Install pnpm | ||
run: npm i -g [email protected] | ||
- uses: actions/setup-node@v4 | ||
|
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 |
---|---|---|
|
@@ -17,5 +17,6 @@ out | |
.vercel | ||
generated | ||
storybook-static | ||
server-jar | ||
|
||
src/react/npmReactComponents.ts |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[ | ||
{ | ||
"uuid": "67128b5b-2e6b-3ad1-baa0-1b937b03e5c5", | ||
"name": "bot", | ||
"level": 4, | ||
"bypassesPlayerLimit": false | ||
} | ||
] |
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,61 @@ | ||
#Minecraft server properties | ||
allow-flight=false | ||
allow-nether=true | ||
broadcast-console-to-ops=true | ||
broadcast-rcon-to-ops=true | ||
difficulty=peaceful | ||
enable-command-block=false | ||
enable-jmx-monitoring=false | ||
enable-query=false | ||
enable-rcon=false | ||
enable-status=true | ||
enforce-secure-profile=true | ||
enforce-whitelist=false | ||
entity-broadcast-range-percentage=100 | ||
force-gamemode=false | ||
function-permission-level=2 | ||
gamemode=survival | ||
generate-structures=true | ||
generator-settings={} | ||
hardcore=false | ||
hide-online-players=false | ||
initial-disabled-packs= | ||
initial-enabled-packs=vanilla | ||
level-name=world | ||
level-seed= | ||
level-type=flat | ||
log-ips=true | ||
max-build-height=256 | ||
max-chained-neighbor-updates=1000000 | ||
max-players=20 | ||
max-tick-time=60000 | ||
max-world-size=29999984 | ||
motd=A Minecraft Server | ||
network-compression-threshold=256 | ||
online-mode=false | ||
op-permission-level=4 | ||
player-idle-timeout=0 | ||
prevent-proxy-connections=false | ||
pvp=true | ||
query.port=25565 | ||
rate-limit=0 | ||
rcon.password= | ||
rcon.port=25575 | ||
require-resource-pack=false | ||
resource-pack= | ||
resource-pack-id= | ||
resource-pack-prompt= | ||
resource-pack-sha1= | ||
server-ip= | ||
server-port=25565 | ||
simulation-distance=10 | ||
snooper-enabled=true | ||
spawn-animals=true | ||
spawn-monsters=true | ||
spawn-npcs=true | ||
spawn-protection=16 | ||
sync-chunk-writes=true | ||
text-filtering-config= | ||
use-native-transport=true | ||
view-distance=10 | ||
white-list=false |
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,45 @@ | ||
import { ChildProcess, spawn } from 'child_process' | ||
import * as fs from 'fs' | ||
import * as path from 'path' | ||
import { promisify } from 'util' | ||
import { downloadServer } from 'minecraft-wrap' | ||
import * as waitOn from 'wait-on' | ||
|
||
let prevProcess: ChildProcess | null = null | ||
export const startMinecraftServer = async (version: string, port: number) => { | ||
if (prevProcess) return null | ||
const jar = `./server-jar/${version}.jar` | ||
|
||
const start = () => { | ||
// if (prevProcess) { | ||
// prevProcess.kill() | ||
// } | ||
|
||
prevProcess = spawn('java', ['-jar', path.basename(jar), 'nogui', '--port', `${port}`], { | ||
stdio: 'inherit', | ||
cwd: path.dirname(jar), | ||
}) | ||
} | ||
|
||
let coldStart = false | ||
if (fs.existsSync(jar)) { | ||
start() | ||
} else { | ||
coldStart = true | ||
promisify(downloadServer)(version, jar).then(() => { | ||
// add eula.txt | ||
fs.writeFileSync(path.join(path.dirname(jar), 'eula.txt'), 'eula=true') | ||
// copy cypress/plugins/server.properties | ||
fs.copyFileSync(path.join(__dirname, 'server.properties'), path.join(path.dirname(jar), 'server.properties')) | ||
// copy ops.json | ||
fs.copyFileSync(path.join(__dirname, 'ops.json'), path.join(path.dirname(jar), 'ops.json')) | ||
start() | ||
}) | ||
} | ||
|
||
return new Promise<null>((res) => { | ||
waitOn({ resources: [`tcp:localhost:${port}`] }, () => { | ||
setTimeout(() => res(null), coldStart ? 6500 : 2000) // todo retry instead of timeout | ||
}) | ||
}) | ||
} |
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.