Comments (4)
Because of this, I had to resort to other methods like iterating through the player's inventory.
from pocketmine-mp.
Why would you run break;
after a return true;
statement 😕 it is dead code.
from pocketmine-mp.
It works fine for me.
Run ci
first to clean the inventory and then ic
twice. First time it will add the items and second time it doesn't because the inventory contains the items.
https://github.com/pmmp/PocketMine-MP/blob/0.16/src/pocketmine/item/Item.php#L548
https://github.com/pmmp/PocketMine-MP/blob/0.16/src/pocketmine/inventory/BaseInventory.php#L162
$checkTags = $item->getCompoundTag() === null ? false : true;
public function onCommand(CommandSender $sender, Command $command, $label, array $args){
if(!($sender instanceof Player)){
$this->getLogger()->info("Not a Player!");
return true;
}
switch($command->getName()){
case "ic":
$item = Item::get(Item::STONE, 0, 1);
if(!$sender->getInventory()->contains($item)){
$this->getLogger()->info("Item not found");
$sender->getInventory()->addItem(clone $item);
}
$item->setCustomName("Not stone");
if(!$sender->getInventory()->contains($item)){
$this->getLogger()->info("Item with custom name not found");
$sender->getInventory()->addItem(clone $item);
}
return true;
case "ci":
$sender->getInventory()->clearAll();
return true;
default:
return false;
}
}
from pocketmine-mp.
Hmmm I must have done something wrong then...
from pocketmine-mp.
Related Issues (20)
- Same file inline optimization
- Enums limit plugins' ability to create custom stuff with existing PM core code
- Variable chunk send rate based on available bandwidth
- Explore running RakLib without a thread
- I'm retiring HOT 104
- Changer RakLib write in full php to extension zend with Raknet official HOT 5
- Implementing new blocks is a pain in the ass HOT 1
- Separate blockstate upgrader system into a library
- Is that removed? HOT 1
- Entities are not loaded from disk HOT 2
- Server connection infinite loading HOT 1
- ToolTiers Register HOT 2
- "/ver", "/version" and "/about" commands issue. HOT 1
- Automatically declare parent permission groups HOT 1
- A bug with the armor equipment sounds
- broadcast sound bug HOT 1
- Make onEnable always run before worlds load, remove `onLoad`, remove `load:` from `plugin.yml`
- Stuck at downloading resource pack HOT 5
- Integrate revamped CallbackValidator
- Consolidate world data version info
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pocketmine-mp.