mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 19:49:44 +00:00
PMF Plugin Reading
This commit is contained in:
parent
6dfe348767
commit
1bfef261ab
4 changed files with 73 additions and 5 deletions
61
src/pmf/Plugin.php
Normal file
61
src/pmf/Plugin.php
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
|
||||
-
|
||||
/ \
|
||||
/ \
|
||||
/ PocketMine \
|
||||
/ MP \
|
||||
|\ @shoghicp /|
|
||||
|. \ / .|
|
||||
| .. \ / .. |
|
||||
| .. | .. |
|
||||
| .. | .. |
|
||||
\ | /
|
||||
\ | /
|
||||
\ | /
|
||||
\ | /
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
/***REM_START***/
|
||||
require_once(FILE_PATH."/src/pmf/PMF.php");
|
||||
/***REM_END***/
|
||||
|
||||
define("PMF_CURRENT_PLUGIN_VERSION", 0x00);
|
||||
|
||||
class PMFPlugin extends PMF{
|
||||
private $pluginData = array();
|
||||
public function __construct($file){
|
||||
$this->load($file);
|
||||
$this->parseInfo();
|
||||
$this->parsePlugin();
|
||||
}
|
||||
|
||||
protected function parsePlugin(){
|
||||
if($this->type !== 0x01){
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->pluginData["fversion"] = ord($this->read(1));
|
||||
$this->pluginData["name"] = $this->read(Utils::readShort($this->read(2), false));
|
||||
$this->pluginData["version"] = $this->read(Utils::readShort($this->read(2), false));
|
||||
$this->pluginData["author"] = $this->read(Utils::readShort($this->read(2), false));
|
||||
$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"] = $this->read(Utils::readShort($this->read(2), false)); //Additional custom plugin data
|
||||
$this->pluginData["code"] = "";
|
||||
while(!feof($this->fp)){
|
||||
$this->pluginData["code"] .= fread($this->fp, 4096);
|
||||
}
|
||||
$this->pluginData["code"] = gzinflate($this->pluginData["code"]);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue