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

Time set

Comments in 'Plugin Development' started by GoldenSteveyt, Aug 12, 2015.

  1. GoldenSteveyt
    Offline

    GoldenSteveyt New Member

    Joined:
    Aug 5, 2015
    Posts:
    12
    Minecraft User:
    D4nl0g
    Hello Guys, im trying to play with setting the time in a plugin, but when i got here, i don't know how to establish the time into night (the action to get executed), please respond, thanks :D

    this is my code so far, thanks.

    PHP:
    public function onCommand(\pocketmine\command\CommandSender $sender, \pocketmine\command\Command $command$label, array $args) {
            if(
    $sender instanceof Player){
                
    $time $sender->getServer()->getLevel("world")->getTime();
                switch(
    strtolower($command ->getName())){
                    case 
    'time':
                        if(
    $args == "night"){
                           
                        }
                        break;
  2. EvolSoft
    Offline

    EvolSoft Notable Member Plugin Developer

    Joined:
    Sep 10, 2014
    Posts:
    821
    Plugins:
    15
    Minecraft User:
    Flavius12
    Assuming you want to change the time on the world where there is the command sender:
    PHP:
    $sender->getLevel()->setTime(15000); //I don't remember if 15000 is the night on MCPE. Just change that parameter with any other
    hoyinm14mc, iksaku and thebigsmileXD like this.
  3. GoldenSteveyt
    Offline

    GoldenSteveyt New Member

    Joined:
    Aug 5, 2015
    Posts:
    12
    Minecraft User:
    D4nl0g
  4. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    I think that command already exists.
  5. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,747
    Minecraft User:
    Legoboy0215
    He wants like /time set night, /time set day???
  6. GoldenSteveyt
    Offline

    GoldenSteveyt New Member

    Joined:
    Aug 5, 2015
    Posts:
    12
    Minecraft User:
    D4nl0g
    i just wanted to practice that bro, sorry if i bothered you
  7. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    No, I was just trying to point it that the command already exists and you'll have trouble to unregister the original one.
    hoyinm14mc and iksaku like this.
  8. iksaku
    Offline

    iksaku Notable Member Plugin Developer

    Joined:
    Sep 2, 2013
    Posts:
    1,132
    Plugins:
    4
    Minecraft User:
    iksaku
    #SoSarcastic xD

Share This Page

Advertisement