Teh Mine

From: Drew (X3N0PH0N) 4 Aug 2011 23:08
To: ANT_THOMAS 2843 of 3934
Ok, gimme a min.
From: Peter (BOUGHTONP) 4 Aug 2011 23:12
To: ANT_THOMAS 2844 of 3934
Is the chat thing itself part of Bukkit or part of Minecraft server?
From: ANT_THOMAS 4 Aug 2011 23:13
To: Peter (BOUGHTONP) 2845 of 3934
Minecraft server I think. Fairly sure there's always chat even if you use the vanilla server.
From: Matt 4 Aug 2011 23:18
To: Drew (X3N0PH0N) 2846 of 3934
Man, I corrected that shit. I blame Android.
From: Drew (X3N0PH0N) 4 Aug 2011 23:19
To: ANT_THOMAS 2847 of 3934
PHP code:
<?
 
$things = file('server.log');
$chats = Array();
 
foreach ($things as $thing) {
	if (strpos($thing, "[INFO] <")) {
		$chats[] = "[" . substr($thing, 11, 5) . "]" . htmlspecialchars(substr($thing, 27));
	} else if (strpos($thing, "[dynmap]")) {
		$thing = str_replace(": ?", ": ", $thing);
		$chats[] = "[" . substr($thing, 11, 5) . "]" . htmlspecialchars(substr($thing, 37));
	}
}
 
$chatt = implode("<br />", array_slice($chats, -30));
echo $chatt;
 
?>


I dunno if those question marks are really there or just an artefact of pasting? If they're not really there the character counts might be out. If they are, then if someone really says ": ?" via the web interface it'll be filtered out (because it's going to be so rare that I can't be arsed to code around it).

That aside, that should work. If you want seconds on the timestamps change those two instances of 11, 5 to 11, 8
From: Drew (X3N0PH0N) 4 Aug 2011 23:20
To: Drew (X3N0PH0N) 2848 of 3934
That'd be much neater with some regex but ... fuck regex :Y
From: ANT_THOMAS 4 Aug 2011 23:20
To: Drew (X3N0PH0N) 2849 of 3934

:D Thanks!

 

The ? are because of pasting, there's some colour formatting from dynmap to make it green.

From: Drew (X3N0PH0N) 4 Aug 2011 23:26
To: ANT_THOMAS 2850 of 3934
What character's really there?
From: ANT_THOMAS 4 Aug 2011 23:30
To: Drew (X3N0PH0N) 2851 of 3934
I've got rid of them now but it was "§"
From: Drew (X3N0PH0N) 4 Aug 2011 23:32
To: ANT_THOMAS 2852 of 3934
Show me exactly how the log looks (unless you've adjusted it already to work).
From: ANT_THOMAS 4 Aug 2011 23:37
To: Drew (X3N0PH0N) 2853 of 3934
I've adjusted it to work but it looks like this for dynmap entries...

code:
2011-08-04 22:09:49 [INFO] [dynmap] §2[WEB] 86.154.231.70: §fwhie I'm stuck in work
From: Drew (X3N0PH0N) 4 Aug 2011 23:38
To: ANT_THOMAS 2854 of 3934
Aight cool (hug)
From: Peter (BOUGHTONP) 5 Aug 2011 00:44
To: ANT_THOMAS 2855 of 3934
The dynmap messages are still disappearing too quick - have you changed the delay yet?
From: af (CAER) 5 Aug 2011 01:22
To: Drew (X3N0PH0N) 2856 of 3934
I last used PHP about 90 years ago, and I barely had a clue what I was doing then.
From: Peter (BOUGHTONP) 5 Aug 2011 01:58
To: ALL2857 of 3934
What's the no clouds thing you use?
From: Drew (X3N0PH0N) 5 Aug 2011 02:16
To: Peter (BOUGHTONP) 2858 of 3934
Just a texture pack with a transparent texture for clouds. I'll attach it.
EDITED: 16 Aug 2011 05:33 by X3N0PH0N
From: Peter (BOUGHTONP) 5 Aug 2011 02:43
To: ANT_THOMAS 2859 of 3934
If you add this before the closing brace of the foreach statement, it should show when people join and leave, which is probably handy?

php code:
	else if ( strpos($this,"logged in") )
	{
		$time = "[" . substr($thing, 11, 5) . "]";
		$person = preg_match( '/(?<=\[INFO\] )\S+/' , $thing );
		$chats[] = $time.' <i>Joined:</i> <b>'.htmlspecialchars($person).'</b>';
	}
	else if ( strpos($thing,"lost connection") )
	{
		$time = "[" . substr($thing, 11, 5) . "]";
		$person = preg_match( '/(?<=\[INFO\] )\S+/' , $thing );
		$reason = substr(strrchr($thing, '.'), 1);
		$chats[] = $time.' <i>Disconnected:</i> <b>'.htmlspecialchars($person).'</b> ('.$reason.')';
	}
From: Peter (BOUGHTONP) 5 Aug 2011 02:43
To: Drew (X3N0PH0N) 2860 of 3934

The stupid download doesn't seem to want to finish. :(

 

Gets to 484 of 507 KB and just stops.

 


That was Firefox, but Chrome is doing same. "506/507 kB, 0 secs left".

 

If I copy and rename the file I can't extract the zip because it's corrupt, because it's got a stupid kilobyte missing. :@

EDITED: 5 Aug 2011 02:47 by BOUGHTONP
From: ANT_THOMAS 5 Aug 2011 07:37
To: Peter (BOUGHTONP) 2861 of 3934
Yeah but I haven't reloaded the plugin yet because it requires a server restart and there was lots of busy people on last night.
From: ANT_THOMAS 5 Aug 2011 09:10
To: ALL2862 of 3934
The dynmap time for displaying chat is up to 20 secs now.