mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
names were fixed, ->loop->stop();
This commit is contained in:
parent
50006a0189
commit
f6897cf862
242 changed files with 111 additions and 166 deletions
13
src/plugin/DummyPlugin.php
Normal file
13
src/plugin/DummyPlugin.php
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
class DummyPlugin implements Plugin{
|
||||
|
||||
public function __construct(ServerAPI $api, $server = false){
|
||||
}
|
||||
|
||||
public function init(){
|
||||
}
|
||||
|
||||
public function __destruct(){
|
||||
}
|
||||
}
|
||||
5
src/plugin/OtherPluginRequirement.php
Normal file
5
src/plugin/OtherPluginRequirement.php
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
|
||||
interface OtherPluginRequirement{
|
||||
public function getRequiredPlugins();
|
||||
}
|
||||
10
src/plugin/Plugin.php
Normal file
10
src/plugin/Plugin.php
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
interface Plugin{
|
||||
|
||||
public function __construct(ServerAPI $api, $server = false);
|
||||
|
||||
public function init();
|
||||
|
||||
//public function __destruct(); useless
|
||||
}
|
||||
7
src/plugin/phar/IClassLoader.php
Normal file
7
src/plugin/phar/IClassLoader.php
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
/*
|
||||
Used in PHAR plugins to load all custom classes
|
||||
*/
|
||||
interface IClassLoader{
|
||||
public function loadAll($pharPath);
|
||||
}
|
||||
33
src/plugin/phar/PharUtils.php
Normal file
33
src/plugin/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"] = trim($content["name"]);
|
||||
$pluginData["description"] = trim($content["description"]);
|
||||
$pluginData["version"] = trim($content["version"]);
|
||||
$pluginData["author"] = trim($content["author"]);
|
||||
$pluginData["mainFile"] = trim($content["mainFile"]);
|
||||
$pluginData["api"] = trim($content["api"]);
|
||||
$pluginData["classLoader"] = trim($content["classLoader"]);
|
||||
$pluginData["CLClass"] = self::getNameSpaceClass($pluginData["classLoader"]);
|
||||
return $pluginData;
|
||||
}
|
||||
|
||||
public static function getNameSpaceClass($content){
|
||||
return trim(substr(str_replace("/", "\\", $content), 0, -4));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue