Skip to content

Commit dea16b5

Browse files
committed
Add server folder items for Velocity
1 parent 25e4867 commit dea16b5

5 files changed

Lines changed: 44 additions & 1 deletion

File tree

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*.war
1616
*.nar
1717
*.ear
18-
*.zip
1918
*.tar.gz
2019
*.rar
2120

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@
66

77
## Installation
88
- Drop the jar into Velocity plugins folder
9+
- Copy contents of `velocity-server-folder-items` next to Velocity jar
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
DyNP7VMBDlUW
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import os, sys, zipfile, shutil, subprocess, time
2+
3+
uuid = sys.argv[1]
4+
port = int(sys.argv[2])
5+
folder = f"servers/voxelearth-{uuid[:8]}"
6+
7+
# Clean old folder if exists
8+
if os.path.exists(folder):
9+
shutil.rmtree(folder)
10+
11+
# Unzip template
12+
with zipfile.ZipFile("voxelearth.zip", "r") as zip_ref:
13+
zip_ref.extractall(folder)
14+
15+
# Modify server.properties for new port
16+
prop_path = os.path.join(folder, "server.properties")
17+
with open(prop_path, "r") as f:
18+
lines = f.readlines()
19+
with open(prop_path, "w") as f:
20+
for line in lines:
21+
if line.startswith("server-port="):
22+
f.write(f"server-port={port}\n")
23+
else:
24+
f.write(line)
25+
26+
cuda_path = os.path.join(folder, "cuda_voxelizer")
27+
if os.path.exists(cuda_path):
28+
subprocess.run(["chmod", "777", cuda_path])
29+
else:
30+
print(f"Warning: cuda_voxelizer not found in {folder}")
31+
32+
# Start Paper server
33+
subprocess.Popen(
34+
["java", "-jar", "paper.jar", "--nogui"],
35+
cwd=folder,
36+
stdout=subprocess.DEVNULL,
37+
stderr=subprocess.STDOUT
38+
)
39+
40+
# Give it time to boot
41+
time.sleep(10)
42+
print(f"Started {folder} on port {port}")
56.5 MB
Binary file not shown.

0 commit comments

Comments
 (0)