Some updates

This commit is contained in:
ArkQuark 2022-10-20 20:23:05 +03:00
parent 8d454e5ec9
commit e6c04861a4
5 changed files with 34 additions and 26 deletions

View file

@ -134,6 +134,7 @@ class PluginAPI extends stdClass{
}
private function loadAll(){
$pharCnt = 0;
$dir = dir($this->pluginsPath());
while(false !== ($file = $dir->read())){
if($file[0] !== "."){
@ -143,6 +144,7 @@ class PluginAPI extends stdClass{
$this->load($dir->path . $file);
}
if($ext2 === "phar"){
++$pharCnt;
$pluginInfo = []; //TODO: A PluginInfo class?
$filePath = $this->pluginsPath().$file;
$p = new Phar($this->pluginsPath().$file, 0);
@ -154,8 +156,7 @@ class PluginAPI extends stdClass{
break;
}
}
console("[INFO] Loading {$pluginInfo["name"]} by {$pluginInfo["author"]}...");
console("[WARNING] PHAR Plugin format is experemental and might cause bugs.");
console("[INFO] Loading PHAR plugin \"".FORMAT_GREEN.$pluginInfo["name"].FORMAT_RESET."\" ".FORMAT_AQUA.$pluginInfo["version"].FORMAT_RESET." by ".FORMAT_AQUA.$pluginInfo["author"].FORMAT_RESET);
$aver = CURRENT_API_VERSION;
if($pluginInfo["api"] != $aver){
@ -182,6 +183,9 @@ class PluginAPI extends stdClass{
}
}
}
if($pharCnt > 0){
console("[WARNING] PHAR Plugin format is experemental and might cause bugs.");
}
}
public function load($file){

View file

@ -30,23 +30,24 @@ abstract class Structure{
}
protected function placeBlock($level, $sym, &$tv){
console("@@@");
//console("@@@");
if($level instanceof Level){
$idm = $this->getMappingFor($sym);
var_dump($idm);
if(!isset($idm[1])) $idm[1] = 0;
//var_dump($idm);
if($idm === Structure::MAP_NO_KEY){
console("Failed to receive id");
//console("Failed to receive id");
return false;
}
$block = $this->api->block->get($idm[0], $idm[1], $tv); //TODO: meta
console($block);
//console($block);
$level->setBlock($tv, $block, true, false, true);
}
}
public function build($level, $centerX, $centerY, $centerZ){
console("b");
//console("b");
$tempVector = new Vector3(0,0,0);
$x = $centerX - $this->radius;
$z = $centerZ - $this->radius;
@ -54,7 +55,7 @@ abstract class Structure{
foreach($blocksXZ as $blocks){
foreach(str_split($blocks) as $block){
$tempVector->setXYZ($x, $centerY + $offsetY, $z);
console("6#&_+7$:373-");
//console("6#&_+7$:373-");
$this->placeBlock($level, $block, $tempVector);
++$x;
}