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

infinite time sendtip

Comments in 'Plugin Development' started by tigerza118, May 23, 2015.

  1. tigerza118
    Offline

    tigerza118 Active Member

    Joined:
    Jan 31, 2015
    Posts:
    100
    Minecraft User:
    tigerza117
    infinite time sendtip ?
  2. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    Use a scheduleRepeatingTask.
  3. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
  4. tigerza118
    Offline

    tigerza118 Active Member

    Joined:
    Jan 31, 2015
    Posts:
    100
    Minecraft User:
    tigerza117
    PHP:
    <?php
    namespace PopupDisplayer;

    use 
    pocketmine\Player;
    use 
    pocketmine\event\Listener;
    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\utils\TextFormat;
    use 
    pocketmine\Server;
    use 
    pocketmine\plugin\PluginManager;
    use 
    pocketmine\plugin\Plugin;
    use 
    pocketmine\event\player\PlayerJoinEvent;
    use 
    pocketmine\utils\Config;

    class 
    Main extends PluginBase implements Listener{

    public 
    $cfg;
       
        public function 
    onLoad(){
            
    $this->getLogger()->info("Plugin Attivato");  //getLogger() mostra il messaggio dopo info nella console di PM
            
    }
       
        public function 
    onEnable(){
            
    $this->getServer()->getPluginManager()->registerEvents($this$this);
                @
    mkdir($this->getDataFolder()); //crea la cartella dove sara il config.yml
                    
    $this->saveDefaultConfig(); //salva la configurazione di default del config.yml
                        
    $this->cfg $this->getConfig(); //prende le informazioni dal config.yml
                       
        
    }   
       
        public function 
    onPlayerJoin(PlayerJoinEvent  $event){
                
    $type $this->cfg->get("type");
                    if(
    $type === "tip"){
                        
    $message $this->cfg->get("message");
                            
    $this->cfg->set("message",$message);
                                
    $this->cfg->save();
                                    
    $event->getPlayer()->sendTip($message);
                               
            }elseif(
    $type === "popup"){
                    
    $message $this->cfg->get("message");
                        
    $this->cfg->set("message",$message);
                            
    $this->cfg->save();
                                
    $event->getPlayer()->sendPopup($message);
                                    }
                                }

    public function 
    onDisable(){
            unset(
    $this->players);
                
    $this->saveDefaultConfig();
                    
    $this->getLogger()->info("Plugin Disattivato");
            }
    }

    ?>
  5. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Why did you post this code?
  6. tigerza118
    Offline

    tigerza118 Active Member

    Joined:
    Jan 31, 2015
    Posts:
    100
    Minecraft User:
    tigerza117
    I know where I need to put code in Sop's all you comments in the first round.
  7. CrazedMiner
    Offline

    CrazedMiner Notable Member Plugin Developer

    Joined:
    Jan 31, 2015
    Posts:
    348
    Plugins:
    2
    Minecraft User:
    CrazedMinerYT
    Use scheduleRepeatingTask and repeat it every 7 seconds (I think this is the right amount of time to replace the PopUp before it disapears)

    **EDIT**
    Use scheduleRepeatingTask and repeat it every 7 ticks (I think this is the right amount of time to replace the PopUp before it disapears)
    Last edited: May 24, 2015
  8. PixelGuy75
    Offline

    PixelGuy75 Notable Member Plugin Developer

    Joined:
    Feb 9, 2014
    Posts:
    316
    Plugins:
    2
    Minecraft User:
    PixelGuy75
    Every 7 ticks not seconds to set it to.
    CrazedMiner likes this.
  9. CrazedMiner
    Offline

    CrazedMiner Notable Member Plugin Developer

    Joined:
    Jan 31, 2015
    Posts:
    348
    Plugins:
    2
    Minecraft User:
    CrazedMinerYT
    yah I thought it was that but it just seemed too short :p
  10. Jon
    Offline

    Jon Active Member Plugin Developer

    Joined:
    Sep 1, 2013
    Posts:
    203
    Plugins:
    3
    Minecraft User:
    Heromine14
    Lol
    It is my code.
    If you can wait i am going to update it with other features...
    Last edited: May 24, 2015
  11. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Please, we aren't here to make plugins for you. We are here to teach you.
    Jon likes this.

Share This Page

Advertisement