Hello? I have little code: PHP: foreach($this->redPlayer as $num => $red){ $this->getServer()->getPlayer($red)->getInventory()->addItem(Item::get(274, 0, 1)); } Sometimes code gives the stone pickaxe, but sometimes no. sendContents() I tried, like addItem(). Any idea why sometimes DOESNT gives stone pickaxe?
Class names are case-senstive. Wut? Maybe it gave the item, but the client didn't display the item? try relogging.
Try to var_dump the array, to check if there are all redPlayers in it, because I assume that there is a problem with your array
Class names are not case sensitive, constants are. I don't see how this will solve the problem, Item::STONE_PICKAXE also refers to 274. But it's a good practice to use constants instead of hard-coding the numbers. What the... I suspect it has something to do with your redPlayer array. You should add a couple debug lines, I guarantee that you'll find some surprising things.
If a bug "sometimes" occurs in a simple plugin and you can't find out the condition, it most likely means that you have a PocketMine/client/PHP bug. It is because simple plugins have little conditions to check for, and you won't have that very complicated bugs either. GI, GO.
Classes are case insensitive, but some filesystems are case sensitive. This leads to a problem when autoloading. This doesn't matter in this situation though, because the Item class is first loaded in the Server class to register default items.
phpstorm will complain if you don't use right caps and I always listen to this ide that's one more reason why you shouldn't do that. We can't know what will happen in future and class references can get case sensitive.
This compatibility thing is less likely. If it is supposed to be compatible the first day, it should theoretically never be removed. Guessing that it will be incompatible one day is a very low priority, because you never guess what will happen in the future. Instead, worry about yourself mixing up this fact with other programming languages.