Merge remote-tracking branch 'origin/stable'

This commit is contained in:
Dylan K. Taylor 2021-04-19 13:32:15 +01:00
commit 5872b2fe23
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
2 changed files with 10 additions and 1 deletions

View File

@ -142,7 +142,7 @@ class TaskScheduler{
continue;
}
$task->run();
if($task->isRepeating()){
if(!$task->isCancelled() && $task->isRepeating()){
$task->setNextRun($this->currentTick + $task->getPeriod());
$this->queue->insert($task, $this->currentTick + $task->getPeriod());
}else{

View File

@ -136,4 +136,13 @@ class ItemTest extends TestCase{
$this->item->removeEnchantment(VanillaEnchantments::FIRE_ASPECT(), 2);
self::assertFalse($this->item->hasEnchantment(VanillaEnchantments::FIRE_ASPECT()));
}
/**
* Tests that when all enchantments are removed from an item, the "ench" tag is removed as well
*/
public function testRemoveAllEnchantmentsNBT() : void{
$this->item->addEnchantment(new EnchantmentInstance(VanillaEnchantments::SHARPNESS(), 1));
$this->item->removeEnchantment(VanillaEnchantments::SHARPNESS());
self::assertNull($this->item->getNamedTag()->getTag(Item::TAG_ENCH));
}
}