Plugin version 2, include extra data

This commit is contained in:
Shoghi Cervantes 2013-06-02 17:55:59 +02:00
parent c7a3fc4931
commit ec22034ad7
2 changed files with 18 additions and 3 deletions

View File

@ -29,7 +29,7 @@ the Free Software Foundation, either version 3 of the License, or
require_once(FILE_PATH."/src/pmf/PMF.php");
/***REM_END***/
define("PMF_CURRENT_PLUGIN_VERSION", 0x01);
define("PMF_CURRENT_PLUGIN_VERSION", 0x02);
class PMFPlugin extends PMF{
private $pluginData = array();
@ -62,7 +62,21 @@ class PMFPlugin extends PMF{
}
$this->pluginData["class"] = $this->read(Utils::readShort($this->read(2), false));
$this->pluginData["identifier"] = $this->read(Utils::readShort($this->read(2), false)); //Will be used to check for updates
$this->pluginData["extra"] = gzinflate($this->read(Utils::readShort($this->read(2), false))); //Additional custom plugin data
if($this->pluginData["fversion"] >= 0x02){
$data = explode(";", gzinflate($this->read(Utils::readInt($this->read(4)))));
$this->pluginData["extra"] = array();
foreach($data as $v){
$v = trim($v);
if($v != ""){
$v = base64_decode($v);
$kl = strpos($v, ":");
$this->pluginData["extra"][substr($v, 0, $kl)] = substr($v, $kl + 1);
}
}
}else{
$this->pluginData["extra"] = gzinflate($this->read(Utils::readShort($this->read(2), false)));
}
$this->pluginData["code"] = "";
while(!feof($this->fp)){
$this->pluginData["code"] .= $this->read(4096);

View File

@ -426,6 +426,7 @@ class Entity extends Position{
$this->speedY = 0;
$this->speedZ = 0;
$update = false;
$this->server->api->handle("entity.move", $this);
$this->server->api->handle("entity.motion", $this);
}
@ -830,7 +831,7 @@ class Entity extends Position{
$this->x = 0;
$this->y = -10;
$this->z = 0;
$this->server->api->dhandle("entity.move", $this);
$this->server->api->trigger("entity.move", $this);
$this->x = $x;
$this->y = $y;
$this->z = $z;