Games (inc Online)Teh Mine

 

Press Ctrl+Enter to quickly submit your post
Quick Reply  
 
 
  
 From:  Peter (BOUGHTONP)  
 To:  ANT_THOMAS     
38140.2844 In reply to 38140.2841 
Is the chat thing itself part of Bukkit or part of Minecraft server?
0/0
 Reply   Quote More 

 From:  ANT_THOMAS  
 To:  Peter (BOUGHTONP)     
38140.2845 In reply to 38140.2844 
Minecraft server I think. Fairly sure there's always chat even if you use the vanilla server.
0/0
 Reply   Quote More 

 From:  Matt  
 To:  Drew (X3N0PH0N)     
38140.2846 In reply to 38140.2832 
Man, I corrected that shit. I blame Android.

doohicky

0/0
 Reply   Quote More 

 From:  Drew (X3N0PH0N)  
 To:  ANT_THOMAS     
38140.2847 In reply to 38140.2841 
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
0/0
 Reply   Quote More 

 From:  Drew (X3N0PH0N)  
 To:  Drew (X3N0PH0N)     
38140.2848 In reply to 38140.2847 
That'd be much neater with some regex but ... fuck regex :Y
0/0
 Reply   Quote More 

 From:  ANT_THOMAS  
 To:  Drew (X3N0PH0N)     
38140.2849 In reply to 38140.2847 

:D Thanks!

 

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

0/0
 Reply   Quote More 

 From:  Drew (X3N0PH0N)  
 To:  ANT_THOMAS     
38140.2850 In reply to 38140.2849 
What character's really there?
0/0
 Reply   Quote More 

 From:  ANT_THOMAS  
 To:  Drew (X3N0PH0N)     
38140.2851 In reply to 38140.2850 
I've got rid of them now but it was "§"
0/0
 Reply   Quote More 

 From:  Drew (X3N0PH0N)  
 To:  ANT_THOMAS     
38140.2852 In reply to 38140.2851 
Show me exactly how the log looks (unless you've adjusted it already to work).
0/0
 Reply   Quote More 

 From:  ANT_THOMAS  
 To:  Drew (X3N0PH0N)     
38140.2853 In reply to 38140.2852 
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
0/0
 Reply   Quote More 

 From:  Drew (X3N0PH0N)  
 To:  ANT_THOMAS     
38140.2854 In reply to 38140.2853 
Aight cool (hug)
0/0
 Reply   Quote More 

 From:  Peter (BOUGHTONP)  
 To:  ANT_THOMAS     
38140.2855 In reply to 38140.2811 
The dynmap messages are still disappearing too quick - have you changed the delay yet?
0/0
 Reply   Quote More 

 From:  af (CAER)  
 To:  Drew (X3N0PH0N)     
38140.2856 In reply to 38140.2808 
I last used PHP about 90 years ago, and I barely had a clue what I was doing then.
0/0
 Reply   Quote More 

 From:  Peter (BOUGHTONP)  
 To:  ALL
38140.2857 
What's the no clouds thing you use?
0/0
 Reply   Quote More 

 From:  Drew (X3N0PH0N)  
 To:  Peter (BOUGHTONP)     
38140.2858 In reply to 38140.2857 
Just a texture pack with a transparent texture for clouds. I'll attach it.
0/0
 Reply   Quote More 

 From:  Peter (BOUGHTONP)  
 To:  ANT_THOMAS     
38140.2859 
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.')';
	}
0/0
 Reply   Quote More 

 From:  Peter (BOUGHTONP)  
 To:  Drew (X3N0PH0N)     
38140.2860 In reply to 38140.2858 

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. :@

0/0
 Reply   Quote More 

 From:  ANT_THOMAS  
 To:  Peter (BOUGHTONP)     
38140.2861 In reply to 38140.2855 
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.
0/0
 Reply   Quote More 

 From:  ANT_THOMAS  
 To:  ALL
38140.2862 
The dynmap time for displaying chat is up to 20 secs now.
0/0
 Reply   Quote More 

 From:  ANT_THOMAS  
 To:  ANT_THOMAS     
38140.2863 In reply to 38140.2862 
Or maybe it's actually 15 seconds, that is possibly a max since I've set it at 20 and 25 and it's still gone after 15.
0/0
 Reply   Quote More 

Reply to All  
 

1–20  …  2801–2820  2821–2840  2841–2860  2861–2880  …  3921–3934

Rate my interest:

Adjust text size : Smaller 10 Larger

Beehive Forum 1.5.2 |  FAQ |  Docs |  Support |  Donate! ©2002 - 2024 Project Beehive Forum

Forum Stats