summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordoy <doy@tozt.net>2009-01-25 16:57:37 -0500
committerdoy <doy@tozt.net>2009-01-25 16:57:37 -0500
commit06e296bdda0c127622aef2aadf336c0dc506c4bc (patch)
treeeb0ae5a555b48d83b3767738547e69e44f8c0253
parenteb436837d8d83e9f21ae12f6db0f23e5bf81e674 (diff)
downloadbot-games-06e296bdda0c127622aef2aadf336c0dc506c4bc.tar.gz
bot-games-06e296bdda0c127622aef2aadf336c0dc506c4bc.zip
don't automatically call the init method if a needs_init command is called - just print a warning and ignore it
-rw-r--r--lib/Bot/Games.pm6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/Bot/Games.pm b/lib/Bot/Games.pm
index ad65db8..f981c27 100644
--- a/lib/Bot/Games.pm
+++ b/lib/Bot/Games.pm
@@ -77,9 +77,9 @@ sub said {
# XXX: maybe the meta stuff should get pushed out into the plugins
# themselves, and this should become $game->meta->get_command or so?
if (my $method_meta = _get_command($game, $action)) {
- if ($method_meta->needs_init) {
- $self->$say($game->init($args->{who})) if $game->can('init');
- $self->done_init->{$game_name} = 1;
+ if ($method_meta->needs_init && !$self->done_init->{$game_name}) {
+ $self->$say("Game $game_name hasn't started yet!");
+ return;
}
$self->$say($method_meta->execute($game, $arg,
{player => $args->{who}}));