mirror of
https://github.com/webmin/webmin.git
synced 2026-06-19 02:40:32 +01:00
Server commands page
This commit is contained in:
@@ -27,7 +27,7 @@ print &ui_table_row($text{'cmds_gamemode'},
|
||||
|
||||
# Change difficulty level
|
||||
print &ui_table_row($text{'cmds_difficulty'},
|
||||
&ui_select("defmode", 2,
|
||||
&ui_select("diff", 2,
|
||||
[ [ 0, $text{'cmds_peaceful'} ],
|
||||
[ 1, $text{'cmds_easy'} ],
|
||||
[ 2, $text{'cmds_normal'} ],
|
||||
|
||||
BIN
minecraft/images/cmds.gif
Executable file
BIN
minecraft/images/cmds.gif
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 532 B |
@@ -174,5 +174,12 @@ cmds_for=for time
|
||||
cmds_weatherb=Change
|
||||
cmds_err=World command failed
|
||||
cmds_downfalldone=Started rain or snow
|
||||
cmds_esecs=Time to change weather for must be a positive number of seconds
|
||||
cmds_weatherdone=Changed weather to $1 for $2 seconds
|
||||
cmds_etimeset=Time to set must be a number between 0 and 24000
|
||||
cmds_etimeadd=Time to add must be a number between 0 and 24000
|
||||
cmds_timedone=Changed game time
|
||||
cmds_gamemodedone=Changed default game mode to $1
|
||||
cmds_difficultydone=Changed game difficulty
|
||||
|
||||
manual_title=Edit Configuration File
|
||||
|
||||
@@ -39,7 +39,8 @@ if (@worlds) {
|
||||
}
|
||||
print &ui_columns_end();
|
||||
print &ui_links_row(\@links);
|
||||
print &ui_form_end([ [ undef, $text{'worlds_change'} ] ]);
|
||||
print &ui_form_end([ [ undef, $text{'worlds_change'} ],
|
||||
[ 'apply', $text{'worlds_change2'} ] ]);
|
||||
}
|
||||
else {
|
||||
print "<b>$text{'worlds_none'}</b><p>\n";
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
#
|
||||
# XXX java param options
|
||||
# XXX plugins?
|
||||
# XXX world reset
|
||||
# XXX world create / clone
|
||||
# XXX configuration page, with seed field
|
||||
|
||||
BEGIN { push(@INC, ".."); };
|
||||
use strict;
|
||||
@@ -266,8 +265,8 @@ sub list_connected_players
|
||||
my @out = &execute_minecraft_command("/list");
|
||||
my @rv;
|
||||
foreach my $l (@out) {
|
||||
if ($l =~ /\[INFO\]\s+(\S+)$/) {
|
||||
push(@rv, $1);
|
||||
if ($l !~ /players\s+online:/ && $l =~ /\[INFO\]\s+(\S.*)$/) {
|
||||
push(@rv, split(/,\s+/, $1));
|
||||
}
|
||||
}
|
||||
return @rv;
|
||||
@@ -340,8 +339,8 @@ sub list_banned_players
|
||||
my @out = &execute_minecraft_command("/banlist");
|
||||
my @rv;
|
||||
foreach my $l (@out) {
|
||||
if ($l =~ /\[INFO\]\s+(\S+)$/) {
|
||||
push(@rv, $1);
|
||||
if ($l !~ /banned\s+players:/ && $l =~ /\[INFO\]\s+(\S.*)$/) {
|
||||
push(@rv, split(/,\s+/, $1));
|
||||
}
|
||||
}
|
||||
return @rv;
|
||||
@@ -351,11 +350,11 @@ return @rv;
|
||||
# Returns a list of players who are whitelisted
|
||||
sub list_whitelisted_players
|
||||
{
|
||||
my @out = &execute_minecraft_command("/whitelist");
|
||||
my @out = &execute_minecraft_command("/whitelist list");
|
||||
my @rv;
|
||||
foreach my $l (@out) {
|
||||
if ($l =~ /\[INFO\]\s+(\S+)$/) {
|
||||
push(@rv, $1);
|
||||
if ($l !~ /whitelisted\s+players:/ && $l =~ /\[INFO\]\s+(\S.*)$/) {
|
||||
push(@rv, split(/,\s+/, $1));
|
||||
}
|
||||
}
|
||||
return @rv;
|
||||
|
||||
@@ -11,9 +11,43 @@ our (%in, %text);
|
||||
my $msg;
|
||||
if ($in{'gamemode'}) {
|
||||
# Change game mode
|
||||
my $out = &execute_minecraft_command(
|
||||
"/defaultgamemode $in{'defmode'}");
|
||||
$out =~ /The\s+world's\s+default\s+game\s+mode/ ||
|
||||
&error(&html_escape($out));
|
||||
$msg = &text('cmds_gamemodedone', $in{'defmode'});
|
||||
}
|
||||
elsif ($in{'difficulty'}) {
|
||||
# Change game mode
|
||||
&send_server_command("/difficulty $in{'diff'}");
|
||||
$msg = $text{'cmds_difficultydone'};
|
||||
}
|
||||
elsif ($in{'time'}) {
|
||||
# Change game time
|
||||
my $mode;
|
||||
if ($in{'time_mode'} == 0) {
|
||||
$mode = 'set day';
|
||||
}
|
||||
elsif ($in{'time_mode'} == 1) {
|
||||
$mode = 'set night';
|
||||
}
|
||||
elsif ($in{'time_mode'} == 2) {
|
||||
$in{'timeset'} =~ /^\d+$/ &&
|
||||
$in{'timeset'} >= 0 && $in{'timeset'} <= 24000 ||
|
||||
&error($text{'cmds_etimeset'});
|
||||
$mode = 'set '.$in{'timeset'};
|
||||
}
|
||||
elsif ($in{'time_mode'} == 3) {
|
||||
$in{'timeadd'} =~ /^\d+$/ &&
|
||||
$in{'timeadd'} >= 0 && $in{'timeadd'} <= 24000 ||
|
||||
&error($text{'cmds_etimeadd'});
|
||||
$mode = 'add '.$in{'timeadd'};
|
||||
}
|
||||
my $out = &execute_minecraft_command(
|
||||
"/time $mode");
|
||||
$out =~ /Set\s+the\s+time/ || $out =~ /Added.*to\s+the\s+time/ ||
|
||||
&error(&html_escape($out));
|
||||
$msg = &text('cmds_timedone');
|
||||
}
|
||||
elsif ($in{'downfall'}) {
|
||||
# Start rain
|
||||
@@ -23,6 +57,16 @@ elsif ($in{'downfall'}) {
|
||||
&error(&html_escape($out));
|
||||
$msg = &text('cmds_downfalldone');
|
||||
}
|
||||
elsif ($in{'weather'}) {
|
||||
# Change weather
|
||||
$in{'secs'} =~ /^[1-9][0-9]*$/ ||
|
||||
&error($text{'cmds_esecs'});
|
||||
my $out = &execute_minecraft_command(
|
||||
"/weather $in{'wtype'} $in{'secs'}");
|
||||
$out =~ /Changing\s+to/ ||
|
||||
&error(&html_escape($out));
|
||||
$msg = &text('cmds_weatherdone', $in{'wtype'}, $in{'secs'});
|
||||
}
|
||||
else {
|
||||
&error($text{'conn_ebutton'});
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ if ($in{'mode'} eq 'white') {
|
||||
my @users = split(/\r?\n/, $in{'white'});
|
||||
&save_whitelist_users(\@users);
|
||||
&save_directive("white-list", $in{'enabled'} ? 'true' : 'false', $conf);
|
||||
&flush_file_lines();
|
||||
&flush_file_lines(&get_minecraft_config_file());
|
||||
&unlock_file(&get_whitelist_file());
|
||||
&unlock_file(&get_minecraft_config_file());
|
||||
|
||||
|
||||
@@ -27,8 +27,10 @@ if ($in{'new'}) {
|
||||
# Create world directory
|
||||
if ($in{'src'} == 0) {
|
||||
# Empty world
|
||||
# XXX .dat file?
|
||||
&make_dir_logged($dir, 0755);
|
||||
&make_dir($dir, 0755);
|
||||
my $fh = "EMPTY";
|
||||
&open_tempfile($fh, ">$dir/level.dat", 0, 1);
|
||||
&close_tempfile($fh);
|
||||
}
|
||||
elsif ($in{'src'} == 1) {
|
||||
# Clone existing world
|
||||
@@ -67,7 +69,6 @@ if ($in{'new'}) {
|
||||
-r $dat && $dat =~ /^(.*)\/level.dat$/ ||
|
||||
&error($text{'world_edat'});
|
||||
my $copysrc = $1;
|
||||
print STDERR "dat=$dat copysrc=$copysrc\n";
|
||||
©_source_dest($copysrc, $dir);
|
||||
}
|
||||
&redirect("list_worlds.cgi");
|
||||
|
||||
@@ -53,9 +53,9 @@ if ($c || 1) {
|
||||
&ui_textbox("text", undef, 40)." ".
|
||||
&ui_submit($text{'conn_msgb'}, 'msg'));
|
||||
|
||||
# Kill player
|
||||
print &ui_table_row($text{'conn_kill'},
|
||||
&ui_submit($text{'conn_killb'}, 'kill'));
|
||||
# Kill player (not possible?)
|
||||
#print &ui_table_row($text{'conn_kill'},
|
||||
# &ui_submit($text{'conn_killb'}, 'kill'));
|
||||
|
||||
# Disconnect player
|
||||
print &ui_table_row($text{'conn_kick'},
|
||||
|
||||
Reference in New Issue
Block a user