1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Solved Teleport plugin

Discussion in 'Development' started by IchHackeNet, May 6, 2020.

  1. IchHackeNet

    IchHackeNet Creeper

    Messages:
    5
    GitHub:
    IchHackeNetDEV
    The plugin loads but if I type /hub nothing happens, why?

    PHP:
    <?php

    namespace IchHackeNet;

    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\command\CommandSender;
    use 
    pocketmine\command\Command;

    class 
    Main extends PluginBase{

        public function 
    onEnable(){
            
    $this->getLogger()->info("Hub geladen");
            
    $this->getServer()->loadLevel("Lobby");   
        }

        public function 
    onCommand(CommandSender $senderCommand $commandstring $label, array $args) : bool{
            switch(
    $command->getName()){
                case 
    "hub":
                    
    $sender->sendMessage("§eEresia§6MC§7 > §b §7Du wurdest zum §bHub §7teleportiert!");
                    
    $sender->teleport($this->getServer()->getLevelByName("Lobby")->getSafeSpawn());
                    return 
    true;
                    default:
                    return 
    false;
            }
          
            }
        }
    Code:
    name: Hub-
    main: IchHackeNet\Main
    version: 0.0.1
    api: 3.12.0
    load: POSTWORLD
    author: IchHackeNet
    description: Hub
    commands:
    hub:
    description: "§eEresia§6MC§7 > §Hub"
    aliases: ["lobby", "spawn"]
    
     
  2. Emirhan Akpınar

    Emirhan Akpınar Slime

    Messages:
    90
    PHP:
    $this->getServer()->loadLevel("Lobby");
    $lobby $this->getServer()->getLevelByName("Lobby");
    if (
    $lobby instanceof Level) {
      
    $sender->teleport($lobby->getSafeSpawn());
    }
     
    IchHackeNet likes this.
  3. IchHackeNet

    IchHackeNet Creeper

    Messages:
    5
    GitHub:
    IchHackeNetDEV

    PHP:
    <?php

    namespace IchHackeNet;

    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\command\CommandSender;
    use 
    pocketmine\command\Command;

    class 
    Main extends PluginBase{

        public function 
    onEnable(){
            
    $this->getLogger()->info("Hub geladen");   
        }

        public function 
    onCommand(CommandSender $senderCommand $commandstring $label, array $args) : bool{
            switch(
    $command->getName()){
                case 
    "hub":
                    
    $this->getServer()->loadLevel("Lobby");

    $lobby $this->getServer()->getLevelByName("Lobby");

    if (
    $lobby instanceof Level) {
      
    $sender->teleport($lobby->getSafeSpawn());
    }
            }
            }
            }
    This don't work
     
  4. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    You forgot
    PHP:
    use pocketmine\level\Level;
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.