From 35a635cb851f677edc0197bc432cdce03de0ecfb Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Sun, 10 Feb 2013 12:56:42 -0800 Subject: [PATCH] Broadcast message function --- minecraft/edit_cmds.cgi | 5 +++++ minecraft/lang/en | 3 +++ minecraft/save_cmds.cgi | 6 ++++++ 3 files changed, 14 insertions(+) diff --git a/minecraft/edit_cmds.cgi b/minecraft/edit_cmds.cgi index 49d0f4e5a..64d1d47ea 100755 --- a/minecraft/edit_cmds.cgi +++ b/minecraft/edit_cmds.cgi @@ -59,6 +59,11 @@ print &ui_table_row($text{'cmds_weather'}, &ui_textbox("secs", 5, 5)." ". &ui_submit($text{'cmds_weatherb'}, 'weather')); +# Broadcast message +print &ui_table_row($text{'cmds_say'}, + &ui_textbox("text", undef, 40)." ". + &ui_submit($text{'cmds_sayb'}, 'say')); + print &ui_table_end(); print &ui_form_end(); diff --git a/minecraft/lang/en b/minecraft/lang/en index 71f2e1eb3..cb86b290d 100644 --- a/minecraft/lang/en +++ b/minecraft/lang/en @@ -234,6 +234,9 @@ 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 +cmds_say=Broadcast message +cmds_sayb=Send +cmds_msgdone=Sent message to all players manual_title=Edit Configuration File manual_desc=This page allows you to manually edit the Minecraft server configuration file $1. Be careful, as no validation will be done on your input. Any changes will not be activated until the server is restarted. diff --git a/minecraft/save_cmds.cgi b/minecraft/save_cmds.cgi index 14ab2d944..3acbd2eb3 100755 --- a/minecraft/save_cmds.cgi +++ b/minecraft/save_cmds.cgi @@ -67,6 +67,12 @@ elsif ($in{'weather'}) { &error(&html_escape($out)); $msg = &text('cmds_weatherdone', $in{'wtype'}, $in{'secs'}); } +elsif ($in{'say'}) { + # Broadcast message + $in{'text'} =~ /\S/ || &error($text{'conn_etext'}); + &send_server_command("/say $in{'text'}"); + $msg = $text{'cmds_msgdone'}; + } else { &error($text{'conn_ebutton'}); }