Skip to content

Commit

Permalink
Merge branch 'master' into tests_and_makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
cosmosquark authored Sep 15, 2024
2 parents dc4ebad + 0f735bf commit eb621c3
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions gamemodules/minecraft/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,11 @@ def install(server,*,eula=False):

eulafile=os.path.join(server.data["dir"],"eula.txt")
configfile=os.path.join(server.data["dir"],"server.properties")
javapath = server.data.get("javapath","java")
if not os.path.isfile(configfile) or (eula and not os.path.isfile(eulafile)): # use as flag for has the server created it's files
print("Starting server to create settings")
try:
ret=sp.check_call(["java","-jar",server.data["exe_name"],"nogui"],cwd=server.data["dir"],shell=False,timeout=20)
ret=sp.check_call([javapath,"-jar",server.data["exe_name"],"nogui"],cwd=server.data["dir"],shell=False,timeout=20)
except sp.CalledProcessError as ex:
print("Error running server. Java returned status: "+ex.returncode)
except sp.TimeoutExpired as ex:
Expand All @@ -166,7 +167,8 @@ def install(server,*,eula=False):
updateconfig(eulafile,{"eula":"true"})

def get_start_command(server):
return ["java","-jar",server.data["exe_name"],"nogui"],server.data["dir"]
javapath = server.data.get("javapath","java")
return [javapath,"-jar",server.data["exe_name"],"nogui"],server.data["dir"]

def do_stop(server,j):
screen.send_to_server(server.name,"\nstop\n")
Expand Down Expand Up @@ -204,6 +206,10 @@ def checkvalue(server,key,*value):
if len(value)!=1:
raise ServerError("Only one value supported for 'exe_name'")
return value[0]
if key == ("javapath",):
if len(value)!=1:
raise ServerError("Only one value supported for 'javapath'")
return value[0]
if key[0] == ("backup"):
try:
return backups.checkdatavalue(server.data.get("backup",{}),key[1:],*value)
Expand Down

0 comments on commit eb621c3

Please sign in to comment.