From ec22034ad71676c30e979a9f6d7e8b1ef3e9fced Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Sun, 2 Jun 2013 17:55:59 +0200 Subject: [PATCH] Plugin version 2, include extra data --- src/pmf/Plugin.php | 18 ++++++++++++++++-- src/world/Entity.php | 3 ++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/pmf/Plugin.php b/src/pmf/Plugin.php index 7b9592b306..4124c82b20 100644 --- a/src/pmf/Plugin.php +++ b/src/pmf/Plugin.php @@ -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); diff --git a/src/world/Entity.php b/src/world/Entity.php index 33f9a9df1e..626bf40e60 100644 --- a/src/world/Entity.php +++ b/src/world/Entity.php @@ -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;