Skip to content
This repository has been archived by the owner on Mar 16, 2020. It is now read-only.

Support PMMP 3.0.0 #277

Merged
merged 30 commits into from
Aug 25, 2018
Merged

Support PMMP 3.0.0 #277

merged 30 commits into from
Aug 25, 2018

Conversation

YassLV
Copy link
Contributor

@YassLV YassLV commented Jun 19, 2018

  • Support PocketMine new API 3.0.0 - Beta 4.0.0
  • New Task support
  • Rename "nether" to "teanether" (PocketMine has the nether now)
  • Modification of constants for better readability + documentation
  • Use PMMP Release instead of Dev-Build
  • Add DevMode to execute .phar TeaSpoon not in poggit

Added:

  • Register Trident Item/Entity
  • Fixed and added Jukebox

Fixed:

  • MobSpawners
  • Lightning
  • Hopper
  • Beacon
  • ShulkerBox
  • BrewingStand
  • Lingering Potions

This pull request is not finished! Changes are still coming on this pull request to fix the various bugs there might be

@xXNiceYT
Copy link

Did u fixed MobSpawner/Lightning

if($entity->getLevel()->getName() != Main::$endName){ // OVERWORLD -> END
Server::getInstance()->getScheduler()->scheduleDelayedTask(new DelayedCrossDimensionTeleportTask(Main::getInstance(), $entity, DimensionIds::THE_END, Main::$endLevel->getSafeSpawn()), 1);
$plug->getScheduler()->scheduleDelayedTask(new DelayedCrossDimensionTeleportTask($entity, DimensionIds::THE_END, Main::$endLevel->getSafeSpawn()), 1);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could've used Main::getInstance() directly

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Effectively, I must have been tired the day I made this pull request x) I correct that

