Hello, I have bedwars plugin I've made sure that everything goes smoothly. But errors in the opening of the chest was found in minecraft v.0.13 is enough time to open the chest, but no problems have piled chest open and close minecraft game is stopped immediately and open the chest, not 0.14. at all The code below (php5) help me fix this problem thanks. PHP: public function onEntityDamage(EntityDamageEvent $event) { if ($event instanceof EntityDamageByEntityEvent) { if (($Victim = $event->getEntity()) && ($Player = $event->getDamager())) { if ($Player instanceof Human) { $Level = $Player->getLevel(); if ($Victim instanceof Villager) { $Type = ($Level->getFolderName() == $this->plugin->lobby_name) ? 1 : 0; $X = round($Victim->getX() - 0.5); $Z = round($Victim->getZ() - 0.5); if ($Level->getBlockIdAt($X, 0, $Z) != 54) { $Level->setBlock(new Vector3($X, 0, $Z), Block::get(54), true, true); $chest = new Chest($Level->getChunk($X >> 4, $Z >> 4, true), new Compound(false, array(new Int("x", $X), new Int("y", 0), new Int("z", $Z), new String("id", Tile::CHEST))), $this->plugin); $Level->addTile($chest); } else $chest = $Level->getTile(new Vector3($X, 0, $Z)); if ($Level->getBlockIdAt($X, 1, $Z) != 54) $Level->setBlock(new Vector3($X, 1, $Z), Block::get(0), true, true); $chest = new BuyingInventory($Level->getTile(new Vector3($X, 0, $Z)), $Player); $contents = []; switch ($Type) { case 0: foreach ($this->plugin->buys_Values as $Buy_Value) $contents [] = Item::get($Buy_Value[0], 0, 1); break; case 1: if ($this->plugin->status == 0) { foreach ($this->plugin->mapList as $Map) $contents [] = Item::get(35, $Map[0], ($Map[4] == 0) ? 99 : $Map[4]); } else { $contents [] = Item::get(345, 0, 1); foreach ($this->plugin->game->teams as $Name => $Team) $contents [] = Item::get(35, $this->plugin->getTeamDataByName($Name), (count($Team->players) == 0) ? 99 : count($Team->players)); } break; } $chest->setContents($contents); $this->plugin->setState("buying_chest", $Player, $chest); $this->plugin->setState("buying_type", $Player, $Type); $this->plugin->setState("buying_menu", $Player, -1); $Player->addWindow($chest); $event->setCancelled(true); } elseif ($Victim instanceof Human) { if ($Level->getFolderName() == $this->plugin->lobby_name) { $event->setCancelled(true); return; } if ((!$this->plugin->game) || ($this->plugin->game->level_name != $Level->getFolderName())) return; $event->setCancelled($this->plugin->game->getTeamByPlayer($Player) == $this->plugin->game->getTeamByPlayer($Victim)); $HandItem = $Player->getInventory()->getItemInHand(); switch ($HandItem->getId()) { case 259: $Victim->setOnFire(5); $event->setKnockBack(0); break; case 280: $event->setKnockBack(0.6); break; } if ($Victim->getHealth() - $event->getFinalDamage() <= 0) { $this->plugin->game->popupInfo2->playersData[strtolower($Player->getName())][1] += $this->plugin->game->popupInfo2->playersData[strtolower($Victim->getName())][1]; $this->plugin->game->popupInfo2->playersData[strtolower($Victim->getName())][1] = 0; } } elseif ($Victim instanceof Villager) { $Level = $Victim->getLevel(); if ($Level->getFolderName() == $this->plugin->lobby_name) { $event->setCancelled(true); return; } if ((!$this->plugin->game) || ($this->plugin->game->level_name != $Level->getFolderName())) return; $event->setCancelled(true); } } } } else if (($Player = $event->getEntity()) instanceof Entity) { $Level = $Player->getLevel(); if ((!$this->plugin->game) || ($this->plugin->game->level_name != $Level->getFolderName())) return; $X = $Player->getFloorX(); $Y = $Player->getFloorY() - 1; $Z = $Player->getFloorZ(); $Block = $Level->getBlock(new Vector3($X, $Y, $Z)); if ($Block->getId() == 133) { $event->setCancelled(true); } } }and public function onTransaction(InventoryTransactionEvent $event) { $Transaction = $event->getTransaction(); $Player = null; $BuyingTile = null; $BuyingInv = null; foreach ($Transaction->getInventories() as $inv) { if ($inv instanceof PlayerInventory) $Player = $inv->getHolder(); elseif (($inv instanceof BuyingInventory) || ($inv instanceof ChestInventory)) $BuyingInv = $inv; } if ((!$Player) || (!$BuyingInv)) return; if ($this->plugin->getState("buying_chest", $Player, null) == null) return; $Level = $Player->getLevel(); $BuyingTile = $BuyingInv->getHolder(); $added = []; foreach ($Transaction->getTransactions() as $t) { foreach ($this->traderInvTransaction($t) as $nt) $added [] = $nt; } $event->setCancelled(true); $X = $BuyingTile->getX(); $Y = $BuyingTile->getY(); $Z = $BuyingTile->getZ(); $Slot = $added[0]->getSlot(); $SourceItem = $added[0]->getSourceItem(); $TargetItem = $added[0]->getTargetItem(); switch ($this->plugin->getState("buying_type", $Player, null)) { case 0: if ($Y == 0) { if ($Level->getBlockIdAt($X, $Y + 1, $Z) != 54) { $Level->setBlock(new Vector3($X, $Y + 1, $Z), Block::get(54), true, true); $chest = new Chest($Level->getChunk($X >> 4, $Z >> 4, true), new Compound(false, array(new Int("x", $X), new Int("y", $Y + 1), new Int("z", $Z), new String("id", Tile::CHEST))), $this->plugin); $Level->addTile($chest); } else $chest = $Level->getTile(new Vector3($X, $Y + 1, $Z)); if ($Level->getBlockIdAt($X, $Y + 2, $Z) != 54) $chest = new BuyingInventory($chest, $Player); $contents = []; foreach ($this->plugin->buys_Values[$Slot][1] as $j => $buy) $contents [] = Item::get($buy[1], $buy[2], $buy[3]); $chest->setContents($contents); $this->plugin->setState("buying_chest", $Player, $chest); $this->plugin->setState("buying_menu", $Player, $Slot); $Player->addWindow($chest); } else { $this->plugin->game->Buy($Player, $this->plugin->getState("buying_menu", $Player, -1), $Slot); } break; case 1: $this->plugin->SelectTeam($Player, $Slot - 1, $TargetItem); break; case 2: $Item = $BuyingInv->getItem($Slot); if ((($i = array_search($Item->getId(), [336, 265, 266])) !== false) && ($t = $this->plugin->spawner_gives[["b", "i", "g"][$i]])) { if (!isset($this->plugin->game->popupInfo2->playersData[strtolower($Player->getName())][1])) { $this->plugin->game->popupInfo2->playersData[strtolower($Player->getName())][0] = TextFormat::GREEN; $this->plugin->game->popupInfo2->playersData[strtolower($Player->getName())][1] = 0; } $this->plugin->game->popupInfo2->playersData[strtolower($Player->getName())][1] += $Item->getCount() * $t; $BuyingInv->clear($Slot); } else $event->setCancelled(false); break; } }
Do you even english? Please use a Translator when not knowing english (well), so we can at least understand you a bit..
The Problem is, that MCPE 0.14.0 closes all chests that are more than around 30 blocks away! You have to make the tile near the player!
Now to a real answer -.-" in 0.14 it won't open because Compound has to be CompoundTag. And more. The plugin is made for 0.11 to 0.13. 0.13 Has the bug that the tile is ways too far away Like he said.
*modify Hello, I have bedwars plugin I've made sure that everything goes smoothly. But errors in the opening of the chest was found in minecraft v.0.13 is enough time to open the chest, but no problems have piled chest open and close minecraft game is stopped immediately and open the chest, not 0.14. at all The code below (php5) help me fix this problem thanks.
guys, if you still dont know.... ill translate. Upon chest open, the game crashes simples. i speak fluent "Broken English"