From ed13f7f8e78bb697bc2f39b11df9ca630f95d95b Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sun, 8 Jan 2017 10:38:53 +0000 Subject: [PATCH 1/5] Add guideline to test bugs on a clean test server without plugins before reporting --- CONTRIBUTING.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 52f028f34..0ba9913a3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,7 +4,9 @@ ## Creating an Issue -- If you are reporting a bug, **make sure that you are using the latest supported version** before opening an issue. +- If you are reporting a bug: + - **make sure that you are using the latest supported version** before opening an issue. + - **test it on a clean test server, WITHOUT PLUGINS**, to see if the issue still occurs. If not then it may be a plugin issue. Please also indicate the result of such tests. - [Search the issue tracker](https://github.com/pmmp/PocketMine-MP/issues?utf8=%E2%9C%93&q=is%3Aissue) to check if anyone has already reported it, to avoid needlessly creating duplicate issues. Make sure you also check closed issues, as an issue you think is valid may already have been resolved. From 2e865a3af9d76264e74c3c1838b5a5d5b2af3305 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sun, 8 Jan 2017 19:35:28 +0000 Subject: [PATCH 2/5] Fix doc comment fail --- src/pocketmine/level/Level.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pocketmine/level/Level.php b/src/pocketmine/level/Level.php index f93abb43f..e30748da1 100644 --- a/src/pocketmine/level/Level.php +++ b/src/pocketmine/level/Level.php @@ -2578,7 +2578,7 @@ class Level implements ChunkManager, Metadatable{ } /** - * Returns true if the spawn is part of the spawn + * Returns whether the chunk at the specified coordinates is a spawn chunk * * @param int $X * @param int $Z From 67940ad6ab4b9632823a749a9e7fa973d4500620 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 9 Jan 2017 13:16:46 +0000 Subject: [PATCH 3/5] Added PowerShell start script with loop capability, mainly useful for Win10 users (#240) --- start.ps1 | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 start.ps1 diff --git a/start.ps1 b/start.ps1 new file mode 100644 index 000000000..1b94da0ca --- /dev/null +++ b/start.ps1 @@ -0,0 +1,40 @@ +param ( + [switch]$Loop = $false +) + +if(Test-Path "bin\php\php.exe"){ + $env:PHPRC = "" + $binary = "bin\php\php.exe" +}else{ + $binary = "php" +} + +if(Test-Path "PocketMine-MP.phar"){ + $file = "PocketMine-MP.phar" +}elseif(Test-Path "src\pocketmine\PocketMine.php"){ + $file = "src\pocketmine\PocketMine.php" +}else{ + echo "Couldn't find a valid PocketMine-MP installation" + pause + exit 1 +} + +function StartServer{ + $command = $binary + " " + $file + " --enable-ansi" + iex $command +} + +$loops = 0 + +StartServer + +while($Loop){ + if($loops -ne 0){ + echo ("Restarted " + $loops + " times") + } + $loops++ + echo "To escape the loop, press CTRL+C now. Otherwise, wait 5 seconds for the server to restart." + echo "" + Start-Sleep 5 + StartServer +} \ No newline at end of file From 441961b199cfe9124ee3d7a8fb524ec5d6bd486f Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 9 Jan 2017 14:10:05 +0000 Subject: [PATCH 4/5] Fix players regenerating health from food while dead, fixes issue 2 in #23 --- src/pocketmine/entity/Human.php | 54 +++++++++++++++++---------------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/src/pocketmine/entity/Human.php b/src/pocketmine/entity/Human.php index 870a7146e..84cfd09b6 100644 --- a/src/pocketmine/entity/Human.php +++ b/src/pocketmine/entity/Human.php @@ -347,36 +347,38 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{ public function entityBaseTick($tickDiff = 1){ $hasUpdate = parent::entityBaseTick($tickDiff); - $food = $this->getFood(); - $health = $this->getHealth(); - if($food >= 18){ - $this->foodTickTimer++; - if($this->foodTickTimer >= 80 and $health < $this->getMaxHealth()){ - $this->heal(1, new EntityRegainHealthEvent($this, 1, EntityRegainHealthEvent::CAUSE_SATURATION)); - $this->exhaust(3.0, PlayerExhaustEvent::CAUSE_HEALTH_REGEN); - $this->foodTickTimer = 0; + if($this->isAlive()){ + $food = $this->getFood(); + $health = $this->getHealth(); + if($food >= 18){ + $this->foodTickTimer++; + if($this->foodTickTimer >= 80 and $health < $this->getMaxHealth()){ + $this->heal(1, new EntityRegainHealthEvent($this, 1, EntityRegainHealthEvent::CAUSE_SATURATION)); + $this->exhaust(3.0, PlayerExhaustEvent::CAUSE_HEALTH_REGEN); + $this->foodTickTimer = 0; - } - }elseif($food === 0){ - $this->foodTickTimer++; - if($this->foodTickTimer >= 80){ - $diff = $this->server->getDifficulty(); - $can = false; - if($diff === 1){ - $can = $health > 10; - }elseif($diff === 2){ - $can = $health > 1; - }elseif($diff === 3){ - $can = true; } - if($can){ - $this->attack(1, new EntityDamageEvent($this, EntityDamageEvent::CAUSE_STARVATION, 1)); + }elseif($food === 0){ + $this->foodTickTimer++; + if($this->foodTickTimer >= 80){ + $diff = $this->server->getDifficulty(); + $can = false; + if($diff === 1){ + $can = $health > 10; + }elseif($diff === 2){ + $can = $health > 1; + }elseif($diff === 3){ + $can = true; + } + if($can){ + $this->attack(1, new EntityDamageEvent($this, EntityDamageEvent::CAUSE_STARVATION, 1)); + } } } - } - if($food <= 6){ - if($this->isSprinting()){ - $this->setSprinting(false); + if($food <= 6){ + if($this->isSprinting()){ + $this->setSprinting(false); + } } } From 41d36e4e7a6318eedfbd475114af816c8b1e04bb Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 9 Jan 2017 15:51:55 +0000 Subject: [PATCH 5/5] Fix .gitignore Ignore the whole folder, stop deleting my damn PhpStorm files --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index c61624eba..b08db6710 100644 --- a/.gitignore +++ b/.gitignore @@ -11,7 +11,7 @@ server.properties memoryDump_*/* # Common IDEs -.idea/* +.idea/ nbproject/* # Windows image file caches