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

SkyBlock | Teleportations

Comments in 'Plugin Development' started by iDirtPlayzMC, Dec 4, 2015.

  1. iDirtPlayzMC
    Offline

    iDirtPlayzMC Active Member

    Joined:
    Apr 10, 2015
    Posts:
    264
    Minecraft User:
    iZenith_xPr
    How do I use Teleport ? How do I teleport player in the middle of the island.

    Here's code

    PHP:
    public function execute(CommandSender $sender, array $args){
            if(empty(
    $args)){
                
    $plotNumber 1;
            }
            elseif(
    count($args) === and is_numeric($args[0])){
                
    $plotNumber = (int) $args[0];
            }
            else{
                return 
    false;
            }
            
    $plots $this->getPlugin()->getProvider()->getPlotsByOwner($sender->getName());
            if(empty(
    $plots)){
                
    $sender->sendMessage(TextFormat::RED "You don't have any islands");
                return 
    true;
            }
            if(!isset(
    $plots[$plotNumber 1])){
                
    $sender->sendMessage(TextFormat::RED "You don't have an island with home number $plotNumber");
                return 
    true;
            }
            
    $player $this->getPlugin()->getServer()->getPlayer($sender->getName());
            
    $plot $plots[$plotNumber 1];
            if(
    $this->getPlugin()->teleportPlayerToPlot($player$plot)){
                
    $sender->sendMessage(TextFormat::GREEN "Teleported to " TextFormat::WHITE $plot);
            }
            else{
                
    $sender->sendMessage(TextFormat::GREEN "Could not teleport because island world " $plot->levelName " is not loaded");
            }
            return 
    true;
        }
    }
    I have no ideas how to figure this out.
    Please leave a comment if you think you can help, if you don't mind xP
  2. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    all islands are in the same level?
  3. iDirtPlayzMC
    Offline

    iDirtPlayzMC Active Member

    Joined:
    Apr 10, 2015
    Posts:
    264
    Minecraft User:
    iZenith_xPr
    yeah
  4. iDirtPlayzMC
    Offline

    iDirtPlayzMC Active Member

    Joined:
    Apr 10, 2015
    Posts:
    264
    Minecraft User:
    iZenith_xPr
    Its same as pmyPlot but differnet generator
  5. iDirtPlayzMC
    Offline

    iDirtPlayzMC Active Member

    Joined:
    Apr 10, 2015
    Posts:
    264
    Minecraft User:
    iZenith_xPr
    Heres the source

    Attached Files:

Share This Page

Advertisement