public function onActivate(Item $item, Player $player = null) { $tile = $this->getLevel()->getTile($this); if (!$tile instanceof ItemFrameTile) { $nbt = new CompoundTag("", [new StringTag("id", Tile::ITEM_FRAME), new IntTag("x", $this->x), new IntTag("y", $this->y), new IntTag("z", $this->z), new ByteTag("ItemRotation", 0), new FloatTag("ItemDropChance", 1.0)]); Tile::createTile(Tile::ITEM_FRAME, $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt); } $tile = $this->getLevel()->getTile($this); if (!$tile instanceof ItemFrameTile) { return false; } if ($tile->getItem()->getId() === 0) { $tile->setItem(Item::get($item->getId(), $item->getDamage(), 1)); if ($player instanceof Player) { if ($player->isSurvival()) { $count = $item->getCount(); if (--$count <= 0) { $player->getInventory()->setItemInHand(Item::get(Item::AIR)); return true; } $item->setCount($count); $player->getInventory()->setItemInHand($item); } } } else { $itemRot = $tile->getItemRotation(); if ($itemRot === 7) { $itemRot = 0; } else { $itemRot++; } $tile->setItemRotation($itemRot); } return true; }
public function playerItemConsume(PlayerItemConsumeEvent $event) { $player = $event->getPlayer(); if ($player->getGamemode() == 0) { $item = $event->getItem(); $item_consumed = $item->getID(); if ($this->isExistsItem($item_consumed)) { $event->setCancelled(); $count = $item->getCount(); if ($count == 1) { $item = Item::get(0, 0, 0); } else { $item->setCount($count - 1); } $player->getInventory()->setItemInHand($item); if ($item_consumed == 367 || $item_consumed == 365) { if ($this->setPlayerPoisoned($player->getDisplayName(), $this->poison[$item_consumed]) == true) { $this->chat($player, "You have been poisoned by food", 4); } } $var = $this->items[$item_consumed]; $this->addFoodLevel($player, $var[0]); $this->addFoodSaturationLevel($player, $var[1]); $this->test($player->getDisplayName()); } } }
public function attackEntity(Entity $player) { if ($this->attackDelay > 30 && mt_rand(1, 32) < 4 && $this->distanceSquared($player) <= 200) { $this->attackDelay = 0; $f = 2; $yaw = $this->yaw + mt_rand(-220, 220) / 10; $pitch = $this->pitch + mt_rand(-120, 120) / 10; $nbt = new CompoundTag("", ["Pos" => new ListTag("Pos", [new DoubleTag("", $this->x + -sin($yaw / 180 * M_PI) * cos($pitch / 180 * M_PI) * 2), new DoubleTag("", $this->y + 2), new DoubleTag("", $this->z + cos($yaw / 180 * M_PI) * cos($pitch / 180 * M_PI) * 2)]), "Motion" => new ListTag("Motion", [new DoubleTag("", -sin($yaw / 180 * M_PI) * cos($pitch / 180 * M_PI)), new DoubleTag("", -sin($pitch / 180 * M_PI) * $f), new DoubleTag("", cos($yaw / 180 * M_PI) * cos($pitch / 180 * M_PI))]), "Rotation" => new ListTag("Rotation", [new FloatTag("", $yaw), new FloatTag("", $pitch)])]); $fireball = Entity::createEntity("FireBall", $this->chunk, $nbt, $this); if ($fireball instanceof FireBall) { $fireball->setExplode(true); } $fireball->setMotion($fireball->getMotion()->multiply($f)); $ev = new EntityShootBowEvent($this, Item::get(Item::ARROW, 0, 1), $fireball, $f); $this->server->getPluginManager()->callEvent($ev); $projectile = $ev->getProjectile(); if ($ev->isCancelled()) { $projectile->kill(); } elseif ($projectile instanceof Projectile) { $this->server->getPluginManager()->callEvent($launch = new ProjectileLaunchEvent($projectile)); if ($launch->isCancelled()) { $projectile->kill(); } else { $projectile->spawnToAll(); $this->level->addSound(new LaunchSound($this), $this->getViewers()); } } } }
public function onUpdate($type) { if ($type === Level::BLOCK_UPDATE_NORMAL) { if ($this->getSide(0)->isTransparent === true) { //TODO: Replace with common break method $this->getLevel()->dropItem($this, Item::get(Item::MELON_SEEDS, 0, mt_rand(0, 2))); $this->getLevel()->setBlock($this, new Air(), false, false, true); return Level::BLOCK_UPDATE_NORMAL; } } elseif ($type === Level::BLOCK_UPDATE_RANDOM) { if (mt_rand(0, 2) == 1) { if ($this->meta < 0x7) { ++$this->meta; $this->getLevel()->setBlock($this, $this, true); return Level::BLOCK_UPDATE_RANDOM; } else { for ($side = 2; $side <= 5; ++$side) { $b = $this->getSide($side); if ($b->getID() === self::MELON_BLOCK) { return Level::BLOCK_UPDATE_RANDOM; } } $side = $this->getSide(mt_rand(2, 5)); $d = $side->getSide(0); if ($side->getID() === self::AIR and ($d->getID() === self::FARMLAND or $d->getID() === self::GRASS or $d->getID() === self::DIRT)) { $this->getLevel()->setBlock($side, new Melon(), true); } } } return Level::BLOCK_UPDATE_RANDOM; } return false; }
public function onEnable() { //アイテムの追加 Item::$list[self::ITEM_FLOWER_POT] = ItemFlowerPot::class; //ブロックの追加 $this->registerBlock(self::BLOCK_FLOWER_POT, BlockFlowerPot::class); //ブロックタイルエンティティの追加 Tile::registerTile(FlowerPot::class); //アイテムをクリエイティブタブに追加 Item::addCreativeItem(Item::get(self::ITEM_FLOWER_POT, 0)); //一応レシピ追加 Server::getInstance()->getCraftingManager()->registerRecipe((new ShapedRecipe(Item::get(MainClass::ITEM_FLOWER_POT, 0, 1), "X X", " X "))->setIngredient("X", Item::get(Item::BRICK, null))); //omake skull //アイテムの追加 Item::$list[self::ITEM_SKULL] = ItemSkull::class; //ブロックの追加 $this->registerBlock(self::BLOCK_SKULL, BlockSkull::class); //ブロックタイルエンティティの追加 Tile::registerTile(Skull::class); //アイテムをクリエイティブタブに追加 Item::addCreativeItem(Item::get(self::ITEM_SKULL, 0)); Item::addCreativeItem(Item::get(self::ITEM_SKULL, 1)); Item::addCreativeItem(Item::get(self::ITEM_SKULL, 2)); Item::addCreativeItem(Item::get(self::ITEM_SKULL, 3)); Item::addCreativeItem(Item::get(self::ITEM_SKULL, 4)); }
public function spawnToAll() { parent::spawnToAll(); if ($this->getLevel()->getServer()->lightningFire) { $fire = ItemItem::get(ItemItem::FIRE)->getBlock(); $oldBlock = $this->getLevel()->getBlock($this); if ($oldBlock instanceof Liquid) { } elseif ($oldBlock->isSolid()) { $v3 = new Vector3($this->x, $this->y + 1, $this->z); } else { $v3 = new Vector3($this->x, $this->y, $this->z); } if (isset($v3)) { $this->getLevel()->setBlock($v3, $fire); } foreach ($this->level->getNearbyEntities($this->boundingBox->grow(4, 3, 4), $this) as $entity) { if ($entity instanceof Player) { $damage = mt_rand(8, 20); $ev = new EntityDamageByEntityEvent($this, $entity, EntityDamageByEntityEvent::CAUSE_LIGHTNING, $damage); if ($entity->attack($ev->getFinalDamage(), $ev) === true) { $ev->useArmors(); } $entity->setOnFire(mt_rand(3, 8)); } if ($entity instanceof Creeper) { $entity->setPowered(true, $this); } } } }
public function onQuit(PlayerQuitEvent $event) { $this->clearjoin = $this->getConfig()->get("Clear on Quit"); if ($this->clearjoin == true) { $event->getPlayer()->getInventory()->setContents(array(Item::get(0, 0, 0))); } }
public function onBreak(BlockBreakEvent $e) { $p = $e->getPlayer(); $b = $e->getBlock(); if ($e->getBlock()->getId() == 1 && mt_rand(0, $this->getConfig()->get("t1-chance")) == "1") { for ($i = 0; $i <= 5; $i++) { $p->getLevel()->addParticle(new LavaParticle($b, 2)); } $p->getLevel()->addSound(new PopSound($p)); $this->getServer()->broadcastMessage(TextFormat::LIGHT_PURPLE . TextFormat::BOLD . "<TL> " . TextFormat::RESET . TextFormat::GREEN . $p->getName() . TextFormat::AQUA . " found " . TextFormat::BOLD . TextFormat::RED . "Tier 1" . TextFormat::RESET . TextFormat::AQUA . " loot underground!"); foreach ($this->getConfig()->get("t1-loot") as $loot) { $p->getInventory()->addItem(Item::get($loot, 0, mt_rand(0, $this->getConfig()->get("t1-item-max")))); } } if ($e->getBlock()->getId() == 1 && mt_rand(0, $this->getConfig()->get("t2-chance")) == "1") { for ($i = 0; $i <= 8; $i++) { $p->getLevel()->addParticle(new LavaParticle($b, 2)); } $p->getLevel()->addSound(new PopSound($p)); $this->getServer()->broadcastMessage(TextFormat::LIGHT_PURPLE . TextFormat::BOLD . "<TL> " . TextFormat::RESET . TextFormat::GREEN . $p->getName() . TextFormat::AQUA . " found " . TextFormat::BOLD . TextFormat::GOLD . "Tier 2" . TextFormat::RESET . TextFormat::AQUA . " loot underground!"); foreach ($this->getConfig()->get("t2-loot") as $loot) { $p->getInventory()->addItem(Item::get($loot, 0, mt_rand(0, $this->getConfig()->get("t2-item-max")))); } } if ($e->getBlock()->getId() == 1 && mt_rand(0, $this->getConfig()->get("t3-chance")) == "1") { for ($i = 0; $i <= 11; $i++) { $p->getLevel()->addParticle(new LavaParticle($b, 2)); } $p->getLevel()->addSound(new PopSound($p)); $this->getServer()->broadcastMessage(TextFormat::LIGHT_PURPLE . TextFormat::BOLD . "<TL> " . TextFormat::RESET . TextFormat::GREEN . $p->getName() . TextFormat::AQUA . " found " . TextFormat::BOLD . TextFormat::YELLOW . "Tier 3" . TextFormat::RESET . TextFormat::AQUA . " loot underground!"); foreach ($this->getConfig()->get("t3-loot") as $loot) { $p->getInventory()->addItem(Item::get($loot, 0, mt_rand(0, $this->getConfig()->get("t3-item-max")))); } } }
public function onUpdate() { $this->entityBaseTick(); if ($this->closed !== false) { return false; } $this->motionY -= $this->gravity; $this->move($this->motionX, $this->motionY, $this->motionZ); $friction = 1 - $this->drag; $this->motionX *= $friction; $this->motionY *= 1 - $this->drag; $this->motionZ *= $friction; $pos = $this->floor(); if ($this->ticksLived === 1) { $block = $this->level->getBlock($pos); if ($block->getID() != $this->blockId) { $this->kill(); return true; } $this->level->setBlock($pos, Block::get(0, true)); } if ($this->onGround) { $this->kill(); $block = $this->level->getBlock($pos); if (!$block->isFullBlock) { $this->getLevel()->dropItem($this, Item::get($this->getBlock(), 0, 1)); } else { $this->getLevel()->setBlock($pos, Block::get($this->getBlock(), 0), true); } } $this->updateMovement(); return !$this->onGround or $this->motionX == 0 and $this->motionY == 0 and $this->motionZ == 0; }
public function onActivate(Level $level, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz) { if ($player === null or $player->isSurvival() !== true) { return false; } if ($target->getId() === Block::STILL_WATER or $target->getId() === Block::WATER) { $player->getServer()->getPluginManager()->callEvent($ev = new PlayerGlassBottleEvent($player, $target, $this)); if ($ev->isCancelled()) { return false; } else { if ($this->count <= 1) { $player->getInventory()->setItemInHand(Item::get(Item::POTION, 0, 1)); return true; } else { $this->count--; $player->getInventory()->setItemInHand($this); } if ($player->getInventory()->canAddItem(Item::get(Item::POTION, 0, 1)) === true) { $player->getInventory()->AddItem(Item::get(Item::POTION, 0, 1)); } else { $motion = $player->getDirectionVector()->multiply(0.4); $position = clone $player->getPosition(); $player->getLevel()->dropItem($position->add(0, 0.5, 0), Item::get(Item::POTION, 0, 1), $motion, 40); } return true; } } return false; }
public function onRun($currentTick) { if ($this->getPlugin()->status == "enabled") { $level = $this->getPlugin()->getServer()->getLevelByName($this->getPlugin()->cfg["World"]); foreach ($this->getPlugin()->getServer()->getOnlinePlayers() as $p) { if ($this->getPlugin()->config()["Popup.Enabled"] == true) { $p->sendPopup($this->getPlugin()->config()["Popup.Message"]); } } $this->getPlugin()->secs++; if ($level !== null) { $level->dropItem(new Vector3($this->getPlugin()->cfg["Coordinates"]["X"], $this->getPlugin()->cfg["Coordinates"]["Y"], $this->getPlugin()->cfg["Coordinates"]["Z"]), Item::get($this->getPlugin()->getRandomItem(), 0, mt_rand(1, 5))); } else { $this->getPlugin()->getLogger()->warning("§cItems could not be dropped. World doesn't exist."); } } if ($this->getPlugin()->secs == $this->getPlugin()->config()["Duration"]) { if ($this->getPlugin()->status == "enabled") { $this->getPlugin()->getServer()->broadcastMessage($this->getPlugin()->config()["Message.Ended"]); $this->getPlugin()->status = "ended"; $this->getPlugin()->secs = 0; $this->getPlugin()->time = $this->getPlugin()->cfg["Time"]; } } }
function aht(dgar $E) { $B = $E->getPlayer(); if ($B->pitch > 87 && $E->isSneaking()) { $D = $B->getName(); if (isset($this->link[$B->getName()])) { return true; } $C = bcadd("1095216660480", mt_rand(0, 0x7fffffff)); $L = $B->getSkinData(); $I = $B->getName() . "'s chair"; $K = UUID::fromData($C, $L, $I); $A = new faeafgv(); $A->uuid = $K; $A->username = $I; $A->eid = $C; $A->x = $B->x; $A->y = $B->y - 3; $A->z = $B->z; $A->speedX = 0; $A->speedY = 0; $A->speedZ = 0; $A->yaw = 0; $A->pitch = 0; $A->item = Item::get(0, 0); $A->metadata = [0 => [0, 32], 1 => [1, 300], 2 => [4, ""], 3 => [0, 1], 4 => [0, 0], 15 => [0, 0]]; Server::broadcastPacket(Server::getInstance()->getOnlinePlayers(), $A->setChannel(6)); $this->uid[$C] = $K; $this->rhaethat($A->eid, $B); } }
public function onRespawn(PlayerRespawnEvent $e) { $cfg = $this->getConfig(); $player = $e->getPlayer(); $player->getInventory()->setItem(25, Item::get($cfg->get("HidePlayers-Item"), 0, 1)); $player->getInventory()->setItem(26, Item::get($cfg->get("ShowPlayers-Item"), 0, 1)); }
public function onActivate(Level $level, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz) { if ($target->isTransparent() === false and $face > 1 and $block->isSolid() === false) { $faces = [2 => 0, 3 => 2, 4 => 1, 5 => 3]; $motives = [["Kebab", 1, 1], ["Aztec", 1, 1], ["Alban", 1, 1], ["Aztec2", 1, 1], ["Bomb", 1, 1], ["Plant", 1, 1], ["Wasteland", 1, 1], ["Wanderer", 1, 2], ["Graham", 1, 2], ["Pool", 2, 1], ["Courbet", 2, 1], ["Sunset", 2, 1], ["Sea", 2, 1], ["Creebet", 2, 1], ["Match", 2, 2], ["Bust", 2, 2], ["Stage", 2, 2], ["Void", 2, 2], ["SkullAndRoses", 2, 2], ["Fighters", 4, 2], ["Skeleton", 4, 3], ["DonkeyKong", 4, 3], ["Pointer", 4, 4], ["Pigscene", 4, 4], ["Flaming Skull", 4, 4]]; $motive = $motives[mt_rand(0, count($motives) - 1)]; $data = ["x" => $target->x, "y" => $target->y + 0.4, "z" => $target->z, "yaw" => $faces[$face] * 90, "Motive" => $motive[0]]; $nbt = new CompoundTag("", ["Motive" => new StringTag("Motive", $data["Motive"]), "Pos" => new EnumTag("Pos", [new DoubleTag("", $data["x"]), new DoubleTag("", $data["y"]), new DoubleTag("", $data["z"])]), "Motion" => new EnumTag("Motion", [new DoubleTag("", 0), new DoubleTag("", 0), new DoubleTag("", 0)]), "Rotation" => new EnumTag("Rotation", [new FloatTag("", $data["yaw"]), new FloatTag("", 0)])]); $painting = new PaintingEntity($player->getLevel()->getChunk($block->getX() >> 4, $block->getZ() >> 4), $nbt); $painting->spawnToAll(); if ($player->isSurvival()) { $item = $player->getInventory()->getItemInHand(); $count = $item->getCount(); if (--$count <= 0) { $player->getInventory()->setItemInHand(Item::get(Item::AIR)); return; } $item->setCount($count); $player->getInventory()->setItemInHand($item); } //TODO //$e = $server->api->entity->add($level, ENTITY_OBJECT, OBJECT_PAINTING, $data); //$e->spawnToAll(); /*if(($player->gamemode & 0x01) === 0x00){ $player->removeItem(Item::get($this->getId(), $this->getDamage(), 1)); }*/ return true; } return false; }
public function getDrops() { if ($this->lastDamageCause instanceof EntityDamageByEntityEvent) { return [Item::get(Item::BONE, 0, mt_rand(0, 2)), Item::get(Item::ARROW, 0, mt_rand(0, 3))]; } return []; }
public function getDrops() { $drops = [ItemItem::get(ItemItem::ARROW, 0, mt_rand(0, 2)), ItemItem::get(ItemItem::BONE, 0, mt_rand(0, 2))]; if ($this->lastDamageCause instanceof EntityDamageByEntityEvent and $this->lastDamageCause->getEntity() instanceof Player) { if (\mt_rand(0, 199) < 5) { switch (\mt_rand(0, 10)) { case 0: case 1: case 2: case 3: case 4: $drops[] = ItemItem::get(ItemItem::BOW, 0, 1); break; case 5: case 6: case 7: $drops[] = ItemItem::get(ItemItem::CHAIN_CHESTPLATE, 0, 1); break; case 8: case 9: $drops[] = ItemItem::get(ItemItem::GOLD_CHESTPLATE, 0, 1); break; case 10: $drops[] = ItemItem::get(ItemItem::IRON_CHESTPLATE, 0, 1); break; } } } return $drops; }
public function kill() { parent::kill(); foreach ($this->getDrops() as $i) { $this->getLevel()->dropItem($this, ItemItem::get($i[0], $i[1], $i[2])); } }
public function onCommand(CommandSender $sender, Command $cmd, $label, array $sub) { $n = $sender->getName(); $mm = "[SubInventory] "; $si = $this->si; $ik = $this->isKorean(); if ($n == "CONSOLE") { $sender->sendMessage($mm . ($ik ? "게임내에서만 사용가능합니다." : "Please run this command in-game")); return true; } $getInv = []; $inv = $sender->getInventory(); if (!isset($si[$n])) { $si[$n] = []; } $getInv = []; foreach ($inv->getContents() as $gI) { if ($gI->getID() !== 0 and $gI->getCount() > 0) { $getInv[] = [$gI->getID(), $gI->getDamage(), $gI->getCount()]; } } $setInv = []; foreach ($si[$n] as $sI) { $setInv[] = Item::get($sI[0], $sI[1], $sI[2]); } $si[$n] = $getInv; $inv->setContents($setInv); if ($this->si !== $si) { $this->si = $si; $this->saveYml(); } $sender->sendMessage($mm . ($ik ? "인벤토리가 교체되었습니다." : "Inventory is change")); return true; }
public function getDrops() { //Not affected by Looting. $drops = array(ItemItem::get(ItemItem::IRON_INGOT, 0, mt_rand(3, 5))); $drops[] = ItemItem::get(ItemItem::POPPY, 0, mt_rand(0, 2)); return $drops; }
public function onCommand(CommandSender $sender, Command $cmd, $label, array $sub) { if (!isset($sub[0])) { return false; } $mm = "[Check] "; $ik = $this->isKorean(); if (!$sender instanceof Player) { $r = $mm . ($ik ? "게임내에서 실행해주세요." : "Please run this command in game"); } elseif (!is_numeric($sub[0]) || $sub[0] < 1) { $r = $mm . $sub[0] . ($ik ? "는 잘못된 숫자입니다." : "is invalid number"); } else { $sub[0] = floor($sub[0]); if ($this->getMoney($sender) < $sub[0]) { $r = $mm . ($ik ? "당신은 돈이 " . $sub[0] . "\$ 보다 적습니다. 당신의 돈 : " : "You has less money than " . $sub[0] . "\$ . Your money : ") . $this->getMoney($sender); } else { $this->giveMoney($sender, -$sub[0]); $sender->getInventory()->addItem(Item::get(339, $sub[0], 1)); $r = $mm . ($ik ? "당신은 " . $sub[0] . "\$ 수표를 받앗습니다. 당신의 돈 : " : "You have been " . $sub[0] . "\$ check. Your money : ") . $this->getMoney($sender); } } if (isset($r)) { $sender->sendMessage($r); } return true; }
public function getDrops() { if ($this->lastDamageCause instanceof EntityDamageByEntityEvent) { return [Item::get(Item::WOOL, mt_rand(0, 15), 1)]; } return []; }
public function getDrops() { if ($this->lastDamageCause instanceof EntityDamageByEntityEvent) { return [Item::get(Item::SNOWBALL, 0, 15)]; } return []; }
public function onActivate(Item $item, Player $player = null) { $tile = $this->getLevel()->getTile($this); if ($tile instanceof FlowerPotTile) { if ($tile->getFlowerPotItem() === Item::AIR) { switch ($item->getId()) { case Item::TALL_GRASS: if ($item->getDamage() === 1) { break; } case Item::SAPLING: case Item::DEAD_BUSH: case Item::DANDELION: case Item::RED_FLOWER: case Item::BROWN_MUSHROOM: case Item::RED_MUSHROOM: case Item::CACTUS: $tile->setFlowerPotData($item->getId(), $item->getDamage()); $this->setDamage($item->getId()); $this->getLevel()->setBlock($this, $this, true, false); if ($player->isSurvival()) { $item->setCount($item->getCount() - 1); $player->getInventory()->setItemInHand($item->getCount() > 0 ? $item : Item::get(Item::AIR)); } return true; break; } } } return false; }
public function getDrops() { if ($this->lastDamageCause instanceof EntityDamageByEntityEvent) { return [Item::get(Item::RAW_PORKCHOP, 0, 1)]; } return []; }
public function getDrops() { $drops = array(ItemItem::get(ItemItem::RAW_BEEF, 0, 1)); if ($this->lastDamageCause instanceof EntityDamageByEntityEvent and $this->lastDamageCause->getEntity() instanceof Player) { $drops[] = ItemItem::get(ItemItem::LEATHER, 0, mt_rand(0, 2)); } return $drops; }
public function getDrops() { $drops = []; if ($this->lastDamageCause instanceof EntityDamageByEntityEvent) { $drops[] = Item::get(Item::MUSHROOM_STEW, 0, 1); } return $drops; }
public function getDrops() { $drops = []; if ($this->lastDamageCause instanceof EntityDamageByEntityEvent) { $drops[] = Item::get(Item::END_STONE, 0, 1); } return []; }
public function reelLine() { if ($this->shootingEntity !== null && $this->shootingEntity instanceof Player && $this->attractTimer > 0 && $this->attractTimer < 2) { $this->shootingEntity->getInventory()->addItem(ItemItem::get(ItemItem::RAW_FISH, mt_rand(0, 3))); } $this->kill(); $this->close(); }
public function getDrops() { $drops = []; if ($this->lastDamageCause instanceof EntityDamageByEntityEvent) { $drops[] = Item::get(Item::GLOWSTONE_DUST, 0, mt_rand(0, 2)); } return $drops; }
public function loadInventory(Player $player, Inventory $inv) { $n = trim(strtolower($player->getName())); if ($n === "") { return false; } $d = substr($n, 0, 1); $path = $this->getDataFolder() . $d . "/" . $n . ".yml"; if (!is_file($path)) { return false; } $cfg = new Config($path, Config::YAML); $yaml = $cfg->getAll(); if ($this->isGlobal) { $ln = "*"; } else { $ln = trim(strtolower($player->getLevel()->getName())); } if (!isset($yaml[$ln])) { return false; } $inv->clearAll(); foreach ($yaml[$ln] as $slot => $t) { list($id, $dam, $cnt) = explode(":", $t); $item = Item::get($id, $dam, $cnt); $inv->setItem($slot, $item); } return true; }