Last active
January 2, 2016 06:59
-
-
Save Omattyao/8267515 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$username = "Steve"; //対象プレイヤー名 | |
$id = 1; //対象アイテムをIDで指定 | |
$amount = 10; //個数 | |
$player = $this->api->player->get($username); | |
foreach ($player->inventory as $slot => $item) { | |
if ($item->getID() == $id) { | |
while ($item->count >= 1 and $amount >= 1) { | |
--$item->count; | |
--$amount; | |
} | |
//追加のひと手間 | |
if ($item->count < 1) { | |
$player->inventory[$slot] = new AirBlock(); | |
} | |
//ここまで | |
if ($amount < 1) { | |
break; | |
} | |
} | |
} | |
$player->sendInventorySlot(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment