mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-12 04:20:17 +00:00
Compare commits
44 Commits
Author | SHA1 | Date | |
---|---|---|---|
b38b932845 | |||
43cb19ebca | |||
769cc91543 | |||
37c2d78731 | |||
b7663e5815 | |||
1d0ffa06f8 | |||
768cfe3953 | |||
2822465f33 | |||
5da48f429f | |||
dbd0d04549 | |||
0f92ec6d2a | |||
791b4d8ef3 | |||
0b7ff6f2e7 | |||
af092b01e1 | |||
d811217755 | |||
d7f86f0240 | |||
5fe1d2e396 | |||
ddbb5363ef | |||
d3704bfae4 | |||
07f034d2da | |||
331ae5498f | |||
eebd90ec42 | |||
8e47a40b4c | |||
0f9fdf6442 | |||
5364e4de68 | |||
1099e2044b | |||
80d48161d3 | |||
fbe8485696 | |||
a150f39b02 | |||
71d17c50d6 | |||
3a18bdd6a0 | |||
96857c65b6 | |||
9826abd83e | |||
48c8c2a8c3 | |||
c83b7d9b69 | |||
c66dc7b273 | |||
5bf7350ee5 | |||
636cc1c199 | |||
62b6405371 | |||
9ecf23d3ee | |||
187f36fe38 | |||
dc89b48354 | |||
e6d1c1dfbc | |||
5a8812b1dc |
@ -4,3 +4,7 @@ root = yes
|
||||
[*]
|
||||
indent_size = 4
|
||||
indent_style = tab
|
||||
|
||||
[*.yml]
|
||||
indent_size = 2
|
||||
indent_style = space
|
||||
|
@ -27,7 +27,7 @@
|
||||
"pocketmine/raklib": "^0.12.0",
|
||||
"pocketmine/spl": "^0.3.0",
|
||||
"pocketmine/binaryutils": "^0.1.0",
|
||||
"pocketmine/nbt": "^0.2.1",
|
||||
"pocketmine/nbt": "^0.2.6",
|
||||
"pocketmine/math": "^0.2.0",
|
||||
"pocketmine/snooze": "^0.1.0",
|
||||
"daverandom/callback-validator": "dev-master",
|
||||
|
26
composer.lock
generated
26
composer.lock
generated
@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "d3fb809caf4d5a5c99054f47f28ff271",
|
||||
"content-hash": "2f5313e4ebd7b62c785cf683b27464b4",
|
||||
"packages": [
|
||||
{
|
||||
"name": "adhocore/json-comment",
|
||||
@ -160,16 +160,16 @@
|
||||
},
|
||||
{
|
||||
"name": "pocketmine/nbt",
|
||||
"version": "0.2.5",
|
||||
"version": "0.2.6",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/pmmp/NBT.git",
|
||||
"reference": "0b290fa0f5b44835ebeea8146c9ac960cac833f5"
|
||||
"reference": "92eaf84dd61f700d3ec02ebd01b606cb5b1590d4"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/pmmp/NBT/zipball/0b290fa0f5b44835ebeea8146c9ac960cac833f5",
|
||||
"reference": "0b290fa0f5b44835ebeea8146c9ac960cac833f5",
|
||||
"url": "https://api.github.com/repos/pmmp/NBT/zipball/92eaf84dd61f700d3ec02ebd01b606cb5b1590d4",
|
||||
"reference": "92eaf84dd61f700d3ec02ebd01b606cb5b1590d4",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -194,23 +194,23 @@
|
||||
],
|
||||
"description": "PHP library for working with Named Binary Tags",
|
||||
"support": {
|
||||
"source": "https://github.com/pmmp/NBT/tree/0.2.5",
|
||||
"source": "https://github.com/pmmp/NBT/tree/0.2.6",
|
||||
"issues": "https://github.com/pmmp/NBT/issues"
|
||||
},
|
||||
"time": "2019-01-07T17:28:16+00:00"
|
||||
"time": "2019-02-07T16:28:11+00:00"
|
||||
},
|
||||
{
|
||||
"name": "pocketmine/raklib",
|
||||
"version": "0.12.1",
|
||||
"version": "0.12.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/pmmp/RakLib.git",
|
||||
"reference": "334b469f2d0f070f17902d7ac584bea7c6149dc6"
|
||||
"reference": "54a36d55eeba0a182e00439920ee2fcfa8c72bf3"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/pmmp/RakLib/zipball/334b469f2d0f070f17902d7ac584bea7c6149dc6",
|
||||
"reference": "334b469f2d0f070f17902d7ac584bea7c6149dc6",
|
||||
"url": "https://api.github.com/repos/pmmp/RakLib/zipball/54a36d55eeba0a182e00439920ee2fcfa8c72bf3",
|
||||
"reference": "54a36d55eeba0a182e00439920ee2fcfa8c72bf3",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -235,10 +235,10 @@
|
||||
],
|
||||
"description": "A RakNet server implementation written in PHP",
|
||||
"support": {
|
||||
"source": "https://github.com/pmmp/RakLib/tree/0.12.1",
|
||||
"source": "https://github.com/pmmp/RakLib/tree/0.12",
|
||||
"issues": "https://github.com/pmmp/RakLib/issues"
|
||||
},
|
||||
"time": "2019-01-04T14:23:37+00:00"
|
||||
"time": "2019-01-21T14:17:30+00:00"
|
||||
},
|
||||
{
|
||||
"name": "pocketmine/snooze",
|
||||
|
19
doxygen.conf
19
doxygen.conf
@ -51,7 +51,7 @@ PROJECT_BRIEF =
|
||||
# and the maximum width should not exceed 200 pixels. Doxygen will copy the logo
|
||||
# to the output directory.
|
||||
|
||||
PROJECT_LOGO = "/home/jenkins/PocketMine-h-64.png"
|
||||
PROJECT_LOGO =
|
||||
|
||||
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
|
||||
# into which the generated documentation will be written. If a relative path is
|
||||
@ -240,7 +240,7 @@ OPTIMIZE_OUTPUT_FOR_C = NO
|
||||
# qualified scopes will look different, etc.
|
||||
# The default value is: NO.
|
||||
|
||||
OPTIMIZE_OUTPUT_JAVA = YES
|
||||
OPTIMIZE_OUTPUT_JAVA = NO
|
||||
|
||||
# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
|
||||
# sources. Doxygen will then generate output that is tailored for Fortran.
|
||||
@ -737,7 +737,9 @@ WARN_LOGFILE =
|
||||
# spaces.
|
||||
# Note: If this tag is empty the current directory is searched.
|
||||
|
||||
INPUT = ./
|
||||
INPUT = ./src \
|
||||
./vendor/pocketmine \
|
||||
./README.md
|
||||
|
||||
# This tag can be used to specify the character encoding of the source files
|
||||
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
|
||||
@ -757,9 +759,7 @@ INPUT_ENCODING = UTF-8
|
||||
# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf,
|
||||
# *.qsf, *.as and *.js.
|
||||
|
||||
FILE_PATTERNS = *.php \
|
||||
*.sh \
|
||||
*.md
|
||||
FILE_PATTERNS = *.php
|
||||
|
||||
# The RECURSIVE tag can be used to specify whether or not subdirectories should
|
||||
# be searched for input files as well.
|
||||
@ -793,7 +793,10 @@ EXCLUDE_SYMLINKS = YES
|
||||
EXCLUDE_PATTERNS = */bin/* \
|
||||
*/players/* \
|
||||
*/worlds/* \
|
||||
*/plugins/*
|
||||
*/plugins/* \
|
||||
*/plugin_data/* \
|
||||
*/tests/* \
|
||||
*/stubs/*
|
||||
|
||||
# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
|
||||
# (namespaces, classes, functions, etc.) that should be excluded from the
|
||||
@ -878,7 +881,7 @@ FILTER_SOURCE_PATTERNS =
|
||||
# (index.html). This can be useful if you have a project on for instance GitHub
|
||||
# and want to reuse the introduction page also for the doxygen output.
|
||||
|
||||
USE_MDFILE_AS_MAINPAGE = README.md
|
||||
USE_MDFILE_AS_MAINPAGE = ./README.md
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to source browsing
|
||||
|
@ -26,6 +26,7 @@ namespace pocketmine;
|
||||
use pocketmine\block\Bed;
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\block\BlockFactory;
|
||||
use pocketmine\block\UnknownBlock;
|
||||
use pocketmine\command\Command;
|
||||
use pocketmine\command\CommandSender;
|
||||
use pocketmine\entity\Effect;
|
||||
@ -185,6 +186,7 @@ use function min;
|
||||
use function preg_match;
|
||||
use function round;
|
||||
use function spl_object_hash;
|
||||
use function sqrt;
|
||||
use function strlen;
|
||||
use function strpos;
|
||||
use function strtolower;
|
||||
@ -475,8 +477,11 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
}
|
||||
|
||||
public function setFlying(bool $value){
|
||||
$this->flying = $value;
|
||||
$this->sendSettings();
|
||||
if($this->flying !== $value){
|
||||
$this->flying = $value;
|
||||
$this->resetFallDistance();
|
||||
$this->sendSettings();
|
||||
}
|
||||
}
|
||||
|
||||
public function isFlying() : bool{
|
||||
@ -688,14 +693,14 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
|
||||
$this->perm->recalculatePermissions();
|
||||
|
||||
if($this->hasPermission(Server::BROADCAST_CHANNEL_USERS)){
|
||||
$permManager->subscribeToPermission(Server::BROADCAST_CHANNEL_USERS, $this);
|
||||
}
|
||||
if($this->hasPermission(Server::BROADCAST_CHANNEL_ADMINISTRATIVE)){
|
||||
$permManager->subscribeToPermission(Server::BROADCAST_CHANNEL_ADMINISTRATIVE, $this);
|
||||
}
|
||||
|
||||
if($this->spawned){
|
||||
if($this->hasPermission(Server::BROADCAST_CHANNEL_USERS)){
|
||||
$permManager->subscribeToPermission(Server::BROADCAST_CHANNEL_USERS, $this);
|
||||
}
|
||||
if($this->hasPermission(Server::BROADCAST_CHANNEL_ADMINISTRATIVE)){
|
||||
$permManager->subscribeToPermission(Server::BROADCAST_CHANNEL_ADMINISTRATIVE, $this);
|
||||
}
|
||||
|
||||
$this->sendCommandData();
|
||||
}
|
||||
}
|
||||
@ -1409,19 +1414,17 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
|
||||
$this->allowFlight = $this->isCreative();
|
||||
if($this->isSpectator()){
|
||||
$this->flying = true;
|
||||
$this->setFlying(true);
|
||||
$this->keepMovement = true;
|
||||
$this->despawnFromAll();
|
||||
}else{
|
||||
$this->keepMovement = $this->allowMovementCheats;
|
||||
if($this->isSurvival()){
|
||||
$this->flying = false;
|
||||
$this->setFlying(false);
|
||||
}
|
||||
$this->spawnToAll();
|
||||
}
|
||||
|
||||
$this->resetFallDistance();
|
||||
|
||||
$this->namedtag->setInt("playerGameType", $this->gamemode);
|
||||
if(!$client){ //Gamemode changed by server, do not send for client changes
|
||||
$this->sendGamemode();
|
||||
@ -1647,7 +1650,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
}else{
|
||||
$this->broadcastMovement();
|
||||
|
||||
$distance = $from->distance($to);
|
||||
$distance = sqrt((($from->x - $to->x) ** 2) + (($from->z - $to->z) ** 2));
|
||||
//TODO: check swimming (adds 0.015 exhaustion in MCPE)
|
||||
if($this->isSprinting()){
|
||||
$this->exhaust(0.1 * $distance, PlayerExhaustEvent::CAUSE_SPRINTING);
|
||||
@ -1678,6 +1681,12 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
$this->newPosition = null;
|
||||
}
|
||||
|
||||
public function fall(float $fallDistance) : void{
|
||||
if(!$this->flying){
|
||||
parent::fall($fallDistance);
|
||||
}
|
||||
}
|
||||
|
||||
public function jump() : void{
|
||||
(new PlayerJumpEvent($this))->call();
|
||||
parent::jump();
|
||||
@ -2714,6 +2723,9 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
|
||||
public function handleBlockPickRequest(BlockPickRequestPacket $packet) : bool{
|
||||
$block = $this->level->getBlockAt($packet->blockX, $packet->blockY, $packet->blockZ);
|
||||
if($block instanceof UnknownBlock){
|
||||
return true;
|
||||
}
|
||||
|
||||
$item = $block->getPickedItem();
|
||||
if($packet->addUserData){
|
||||
@ -2938,8 +2950,9 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
$ev->call();
|
||||
if($ev->isCancelled()){
|
||||
$this->sendSettings();
|
||||
}else{
|
||||
}else{ //don't use setFlying() here, to avoid feedback loops
|
||||
$this->flying = $ev->isFlying();
|
||||
$this->resetFallDistance();
|
||||
}
|
||||
|
||||
$handled = true;
|
||||
|
@ -37,7 +37,7 @@ namespace pocketmine {
|
||||
use pocketmine\wizard\SetupWizard;
|
||||
|
||||
const NAME = "PocketMine-MP";
|
||||
const BASE_VERSION = "3.5.7";
|
||||
const BASE_VERSION = "3.5.11";
|
||||
const IS_DEVELOPMENT_BUILD = false;
|
||||
const BUILD_NUMBER = 0;
|
||||
|
||||
|
@ -28,7 +28,7 @@ namespace pocketmine;
|
||||
*/
|
||||
abstract class Thread extends \Thread{
|
||||
|
||||
/** @var \ClassLoader */
|
||||
/** @var \ClassLoader|null */
|
||||
protected $classLoader;
|
||||
/** @var string|null */
|
||||
protected $composerAutoloaderPath;
|
||||
|
@ -28,7 +28,7 @@ namespace pocketmine;
|
||||
*/
|
||||
abstract class Worker extends \Worker{
|
||||
|
||||
/** @var \ClassLoader */
|
||||
/** @var \ClassLoader|null */
|
||||
protected $classLoader;
|
||||
/** @var string|null */
|
||||
protected $composerAutoloaderPath;
|
||||
|
@ -39,6 +39,7 @@ use pocketmine\metadata\MetadataValue;
|
||||
use pocketmine\Player;
|
||||
use pocketmine\plugin\Plugin;
|
||||
use function array_merge;
|
||||
use function get_class;
|
||||
use const PHP_INT_MAX;
|
||||
|
||||
class Block extends Position implements BlockIds, Metadatable{
|
||||
@ -268,6 +269,7 @@ class Block extends Position implements BlockIds, Metadatable{
|
||||
* @param Item $item
|
||||
*
|
||||
* @return float
|
||||
* @throws \InvalidArgumentException if the item efficiency is not a positive number
|
||||
*/
|
||||
public function getBreakTime(Item $item) : float{
|
||||
$base = $this->getHardness();
|
||||
@ -279,7 +281,7 @@ class Block extends Position implements BlockIds, Metadatable{
|
||||
|
||||
$efficiency = $item->getMiningEfficiency($this);
|
||||
if($efficiency <= 0){
|
||||
throw new \RuntimeException("Item efficiency is invalid");
|
||||
throw new \InvalidArgumentException(get_class($item) . " has invalid mining efficiency: expected >= 0, got $efficiency");
|
||||
}
|
||||
|
||||
$base /= $efficiency;
|
||||
|
@ -96,9 +96,12 @@ class Cactus extends Transparent{
|
||||
if($b->getId() === self::AIR){
|
||||
$ev = new BlockGrowEvent($b, BlockFactory::get(Block::CACTUS));
|
||||
$ev->call();
|
||||
if(!$ev->isCancelled()){
|
||||
$this->getLevel()->setBlock($b, $ev->getNewState(), true);
|
||||
if($ev->isCancelled()){
|
||||
break;
|
||||
}
|
||||
$this->getLevel()->setBlock($b, $ev->getNewState(), true);
|
||||
}else{
|
||||
break;
|
||||
}
|
||||
}
|
||||
$this->meta = 0;
|
||||
|
@ -43,7 +43,7 @@ abstract class Crops extends Flowable{
|
||||
|
||||
|
||||
public function onActivate(Item $item, Player $player = null) : bool{
|
||||
if($item->getId() === Item::DYE and $item->getDamage() === 0x0F){ //Bonemeal
|
||||
if($this->meta < 7 and $item->getId() === Item::DYE and $item->getDamage() === 0x0F){ //Bonemeal
|
||||
$block = clone $this;
|
||||
$block->meta += mt_rand(2, 5);
|
||||
if($block->meta > 7){
|
||||
|
@ -65,7 +65,7 @@ class ItemFrame extends Flowable{
|
||||
2 => Vector3::SIDE_NORTH,
|
||||
3 => Vector3::SIDE_SOUTH
|
||||
];
|
||||
if(!$this->getSide($sides[$this->meta])->isSolid()){
|
||||
if(isset($sides[$this->meta]) and !$this->getSide($sides[$this->meta])->isSolid()){
|
||||
$this->level->useBreakOn($this);
|
||||
}
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ abstract class Stair extends Transparent{
|
||||
2 => 1,
|
||||
3 => 3
|
||||
];
|
||||
$this->meta = $faces[$player->getDirection()] & 0x03;
|
||||
$this->meta = $player !== null ? $faces[$player->getDirection()] & 0x03 : 0;
|
||||
if(($clickVector->y > 0.5 and $face !== Vector3::SIDE_UP) or $face === Vector3::SIDE_DOWN){
|
||||
$this->meta |= 0x04; //Upside-down stairs
|
||||
}
|
||||
|
@ -50,9 +50,11 @@ class Sugarcane extends Flowable{
|
||||
if($b->getId() === self::AIR){
|
||||
$ev = new BlockGrowEvent($b, BlockFactory::get(Block::SUGARCANE_BLOCK));
|
||||
$ev->call();
|
||||
if(!$ev->isCancelled()){
|
||||
$this->getLevel()->setBlock($b, $ev->getNewState(), true);
|
||||
if($ev->isCancelled()){
|
||||
break;
|
||||
}
|
||||
$this->getLevel()->setBlock($b, $ev->getNewState(), true);
|
||||
}else{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -51,8 +51,8 @@ class TallGrass extends Flowable{
|
||||
}
|
||||
|
||||
public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, Player $player = null) : bool{
|
||||
$down = $this->getSide(Vector3::SIDE_DOWN);
|
||||
if($down->getId() === self::GRASS){
|
||||
$down = $this->getSide(Vector3::SIDE_DOWN)->getId();
|
||||
if($down === self::GRASS or $down === self::DIRT){
|
||||
$this->getLevel()->setBlock($blockReplace, $this, true);
|
||||
|
||||
return true;
|
||||
|
@ -578,7 +578,9 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
|
||||
}
|
||||
|
||||
public function getXpDropAmount() : int{
|
||||
return (int) min(100, $this->getCurrentTotalXp());
|
||||
//this causes some XP to be lost on death when above level 1 (by design), dropping at most enough points for
|
||||
//about 7.5 levels of XP.
|
||||
return (int) min(100, 7 * $this->getXpLevel());
|
||||
}
|
||||
|
||||
public function getInventory(){
|
||||
|
@ -644,6 +644,10 @@ abstract class Living extends Entity implements Damageable{
|
||||
foreach($ev->getDrops() as $item){
|
||||
$this->getLevel()->dropItem($this, $item);
|
||||
}
|
||||
|
||||
//TODO: check death conditions (must have been damaged by player < 5 seconds from death)
|
||||
//TODO: allow this number to be manipulated during EntityDeathEvent
|
||||
$this->level->dropExperience($this, $this->getXpDropAmount());
|
||||
}
|
||||
|
||||
protected function onDeathUpdate(int $tickDiff) : bool{
|
||||
@ -651,9 +655,6 @@ abstract class Living extends Entity implements Damageable{
|
||||
$this->deadTicks += $tickDiff;
|
||||
if($this->deadTicks >= $this->maxDeadTicks){
|
||||
$this->endDeathAnimation();
|
||||
|
||||
//TODO: check death conditions (must have been damaged by player < 5 seconds from death)
|
||||
$this->level->dropExperience($this, $this->getXpDropAmount());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,7 @@ use pocketmine\entity\Human;
|
||||
use pocketmine\nbt\tag\IntTag;
|
||||
use pocketmine\nbt\tag\ShortTag;
|
||||
use pocketmine\Player;
|
||||
use function sqrt;
|
||||
|
||||
class ExperienceOrb extends Entity{
|
||||
public const NETWORK_ID = self::XP_ORB;
|
||||
@ -190,15 +191,15 @@ class ExperienceOrb extends Entity{
|
||||
$this->setTargetPlayer($currentTarget);
|
||||
|
||||
if($currentTarget !== null){
|
||||
$vector = $currentTarget->subtract($this)->add(0, $currentTarget->getEyeHeight() / 2, 0)->divide(self::MAX_TARGET_DISTANCE);
|
||||
$vector = $currentTarget->add(0, $currentTarget->getEyeHeight() / 2, 0)->subtract($this)->divide(self::MAX_TARGET_DISTANCE);
|
||||
|
||||
$distance = $vector->length();
|
||||
$oneMinusDistance = (1 - $distance) ** 2;
|
||||
$distance = $vector->lengthSquared();
|
||||
if($distance < 1){
|
||||
$diff = $vector->normalize()->multiply(0.2 * (1 - sqrt($distance)) ** 2);
|
||||
|
||||
if($oneMinusDistance > 0){
|
||||
$this->motion->x += $vector->x / $distance * $oneMinusDistance * 0.2;
|
||||
$this->motion->y += $vector->y / $distance * $oneMinusDistance * 0.2;
|
||||
$this->motion->z += $vector->z / $distance * $oneMinusDistance * 0.2;
|
||||
$this->motion->x += $diff->x;
|
||||
$this->motion->y += $diff->y;
|
||||
$this->motion->z += $diff->z;
|
||||
}
|
||||
|
||||
if($currentTarget->canPickupXp() and $this->boundingBox->intersectsWith($currentTarget->getBoundingBox())){
|
||||
|
@ -85,7 +85,7 @@ class SplashPotion extends Throwable{
|
||||
if(!$this->willLinger()){
|
||||
foreach($this->level->getNearbyEntities($this->boundingBox->expandedCopy(4.125, 2.125, 4.125), $this) as $entity){
|
||||
if($entity instanceof Living and $entity->isAlive()){
|
||||
$distanceSquared = $entity->distanceSquared($this);
|
||||
$distanceSquared = $entity->add(0, $entity->getEyeHeight(), 0)->distanceSquared($this);
|
||||
if($distanceSquared > 16){ //4 blocks
|
||||
continue;
|
||||
}
|
||||
|
@ -318,7 +318,7 @@ class ItemFactory{
|
||||
$listed = self::$list[self::getListOffset($id)];
|
||||
if($listed !== null){
|
||||
$item = clone $listed;
|
||||
}elseif($id < 256){ //intentionally includes negatives, for extended block IDs
|
||||
}elseif($id >= 0 and $id < 256){ //intentionally excludes negatives because extended blocks aren't supported yet
|
||||
/* Blocks must have a damage value 0-15, but items can have damage value -1 to indicate that they are
|
||||
* crafting ingredients with any-damage. */
|
||||
$item = new ItemBlock($id, $meta);
|
||||
|
Submodule src/pocketmine/lang/locale updated: 1d525a7c1c...5dad5db214
@ -219,11 +219,10 @@ class Explosion{
|
||||
|
||||
$t = $this->level->getTileAt($block->x, $block->y, $block->z);
|
||||
if($t instanceof Tile){
|
||||
if($t instanceof Chest){
|
||||
$t->unpair();
|
||||
}
|
||||
if($yieldDrops and $t instanceof Container){
|
||||
if($t instanceof Chest){
|
||||
$t->unpair();
|
||||
}
|
||||
|
||||
$t->getInventory()->dropContents($this->level, $t->add(0.5, 0.5, 0.5));
|
||||
}
|
||||
|
||||
|
@ -293,6 +293,19 @@ class Level implements ChunkManager, Metadatable{
|
||||
return (($x & 0xFFFFFFF) << 36) | (($y & Level::Y_MASK) << 28) | ($z & 0xFFFFFFF);
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes a small index relative to chunk base from the given coordinates.
|
||||
*
|
||||
* @param int $x
|
||||
* @param int $y
|
||||
* @param int $z
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public static function chunkBlockHash(int $x, int $y, int $z) : int{
|
||||
return ($y << 8) | (($z & 0xf) << 4) | ($x & 0xf);
|
||||
}
|
||||
|
||||
public static function getBlockXYZ(int $hash, ?int &$x, ?int &$y, ?int &$z) : void{
|
||||
$x = $hash >> 36;
|
||||
$y = ($hash >> 28) & Level::Y_MASK; //it's always positive
|
||||
@ -369,6 +382,7 @@ class Level implements ChunkManager, Metadatable{
|
||||
|
||||
$this->server->getLogger()->info($this->server->getLanguage()->translateString("pocketmine.level.preparing", [$this->displayName]));
|
||||
$this->generator = GeneratorManager::getGenerator($this->provider->getGenerator());
|
||||
//TODO: validate generator options
|
||||
|
||||
$this->folderName = $name;
|
||||
|
||||
@ -554,7 +568,8 @@ class Level implements ChunkManager, Metadatable{
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal DO NOT use this from plugins, it's for internal use only. Use Server->unloadLevel() instead.
|
||||
* @internal
|
||||
* @see Server::unloadLevel()
|
||||
*
|
||||
* Unloads the current level from memory safely
|
||||
*
|
||||
@ -602,7 +617,10 @@ class Level implements ChunkManager, Metadatable{
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the players being used in a specific chunk
|
||||
* @deprecated WARNING: This function has a misleading name. Contrary to what the name might imply, this function
|
||||
* DOES NOT return players who are IN a chunk, rather, it returns players who can SEE the chunk.
|
||||
*
|
||||
* Returns a list of players who have the target chunk within their view distance.
|
||||
*
|
||||
* @param int $chunkX
|
||||
* @param int $chunkZ
|
||||
@ -681,25 +699,25 @@ class Level implements ChunkManager, Metadatable{
|
||||
}
|
||||
|
||||
public function registerChunkLoader(ChunkLoader $loader, int $chunkX, int $chunkZ, bool $autoLoad = true){
|
||||
$hash = $loader->getLoaderId();
|
||||
$loaderId = $loader->getLoaderId();
|
||||
|
||||
if(!isset($this->chunkLoaders[$index = Level::chunkHash($chunkX, $chunkZ)])){
|
||||
$this->chunkLoaders[$index] = [];
|
||||
$this->playerLoaders[$index] = [];
|
||||
}elseif(isset($this->chunkLoaders[$index][$hash])){
|
||||
if(!isset($this->chunkLoaders[$chunkHash = Level::chunkHash($chunkX, $chunkZ)])){
|
||||
$this->chunkLoaders[$chunkHash] = [];
|
||||
$this->playerLoaders[$chunkHash] = [];
|
||||
}elseif(isset($this->chunkLoaders[$chunkHash][$loaderId])){
|
||||
return;
|
||||
}
|
||||
|
||||
$this->chunkLoaders[$index][$hash] = $loader;
|
||||
$this->chunkLoaders[$chunkHash][$loaderId] = $loader;
|
||||
if($loader instanceof Player){
|
||||
$this->playerLoaders[$index][$hash] = $loader;
|
||||
$this->playerLoaders[$chunkHash][$loaderId] = $loader;
|
||||
}
|
||||
|
||||
if(!isset($this->loaders[$hash])){
|
||||
$this->loaderCounter[$hash] = 1;
|
||||
$this->loaders[$hash] = $loader;
|
||||
if(!isset($this->loaders[$loaderId])){
|
||||
$this->loaderCounter[$loaderId] = 1;
|
||||
$this->loaders[$loaderId] = $loader;
|
||||
}else{
|
||||
++$this->loaderCounter[$hash];
|
||||
++$this->loaderCounter[$loaderId];
|
||||
}
|
||||
|
||||
$this->cancelUnloadChunkRequest($chunkX, $chunkZ);
|
||||
@ -710,27 +728,26 @@ class Level implements ChunkManager, Metadatable{
|
||||
}
|
||||
|
||||
public function unregisterChunkLoader(ChunkLoader $loader, int $chunkX, int $chunkZ){
|
||||
$index = Level::chunkHash($chunkX, $chunkZ);
|
||||
$hash = $loader->getLoaderId();
|
||||
if(isset($this->chunkLoaders[$index][$hash])){
|
||||
unset($this->chunkLoaders[$index][$hash]);
|
||||
unset($this->playerLoaders[$index][$hash]);
|
||||
if(count($this->chunkLoaders[$index]) === 0){
|
||||
unset($this->chunkLoaders[$index]);
|
||||
unset($this->playerLoaders[$index]);
|
||||
$chunkHash = Level::chunkHash($chunkX, $chunkZ);
|
||||
$loaderId = $loader->getLoaderId();
|
||||
if(isset($this->chunkLoaders[$chunkHash][$loaderId])){
|
||||
unset($this->chunkLoaders[$chunkHash][$loaderId]);
|
||||
unset($this->playerLoaders[$chunkHash][$loaderId]);
|
||||
if(count($this->chunkLoaders[$chunkHash]) === 0){
|
||||
unset($this->chunkLoaders[$chunkHash]);
|
||||
unset($this->playerLoaders[$chunkHash]);
|
||||
$this->unloadChunkRequest($chunkX, $chunkZ, true);
|
||||
}
|
||||
|
||||
if(--$this->loaderCounter[$hash] === 0){
|
||||
unset($this->loaderCounter[$hash]);
|
||||
unset($this->loaders[$hash]);
|
||||
if(--$this->loaderCounter[$loaderId] === 0){
|
||||
unset($this->loaderCounter[$loaderId]);
|
||||
unset($this->loaders[$loaderId]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* WARNING: Do not use this, it's only for internal use.
|
||||
* Changes to this function won't be recorded on the version.
|
||||
* @internal
|
||||
*/
|
||||
public function checkTime(){
|
||||
if($this->stopTime){
|
||||
@ -741,8 +758,7 @@ class Level implements ChunkManager, Metadatable{
|
||||
}
|
||||
|
||||
/**
|
||||
* WARNING: Do not use this, it's only for internal use.
|
||||
* Changes to this function won't be recorded on the version.
|
||||
* @internal
|
||||
*
|
||||
* @param Player ...$targets If empty, will send to all players in the level.
|
||||
*/
|
||||
@ -754,8 +770,7 @@ class Level implements ChunkManager, Metadatable{
|
||||
}
|
||||
|
||||
/**
|
||||
* WARNING: Do not use this, it's only for internal use.
|
||||
* Changes to this function won't be recorded on the version.
|
||||
* @internal
|
||||
*
|
||||
* @param int $currentTick
|
||||
*
|
||||
@ -1076,11 +1091,12 @@ class Level implements ChunkManager, Metadatable{
|
||||
|
||||
foreach($chunk->getSubChunks() as $Y => $subChunk){
|
||||
if(!($subChunk instanceof EmptySubChunk)){
|
||||
$k = mt_rand(0, 0xfffffffff); //36 bits
|
||||
for($i = 0; $i < 3; ++$i){
|
||||
$k = mt_rand(0, 0xfff);
|
||||
$x = $k & 0x0f;
|
||||
$y = ($k >> 4) & 0x0f;
|
||||
$z = ($k >> 8) & 0x0f;
|
||||
$k >>= 12;
|
||||
|
||||
$blockId = $subChunk->getBlockId($x, $y, $z);
|
||||
if($this->randomTickBlocks[$blockId] !== null){
|
||||
@ -1423,14 +1439,14 @@ class Level implements ChunkManager, Metadatable{
|
||||
*/
|
||||
public function getBlockAt(int $x, int $y, int $z, bool $cached = true, bool $addToCache = true) : Block{
|
||||
$fullState = 0;
|
||||
$blockHash = null;
|
||||
$relativeBlockHash = null;
|
||||
$chunkHash = Level::chunkHash($x >> 4, $z >> 4);
|
||||
|
||||
if($this->isInWorld($x, $y, $z)){
|
||||
$blockHash = Level::blockHash($x, $y, $z);
|
||||
$relativeBlockHash = Level::chunkBlockHash($x, $y, $z);
|
||||
|
||||
if($cached and isset($this->blockCache[$chunkHash][$blockHash])){
|
||||
return $this->blockCache[$chunkHash][$blockHash];
|
||||
if($cached and isset($this->blockCache[$chunkHash][$relativeBlockHash])){
|
||||
return $this->blockCache[$chunkHash][$relativeBlockHash];
|
||||
}
|
||||
|
||||
$chunk = $this->chunks[$chunkHash] ?? null;
|
||||
@ -1448,8 +1464,8 @@ class Level implements ChunkManager, Metadatable{
|
||||
$block->z = $z;
|
||||
$block->level = $this;
|
||||
|
||||
if($addToCache and $blockHash !== null){
|
||||
$this->blockCache[$chunkHash][$blockHash] = $block;
|
||||
if($addToCache and $relativeBlockHash !== null){
|
||||
$this->blockCache[$chunkHash][$relativeBlockHash] = $block;
|
||||
}
|
||||
|
||||
return $block;
|
||||
@ -1607,19 +1623,19 @@ class Level implements ChunkManager, Metadatable{
|
||||
$block->clearCaches();
|
||||
|
||||
$chunkHash = Level::chunkHash($pos->x >> 4, $pos->z >> 4);
|
||||
$blockHash = Level::blockHash($pos->x, $pos->y, $pos->z);
|
||||
$relativeBlockHash = Level::chunkBlockHash($pos->x, $pos->y, $pos->z);
|
||||
|
||||
unset($this->blockCache[$chunkHash][$blockHash]);
|
||||
unset($this->blockCache[$chunkHash][$relativeBlockHash]);
|
||||
|
||||
if($direct){
|
||||
$this->sendBlocks($this->getChunkPlayers($pos->x >> 4, $pos->z >> 4), [$block], UpdateBlockPacket::FLAG_ALL_PRIORITY);
|
||||
unset($this->chunkCache[$chunkHash], $this->changedBlocks[$chunkHash][$blockHash]);
|
||||
unset($this->chunkCache[$chunkHash], $this->changedBlocks[$chunkHash][$relativeBlockHash]);
|
||||
}else{
|
||||
if(!isset($this->changedBlocks[$chunkHash])){
|
||||
$this->changedBlocks[$chunkHash] = [];
|
||||
}
|
||||
|
||||
$this->changedBlocks[$chunkHash][$blockHash] = $block;
|
||||
$this->changedBlocks[$chunkHash][$relativeBlockHash] = $block;
|
||||
}
|
||||
|
||||
foreach($this->getChunkLoaders($pos->x >> 4, $pos->z >> 4) as $loader){
|
||||
@ -2212,14 +2228,14 @@ class Level implements ChunkManager, Metadatable{
|
||||
return;
|
||||
}
|
||||
$chunkHash = Level::chunkHash($x >> 4, $z >> 4);
|
||||
$blockHash = Level::blockHash($x, $y, $z);
|
||||
unset($this->blockCache[$chunkHash][$blockHash]);
|
||||
$relativeBlockHash = Level::chunkBlockHash($x, $y, $z);
|
||||
unset($this->blockCache[$chunkHash][$relativeBlockHash]);
|
||||
$this->getChunk($x >> 4, $z >> 4, true)->setBlockId($x & 0x0f, $y, $z & 0x0f, $id & 0xff);
|
||||
|
||||
if(!isset($this->changedBlocks[$chunkHash])){
|
||||
$this->changedBlocks[$chunkHash] = [];
|
||||
}
|
||||
$this->changedBlocks[$chunkHash][$blockHash] = $v = new Vector3($x, $y, $z);
|
||||
$this->changedBlocks[$chunkHash][$relativeBlockHash] = $v = new Vector3($x, $y, $z);
|
||||
foreach($this->getChunkLoaders($x >> 4, $z >> 4) as $loader){
|
||||
$loader->onBlockChanged($v);
|
||||
}
|
||||
@ -2251,15 +2267,15 @@ class Level implements ChunkManager, Metadatable{
|
||||
return;
|
||||
}
|
||||
$chunkHash = Level::chunkHash($x >> 4, $z >> 4);
|
||||
$blockHash = Level::blockHash($x, $y, $z);
|
||||
unset($this->blockCache[$chunkHash][$blockHash]);
|
||||
$relativeBlockHash = Level::chunkBlockHash($x, $y, $z);
|
||||
unset($this->blockCache[$chunkHash][$relativeBlockHash]);
|
||||
|
||||
$this->getChunk($x >> 4, $z >> 4, true)->setBlockData($x & 0x0f, $y, $z & 0x0f, $data & 0x0f);
|
||||
|
||||
if(!isset($this->changedBlocks[$chunkHash])){
|
||||
$this->changedBlocks[$chunkHash] = [];
|
||||
}
|
||||
$this->changedBlocks[$chunkHash][$blockHash] = $v = new Vector3($x, $y, $z);
|
||||
$this->changedBlocks[$chunkHash][$relativeBlockHash] = $v = new Vector3($x, $y, $z);
|
||||
foreach($this->getChunkLoaders($x >> 4, $z >> 4) as $loader){
|
||||
$loader->onBlockChanged($v);
|
||||
}
|
||||
@ -2461,9 +2477,9 @@ class Level implements ChunkManager, Metadatable{
|
||||
* @param int $chunkX
|
||||
* @param int $chunkZ
|
||||
* @param Chunk|null $chunk
|
||||
* @param bool $unload
|
||||
* @param bool $deleteEntitiesAndTiles Whether to delete entities and tiles on the old chunk, or transfer them to the new one
|
||||
*/
|
||||
public function setChunk(int $chunkX, int $chunkZ, Chunk $chunk = null, bool $unload = true){
|
||||
public function setChunk(int $chunkX, int $chunkZ, Chunk $chunk = null, bool $deleteEntitiesAndTiles = true){
|
||||
if($chunk === null){
|
||||
return;
|
||||
}
|
||||
@ -2474,7 +2490,16 @@ class Level implements ChunkManager, Metadatable{
|
||||
$chunkHash = Level::chunkHash($chunkX, $chunkZ);
|
||||
$oldChunk = $this->getChunk($chunkX, $chunkZ, false);
|
||||
if($oldChunk !== null and $oldChunk !== $chunk){
|
||||
if($unload){
|
||||
if($deleteEntitiesAndTiles){
|
||||
foreach($oldChunk->getEntities() as $player){
|
||||
if(!($player instanceof Player)){
|
||||
continue;
|
||||
}
|
||||
$chunk->addEntity($player);
|
||||
$oldChunk->removeEntity($player);
|
||||
$player->chunk = $chunk;
|
||||
}
|
||||
//TODO: this causes chunkloaders to receive false "unloaded" notifications
|
||||
$this->unloadChunk($chunkX, $chunkZ, false, false);
|
||||
}else{
|
||||
foreach($oldChunk->getEntities() as $entity){
|
||||
@ -2814,6 +2839,7 @@ class Level implements ChunkManager, Metadatable{
|
||||
$loader->onChunkLoaded($chunk);
|
||||
}
|
||||
}else{
|
||||
$this->server->getLogger()->debug("Newly loaded chunk $x $z has no loaders registered, will be unloaded at next available opportunity");
|
||||
$this->unloadChunkRequest($x, $z);
|
||||
}
|
||||
|
||||
|
@ -33,10 +33,11 @@ use pocketmine\level\generator\populator\Ore;
|
||||
use pocketmine\level\generator\populator\Populator;
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\utils\Random;
|
||||
use function array_map;
|
||||
use function count;
|
||||
use function explode;
|
||||
use function preg_match;
|
||||
use function preg_match_all;
|
||||
use function str_replace;
|
||||
|
||||
class Flat extends Generator{
|
||||
/** @var Chunk */
|
||||
@ -62,6 +63,11 @@ class Flat extends Generator{
|
||||
return "flat";
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $options
|
||||
*
|
||||
* @throws InvalidGeneratorOptionsException
|
||||
*/
|
||||
public function __construct(array $options = []){
|
||||
$this->options = $options;
|
||||
if(isset($this->options["preset"]) and $this->options["preset"] != ""){
|
||||
@ -89,13 +95,28 @@ class Flat extends Generator{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $layers
|
||||
*
|
||||
* @return int[][]
|
||||
* @throws InvalidGeneratorOptionsException
|
||||
*/
|
||||
public static function parseLayers(string $layers) : array{
|
||||
$result = [];
|
||||
preg_match_all('#^(([0-9]*x|)([0-9]{1,3})(|:[0-9]{0,2}))$#m', str_replace(",", "\n", $layers), $matches);
|
||||
$split = array_map('\trim', explode(',', $layers));
|
||||
$y = 0;
|
||||
foreach($matches[3] as $i => $b){
|
||||
$b = ItemFactory::fromString($b . $matches[4][$i]);
|
||||
$cnt = $matches[2][$i] === "" ? 1 : (int) $matches[2][$i];
|
||||
foreach($split as $line){
|
||||
preg_match('#^(?:(\d+)x)?(.+)$#', $line, $matches);
|
||||
if(count($matches) !== 3){
|
||||
throw new InvalidGeneratorOptionsException("Invalid preset layer \"$line\"");
|
||||
}
|
||||
|
||||
$cnt = $matches[1] !== "" ? (int) $matches[1] : 1;
|
||||
try{
|
||||
$b = ItemFactory::fromString($matches[2])->getBlock();
|
||||
}catch(\InvalidArgumentException $e){
|
||||
throw new InvalidGeneratorOptionsException("Invalid preset layer \"$line\": " . $e->getMessage(), 0, $e);
|
||||
}
|
||||
for($cY = $y, $y += $cnt; $cY < $y; ++$cY){
|
||||
$result[$cY] = [$b->getId(), $b->getDamage()];
|
||||
}
|
||||
@ -113,6 +134,7 @@ class Flat extends Generator{
|
||||
|
||||
$this->floorLevel = count($this->structure);
|
||||
|
||||
//TODO: more error checking
|
||||
preg_match_all('#(([0-9a-z_]{1,})\(?([0-9a-z_ =:]{0,})\)?),?#', $options, $matches);
|
||||
foreach($matches[2] as $i => $option){
|
||||
$params = true;
|
||||
|
@ -58,6 +58,11 @@ abstract class Generator{
|
||||
/** @var Random */
|
||||
protected $random;
|
||||
|
||||
/**
|
||||
* @param array $settings
|
||||
*
|
||||
* @throws InvalidGeneratorOptionsException
|
||||
*/
|
||||
abstract public function __construct(array $settings = []);
|
||||
|
||||
|
||||
|
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\level\generator;
|
||||
|
||||
class InvalidGeneratorOptionsException extends \UnexpectedValueException{
|
||||
|
||||
}
|
@ -27,6 +27,7 @@ use pocketmine\block\Block;
|
||||
use pocketmine\level\biome\Biome;
|
||||
use pocketmine\level\ChunkManager;
|
||||
use pocketmine\level\generator\Generator;
|
||||
use pocketmine\level\generator\InvalidGeneratorOptionsException;
|
||||
use pocketmine\level\generator\noise\Simplex;
|
||||
use pocketmine\level\generator\populator\Populator;
|
||||
use pocketmine\math\Vector3;
|
||||
@ -51,6 +52,11 @@ class Nether extends Generator{
|
||||
/** @var Simplex */
|
||||
private $noiseBase;
|
||||
|
||||
/**
|
||||
* @param array $options
|
||||
*
|
||||
* @throws InvalidGeneratorOptionsException
|
||||
*/
|
||||
public function __construct(array $options = []){
|
||||
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ use pocketmine\level\biome\Biome;
|
||||
use pocketmine\level\ChunkManager;
|
||||
use pocketmine\level\generator\biome\BiomeSelector;
|
||||
use pocketmine\level\generator\Generator;
|
||||
use pocketmine\level\generator\InvalidGeneratorOptionsException;
|
||||
use pocketmine\level\generator\noise\Simplex;
|
||||
use pocketmine\level\generator\object\OreType;
|
||||
use pocketmine\level\generator\populator\GroundCover;
|
||||
@ -57,6 +58,11 @@ class Normal extends Generator{
|
||||
private static $GAUSSIAN_KERNEL = null;
|
||||
private static $SMOOTH_SIZE = 2;
|
||||
|
||||
/**
|
||||
* @param array $options
|
||||
*
|
||||
* @throws InvalidGeneratorOptionsException
|
||||
*/
|
||||
public function __construct(array $options = []){
|
||||
if(self::$GAUSSIAN_KERNEL === null){
|
||||
self::generateKernel();
|
||||
|
@ -94,7 +94,9 @@ class StartGamePacket extends DataPacket{
|
||||
/** @var bool */
|
||||
public $isTexturePacksRequired = true;
|
||||
/** @var array */
|
||||
public $gameRules = []; //TODO: implement this
|
||||
public $gameRules = [ //TODO: implement this
|
||||
"naturalregeneration" => [1, false] //Hack for client side regeneration
|
||||
];
|
||||
/** @var bool */
|
||||
public $hasBonusChestEnabled = false;
|
||||
/** @var bool */
|
||||
|
@ -40,7 +40,18 @@ use function strlen;
|
||||
use function substr;
|
||||
|
||||
class QueryHandler{
|
||||
private $server, $lastToken, $token, $longData, $shortData, $timeout;
|
||||
/** @var Server */
|
||||
private $server;
|
||||
/** @var string */
|
||||
private $lastToken;
|
||||
/** @var string */
|
||||
private $token;
|
||||
/** @var string */
|
||||
private $longData;
|
||||
/** @var string */
|
||||
private $shortData;
|
||||
/** @var float */
|
||||
private $timeout;
|
||||
|
||||
public const HANDSHAKE = 9;
|
||||
public const STATISTICS = 0;
|
||||
|
@ -29,9 +29,7 @@ namespace pocketmine\network\upnp;
|
||||
use pocketmine\utils\Internet;
|
||||
use pocketmine\utils\Utils;
|
||||
use function class_exists;
|
||||
use function gethostbyname;
|
||||
use function is_object;
|
||||
use function trim;
|
||||
|
||||
abstract class UPnP{
|
||||
|
||||
@ -46,7 +44,7 @@ abstract class UPnP{
|
||||
throw new \RuntimeException("UPnP requires the com_dotnet extension");
|
||||
}
|
||||
|
||||
$myLocalIP = gethostbyname(trim(`hostname`));
|
||||
$myLocalIP = Internet::getInternalIP();
|
||||
|
||||
/** @noinspection PhpUndefinedClassInspection */
|
||||
$com = new \COM("HNetCfg.NATUPnP");
|
||||
|
@ -4,192 +4,192 @@
|
||||
# New settings/defaults won't appear automatically in this file when upgrading.
|
||||
|
||||
settings:
|
||||
#Whether to send all strings translated to server locale or let the device handle them
|
||||
force-language: false
|
||||
shutdown-message: "Server closed"
|
||||
#Allow listing plugins via Query
|
||||
query-plugins: true
|
||||
#Show a console message when a plugin uses deprecated API methods
|
||||
deprecated-verbose: true
|
||||
#Enable plugin and core profiling by default
|
||||
enable-profiling: false
|
||||
#Will only add results when tick measurement is below or equal to given value (default 20)
|
||||
profile-report-trigger: 20
|
||||
#Number of AsyncTask workers.
|
||||
#Used for plugin asynchronous tasks, world generation, compression and web communication.
|
||||
#Set this approximately to your number of cores.
|
||||
#If set to auto, it'll try to detect the number of cores (or use 2)
|
||||
async-workers: auto
|
||||
#Whether to allow running development builds. Dev builds might crash, break your plugins, corrupt your world and more.
|
||||
#It is recommended to avoid using development builds where possible.
|
||||
enable-dev-builds: false
|
||||
#Whether to send all strings translated to server locale or let the device handle them
|
||||
force-language: false
|
||||
shutdown-message: "Server closed"
|
||||
#Allow listing plugins via Query
|
||||
query-plugins: true
|
||||
#Show a console message when a plugin uses deprecated API methods
|
||||
deprecated-verbose: true
|
||||
#Enable plugin and core profiling by default
|
||||
enable-profiling: false
|
||||
#Will only add results when tick measurement is below or equal to given value (default 20)
|
||||
profile-report-trigger: 20
|
||||
#Number of AsyncTask workers.
|
||||
#Used for plugin asynchronous tasks, world generation, compression and web communication.
|
||||
#Set this approximately to your number of cores.
|
||||
#If set to auto, it'll try to detect the number of cores (or use 2)
|
||||
async-workers: auto
|
||||
#Whether to allow running development builds. Dev builds might crash, break your plugins, corrupt your world and more.
|
||||
#It is recommended to avoid using development builds where possible.
|
||||
enable-dev-builds: false
|
||||
|
||||
memory:
|
||||
#Global soft memory limit in megabytes. Set to 0 to disable
|
||||
#This will trigger low-memory-triggers and fire an event to free memory when the usage goes over this
|
||||
global-limit: 0
|
||||
#Global soft memory limit in megabytes. Set to 0 to disable
|
||||
#This will trigger low-memory-triggers and fire an event to free memory when the usage goes over this
|
||||
global-limit: 0
|
||||
|
||||
#Main thread soft memory limit in megabytes. Set to 0 to disable
|
||||
#This will trigger low-memory-triggers and fire an event to free memory when the usage goes over this
|
||||
main-limit: 0
|
||||
#Main thread soft memory limit in megabytes. Set to 0 to disable
|
||||
#This will trigger low-memory-triggers and fire an event to free memory when the usage goes over this
|
||||
main-limit: 0
|
||||
|
||||
#Main thread hard memory limit in megabytes. Set to 0 to disable
|
||||
#This will stop the server when the limit is surpassed
|
||||
main-hard-limit: 1024
|
||||
#Main thread hard memory limit in megabytes. Set to 0 to disable
|
||||
#This will stop the server when the limit is surpassed
|
||||
main-hard-limit: 1024
|
||||
|
||||
#AsyncWorker threads' hard memory limit in megabytes. Set to 0 to disable
|
||||
#This will crash the task currently executing on the worker if the task exceeds the limit
|
||||
#NOTE: THIS LIMIT APPLIES PER WORKER, NOT TO THE WHOLE PROCESS.
|
||||
async-worker-hard-limit: 256
|
||||
#AsyncWorker threads' hard memory limit in megabytes. Set to 0 to disable
|
||||
#This will crash the task currently executing on the worker if the task exceeds the limit
|
||||
#NOTE: THIS LIMIT APPLIES PER WORKER, NOT TO THE WHOLE PROCESS.
|
||||
async-worker-hard-limit: 256
|
||||
|
||||
#Period in ticks to check memory (default 1 second)
|
||||
check-rate: 20
|
||||
#Period in ticks to check memory (default 1 second)
|
||||
check-rate: 20
|
||||
|
||||
#Continue firing low-memory-triggers and event while on low memory
|
||||
continuous-trigger: true
|
||||
#Continue firing low-memory-triggers and event while on low memory
|
||||
continuous-trigger: true
|
||||
|
||||
#Only if memory.continuous-trigger is enabled. Specifies the rate in memory.check-rate steps (default 30 seconds)
|
||||
continuous-trigger-rate: 30
|
||||
#Only if memory.continuous-trigger is enabled. Specifies the rate in memory.check-rate steps (default 30 seconds)
|
||||
continuous-trigger-rate: 30
|
||||
|
||||
garbage-collection:
|
||||
#Period in ticks to fire the garbage collector manually (default 30 minutes), set to 0 to disable
|
||||
#This only affects the main thread. Other threads should fire their own collections
|
||||
period: 36000
|
||||
garbage-collection:
|
||||
#Period in ticks to fire the garbage collector manually (default 30 minutes), set to 0 to disable
|
||||
#This only affects the main thread. Other threads should fire their own collections
|
||||
period: 36000
|
||||
|
||||
#Fire asynchronous tasks to collect garbage from workers
|
||||
collect-async-worker: true
|
||||
#Fire asynchronous tasks to collect garbage from workers
|
||||
collect-async-worker: true
|
||||
|
||||
#Trigger on low memory
|
||||
low-memory-trigger: true
|
||||
#Trigger on low memory
|
||||
low-memory-trigger: true
|
||||
|
||||
#Settings controlling memory dump handling.
|
||||
memory-dump:
|
||||
#Dump memory from async workers as well as the main thread. If you have issues with segfaults when dumping memory, disable this setting.
|
||||
dump-async-worker: true
|
||||
#Settings controlling memory dump handling.
|
||||
memory-dump:
|
||||
#Dump memory from async workers as well as the main thread. If you have issues with segfaults when dumping memory, disable this setting.
|
||||
dump-async-worker: true
|
||||
|
||||
max-chunks:
|
||||
#Cap maximum render distance per player when low memory is triggered. Set to 0 to disable cap.
|
||||
chunk-radius: 4
|
||||
max-chunks:
|
||||
#Cap maximum render distance per player when low memory is triggered. Set to 0 to disable cap.
|
||||
chunk-radius: 4
|
||||
|
||||
#Do chunk garbage collection on trigger
|
||||
trigger-chunk-collect: true
|
||||
#Do chunk garbage collection on trigger
|
||||
trigger-chunk-collect: true
|
||||
|
||||
world-caches:
|
||||
#Disallow adding to world chunk-packet caches when memory is low
|
||||
disable-chunk-cache: true
|
||||
#Clear world caches when memory is low
|
||||
low-memory-trigger: true
|
||||
world-caches:
|
||||
#Disallow adding to world chunk-packet caches when memory is low
|
||||
disable-chunk-cache: true
|
||||
#Clear world caches when memory is low
|
||||
low-memory-trigger: true
|
||||
|
||||
|
||||
network:
|
||||
#Threshold for batching packets, in bytes. Only these packets will be compressed
|
||||
#Set to 0 to compress everything, -1 to disable.
|
||||
batch-threshold: 256
|
||||
#Compression level used when sending batched packets. Higher = more CPU, less bandwidth usage
|
||||
compression-level: 7
|
||||
#Use AsyncTasks for compression. Adds half/one tick delay, less CPU load on main thread
|
||||
async-compression: false
|
||||
#Experimental, only for Windows. Tries to use UPnP to automatically port forward
|
||||
upnp-forwarding: false
|
||||
#Maximum size in bytes of packets sent over the network (default 1492 bytes). Packets larger than this will be
|
||||
#fragmented or split into smaller parts. Clients can request MTU sizes up to but not more than this number.
|
||||
max-mtu-size: 1492
|
||||
#Threshold for batching packets, in bytes. Only these packets will be compressed
|
||||
#Set to 0 to compress everything, -1 to disable.
|
||||
batch-threshold: 256
|
||||
#Compression level used when sending batched packets. Higher = more CPU, less bandwidth usage
|
||||
compression-level: 7
|
||||
#Use AsyncTasks for compression. Adds half/one tick delay, less CPU load on main thread
|
||||
async-compression: false
|
||||
#Experimental, only for Windows. Tries to use UPnP to automatically port forward
|
||||
upnp-forwarding: false
|
||||
#Maximum size in bytes of packets sent over the network (default 1492 bytes). Packets larger than this will be
|
||||
#fragmented or split into smaller parts. Clients can request MTU sizes up to but not more than this number.
|
||||
max-mtu-size: 1492
|
||||
|
||||
debug:
|
||||
#If > 1, it will show debug messages in the console
|
||||
level: 1
|
||||
#If > 1, it will show debug messages in the console
|
||||
level: 1
|
||||
|
||||
player:
|
||||
#Choose whether to enable player data saving.
|
||||
save-player-data: true
|
||||
anti-cheat:
|
||||
#If false, will try to prevent speed and noclip cheats. May cause movement issues.
|
||||
allow-movement-cheats: true
|
||||
#Choose whether to enable player data saving.
|
||||
save-player-data: true
|
||||
anti-cheat:
|
||||
#If false, will try to prevent speed and noclip cheats. May cause movement issues.
|
||||
allow-movement-cheats: true
|
||||
|
||||
level-settings:
|
||||
#The default format that levels will use when created
|
||||
default-format: pmanvil
|
||||
#Automatically change levels tick rate to maintain 20 ticks per second
|
||||
auto-tick-rate: true
|
||||
auto-tick-rate-limit: 20
|
||||
#Sets the base tick rate (1 = 20 ticks per second, 2 = 10 ticks per second, etc.)
|
||||
base-tick-rate: 1
|
||||
#Tick all players each tick even when other settings disallow this.
|
||||
always-tick-players: false
|
||||
#The default format that levels will use when created
|
||||
default-format: pmanvil
|
||||
#Automatically change levels tick rate to maintain 20 ticks per second
|
||||
auto-tick-rate: true
|
||||
auto-tick-rate-limit: 20
|
||||
#Sets the base tick rate (1 = 20 ticks per second, 2 = 10 ticks per second, etc.)
|
||||
base-tick-rate: 1
|
||||
#Tick all players each tick even when other settings disallow this.
|
||||
always-tick-players: false
|
||||
|
||||
chunk-sending:
|
||||
#To change server normal render distance, change view-distance in server.properties.
|
||||
#Amount of chunks sent to players per tick
|
||||
per-tick: 4
|
||||
#Radius of chunks that need to be sent before spawning the player
|
||||
spawn-radius: 4
|
||||
#To change server normal render distance, change view-distance in server.properties.
|
||||
#Amount of chunks sent to players per tick
|
||||
per-tick: 4
|
||||
#Radius of chunks that need to be sent before spawning the player
|
||||
spawn-radius: 4
|
||||
|
||||
chunk-ticking:
|
||||
#Max amount of chunks processed each tick
|
||||
per-tick: 40
|
||||
#Radius of chunks around a player to tick
|
||||
tick-radius: 3
|
||||
light-updates: false
|
||||
clear-tick-list: true
|
||||
#IDs of blocks not to perform random ticking on.
|
||||
disable-block-ticking:
|
||||
#- 2 # grass
|
||||
#Max amount of chunks processed each tick
|
||||
per-tick: 40
|
||||
#Radius of chunks around a player to tick
|
||||
tick-radius: 3
|
||||
light-updates: false
|
||||
clear-tick-list: true
|
||||
#IDs of blocks not to perform random ticking on.
|
||||
disable-block-ticking:
|
||||
#- 2 # grass
|
||||
|
||||
chunk-generation:
|
||||
#Max. amount of chunks in the waiting queue to be populated
|
||||
population-queue-size: 8
|
||||
#Max. amount of chunks in the waiting queue to be populated
|
||||
population-queue-size: 8
|
||||
|
||||
ticks-per:
|
||||
autosave: 6000
|
||||
autosave: 6000
|
||||
|
||||
auto-report:
|
||||
#Send crash reports for processing
|
||||
enabled: true
|
||||
send-code: true
|
||||
send-settings: true
|
||||
send-phpinfo: false
|
||||
use-https: true
|
||||
host: crash.pmmp.io
|
||||
#Send crash reports for processing
|
||||
enabled: true
|
||||
send-code: true
|
||||
send-settings: true
|
||||
send-phpinfo: false
|
||||
use-https: true
|
||||
host: crash.pmmp.io
|
||||
|
||||
anonymous-statistics:
|
||||
#Sends anonymous statistics for data aggregation, plugin usage tracking
|
||||
enabled: false #TODO: re-enable this when we have a new stats host
|
||||
host: stats.pocketmine.net
|
||||
#Sends anonymous statistics for data aggregation, plugin usage tracking
|
||||
enabled: false #TODO: re-enable this when we have a new stats host
|
||||
host: stats.pocketmine.net
|
||||
|
||||
auto-updater:
|
||||
enabled: true
|
||||
on-update:
|
||||
warn-console: true
|
||||
warn-ops: true
|
||||
#Can be development, alpha, beta or stable.
|
||||
preferred-channel: stable
|
||||
#If using a development version, it will suggest changing the channel
|
||||
suggest-channels: true
|
||||
host: update.pmmp.io
|
||||
enabled: true
|
||||
on-update:
|
||||
warn-console: true
|
||||
warn-ops: true
|
||||
#Can be development, alpha, beta or stable.
|
||||
preferred-channel: stable
|
||||
#If using a development version, it will suggest changing the channel
|
||||
suggest-channels: true
|
||||
host: update.pmmp.io
|
||||
|
||||
timings:
|
||||
#Choose the host to use for viewing your timings results.
|
||||
host: timings.pmmp.io
|
||||
#Choose the host to use for viewing your timings results.
|
||||
host: timings.pmmp.io
|
||||
|
||||
console:
|
||||
#Choose whether to enable server stats reporting on the console title.
|
||||
#NOTE: The title ticker will be disabled regardless if console colours are not enabled.
|
||||
title-tick: true
|
||||
#Choose whether to enable server stats reporting on the console title.
|
||||
#NOTE: The title ticker will be disabled regardless if console colours are not enabled.
|
||||
title-tick: true
|
||||
|
||||
aliases:
|
||||
#Examples:
|
||||
#showtheversion: version
|
||||
#savestop: [save-all, stop]
|
||||
#Examples:
|
||||
#showtheversion: version
|
||||
#savestop: [save-all, stop]
|
||||
|
||||
worlds:
|
||||
#These settings will override the generator set in server.properties and allows loading multiple levels
|
||||
#Example:
|
||||
#world:
|
||||
# seed: 404
|
||||
# generator: FLAT:2;7,59x1,3x3,2;1;decoration(treecount=80 grasscount=45)
|
||||
#These settings will override the generator set in server.properties and allows loading multiple levels
|
||||
#Example:
|
||||
#world:
|
||||
# seed: 404
|
||||
# generator: FLAT:2;7,59x1,3x3,2;1;decoration(treecount=80 grasscount=45)
|
||||
|
||||
plugins:
|
||||
#Setting this to true will cause the legacy structure to be used where plugin data is placed inside the --plugins dir.
|
||||
#False will place plugin data under plugin_data under --data.
|
||||
#This option exists for backwards compatibility with existing installations.
|
||||
legacy-data-dir: false
|
||||
#Setting this to true will cause the legacy structure to be used where plugin data is placed inside the --plugins dir.
|
||||
#False will place plugin data under plugin_data under --data.
|
||||
#This option exists for backwards compatibility with existing installations.
|
||||
legacy-data-dir: false
|
||||
|
@ -4,9 +4,9 @@
|
||||
#NOTE: This will do nothing if there are no resource packs in the stack below.
|
||||
force_resources: false
|
||||
resource_stack:
|
||||
#Resource packs here are applied from bottom to top. This means that resources in higher packs will override those in lower packs.
|
||||
#Entries here must indicate the filename of the resource pack.
|
||||
#Example
|
||||
# - natural.zip
|
||||
# - vanilla.zip
|
||||
#If you want to force clients to use vanilla resources, you must place a vanilla resource pack in your resources folder and add it to the stack here.
|
||||
#Resource packs here are applied from bottom to top. This means that resources in higher packs will override those in lower packs.
|
||||
#Entries here must indicate the filename of the resource pack.
|
||||
#Example
|
||||
# - natural.zip
|
||||
# - vanilla.zip
|
||||
#If you want to force clients to use vanilla resources, you must place a vanilla resource pack in your resources folder and add it to the stack here.
|
||||
|
Submodule src/pocketmine/resources/vanilla updated: 0c00c4f3b9...b9247957da
@ -30,7 +30,13 @@ use function count;
|
||||
class Color{
|
||||
|
||||
/** @var int */
|
||||
protected $a, $r, $g, $b;
|
||||
protected $a;
|
||||
/** @var int */
|
||||
protected $r;
|
||||
/** @var int */
|
||||
protected $g;
|
||||
/** @var int */
|
||||
protected $b;
|
||||
|
||||
public function __construct(int $r, int $g, int $b, int $a = 0xff){
|
||||
$this->r = $r & 0xff;
|
||||
|
@ -32,10 +32,17 @@ use function curl_init;
|
||||
use function curl_setopt_array;
|
||||
use function explode;
|
||||
use function preg_match;
|
||||
use function socket_close;
|
||||
use function socket_connect;
|
||||
use function socket_create;
|
||||
use function socket_getsockname;
|
||||
use function socket_last_error;
|
||||
use function socket_strerror;
|
||||
use function strip_tags;
|
||||
use function strtolower;
|
||||
use function substr;
|
||||
use function trim;
|
||||
use const AF_INET;
|
||||
use const CURLINFO_HEADER_SIZE;
|
||||
use const CURLINFO_HTTP_CODE;
|
||||
use const CURLOPT_AUTOREFERER;
|
||||
@ -51,6 +58,8 @@ use const CURLOPT_RETURNTRANSFER;
|
||||
use const CURLOPT_SSL_VERIFYHOST;
|
||||
use const CURLOPT_SSL_VERIFYPEER;
|
||||
use const CURLOPT_TIMEOUT_MS;
|
||||
use const SOCK_DGRAM;
|
||||
use const SOL_UDP;
|
||||
|
||||
class Internet{
|
||||
public static $ip = false;
|
||||
@ -98,6 +107,28 @@ class Internet{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the machine's internal network IP address. If the machine is not behind a router, this may be the same
|
||||
* as the external IP.
|
||||
*
|
||||
* @return string
|
||||
* @throws InternetException
|
||||
*/
|
||||
public static function getInternalIP() : string{
|
||||
$sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
|
||||
try{
|
||||
if(!@socket_connect($sock, "8.8.8.8", 65534)){
|
||||
throw new InternetException("Failed to get internal IP: " . trim(socket_strerror(socket_last_error($sock))));
|
||||
}
|
||||
if(!@socket_getsockname($sock, $name)){
|
||||
throw new InternetException("Failed to get internal IP: " . trim(socket_strerror(socket_last_error($sock))));
|
||||
}
|
||||
return $name;
|
||||
}finally{
|
||||
socket_close($sock);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* GETs an URL using cURL
|
||||
* NOTE: This is a blocking operation and can take a significant amount of time. It is inadvisable to use this method on the main thread.
|
||||
|
@ -84,6 +84,7 @@ use function strlen;
|
||||
use function strpos;
|
||||
use function strtolower;
|
||||
use function strval;
|
||||
use function substr;
|
||||
use function sys_get_temp_dir;
|
||||
use function trim;
|
||||
use function xdebug_get_function_stack;
|
||||
@ -127,7 +128,7 @@ class Utils{
|
||||
*/
|
||||
public static function getNiceClosureName(\Closure $closure) : string{
|
||||
$func = new \ReflectionFunction($closure);
|
||||
if($func->getName() !== "{closure}"){
|
||||
if(substr($func->getName(), -strlen('{closure}')) !== '{closure}'){
|
||||
//closure wraps a named function, can be done with reflection or fromCallable()
|
||||
//isClosure() is useless here because it just tells us if $func is reflecting a Closure object
|
||||
|
||||
|
@ -30,9 +30,9 @@ namespace pocketmine\wizard;
|
||||
use pocketmine\lang\BaseLang;
|
||||
use pocketmine\utils\Config;
|
||||
use pocketmine\utils\Internet;
|
||||
use pocketmine\utils\InternetException;
|
||||
use function base64_encode;
|
||||
use function fgets;
|
||||
use function gethostbyname;
|
||||
use function random_bytes;
|
||||
use function sleep;
|
||||
use function strtolower;
|
||||
@ -76,10 +76,6 @@ class SetupWizard{
|
||||
}
|
||||
}while($lang === null);
|
||||
|
||||
$config = new Config(\pocketmine\DATA . "server.properties", Config::PROPERTIES);
|
||||
$config->set("language", $lang);
|
||||
$config->save();
|
||||
|
||||
$this->lang = new BaseLang($lang);
|
||||
|
||||
$this->message($this->lang->get("language_has_been_selected"));
|
||||
@ -88,6 +84,11 @@ class SetupWizard{
|
||||
return false;
|
||||
}
|
||||
|
||||
//this has to happen here to prevent user avoiding agreeing to license
|
||||
$config = new Config(\pocketmine\DATA . "server.properties", Config::PROPERTIES);
|
||||
$config->set("language", $lang);
|
||||
$config->save();
|
||||
|
||||
if(strtolower($this->getInput($this->lang->get("skip_installer"), "n", "y/N")) === "y"){
|
||||
return true;
|
||||
}
|
||||
@ -223,7 +224,11 @@ LICENSE;
|
||||
if($externalIP === false){
|
||||
$externalIP = "unknown (server offline)";
|
||||
}
|
||||
$internalIP = gethostbyname(trim(`hostname`));
|
||||
try{
|
||||
$internalIP = Internet::getInternalIP();
|
||||
}catch(InternetException $e){
|
||||
$internalIP = "unknown (" . $e->getMessage() . ")";
|
||||
}
|
||||
|
||||
$this->error($this->lang->translateString("ip_warning", ["EXTERNAL_IP" => $externalIP, "INTERNAL_IP" => $internalIP]));
|
||||
$this->error($this->lang->get("ip_confirm"));
|
||||
|
@ -24,9 +24,20 @@ declare(strict_types=1);
|
||||
namespace pocketmine\utils;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use function define;
|
||||
use function defined;
|
||||
|
||||
class UtilsTest extends TestCase{
|
||||
|
||||
public function setUp(){
|
||||
if(!defined('pocketmine\PATH')){
|
||||
define('pocketmine\PATH', 'dummy');
|
||||
}
|
||||
if(!defined('pocketmine\PLUGIN_PATH')){
|
||||
define('pocketmine\PLUGIN_PATH', 'dummy');
|
||||
}
|
||||
}
|
||||
|
||||
public function parseDocCommentNewlineProvider() : array{
|
||||
return [
|
||||
["\t/**\r\n\t * @param PlayerJoinEvent \$event\r\n\t * @priority HIGHEST\r\n\t * @notHandler\r\n\t */"],
|
||||
@ -47,4 +58,9 @@ class UtilsTest extends TestCase{
|
||||
self::assertArrayHasKey("priority", $tags);
|
||||
self::assertEquals("HIGHEST", $tags["priority"]);
|
||||
}
|
||||
|
||||
public function testNamespacedNiceClosureName() : void{
|
||||
//be careful with this test. The closure has to be declared on the same line as the assertion.
|
||||
self::assertSame('closure@' . Utils::cleanPath(__FILE__) . '#L' . __LINE__, Utils::getNiceClosureName(function(){}));
|
||||
}
|
||||
}
|
||||
|
Submodule tests/plugins/PocketMine-DevTools updated: 3f14ab5bb7...c0f0f9383d
Submodule tests/preprocessor updated: b87380457e...cab4e6ceb1
Reference in New Issue
Block a user