mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 03:59:43 +00:00
structure class added, phar plugins support
This commit is contained in:
parent
bc75dd9efa
commit
95dbf588c5
9 changed files with 160 additions and 12 deletions
33
src/phar/PharUtils.php
Normal file
33
src/phar/PharUtils.php
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
class PharUtils{
|
||||
|
||||
public static function readMainConfig($content){
|
||||
$pluginData = [];
|
||||
$content = explode("\n", $content);
|
||||
foreach($content as $id => $line){
|
||||
if(!strpos($line, "=")){
|
||||
continue;
|
||||
}
|
||||
|
||||
$line = explode("=", $line);
|
||||
$content[$line[0]] = $line[1];
|
||||
}
|
||||
|
||||
$pluginData["name"] = $content["name"];
|
||||
$pluginData["description"] = $content["description"];
|
||||
$pluginData["version"] = $content["version"];
|
||||
$pluginData["author"] = $content["author"];
|
||||
$pluginData["mainFile"] = $content["mainFile"];
|
||||
$pluginData["api"] = $content["api"];
|
||||
$pluginData["classLoader"] = $content["classLoader"];
|
||||
$pluginData["CLClass"] = self::getNameSpaceClass($pluginData["classLoader"]);
|
||||
return $pluginData;
|
||||
}
|
||||
|
||||
public static function getNameSpaceClass($content){
|
||||
return substr(str_replace("/", "\\", $content), 0, -4);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue