Minecraft Plugin mcMMO PHP StatViewer

Aus Laub-Home.de Wiki
Zur Navigation springen Zur Suche springen

Beispiel mcMMO Player Stat Datei:

PlayerA:0:null:null:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:null:0:0:0:0:0:0:0:0:0:STANDARD:0:0:
PlayerB:0:null:null:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:null:0:0:0:0:0:0:0:0:0:STANDARD:0:0:
PlayerC:0:null:null:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:null:0:0:0:0:0:0:0:0:0:STANDARD:0:0:


Feldbeschreibung:

 0    Username
 1    Mining Lvl
 2    MySpawn Location
 3    Party
 4    Mining XP
 5    Woodcutting Lvl
 6    Woodcutting Xp
 7    Repair Lvl
 8    Unarmed Lvl
 9    Herbalism Lvl
10    Excavation Lvl
11    Archery Lvl
12    Swords Lvl
13    Axes Lvl
14    Acrobatics Lvl
15    Repair XP
16    Unarmed XP
17    Herbalism XP
18    Excavation XP
19    Archery XP
20    Sword XP
21    Axe XP
22    Acrobatics XP


PHP Script zum Auswerten der Felder:

	// load mcMMO user stat file mcmmo.users
	$l_UserDataFileContent = file_get_contents('./mcmmo.users') or die('user data not found');

	$l_UserDataFileLines = explode("\n", $l_UserDataFileContent);
	$l_Users = array();
	foreach ($l_UserDataFileLines as $key => $l_UserDataLine) {
		$l_UserData = explode(":", $l_UserDataLine);
		$l_Users[] = array(
				'name'              => $l_UserData[0],
				'mining_lvl'        => $l_UserData[1],
				'mining_exp'        => $l_UserData[4],
				'woodcutting_lvl'   => $l_UserData[5],
				'woodcutting_exp'   => $l_UserData[6],
				'repair_lvl'        => $l_UserData[7],
				'repair_exp'        => $l_UserData[15],
				'unarmed_lvl'       => $l_UserData[8],
				'unarmed_exp'       => $l_UserData[16],
				'herbalism_lvl'     => $l_UserData[9],
				'herbalism_exp'     => $l_UserData[17],
				'excavation_lvl'    => $l_UserData[10],
				'excavation_exp'    => $l_UserData[18],
				'archery_lvl'       => $l_UserData[11],
				'archery_exp'       => $l_UserData[19],
				'swords_lvl'        => $l_UserData[12],
				'swords_exp'        => $l_UserData[20],
				'axes_lvl'          => $l_UserData[13],
				'axes_exp'          => $l_UserData[21],
				'acrobatics_lvl'    => $l_UserData[14],
				'acrobatics_exp'    => $l_UserData[22],
				'tamming_lvl'       => $l_UserData[24],
				'tamming_exp'       => $l_UserData[25],
				'power_lvl'         => $l_UserData[1] + $l_UserData[5] + $l_UserData[7]
							+ $l_UserData[8] + $l_UserData[9] + $l_UserData[10]
							+ $l_UserData[11] + $l_UserData[12] + $l_UserData[13]
							+ $l_UserData[14] + $l_UserData[24]
						);
	}

	foreach ($l_Users as $key => $l_User) {
		if($l_User['name'] != '') {
			echo $l_User['name'] . '<br/>';
			echo $l_User['power_lvl'] . '<br/>';
			echo $l_User['mining_lvl'] . '<br/>';
			echo $l_User['woodcutting_lvl'] . '<br/>';
			echo $l_User['repair_lvl'] . '<br/>';
			echo $l_User['unarmed_lvl'] . '<br/>';
			echo $l_User['herbalism_lvl'] . '<br/>';
			echo $l_User['excavation_lvl'] . '<br/>';
			echo $l_User['archery_lvl'] . '<br/>';
			echo $l_User['swords_lvl'] . '<br/>';
			echo $l_User['axes_lvl'] . '<br/>';
			echo $l_User['acrobatics_lvl'] . '<br/>';
			echo $l_User['tamming_lvl'] . '<br/>';
			echo '<hr>';
		}
	}


Beispieldarstellung der Daten mit selbst erstellten Symbolen:
Minecraft mcMMO-StatViewer.png