@@ -46,6 +46,21 @@ def start(java: Path, mc_path: Path):
46
46
exit (0 )
47
47
48
48
49
+ def update_build (mc_path : Path ):
50
+ # Build project
51
+ print ('Building project...' )
52
+ build_jar = Path ('build/libs' )
53
+ shutil .rmtree (build_jar , ignore_errors = True )
54
+ check_call ('./gradlew build' , shell = True )
55
+
56
+ # Install plugin
57
+ print ('Installing our MCPM plugin...' )
58
+ plugin_path = mc_path / 'plugins/mcpm.jar'
59
+ shutil .rmtree (plugin_path , ignore_errors = True )
60
+ ensure_dir (plugin_path .parent )
61
+ shutil .copy2 (build_jar / str (os .listdir (build_jar )[0 ]), plugin_path )
62
+
63
+
49
64
if __name__ == '__main__' :
50
65
# Download JDK
51
66
java = ensure_java ("19" , 'build/jdk19' )
@@ -72,18 +87,8 @@ def start(java: Path, mc_path: Path):
72
87
73
88
print (f'Server installed to { mc_path } ' )
74
89
75
- # Build project
76
- print ('Building project...' )
77
- build_jar = Path ('build/libs' )
78
- shutil .rmtree (build_jar , ignore_errors = True )
79
- check_call ('./gradlew build' , shell = True )
80
-
81
- # Install plugin
82
- print ('Installing our MCPM plugin...' )
83
- plugin_path = mc_path / 'plugins/mcpm.jar'
84
- shutil .rmtree (plugin_path , ignore_errors = True )
85
- ensure_dir (plugin_path .parent )
86
- shutil .copy2 (build_jar / str (os .listdir (build_jar )[0 ]), plugin_path )
90
+ # Update built jar file
91
+ update_build (mc_path )
87
92
88
93
# Start server
89
94
print ('Starting server...' )
0 commit comments