mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-03 00:29:54 +00:00
Fixed and silenced some inspections
This commit is contained in:
parent
99995579d7
commit
f98a964cdc
@ -453,20 +453,21 @@ namespace pocketmine {
|
|||||||
exit(1); //Exit with error
|
exit(1); //Exit with error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$gitHash = str_repeat("00", 20);
|
||||||
if(file_exists(\pocketmine\PATH . ".git/HEAD")){ //Found Git information!
|
if(file_exists(\pocketmine\PATH . ".git/HEAD")){ //Found Git information!
|
||||||
$ref = trim(file_get_contents(\pocketmine\PATH . ".git/HEAD"));
|
$ref = trim(file_get_contents(\pocketmine\PATH . ".git/HEAD"));
|
||||||
if(preg_match('/^[0-9a-f]{40}$/i', $ref)){
|
if(preg_match('/^[0-9a-f]{40}$/i', $ref)){
|
||||||
define('pocketmine\GIT_COMMIT', strtolower($ref));
|
$gitHash = strtolower($ref);
|
||||||
}elseif(substr($ref, 0, 5) === "ref: "){
|
}elseif(substr($ref, 0, 5) === "ref: "){
|
||||||
$refFile = \pocketmine\PATH . ".git/" . substr($ref, 5);
|
$refFile = \pocketmine\PATH . ".git/" . substr($ref, 5);
|
||||||
if(is_file($refFile)){
|
if(is_file($refFile)){
|
||||||
define('pocketmine\GIT_COMMIT', strtolower(trim(file_get_contents($refFile))));
|
$gitHash = strtolower(trim(file_get_contents($refFile)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!defined('pocketmine\GIT_COMMIT')){ //Unknown :(
|
|
||||||
define('pocketmine\GIT_COMMIT', str_repeat("00", 20));
|
define('pocketmine\GIT_COMMIT', $gitHash);
|
||||||
}
|
|
||||||
|
|
||||||
@define("ENDIANNESS", (pack("d", 1) === "\77\360\0\0\0\0\0\0" ? Binary::BIG_ENDIAN : Binary::LITTLE_ENDIAN));
|
@define("ENDIANNESS", (pack("d", 1) === "\77\360\0\0\0\0\0\0" ? Binary::BIG_ENDIAN : Binary::LITTLE_ENDIAN));
|
||||||
@define("INT32_MASK", is_int(0xffffffff) ? 0xffffffff : -1);
|
@define("INT32_MASK", is_int(0xffffffff) ? 0xffffffff : -1);
|
||||||
|
@ -21,10 +21,6 @@
|
|||||||
|
|
||||||
namespace pocketmine\block;
|
namespace pocketmine\block;
|
||||||
|
|
||||||
use pocketmine\item\Item;
|
|
||||||
use pocketmine\item\Tool;
|
|
||||||
use pocketmine\Player;
|
|
||||||
|
|
||||||
class LitPumpkin extends Pumpkin{
|
class LitPumpkin extends Pumpkin{
|
||||||
|
|
||||||
protected $id = self::LIT_PUMPKIN;
|
protected $id = self::LIT_PUMPKIN;
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
namespace pocketmine\level\generator\object;
|
namespace pocketmine\level\generator\object;
|
||||||
|
|
||||||
use pocketmine\level\ChunkManager;
|
use pocketmine\level\ChunkManager;
|
||||||
|
use pocketmine\utils\Random;
|
||||||
|
|
||||||
class BigTree extends Tree{
|
class BigTree extends Tree{
|
||||||
private $trunkHeightMultiplier = 0.618;
|
private $trunkHeightMultiplier = 0.618;
|
||||||
@ -38,13 +39,13 @@ class BigTree extends Tree{
|
|||||||
private $addLogVines = false;
|
private $addLogVines = false;
|
||||||
private $addCocoaPlants = false;
|
private $addCocoaPlants = false;
|
||||||
|
|
||||||
public function canPlaceObject(ChunkManager $level, $x, $y, $z){
|
public function canPlaceObject(ChunkManager $level, $x, $y, $z, Random $random){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function placeObject(ChunkManager $level, $x, $y, $z, $type){
|
public function placeObject(ChunkManager $level, $x, $y, $z, Random $random){
|
||||||
|
|
||||||
$this->trunkHeight = (int) ($this->totalHeight * $this->trunkHeightMultiplier);
|
/*$this->trunkHeight = (int) ($this->totalHeight * $this->trunkHeightMultiplier);
|
||||||
$leaves = $this->getLeafGroupPoints($level, $pos);
|
$leaves = $this->getLeafGroupPoints($level, $pos);
|
||||||
foreach($leaves as $leafGroup){
|
foreach($leaves as $leafGroup){
|
||||||
$groupX = $leafGroup->getBlockX();
|
$groupX = $leafGroup->getBlockX();
|
||||||
@ -54,7 +55,7 @@ class BigTree extends Tree{
|
|||||||
$this->generateGroupLayer($level, $groupX, $yy, $groupZ, $this->getLeafGroupLayerSize($yy - $groupY));
|
$this->generateGroupLayer($level, $groupX, $yy, $groupZ, $this->getLeafGroupLayerSize($yy - $groupY));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*final BlockIterator trunk = new BlockIterator(new Point(w, x, y - 1, z), new Point(w, x, y + trunkHeight, z));
|
final BlockIterator trunk = new BlockIterator(new Point(w, x, y - 1, z), new Point(w, x, y + trunkHeight, z));
|
||||||
while (trunk.hasNext()) {
|
while (trunk.hasNext()) {
|
||||||
trunk.next().setMaterial(VanillaMaterials.LOG, logMetadata);
|
trunk.next().setMaterial(VanillaMaterials.LOG, logMetadata);
|
||||||
}
|
}
|
||||||
@ -69,13 +70,13 @@ class BigTree extends Tree{
|
|||||||
for($xx = -$xzRadius; $xx < ($xzRadius + 1); ++$xx){
|
for($xx = -$xzRadius; $xx < ($xzRadius + 1); ++$xx){
|
||||||
for($zz = -$xzRadius; $zz < ($xzRadius + 1); ++$zz){
|
for($zz = -$xzRadius; $zz < ($xzRadius + 1); ++$zz){
|
||||||
if((abs($xx) != $xzRadius or abs($zz) != $xzRadius) and $yRadius != 0){
|
if((abs($xx) != $xzRadius or abs($zz) != $xzRadius) and $yRadius != 0){
|
||||||
$level->setBlock($pos->x + $xx, $pos->y + $yy, $pos->z + $zz, 18, $type);
|
$level->setBlock($pos->x + $xx, $pos->y + $yy, $pos->z + $zz, 18, $this->type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for($yy = 0; $yy < ($this->totalHeight - 1); ++$yy){
|
for($yy = 0; $yy < ($this->totalHeight - 1); ++$yy){
|
||||||
$level->setBlock($x, $pos->y + $yy, $z, 17, $type);
|
$level->setBlock($x, $pos->y + $yy, $z, 17, $this->type);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,7 @@ class Pond{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function canPlaceObject(ChunkManager $level, Vector3 $pos){
|
public function canPlaceObject(ChunkManager $level, Vector3 $pos){
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function placeObject(ChunkManager $level, Vector3 $pos){
|
public function placeObject(ChunkManager $level, Vector3 $pos){
|
||||||
|
@ -23,6 +23,7 @@ namespace pocketmine\level\generator\populator;
|
|||||||
|
|
||||||
use pocketmine\block\Water;
|
use pocketmine\block\Water;
|
||||||
use pocketmine\level\ChunkManager;
|
use pocketmine\level\ChunkManager;
|
||||||
|
use pocketmine\math\Vector3;
|
||||||
use pocketmine\utils\Random;
|
use pocketmine\utils\Random;
|
||||||
|
|
||||||
class Pond extends Populator{
|
class Pond extends Populator{
|
||||||
@ -36,8 +37,8 @@ class Pond extends Populator{
|
|||||||
$y = $random->nextBoundedInt(128);
|
$y = $random->nextBoundedInt(128);
|
||||||
$z = $random->nextRange($chunkZ << 4, ($chunkZ << 4) + 16);
|
$z = $random->nextRange($chunkZ << 4, ($chunkZ << 4) + 16);
|
||||||
$pond = new \pocketmine\level\generator\object\Pond($random, new Water());
|
$pond = new \pocketmine\level\generator\object\Pond($random, new Water());
|
||||||
if($pond->canPlaceObject($level, $x, $y, $z)){
|
if($pond->canPlaceObject($level, $v = new Vector3($x, $y, $z))){
|
||||||
$pond->placeObject($level, $x, $y, $z);
|
$pond->placeObject($level, $v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,10 +37,13 @@ abstract class UPnP{
|
|||||||
$port = (int) $port;
|
$port = (int) $port;
|
||||||
$myLocalIP = gethostbyname(trim(`hostname`));
|
$myLocalIP = gethostbyname(trim(`hostname`));
|
||||||
try{
|
try{
|
||||||
|
/** @noinspection PhpUndefinedClassInspection */
|
||||||
$com = new \COM("HNetCfg.NATUPnP");
|
$com = new \COM("HNetCfg.NATUPnP");
|
||||||
|
/** @noinspection PhpUndefinedFieldInspection */
|
||||||
if($com === false or !is_object($com->StaticPortMappingCollection)){
|
if($com === false or !is_object($com->StaticPortMappingCollection)){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
/** @noinspection PhpUndefinedFieldInspection */
|
||||||
$com->StaticPortMappingCollection->Add($port, "UDP", $port, $myLocalIP, true, "PocketMine-MP");
|
$com->StaticPortMappingCollection->Add($port, "UDP", $port, $myLocalIP, true, "PocketMine-MP");
|
||||||
}catch(\Throwable $e){
|
}catch(\Throwable $e){
|
||||||
return false;
|
return false;
|
||||||
@ -58,10 +61,13 @@ abstract class UPnP{
|
|||||||
}
|
}
|
||||||
$port = (int) $port;
|
$port = (int) $port;
|
||||||
try{
|
try{
|
||||||
|
/** @noinspection PhpUndefinedClassInspection */
|
||||||
$com = new \COM("HNetCfg.NATUPnP") or false;
|
$com = new \COM("HNetCfg.NATUPnP") or false;
|
||||||
|
/** @noinspection PhpUndefinedFieldInspection */
|
||||||
if($com === false or !is_object($com->StaticPortMappingCollection)){
|
if($com === false or !is_object($com->StaticPortMappingCollection)){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
/** @noinspection PhpUndefinedFieldInspection */
|
||||||
$com->StaticPortMappingCollection->Remove($port, "UDP");
|
$com->StaticPortMappingCollection->Remove($port, "UDP");
|
||||||
}catch(\Throwable $e){
|
}catch(\Throwable $e){
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user