mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-07 12:18:46 +00:00
Some fixes, thanks PhpStorm
This commit is contained in:
parent
096836faaa
commit
1cb96d24ce
@ -76,7 +76,7 @@ class ExampleClass{
|
|||||||
4 => "value5",
|
4 => "value5",
|
||||||
5 => "value6",
|
5 => "value6",
|
||||||
];
|
];
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1078,8 +1078,8 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
|||||||
*/
|
*/
|
||||||
public function awardAchievement($achievementId){
|
public function awardAchievement($achievementId){
|
||||||
if(isset(Achievement::$list[$achievementId]) and !$this->hasAchievement($achievementId)){
|
if(isset(Achievement::$list[$achievementId]) and !$this->hasAchievement($achievementId)){
|
||||||
foreach(Achievement::$list[$achievementId]["requires"] as $requerimentId){
|
foreach(Achievement::$list[$achievementId]["requires"] as $requirementId){
|
||||||
if(!$this->hasAchievement($requerimentId)){
|
if(!$this->hasAchievement($requirementId)){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -366,10 +366,10 @@ class Block extends Position implements BlockIds, Metadatable{
|
|||||||
*
|
*
|
||||||
* @param int $type
|
* @param int $type
|
||||||
*
|
*
|
||||||
* @return void
|
* @return int|bool
|
||||||
*/
|
*/
|
||||||
public function onUpdate($type){
|
public function onUpdate($type){
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -52,7 +52,7 @@ class Bucket extends Item{
|
|||||||
if(!$ev->isCancelled()){
|
if(!$ev->isCancelled()){
|
||||||
$player->getLevel()->setBlock($target, new Air(), true, true);
|
$player->getLevel()->setBlock($target, new Air(), true, true);
|
||||||
if($player->isSurvival()){
|
if($player->isSurvival()){
|
||||||
$player->getInventory()->setItemInHand($ev->getItem(), $player);
|
$player->getInventory()->setItemInHand($ev->getItem());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}else{
|
}else{
|
||||||
@ -66,7 +66,7 @@ class Bucket extends Item{
|
|||||||
if(!$ev->isCancelled()){
|
if(!$ev->isCancelled()){
|
||||||
$player->getLevel()->setBlock($block, $targetBlock, true, true);
|
$player->getLevel()->setBlock($block, $targetBlock, true, true);
|
||||||
if($player->isSurvival()){
|
if($player->isSurvival()){
|
||||||
$player->getInventory()->setItemInHand($ev->getItem(), $player);
|
$player->getInventory()->setItemInHand($ev->getItem());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}else{
|
}else{
|
||||||
|
@ -787,7 +787,8 @@ class Item implements ItemIds, \JsonSerializable{
|
|||||||
/**
|
/**
|
||||||
* Serializes the item to an NBT CompoundTag
|
* Serializes the item to an NBT CompoundTag
|
||||||
*
|
*
|
||||||
* @param int $slot optional, the inventory slot of the item
|
* @param int $slot optional, the inventory slot of the item
|
||||||
|
* @param string $tagName the name to assign to the CompoundTag object
|
||||||
*
|
*
|
||||||
* @return CompoundTag
|
* @return CompoundTag
|
||||||
*/
|
*/
|
||||||
|
@ -61,6 +61,7 @@ interface Chunk{
|
|||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getHeight() : int;
|
public function getHeight() : int;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets block and meta in one go
|
* Gets block and meta in one go
|
||||||
*
|
*
|
||||||
@ -324,6 +325,7 @@ interface Chunk{
|
|||||||
/**
|
/**
|
||||||
* @param int $fY 0-15
|
* @param int $fY 0-15
|
||||||
* @param SubChunk $subChunk
|
* @param SubChunk $subChunk
|
||||||
|
* @param bool $allowEmpty
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
@ -337,7 +339,7 @@ interface Chunk{
|
|||||||
/**
|
/**
|
||||||
* Returns the index of the highest non-empty subchunk
|
* Returns the index of the highest non-empty subchunk
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getHighestSubChunkIndex() : int;
|
public function getHighestSubChunkIndex() : int;
|
||||||
|
|
||||||
@ -363,6 +365,8 @@ interface Chunk{
|
|||||||
/**
|
/**
|
||||||
* Serializes a chunk without compression for use in AsyncTasks.
|
* Serializes a chunk without compression for use in AsyncTasks.
|
||||||
*
|
*
|
||||||
|
* @param Chunk $chunk
|
||||||
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function fastSerialize(Chunk $chunk) : string;
|
public static function fastSerialize(Chunk $chunk) : string;
|
||||||
|
@ -109,6 +109,8 @@ interface LevelProvider{
|
|||||||
/**
|
/**
|
||||||
* @param int $chunkX
|
* @param int $chunkX
|
||||||
* @param int $chunkZ
|
* @param int $chunkZ
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function saveChunk(int $chunkX, int $chunkZ) : bool;
|
public function saveChunk(int $chunkX, int $chunkZ) : bool;
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ class GenericChunk implements Chunk{
|
|||||||
* @param CompoundTag[] $entities
|
* @param CompoundTag[] $entities
|
||||||
* @param CompoundTag[] $tiles
|
* @param CompoundTag[] $tiles
|
||||||
* @param string $biomeIds
|
* @param string $biomeIds
|
||||||
* @param int[256] $heightMap
|
* @param int[] $heightMap
|
||||||
*/
|
*/
|
||||||
public function __construct($provider, int $chunkX, int $chunkZ, array $subChunks = [], array $entities = [], array $tiles = [], string $biomeIds = "", array $heightMap = []){
|
public function __construct($provider, int $chunkX, int $chunkZ, array $subChunks = [], array $entities = [], array $tiles = [], string $biomeIds = "", array $heightMap = []){
|
||||||
$this->provider = $provider;
|
$this->provider = $provider;
|
||||||
@ -736,7 +736,7 @@ class GenericChunk implements Chunk{
|
|||||||
/**
|
/**
|
||||||
* Converts pre-MCPE-1.0 biome colour array to biome ID array. RIP BiomeColors :(
|
* Converts pre-MCPE-1.0 biome colour array to biome ID array. RIP BiomeColors :(
|
||||||
*
|
*
|
||||||
* @param int[256] $array of biome colour values
|
* @param int[] $array of biome colour values
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
@ -59,7 +59,7 @@ class Anvil extends McRegion{
|
|||||||
}
|
}
|
||||||
$nbt->Sections[++$subChunks] = new CompoundTag(null, [
|
$nbt->Sections[++$subChunks] = new CompoundTag(null, [
|
||||||
"Y" => new ByteTag("Y", $y),
|
"Y" => new ByteTag("Y", $y),
|
||||||
"Blocks" => new ByteArrayTag("Blocks", GenericChunk::reorderByteArray($subChunk->getBlockIdArray())), //Generic in-memory chunks are currrently always XZY
|
"Blocks" => new ByteArrayTag("Blocks", GenericChunk::reorderByteArray($subChunk->getBlockIdArray())), //Generic in-memory chunks are currently always XZY
|
||||||
"Data" => new ByteArrayTag("Data", GenericChunk::reorderNibbleArray($subChunk->getBlockDataArray())),
|
"Data" => new ByteArrayTag("Data", GenericChunk::reorderNibbleArray($subChunk->getBlockDataArray())),
|
||||||
"SkyLight" => new ByteArrayTag("SkyLight", GenericChunk::reorderNibbleArray($subChunk->getSkyLightArray())),
|
"SkyLight" => new ByteArrayTag("SkyLight", GenericChunk::reorderNibbleArray($subChunk->getSkyLightArray())),
|
||||||
"BlockLight" => new ByteArrayTag("BlockLight", GenericChunk::reorderNibbleArray($subChunk->getBlockLightArray()))
|
"BlockLight" => new ByteArrayTag("BlockLight", GenericChunk::reorderNibbleArray($subChunk->getBlockLightArray()))
|
||||||
|
@ -21,10 +21,6 @@
|
|||||||
|
|
||||||
namespace pocketmine\math;
|
namespace pocketmine\math;
|
||||||
|
|
||||||
/**
|
|
||||||
* WARNING: This class is available on the PocketMine-MP Zephir project.
|
|
||||||
* If this class is modified, remember to modify the PHP C extension.
|
|
||||||
*/
|
|
||||||
class Vector2{
|
class Vector2{
|
||||||
public $x;
|
public $x;
|
||||||
public $y;
|
public $y;
|
||||||
|
@ -433,6 +433,8 @@ class NBT{
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param bool $network
|
||||||
|
*
|
||||||
* @return string|bool
|
* @return string|bool
|
||||||
*/
|
*/
|
||||||
public function write(bool $network = false){
|
public function write(bool $network = false){
|
||||||
|
@ -45,6 +45,7 @@ class TextPacket extends DataPacket{
|
|||||||
switch($this->type){
|
switch($this->type){
|
||||||
case self::TYPE_POPUP:
|
case self::TYPE_POPUP:
|
||||||
case self::TYPE_CHAT:
|
case self::TYPE_CHAT:
|
||||||
|
/** @noinspection PhpMissingBreakStatementInspection */
|
||||||
case self::TYPE_WHISPER:
|
case self::TYPE_WHISPER:
|
||||||
$this->source = $this->getString();
|
$this->source = $this->getString();
|
||||||
case self::TYPE_RAW:
|
case self::TYPE_RAW:
|
||||||
@ -68,6 +69,7 @@ class TextPacket extends DataPacket{
|
|||||||
switch($this->type){
|
switch($this->type){
|
||||||
case self::TYPE_POPUP:
|
case self::TYPE_POPUP:
|
||||||
case self::TYPE_CHAT:
|
case self::TYPE_CHAT:
|
||||||
|
/** @noinspection PhpMissingBreakStatementInspection */
|
||||||
case self::TYPE_WHISPER:
|
case self::TYPE_WHISPER:
|
||||||
$this->putString($this->source);
|
$this->putString($this->source);
|
||||||
case self::TYPE_RAW:
|
case self::TYPE_RAW:
|
||||||
|
@ -80,7 +80,7 @@ interface Plugin extends CommandExecutor{
|
|||||||
public function saveResource($filename, $replace = false);
|
public function saveResource($filename, $replace = false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns all the resources incrusted in the plugin
|
* Returns all the resources packaged with the plugin
|
||||||
*/
|
*/
|
||||||
public function getResources();
|
public function getResources();
|
||||||
|
|
||||||
|
@ -217,7 +217,7 @@ abstract class PluginBase implements Plugin{
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns all the resources incrusted on the plugin
|
* Returns all the resources packaged with the plugin
|
||||||
*
|
*
|
||||||
* @return string[]
|
* @return string[]
|
||||||
*/
|
*/
|
||||||
|
@ -31,7 +31,7 @@ use pocketmine\Server;
|
|||||||
* with no AsyncTask running. Therefore, an AsyncTask SHOULD NOT execute for more than a few seconds. For tasks that
|
* with no AsyncTask running. Therefore, an AsyncTask SHOULD NOT execute for more than a few seconds. For tasks that
|
||||||
* run for a long time or infinitely, start another {@link \pocketmine\Thread} instead.
|
* run for a long time or infinitely, start another {@link \pocketmine\Thread} instead.
|
||||||
*
|
*
|
||||||
* WARNING: Do not call PocketMine-MP API methods, or save objects (and arrays cotaining objects) from/on other Threads!!
|
* WARNING: Do not call PocketMine-MP API methods, or save objects (and arrays containing objects) from/on other Threads!!
|
||||||
*/
|
*/
|
||||||
abstract class AsyncTask extends Collectable{
|
abstract class AsyncTask extends Collectable{
|
||||||
|
|
||||||
@ -176,7 +176,7 @@ abstract class AsyncTask extends Collectable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call this method from {@link AsyncTask#onRun} (AsyncTask execution therad) to schedule a call to
|
* Call this method from {@link AsyncTask#onRun} (AsyncTask execution thread) to schedule a call to
|
||||||
* {@link AsyncTask#onProgressUpdate} from the main thread with the given progress parameter.
|
* {@link AsyncTask#onProgressUpdate} from the main thread with the given progress parameter.
|
||||||
*
|
*
|
||||||
* @param mixed $progress A value that can be safely serialize()'ed.
|
* @param mixed $progress A value that can be safely serialize()'ed.
|
||||||
|
@ -45,6 +45,7 @@ class FlowerPot extends Spawnable{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
switch($item->getId()){
|
switch($item->getId()){
|
||||||
|
/** @noinspection PhpMissingBreakStatementInspection */
|
||||||
case Item::TALL_GRASS:
|
case Item::TALL_GRASS:
|
||||||
if($item->getDamage() === 1){
|
if($item->getDamage() === 1){
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user