if($gm == Player::SURVIVAL || $gm == Player::ADVENTURE){
Server::getInstance()->getScheduler()->scheduleDelayedTask(new DelayedCrossDimensionTeleportTask(Main::getInstance(), $entity, DimensionIds::NETHER, $posNether), 20 * 4);
$plug->getScheduler()->scheduleDelayedTask(new DelayedCrossDimensionTeleportTask($entity, DimensionIds::NETHER, $posNether), 20 * 4);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use Main::getInstance() instead

@@ -188,7 +189,8 @@ private static function writeEnchantList(EnchantmentList $list, NetworkBinaryStr
$entry = $list->getSlot($i);
$stream->putUnsignedVarInt($entry->getCost());
$stream->putUnsignedVarInt(count($entry->getEnchantments()));
foreach($entry->getEnchantments() as $enchantment){
/** @var Enchantment $enchantment */
foreach($entry->getEnchantments() as $enchantment){
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation

@@ -65,7 +64,7 @@ public function onRun(int $currentTick){
)));
$this->internalCount++;
}else{
$plug = PMServer::getInstance()->getPluginManager()->getPlugin(Main::getInstance()->getName());
$plug = Main::getInstance();
$plug->getScheduler()->cancelTask($this->getTaskId());
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$plug = Main::getInstance();
$plug->getScheduler()->cancelTask($this->getTaskId());

could've been easily
Main::getInstance()->getScheduler()->cancelTask($this->getTaskId());
since you're only using the variable's value once. xd

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xD ok i'm changing that

@CortexPE
Copy link
Owner

Save MobSpawners in HardDisk

This'd be kinda hacky, but would it be appropriate to do so?

@CortexPE
Copy link
Owner

haven't touched minecraft for a while now xd

@YassLV
Copy link
Contributor Author

YassLV commented Jun 21, 2018

If we don't do that, each time the server restarts the content of the mobs spawners will be restored: It's like leaving our minecraft survival world, and our farm for the Mobs disappears xD

@CortexPE
Copy link
Owner

that means the NBT data isn't being saved... there's a correct way of doing this however, I'm not quite sure how it is right now because PMMP has changed so much within the past few weeks xD

@YassLV
Copy link
Contributor Author

YassLV commented Jun 21, 2018

Mmm, the mobs spawners appears at the reboot of the server but without the mobs inside, I fix that tonight

@ghost
Copy link

ghost commented Jun 22, 2018

fix losted nbt when chunk is unloaded

@YassLV
Copy link
Contributor Author

YassLV commented Jun 22, 2018

Losted nbt ?

@ghost
Copy link

ghost commented Jun 22, 2018

add a mob to spawner and restart server, bum, spawner is empty.

@YassLV
Copy link
Contributor Author

YassLV commented Jun 22, 2018

I already fixed that, you should try again with a newer version of this pull request.

@YassLV
Copy link
Contributor Author

YassLV commented Jun 23, 2018

#234

@CortexPE
Copy link
Owner

thats why I disabled them in the first place xd

@YassLV
Copy link
Contributor Author

YassLV commented Jun 29, 2018

I'll fix it tomorrow morning ^^ I would also reformat the code/indentation (PHPStorm doesn't do its job well apparently)

@teracube
Copy link

@MineBuilderFR
i Pass constant "DEV_MODE" to true and recreate a .phar with DevTools
i tested https://jenkins.pmmp.io/job/PocketMine-MP/1224/artifact/PocketMine-MP.phar
but i have this issue

2018-06-30 [08:33:31] [Server thread/INFO]: Loading TeaSpoon v1.0.0
2018-06-30 [08:33:31] [Server thread/INFO]: [TeaSpoon] Loading Resources...
2018-06-30 [08:33:31] [Server thread/CRITICAL]: ErrorException: "Undefined index: fromCommit" (EXCEPTION) in "TeaSpoon_v1.0.0.phar/src/CortexPE/Main" at line 304
2018-06-30 [08:33:31] [Server thread/DEBUG]: #0 TeaSpoon_v1.0.0.phar/src/CortexPE/Main(304): pocketmine\utils\Utils::errorExceptionHandler(integer 8, string Undefined index: fromCommit, string phar:///home/myservertest/plugins/TeaSpoon_v1.0.0.phar/src/CortexPE/Main.php, integer 304, array Array())
2018-06-30 [08:33:31] [Server thread/DEBUG]: #1 src/pocketmine/plugin/PluginBase(72): CortexPE\Main->onLoad()
2018-06-30 [08:33:31] [Server thread/DEBUG]: #2 src/pocketmine/plugin/PluginManager(203): pocketmine\plugin\PluginBase->__construct(pocketmine\plugin\PharPluginLoader object, pocketmine\Server object, pocketmine\plugin\PluginDescription object, string /home/myservertest/plugin_data/TeaSpoon, string phar:///home/myservertest/plugins/TeaSpoon_v1.0.0.phar)
2018-06-30 [08:33:31] [Server thread/DEBUG]: #3 src/pocketmine/plugin/PluginManager(349): pocketmine\plugin\PluginManager->loadPlugin(string /home/myservertest/plugins/TeaSpoon_v1.0.0.phar, array Array())
2018-06-30 [08:33:31] [Server thread/DEBUG]: #4 src/pocketmine/Server(1654): pocketmine\plugin\PluginManager->loadPlugins(string /home/myservertest/plugins/)
2018-06-30 [08:33:31] [Server thread/DEBUG]: #5 src/pocketmine/PocketMine(237): pocketmine\Server->__construct(BaseClassLoader object, pocketmine\utils\MainLogger object, string /home/myservertest/, string /home/myservertest/plugins/)
2018-06-30 [08:33:31] [Server thread/DEBUG]: #6 /home/myservertest/PocketMine-MP.phar(1): require(string phar:///home/myservertest/PocketMine-MP.phar/src/pocketmine/PocketMine.php)
2018-06-30 [08:33:31] [Server thread/CRITICAL]: Could not load plugin 'TeaSpoon'

This was referenced Jul 3, 2018
@ghost
Copy link

ghost commented Jul 4, 2018

image
image

You don't fixed bug.

If you create mob spawner with a egg and a spawner, and you restart server, them is empty.

Actually, is client-side bug, not server side. nbt is saved on server, but it's not handled by client because if you "put" again egg, mob spawner is not updated, so nbt already exist.

Can you fix that?

@ghost
Copy link

ghost commented Jul 4, 2018

[13:56:03] [Server thread/CRITICAL]: Error: "Undefined class constant 'SOURCE_TYPE_ANVIL_MATERIAL'" (EXCEPTION) in "TeaSpoon-master/src/CortexPE/network/types/NetworkInventoryAction" at line 250
[13:56:03] [Server thread/DEBUG]: #0 src/pocketmine/Player(2284): CortexPE\network\types\NetworkInventoryAction->createInventoryAction(pocketmine\Player object)
[13:56:03] [Server thread/DEBUG]: #1 src/pocketmine/network/mcpe/PlayerNetworkSessionAdapter(132): pocketmine\Player->handleInventoryTransaction(CortexPE\network\InventoryTransactionPacket object)
[13:56:03] [Server thread/DEBUG]: #2 TeaSpoon-master/src/CortexPE/network/InventoryTransactionPacket(163): pocketmine\network\mcpe\PlayerNetworkSessionAdapter->handleInventoryTransaction(CortexPE\network\InventoryTransactionPacket object)
[13:56:03] [Server thread/DEBUG]: #3 src/pocketmine/network/mcpe/PlayerNetworkSessionAdapter(92): CortexPE\network\InventoryTransactionPacket->handle(pocketmine\network\mcpe\PlayerNetworkSessionAdapter object)
[13:56:03] [Server thread/DEBUG]: #4 src/pocketmine/network/mcpe/protocol/BatchPacket(114): pocketmine\network\mcpe\PlayerNetworkSessionAdapter->handleDataPacket(CortexPE\network\InventoryTransactionPacket object)
[13:56:03] [Server thread/DEBUG]: #5 src/pocketmine/network/mcpe/PlayerNetworkSessionAdapter(92): pocketmine\network\mcpe\protocol\BatchPacket->handle(pocketmine\network\mcpe\PlayerNetworkSessionAdapter object)
[13:56:03] [Server thread/DEBUG]: #6 src/pocketmine/Player(3032): pocketmine\network\mcpe\PlayerNetworkSessionAdapter->handleDataPacket(pocketmine\network\mcpe\protocol\BatchPacket object)
[13:56:03] [Server thread/DEBUG]: #7 src/pocketmine/network/mcpe/RakLibInterface(158): pocketmine\Player->handleDataPacket(pocketmine\network\mcpe\protocol\BatchPacket object)
[13:56:03] [Server thread/DEBUG]: #8 vendor/pocketmine/raklib/src/server/ServerHandler(98): pocketmine\network\mcpe\RakLibInterface->handleEncapsulated(string 86.126.186.28 49206, raklib\protocol\EncapsulatedPacket object, integer 0)
[13:56:03] [Server thread/DEBUG]: #9 src/pocketmine/network/mcpe/RakLibInterface(103): raklib\server\ServerHandler->handlePacket()
[13:56:03] [Server thread/DEBUG]: #10 src/pocketmine/network/Network(94): pocketmine\network\mcpe\RakLibInterface->process()
[13:56:03] [Server thread/DEBUG]: #11 src/pocketmine/network/mcpe/RakLibInterface(80): pocketmine\network\Network->processInterface(pocketmine\network\mcpe\RakLibInterface object)
[13:56:03] [Server thread/DEBUG]: #12 vendor/pocketmine/snooze/src/SleeperHandler(120): pocketmine\network\mcpe\RakLibInterface->pocketmine\network\mcpe\{closure}()
[13:56:03] [Server thread/DEBUG]: #13 vendor/pocketmine/snooze/src/SleeperHandler(82): pocketmine\snooze\SleeperHandler->processNotifications()
[13:56:03] [Server thread/DEBUG]: #14 src/pocketmine/Server(2258): pocketmine\snooze\SleeperHandler->sleepUntil(double 1530726963.6407)
[13:56:03] [Server thread/DEBUG]: #15 src/pocketmine/Server(2129): pocketmine\Server->tickProcessor()
[13:56:03] [Server thread/DEBUG]: #16 src/pocketmine/Server(1710): pocketmine\Server->start()
[13:56:03] [Server thread/DEBUG]: #17 src/pocketmine/PocketMine(237): pocketmine\Server->__construct(BaseClassLoader object, pocketmine\utils\MainLogger object, string /root/build/, string /root/build/plugins/)
[13:56:03] [Server thread/DEBUG]: #18 /root/build/PocketMine-MP.phar(1): require(string phar:///root/build/PocketMine-MP.phar/src/pocketmine/PocketMine.php)

Error when i want use Anvil for changing name of x64 Mob Spawners.
I want mention i was on Creative Mode, but actually is by packet so it's useless to debug because is code error, not bug by coding.

@TDMidkwhatisxd
Copy link

Just a report: I cant turn off Hopper transaction (btw it seems that all dupes are fixed from hopper). All api load, if i turn it on it give a error( about construct ) .... Elytra gets pulled back by antifly...
And a known bug: trident dupe xd

Otherwise the plugin works well, good job ...

@TDMidkwhatisxd
Copy link

[Server thread/CRITICAL]: InvalidStateException: "Cannot schedule update on garbage entity CortexPE\entity\projectile\FishingHook" (EXCEPTION) in "src/pocketmine/entity/Entity" at line 1381
[14:19:23] [Server thread/DEBUG]: #0 src/pocketmine/entity/Entity(1981): pocketmine\entity\Entity->scheduleUpdate()
[14:19:23] [Server thread/DEBUG]: #1 TeaSpoon-b8dabf09729a13a46f80bb80347a1d0c84647940/src/CortexPE/item/FishingRod(144): pocketmine\entity\Entity->flagForDespawn()
[14:19:23] [Server thread/DEBUG]: #2 src/pocketmine/Player(2456): CortexPE\item\FishingRod->onClickAir(pocketmine\Player object, pocketmine\math\Vector3 object)
[14:19:23] [Server thread/DEBUG]: #3 src/pocketmine/network/mcpe/PlayerNetworkSessionAdapter(132): pocketmine\Player->handleInventoryTransaction(CortexPE\network\InventoryTransactionPacket object)

@TDMidkwhatisxd
Copy link

Error: Value 38475 is too large!
File: vendor/pocketmine/nbt/src/tag/ShortTag
Line: 42
Type: InvalidArgumentException

Code:
[33] private $value;
[34]
[35] /**
[36] * @param string $name
[37] * @param int $value
[38] */
[39] public function __construct(string $name = "", int $value = 0){
[40] parent::__construct($name);
[41] if($value < -0x8000 or $value > 0x7fff){
[42] throw new \InvalidArgumentException("Value $value is too large!");
[43] }
[44] $this->value = $value;
[45] }
[46]
[47] public function getType() : int{
[48] return NBT::TAG_Short;
[49] }
[50]
[51] public function read(NBTStream $nbt) : void{
[52] $this->value = $nbt->getSignedShort();

Backtrace:
#0 vendor/pocketmine/nbt/src/tag/CompoundTag(304): pocketmine\nbt\tag\ShortTag->__construct(string Age, integer 38475)
#1 src/pocketmine/entity/projectile/Projectile(126): pocketmine\nbt\tag\CompoundTag->setShort(string Age, integer 38475)
#2 src/pocketmine/level/format/io/region/Anvil(70): pocketmine\entity\projectile\Projectile->saveNBT()
#3 src/pocketmine/level/format/io/region/McRegion(373): pocketmine\level\format\io\region\Anvil->nbtSerialize(pocketmine\level\format\Chunk object)
#4 src/pocketmine/level/format/io/BaseLevelProvider(163): pocketmine\level\format\io\region\McRegion->writeChunk(pocketmine\level\format\Chunk object)
#5 src/pocketmine/level/Level(1053): pocketmine\level\format\io\BaseLevelProvider->saveChunk(pocketmine\level\format\Chunk object)
#6 src/pocketmine/level/Level(1042): pocketmine\level\Level->saveChunks()
#7 src/pocketmine/Server(2401): pocketmine\level\Level->save(boolean )
#8 src/pocketmine/Server(2541): pocketmine\Server->doAutoSave()
#9 src/pocketmine/Server(2255): pocketmine\Server->tick()
#10 src/pocketmine/Server(2129): pocketmine\Server->tickProcessor()
#11 src/pocketmine/Server(1710): pocketmine\Server->start()
#12 src/pocketmine/PocketMine(237): pocketmine\Server->__construct(BaseClassLoader object, pocketmine\utils\MainLogger object, string /root/, string /root/plugins/)
#13 /root/PocketMine-MP.phar(1): require(string phar:///root/PocketMine-MP.phar/src/pocketmine/PocketMine.php)

Trident projectile :o crash

@TDMidkwhatisxd
Copy link

i think this is ded :))

@ghost
Copy link

ghost commented Jul 13, 2018

 [Server thread/CRITICAL]: Error: "Call to undefined method pocketmine\Server::getScheduler()" (EXCEPTION) in "TeaSpoon-master/src/CortexPE/item/Fireworks" at line 127

@teracube
Copy link

teracube commented Jul 15, 2018

up

@MineBuilderFR
@CortexPE
@Laghd

i tried this configuration with latest build 1.5.0

https://github.com/pmmp/PocketMine-MP/tree/mc-broken-ed-1.5
https://github.com/MineBuilderFR/TeaSpoon

server crash

PocketMine-MP Crash Dump Tue Jul 10 21:19:07 CEST 2018

Error: Declaration of CortexPE\network\CraftingDataPacket::decodePayload() must be compatible with pocketmine\network\mcpe\protocol\CraftingDataPacket::decodePayload(): void
File: TeaSpoon-master/src/CortexPE/network/CraftingDataPacket
Line: 240
Type: E_COMPILE_ERROR

THIS CRASH WAS CAUSED BY A PLUGIN
BAD PLUGIN: TeaSpoon v1.0.0

Code:
[231] 		}
[232] 
[233] 		$this->putBool($this->cleanRecipes);
[234] 	}
[235] 
[236] 	public function handle(NetworkSession $session): bool{
[237] 		return $session->handleCraftingData($this);
[238] 	}
[239] 
[240] }
[241] 
[242] 
[243] 
[244] 
[245] 
[246] 
[247] 
[248] 
[249] 
[250] 

