Advertisement
Guest User

Untitled

a guest
May 27th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.43 KB | None | 0 0
  1. namespace muqsit\skywars\utils;
  2.  
  3. use pocketmine\block\BlockIds;
  4. use pocketmine\Player;
  5.  
  6. class BlockUtils {
  7.  
  8.     public static function trapPlayerInBox(Player $player, int $blockId = BlockIds::AIR, int $blockMeta = 0, bool $overrideBlocks = false) : void
  9.     {
  10.         $level = $player->getLevel();
  11.         $pos = $player->floor();
  12.         $player->teleport($pos);
  13.  
  14.         $x = $pos->x;
  15.         $y = $pos->y;
  16.         $z = $pos->z;
  17.  
  18.         for ($i = -1; $i <= 1; ++$i) {
  19.             for ($k = -1; $k <= 1; ++$k) {
  20.                 if ($i === 1 && $k === 1) {
  21.                     continue;
  22.                 }
  23.  
  24.                 for ($j = -1; $j <= 1; ++$j) {
  25.                     if (!$overrideBlocks && $level->getBlockIdAt($x + $i, $y + $j, $z + $k) !== BlockIds::AIR) {
  26.                         continue;
  27.                     }
  28.  
  29.                     $level->setBlockIdAt($x + $i, $y + $j, $z + $k, $blockId);
  30.                     $level->setBlockDataAt($x + $i, $y + $j, $z + $k, $blockMeta);
  31.                 }
  32.             }
  33.         }
  34.     }
  35. }[23:12:37] [Server thread/CRITICAL]: Could not pass event 'pocketmine\event\player\PlayerInteractEvent' to 'SkyWars v1.0.0': Class 'muqsit\skywars\utils\BlockUtils' not found on muqsit\skywars\game\SkyWarsListener
  36. [23:12:37] [Server thread/CRITICAL]: Error: "Class 'muqsit\skywars\utils\BlockUtils' not found" (EXCEPTION) in "plugins/SkyWars-master/src/muqsit/skywars/game/SkyWars" at line 403
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement