Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

hum... my code dont work

Comments in 'Plugin Development' started by XWITHERHEROX, Feb 28, 2016.

  1. XWITHERHEROX
    Offline

    XWITHERHEROX Active Member

    Joined:
    Jun 4, 2015
    Posts:
    57
    Minecraft User:
    ReDaRWiTheR
    this is my code ::
    PHP:
    <?php

    namespace oi;

    use 
    pocketmine\Player;
    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\entity\Effect;
    use 
    pocketmine\level\particle\PortalParticle;
    use 
    pocketmine\command\CommandSender;
    use 
    pocketmine\event\Listener;
    use 
    pocketmine\utils\TextFormat as Color;
    use 
    pocketmine\command\Command;
    use 
    pocketmine\math\Vector3;
    use 
    pocketmine\item\Item;

    class 
    main extends PluginBase implements Listener {
       
        public function 
    onEnable() {
            
    $this->getLogger()->info(Color::GREEN."on!");
        }
       
        public function 
    onCommand(CommandSender $sender,Command $cmd,$label,array $args) {
                if(
    $sender instanceof Player) {
                if((
    strtolower($cmd->getName()) == "oi") && isset($args[0])) {
                
    $player $this->getServer()->getPlayer($args[0]);
                if(
    $player instanceof Player){
                
    $level $player->getLevel();
                
    $level->setBlock(new Vector3($player->x$player->y$player->z),Block::get(42,0));
                
    $level->setBlock(new Vector3($player->x$player->1$player->z),Block::get(42,0));
                
    $player->addEffect(Effect::getEffect(9)->setDuration(100)->setAmplifier(9));
                
    $level->addParticle(new PortalParticle(new Vector3($player->x$player->y$player->z)));
                } else { 
    $sender->sendMessage("Player not found"); }
                }
            }
        }
    }


    the error ::
    "An unknown error occurred while attempting to perform this command"
    and thankis
  2. Hotshot_9930
    Offline

    Hotshot_9930 Notable Member Plugin Developer

    Joined:
    May 26, 2014
    Posts:
    665
    Plugins:
    2
    Minecraft User:
    HotshotHD
    Well... what does the error say in the console
  3. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    extra (

Share This Page

Advertisement