mirror of
https://github.com/webmin/webmin.git
synced 2026-05-04 22:30:33 +01:00
Bugfixes and custom port support
This commit is contained in:
@@ -4,3 +4,4 @@ java_cmd=Full path to java command,0
|
||||
unix_user=Run Minecraft server as user,5
|
||||
init_name=Name of init script,0
|
||||
history_size=Command history size,0
|
||||
port=Minecraft server port number,3,Default (25565)
|
||||
|
||||
@@ -11,7 +11,7 @@ our $progress_callback_url;
|
||||
# Validate inputs
|
||||
if ($in{'new'}) {
|
||||
$in{'dir'} =~ /^\/\S+$/ || &error($text{'download_edir'});
|
||||
getpwnam($in{'user'}) || &error($text{'download_euser'});
|
||||
defined(getpwnam($in{'user'})) || &error($text{'download_euser'});
|
||||
}
|
||||
|
||||
&ui_print_unbuffered_header(undef, $text{'download_title'}, "");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
index_title=Minecraft Server
|
||||
index_cerr=An error was detected with your Minecraft server : $1. You may need to adjust the <a href='$2'>module configuration</a>.
|
||||
index_cerr=An error was detected with your Minecraft server : $1. You may need to adjust the <a href='$2'>module configuration</a>. Automatic installation is not possible as the server appears to be already running.
|
||||
index_cerr2=The Minecraft server does not appear to be installed on your system. If it is already running, you will need to adjust the <a href='$1'>module configuration</a> to use the correct paths.
|
||||
index_rooterr=The Minecraft root directory is set on the <a href='$1'>module configuration</a> page to <tt>$2</tt>, but this is the same as the Webmin module directory!
|
||||
index_nojava=Also, the Java command <tt>$1</tt> needed to run Minecraft was not found.
|
||||
|
||||
@@ -38,11 +38,14 @@ return undef;
|
||||
sub is_minecraft_port_in_use
|
||||
{
|
||||
&foreign_require("proc");
|
||||
my ($pid) = &proc::find_socket_processes("tcp:25565");
|
||||
my $port = $config{'port'} || 25565;
|
||||
my ($pid) = &proc::find_socket_processes("tcp:".$port);
|
||||
return $pid if ($pid);
|
||||
my @procs = &proc::list_processes();
|
||||
my $jar = $config{'minecraft_jar'} ||
|
||||
$config{'minecraft_dir'}."/"."minecraft_server.jar";
|
||||
foreach my $p (@procs) {
|
||||
if ($p->{'args'} =~ /^java.*minecraft_server.jar/) {
|
||||
if ($p->{'args'} =~ /^java.*\Q$jar\E/) {
|
||||
return $p->{'pid'};
|
||||
}
|
||||
}
|
||||
@@ -60,7 +63,7 @@ my $jar = $config{'minecraft_jar'} ||
|
||||
my $shortjar = $jar;
|
||||
$shortjar =~ s/^.*\///;
|
||||
foreach my $p (@procs) {
|
||||
if ($p->{'args'} =~ /^\S*\Q$config{'java_cmd'}\E.*(\Q$jar\E|\Q$shortjar\E)/) {
|
||||
if ($p->{'args'} =~ /^\S*\Q$config{'java_cmd'}\E.*\Q$jar\E/) {
|
||||
return $p->{'pid'};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user