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

sumwon help me in this code

Comments in 'Plugin Development' started by XWITHERHEROX, Dec 16, 2015.

  1. XWITHERHEROX
    Offline

    XWITHERHEROX Active Member

    Joined:
    Jun 4, 2015
    Posts:
    57
    Minecraft User:
    ReDaRWiTheR
    PHP:
    <?php
    namespace dr;

    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\command\Command;
    use 
    pocketmine\math\Vector3;
    use 
    pocketmine\command\CommandSender;
    use 
    pocketmine\utils\TextFormat as Color;
    use 
    pocketmine\event\Listener;
    use 
    pocketmine\block\Air;
    use 
    pocketmine\block\Block;

    class 
    main extends PluginBase implements Listener {
        public function 
    onEnable() {
            
    $this->getLogger()->info(Color::BLUE."[DeathRunPlugin] on!");
        }
      
      
        public function 
    onDisable() {
            
    $this->getLogger()->info(Color::RED."[DeathRunPlugin] off!");
            }
           
           
            public function 
    onCommand(CommandSender $senderCommand $command$label, array $args) {
                if(
    $sender instanceof Player) {
                if((
    strtolower($command->getName()) == "drjoin1") && isset($args[0])) {
                
    $player $this->getServer()->getPlayer($args[0]);
                
    $player->sendMessage(Color::BLUE."[DeathRunPlugin] You Are Join Death Run Game");
                
    $player->teleport(new Vector3(1282584));
                
    $level $player->getLevel();
                
    $level->setBlock(new Vector3(129,20,77),Block::get(1));
                
    $level->setBlock(new Vector3(127,20,77),Block::get(Air));
                
    $level->setBlock(new Vector3(126,20,206),Block::get(Air));
                
    $level->setBlock(new Vector3(127,20,207),Block::get(Air));
                
    $level->setBlock(new Vector3(125,20,207),Block::get(Air));
                }
                elseif ((
    strtolower($command->getName()) == "drjoin2") && isset($args[0])) {   
                
    $player $this->getServer()->getPlayer($args[0]);
                
    $player->sendMessage(Color::BLUE."[DeathRunPlugin] You Are Join Death Run Game");
                
    $player->teleport(new Vector3(1252584));
                
    $level $player->getLevel();
                
    $level->setBlock(new Vector3(126,20,77),Block::get(1,0));
                
    $level->setBlock(new Vector3(125,20,77),Block::get(Air));
                }
                elseif ((
    strtolower($command->getName()) == "drjoin3") && isset($args[0])) {
                
    $player $this->getServer()->getPlayer($args[0]);
                
    $player->sendMessage(Color::BLUE."[DeathRunPlugin] You Are Join Death Run Game");
                
    $player->teleport(new Vector3(1342580));
                
    $level $player->getLevel();
                
    $level->setBlock(new Vector3(125,20,77),Block::get(1,0));
                
    $level->setBlock(new Vector3(123,20,77),Block::get(Air));
                }
                elseif((
    strtolower($command->getName()) == "drjoin4") && isset($args[0])) {
                
    $player $this->getServer()->getPlayer($args[0]);
                
    $player->sendMessage(Color::BLUE."[DeathRunPlugin] You Are Join Death Run Game");
                
    $player->teleport(new Vector3(1272582));
                
    $level $player->getLevel();
                
    $level->setBlock(new Vector3(123,25,82),Block::get(1,0));
                
    $level->setBlock(new Vector3(128,24,84),Block::get(Air));
                
    $level->setBlock(new Vector3(125,24,84),Block::get(Air));
                
    $level->setBlock(new Vector3(126,24,82),Block::get(Air));
                
    $level->setBlock(new Vector3(127,24,82),Block::get(Air));
                }
                elseif((
    strtolower($command->getName()) == "drEnd") && isset($args[0])) {
                
    $player $this->getServer()->getPlayer($args[0]);
                
    $player->sendMessage(Color::BLUE."[DeathRunPlugin] You Are Winer !");
                
    $player->teleport(new Vector3(1262582));
                
    $level $player->getLevel();
                
    $level->setBlock(new Vector3(126,20,206),Block::get(1));
                
    $level->setBlock(new Vector3(127,20,207),Block::get(1));
                
    $level->setBlock(new Vector3(125,20,207),Block::get(1));
                
    $level->setBlock(new Vector3(128,24,84),Block::get(1));
                
    $level->setBlock(new Vector3(125,24,84),Block::get(1));
                
    $level->setBlock(new Vector3(126,24,82),Block::get(1));
                
    $level->setBlock(new Vector3(127,24,82),Block::get(1));
                }

                
               


             
    /*
              * Death run for Player ^
              * Plugin By ReDaRWiTheR
              * Death run for Killer V
              */          
            
    }        
            }
    }
  2. applqpak
    Offline

    applqpak Active Member Plugin Developer

    Joined:
    Dec 16, 2015
    Posts:
    284
    Plugins:
    1
    Minecraft User:
    applqpak
    What are you wanting to do with it?

    Like, what's the problem?
  3. XWITHERHEROX
    Offline

    XWITHERHEROX Active Member

    Joined:
    Jun 4, 2015
    Posts:
    57
    Minecraft User:
    ReDaRWiTheR
    commands not work !
  4. applqpak
    Offline

    applqpak Active Member Plugin Developer

    Joined:
    Dec 16, 2015
    Posts:
    284
    Plugins:
    1
    Minecraft User:
    applqpak
    Try changing
    PHP:
    $command->getName()) == ""
    To:

    PHP:
    $command->getName()) === ""
  5. XWITHERHEROX
    Offline

    XWITHERHEROX Active Member

    Joined:
    Jun 4, 2015
    Posts:
    57
    Minecraft User:
    ReDaRWiTheR
    again is now working :(
  6. XWITHERHEROX
    Offline

    XWITHERHEROX Active Member

    Joined:
    Jun 4, 2015
    Posts:
    57
    Minecraft User:
    ReDaRWiTheR
    i mean not working **** my key bord
  7. applqpak
    Offline

    applqpak Active Member Plugin Developer

    Joined:
    Dec 16, 2015
    Posts:
    284
    Plugins:
    1
    Minecraft User:
    applqpak
    Sorry, it's late, and I can't think too well. :/
  8. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    Make sure you have given atleast 1 argument else it wont work as its said in your code.
  9. applqpak
    Offline

    applqpak Active Member Plugin Developer

    Joined:
    Dec 16, 2015
    Posts:
    284
    Plugins:
    1
    Minecraft User:
    applqpak
    Yeah, sorry, thanks for helping out lol :p too late xD
  10. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    How often are you creating a thread for this..? Which commands don't work? Did you register them in the plugin.yml?
  11. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    Hopeless
    PHP:
    elseif((strtolower($command->getName()) == "drEnd") && isset($args[0])) {
  12. Nawaf_Craft1b
    Offline

    Nawaf_Craft1b Active Member Plugin Developer

    Joined:
    May 8, 2015
    Posts:
    232
    Plugins:
    1
    Minecraft User:
    Nawaf_Craft1b
    okey check in plugin.yml
  13. XWITHERHEROX
    Offline

    XWITHERHEROX Active Member

    Joined:
    Jun 4, 2015
    Posts:
    57
    Minecraft User:
    ReDaRWiTheR
    guys the command not give me erorr is give me nothing
    i do /drjoin1 and nothing happen
  14. XWITHERHEROX
    Offline

    XWITHERHEROX Active Member

    Joined:
    Jun 4, 2015
    Posts:
    57
    Minecraft User:
    ReDaRWiTheR
    this is my plugin.yml

    ------------------------------------------------------
    PHP:
    namedr
    aurthor
    ReDaRWiTheR/m7md
    version
    1.0.0
    api
    : [1.13.0]
    maindr\main

    commands
    :
        
    drjoin1:
            
    descriptiondr 1
            permission
    dr1.cmd
        drjoin2
    :
            
    descriptiondr 2
            permission
    dr2.cmd
        drjoin3
    :
            
    descriptiondr 3
            permission
    dr3.cmd
        drjoin4
    :
            
    descriptiondr 4
            permission
    dr4.cmd
        drEnd
    :
            
    descriptiondr 5
            permission
    dr5.cmd
    permissions
    :
        
    dr1.cmd:
            default: 
    true
        dr2
    .cmd:
            default: 
    true
        dr3
    .cmd:
            default: 
    true
        dr4
    .cmd:
            default: 
    true
        dr5
    .cmd:
            default: 
    true
                
  15. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    Add "usage" to every command. Also, it's author, not aurthor.
  16. XWITHERHEROX
    Offline

    XWITHERHEROX Active Member

    Joined:
    Jun 4, 2015
    Posts:
    57
    Minecraft User:
    ReDaRWiTheR
    his steel not work !!
  17. XWITHERHEROX
    Offline

    XWITHERHEROX Active Member

    Joined:
    Jun 4, 2015
    Posts:
    57
    Minecraft User:
    ReDaRWiTheR
    the problim in this code
    PHP:
    <?php
    namespace dr;

    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\command\Command;
    use 
    pocketmine\math\Vector3;
    use 
    pocketmine\command\CommandSender;
    use 
    pocketmine\utils\TextFormat as Color;
    use 
    pocketmine\event\Listener;
    use 
    pocketmine\block\Air;
    use 
    pocketmine\block\Block;

    class 
    main extends PluginBase implements Listener {
        public function 
    onEnable() {
            
    $this->getLogger()->info(Color::BLUE."[DeathRunPlugin] on!");
        }
      
      
        public function 
    onDisable() {
            
    $this->getLogger()->info(Color::RED."[DeathRunPlugin] off!");
            }
           
           
            public function 
    onCommand(CommandSender $senderCommand $command$label, array $args) {
                if(
    $sender instanceof Player) {
                if((
    strtolower($command->getName()) === "drjoin1") && isset($args[0])) {
                
    $player $this->getServer()->getPlayer($args[0]);
                
    $player->sendMessage(Color::BLUE."[DeathRunPlugin] You Are Join Death Run Game");
                
    $player->teleport(new Vector3(1282584));
                
    $level $player->getLevel();
                
    $level->setBlock(new Vector3(129,20,77),Block::get(1));
                
    $level->setBlock(new Vector3(127,20,77),Block::get(Air));
                
    $level->setBlock(new Vector3(126,20,206),Block::get(Air));
                
    $level->setBlock(new Vector3(127,20,207),Block::get(Air));
                
    $level->setBlock(new Vector3(125,20,207),Block::get(Air));
                }
                elseif ((
    strtolower($command->getName()) === "drjoin2") && isset($args[0])) {   
                
    $player $this->getServer()->getPlayer($args[0]);
                
    $player->sendMessage(Color::BLUE."[DeathRunPlugin] You Are Join Death Run Game");
                
    $player->teleport(new Vector3(1252584));
                
    $level $player->getLevel();
                
    $level->setBlock(new Vector3(126,20,77),Block::get(1,0));
                
    $level->setBlock(new Vector3(125,20,77),Block::get(Air));
                }
                elseif ((
    strtolower($command->getName()) === "drjoin3") && isset($args[0])) {
                
    $player $this->getServer()->getPlayer($args[0]);
                
    $player->sendMessage(Color::BLUE."[DeathRunPlugin] You Are Join Death Run Game");
                
    $player->teleport(new Vector3(1342580));
                
    $level $player->getLevel();
                
    $level->setBlock(new Vector3(125,20,77),Block::get(1,0));
                
    $level->setBlock(new Vector3(123,20,77),Block::get(Air));
                }
                elseif((
    strtolower($command->getName()) === "drjoin4") && isset($args[0])) {
                
    $player $this->getServer()->getPlayer($args[0]);
                
    $player->sendMessage(Color::BLUE."[DeathRunPlugin] You Are Join Death Run Game");
                
    $player->teleport(new Vector3(1272582));
                
    $level $player->getLevel();
                
    $level->setBlock(new Vector3(123,25,82),Block::get(1,0));
                
    $level->setBlock(new Vector3(128,24,84),Block::get(Air));
                
    $level->setBlock(new Vector3(125,24,84),Block::get(Air));
                
    $level->setBlock(new Vector3(126,24,82),Block::get(Air));
                
    $level->setBlock(new Vector3(127,24,82),Block::get(Air));
                }
                elseif((
    strtolower($command->getName()) === "drEnd") && isset($args[0])) {
                
    $player $this->getServer()->getPlayer($args[0]);
                
    $player->sendMessage(Color::BLUE."[DeathRunPlugin] You Are Winer !");
                
    $player->teleport(new Vector3(1262582));
                
    $level $player->getLevel();
                
    $level->setBlock(new Vector3(126,20,206),Block::get(1));
                
    $level->setBlock(new Vector3(127,20,207),Block::get(1));
                
    $level->setBlock(new Vector3(125,20,207),Block::get(1));
                
    $level->setBlock(new Vector3(128,24,84),Block::get(1));
                
    $level->setBlock(new Vector3(125,24,84),Block::get(1));
                
    $level->setBlock(new Vector3(126,24,82),Block::get(1));
                
    $level->setBlock(new Vector3(127,24,82),Block::get(1));
                }

                
               


             
    /*
              * Death run for Player ^
              * Plugin By ReDaRWiTheR
              * Death run for Killer V
              */          
            
    }        
            }
    }
  18. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    Is the plugin even loaded? Check it with doing /pl, if it's red, it's not loaded.
  19. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    I'm sorry to say but he is an idiot.
    iDirtPlayzMC and applqpak like this.
  20. applqpak
    Offline

    applqpak Active Member Plugin Developer

    Joined:
    Dec 16, 2015
    Posts:
    284
    Plugins:
    1
    Minecraft User:
    applqpak
    At least learn everything there is to make a plugin.

Share This Page

Advertisement