… | |
… | |
53 | }; |
53 | }; |
54 | |
54 | |
55 | cf::register_command seen => sub { |
55 | cf::register_command seen => sub { |
56 | my ($pl, $args) = @_; |
56 | my ($pl, $args) = @_; |
57 | |
57 | |
|
|
58 | cf::async { |
58 | if (my ($login) = $args =~ /(\S+)/) { |
59 | if (my ($login) = $args =~ /(\S+)/) { |
59 | if ($login eq $pl->name) { |
60 | if ($login eq $pl->name) { |
60 | $pl->message ("Very funny, $login. Ha. Ha.", cf::NDI_REPLY); |
61 | $pl->message ("Very funny, $login. Ha. Ha.", cf::NDI_REPLY); |
61 | } elsif (cf::player::find_active $login) { |
62 | } elsif (cf::player::find_active $login) { |
62 | $pl->message ("$login is right here on this server!", cf::NDI_REPLY); |
63 | $pl->message ("$login is right here on this server!", cf::NDI_REPLY); |
63 | } elsif (cf::player::exists $login |
64 | } elsif (cf::player::exists $login |
64 | and stat cf::player::path $login) { |
65 | and stat cf::player::path $login) { |
65 | my $time = (stat _)[9]; |
66 | my $time = (stat _)[9]; |
66 | |
67 | |
67 | $pl->message ("$login was last seen here " |
68 | $pl->message ("$login was last seen here " |
68 | . (POSIX::strftime "%Y-%m-%d %H:%M:%S +0000", gmtime $time) |
69 | . (POSIX::strftime "%Y-%m-%d %H:%M:%S +0000", gmtime $time) |
69 | . " which was " . (int +(time - $time) / 3600) . " hours ago.", cf::NDI_REPLY); |
70 | . " which was " . (int +(time - $time) / 3600) . " hours ago.", cf::NDI_REPLY); |
|
|
71 | } else { |
|
|
72 | $pl->message ("No player named $login is known to me.", cf::NDI_REPLY); |
|
|
73 | } |
70 | } else { |
74 | } else { |
71 | $pl->message ("No player named $login is known to me.", cf::NDI_REPLY); |
75 | $pl->message ("Usage: seen <player>", cf::NDI_REPLY); |
72 | } |
76 | } |
73 | } else { |
|
|
74 | $pl->message ("Usage: seen <player>", cf::NDI_REPLY); |
|
|
75 | } |
77 | }; |
76 | }; |
78 | }; |
77 | |
79 | |
78 | cf::register_command body => sub { |
80 | cf::register_command body => sub { |
79 | my ($ob) = @_; |
81 | my ($ob) = @_; |
80 | |
82 | |