Backtrace:

PocketMine-MP version: 4.0.0+dev.1242 [Protocol 274]
Git commit: bafc397749b9abda7cc3f5317f7cf5326ae48b74
uname -a: Linux g1 4.5.0-0.bpo.2-amd64 #1 SMP Debian 4.5.4-1~bpo8+1 (2016-05-13) x86_64
PHP Version: 7.2.4
Zend version: 3.2.0
OS : Linux, linux

@Adam1609
Copy link

Please try #285 as the pull request hasn't actived for a while now....

@teracube
Copy link

@Adam1609
I can't test #285 because i have this issue with latest PMMP build
how to solve that
thanks

rror: Declaration of CortexPE\network\CraftingDataPacket::decodePayload() must be compatible with pocketmine\network\mcpe\protocol\CraftingDataPacket::decodePayload(): void
File: TeaSpoon-master/src/CortexPE/network/CraftingDataPacket
Line: 240
Type: E_COMPILE_ERROR

THIS CRASH WAS CAUSED BY A PLUGIN
BAD PLUGIN: TeaSpoon v1.0.0

Code:
[231] 		}
[232] 
[233] 		$this->putBool($this->cleanRecipes);
[234] 	}
[235] 
[236] 	public function handle(NetworkSession $session): bool{
[237] 		return $session->handleCraftingData($this);
[238] 	}
[239] 
[240] }
[241] 
[242] 
[243] 
[244] 
[245] 
[246] 
[247] 
[248] 
[249] 
[250] 

@nicsmith78
Copy link

please update to 3.0.0 ALPHA 10

larryTheCoder and others added 5 commits August 2, 2018 22:41
Reformat code
Some inappropriate pocketmine API break.
Fishing is now working.
@CortexPE CortexPE dismissed their stale review August 4, 2018 02:43

stale review

@CortexPE CortexPE merged commit ed5d5e6 into CortexPE:master Aug 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet