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

Create Popup and repeated Help pls!

Comments in 'Plugin Development' started by Nifo2000, Apr 24, 2015.

  1. Nifo2000
    Offline

    Nifo2000 New Member

    Joined:
    Apr 24, 2015
    Posts:
    31
    Minecraft User:
    Nifo2000
    Hello ! I am french and i little speak english, i would like to create a Popup repeated and the color change. I don't know how to create a plugin for that. Please help me. Thank you for an answer !
    DunxandMinecraft likes this.
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Use the search button.
    DunxandMinecraft likes this.
  3. Lambo
    Offline

    Lambo Notable Member Plugin Developer

    Joined:
    Sep 14, 2013
    Posts:
    431
    Plugins:
    4
    Minecraft User:
    Lambo
    This might be helpful, and also I believe there have already been threads about this. Schedule this task every 10 seconds.
    PHP:
    class sendPopupExtended extends PluginTask{

        private static 
    $players=array();

        public function 
    __construct($plugin){
            
    parent::__construct($plugin);
        }

        public static function 
    queuePopup(Player $player$popup$time){
            
    $c count(self::$players);
            
    array_push(self::$players, array($player$popup, ($time 20), $c));
        }

        public function 
    onRun($tick){
            foreach(
    self::$players as $player){
                if((
    $player[2] - 10) >= and $player[0]->isOnline()){
                    
    $player[0]->sendPopup($player[1]);
                    
    self::$players[$player[3]][2] -= 10;
                }else{
                    unset(
    self::$players[$player[3]]);
                }
            }
        }
    }
  4. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    1Don't use static properties of type array.
  5. Lambo
    Offline

    Lambo Notable Member Plugin Developer

    Joined:
    Sep 14, 2013
    Posts:
    431
    Plugins:
    4
    Minecraft User:
    Lambo
    Why?
  6. Nifo2000
    Offline

    Nifo2000 New Member

    Joined:
    Apr 24, 2015
    Posts:
    31
    Minecraft User:
    Nifo2000
  7. Nifo2000
    Offline

    Nifo2000 New Member

    Joined:
    Apr 24, 2015
    Posts:
    31
    Minecraft User:
    Nifo2000
    Yeah i think it's work but i don't know to create plugin. Please give me more informations i am a noob in that!
    sorry for bad english.
  8. Nifo2000
    Offline

    Nifo2000 New Member

    Joined:
    Apr 24, 2015
    Posts:
    31
    Minecraft User:
    Nifo2000
    Or can you create the plugin and give the download ? I am new.
  9. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Because of pthreads bugs.

    Just avoid using static properties. Why don't you just save the array in your main class's instance?
  10. Lambo
    Offline

    Lambo Notable Member Plugin Developer

    Joined:
    Sep 14, 2013
    Posts:
    431
    Plugins:
    4
    Minecraft User:
    Lambo
    I did last time, but it seemed like bad practice.
  11. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Yep, we call them bad practice for a reason.
    Also it mightn't support /reload.
  12. Nifo2000
    Offline

    Nifo2000 New Member

    Joined:
    Apr 24, 2015
    Posts:
    31
    Minecraft User:
    Nifo2000
    Can you create the plugin and give me a download ? Please i need it !
  13. Nifo2000
    Offline

    Nifo2000 New Member

    Joined:
    Apr 24, 2015
    Posts:
    31
    Minecraft User:
    Nifo2000
    I tryed to create a plugin with your code Lambo but the plugin has not loaded.
  14. Praxthisnovcht
    Offline

    Praxthisnovcht Notable Member Plugin Developer

    Joined:
    Mar 10, 2014
    Posts:
    699
    Plugins:
    4
    Minecraft User:
    PraxHellTag
    wrong section......
  15. Pman1220
    Offline

    Pman1220 Active Member Plugin Developer

    Joined:
    Nov 21, 2013
    Posts:
    123
    Plugins:
    1
    Minecraft User:
    Pman1220
    Im working on a plugin called Popper. It will allow you to send popups like broadcaster.
  16. Praxthisnovcht
    Offline

    Praxthisnovcht Notable Member Plugin Developer

    Joined:
    Mar 10, 2014
    Posts:
    699
    Plugins:
    4
    Minecraft User:
    PraxHellTag
  17. Lambo
    Offline

    Lambo Notable Member Plugin Developer

    Joined:
    Sep 14, 2013
    Posts:
    431
    Plugins:
    4
    Minecraft User:
    Lambo
    Wait, I meant that I thought putting the array in the main class is bad practice.
  18. Nifo2000
    Offline

    Nifo2000 New Member

    Joined:
    Apr 24, 2015
    Posts:
    31
    Minecraft User:
    Nifo2000
  19. Nifo2000
    Offline

    Nifo2000 New Member

    Joined:
    Apr 24, 2015
    Posts:
    31
    Minecraft User:
    Nifo2000
    Cool !
  20. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    No. Saving data in a non-static context in the main class is perfect.

Share This Page

Advertisement