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

FIRST PLUGIN YEY

Discussion in 'Development' started by QuiverlyRivalry, Sep 28, 2017.

  1. QuiverlyRivalry

    QuiverlyRivalry Zombie Pigman

    Messages:
    491
    GitHub:
    quiverlyrivalry
    Hi, this is my first plugin. I just wanna post the code here, can someone tell me if there is any errors before I release it?
    PHP:
    <?php

    namespace AlwaysSpawn;
    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\event\Listener;
    use 
    pocketmine\event\player\PlayerRespawnEvent;

    class 
    Loader extends Plugin implements Listener{
     
     
              public function 
    onLoad(){
                        
    $this->getLogger()->info("Plugin Loading");
              }
              public function 
    onEnable(){
                        
    $this->getLogger()->info("Enabled Plugin");
              }
              public function 
    onDisable(){
                        
    $this->getLogger()->info("Plugin Disabled");
              }
     
      public function 
    onPlayerRespawn(PlayerRespawnEvent $event){
        
    $player $event->getPlayer();
        
    $x $this->getServer()->getDefaultLevel()->getSafeSpawn()->getX();
        
    $y $this->getServer()->getDefaultLevel()->getSafeSpawn()->getY();
        
    $z $this->getServer()->getDefaultLevel()->getSafeSpawn()->getZ();
        
    $player->setLevel($level);
        }
      }
     
    Last edited: Sep 29, 2017
  2. Kyd

    Kyd Zombie Pigman

    Messages:
    678
    GitHub:
    boi1216
    You don't registred events and you don't want to check safespawn x,y,z getSafeSpawn() already return position
     
  3. Awzaw

    Awzaw Zombie Pigman Poggit Admin

    Messages:
    726
    GitHub:
    awzaw
    The code looks familiar; are you absolutely 100% certain sure this is your plugin?
     
    Levi, EdwardHamHam and iiFlamiinBlaze like this.
  4. TheShinPin

    TheShinPin Baby Zombie

    Messages:
    121
    I like how he didnt even bother to change the name.
     
  5. QuiverlyRivalry

    QuiverlyRivalry Zombie Pigman

    Messages:
    491
    GitHub:
    quiverlyrivalry
    Yes nickethunicorn helped me make it
     
  6. QuiverlyRivalry

    QuiverlyRivalry Zombie Pigman

    Messages:
    491
    GitHub:
    quiverlyrivalry
    It’s based of awzaws awzaws doesn’t work when player respawns so I just branched it off
     
  7. Awzaw

    Awzaw Zombie Pigman Poggit Admin

    Messages:
    726
    GitHub:
    awzaw
    AlwaysSpawn isn't mine (or yours), I just help maintain it for Poggit because the author is inactive, and dktapps already updated it recently to fix problems some people were having:
    https://poggit.pmmp.io/p/AlwaysSpawn
     
    Last edited: Sep 29, 2017
    iiFlamiinBlaze likes this.
  8. QuiverlyRivalry

    QuiverlyRivalry Zombie Pigman

    Messages:
    491
    GitHub:
    quiverlyrivalry
    I’ll change it too DefaultWorldSpawn
     
  9. Awzaw

    Awzaw Zombie Pigman Poggit Admin

    Messages:
    726
    GitHub:
    awzaw
    You can fork and edit anyone's repo as much as you like, that's one of the great things about git and github... but please don't start claiming plugins are yours because you changed a few lines; it doesn't work like that and you'll make enemies fast. Much better is to make useful changes (for example, add an option to AlwaysSpawn to teleport players somewhere in PlayerRespawnEvent, in addition to the current PlayerLoginEvent) and submit a pull request if you think it adds or fixes something in the original. Even better, start writing a plugin of your own with your very own plugin name, and get other people to contribute to yours in the same way.
     
    Last edited: Sep 29, 2017
  10. Karanpatel567

    Karanpatel567 Baby Zombie

    Messages:
    115
    GitHub:
    Karanpatel567
    Where is the
    Code:
    $this->getServer()->getPluginManager()->registerEvents($this, $this);
    under the function onEnable seen as you have used the class listener.
     
  11. QuiverlyRivalry

    QuiverlyRivalry Zombie Pigman

    Messages:
    491
    GitHub:
    quiverlyrivalry
    No no I think u got me wrong.. I am learning to make a plug8n I need for my server because when player die they don’t respawn properly nick helped me make it, ask him it’s authentic except they idea was from awzaws remake of a dead plugin
     
  12. Teamblocket

    Teamblocket Zombie

    Messages:
    301
    GitHub:
    teamblocket
    stop plagiarizing is what @Awzaw is trying to tell you.
     
    iiFlamiinBlaze likes this.
  13. QuiverlyRivalry

    QuiverlyRivalry Zombie Pigman

    Messages:
    491
    GitHub:
    quiverlyrivalry
    I'm sorry if I confused you but awzaws plugin teleports player to spawn in world. I am making one which tpass played to default world. And I am sorry for naming plugin alwaysspawn I just didn't have any better names.
     
  14. iiFlamiinBlaze

    iiFlamiinBlaze Witch

    Messages:
    59
    GitHub:
    iiflamiinblaze
    Awzaw’s does teleport to the default world spawn... it’s just broken so technically you are plagiarizing.
     
  15. Awzaw

    Awzaw Zombie Pigman Poggit Admin

    Messages:
    726
    GitHub:
    awzaw
    Again, not mine! The version I've been maintaining for poggit has always worked perfectly for me as regards teleporting players to the default spawn when they join on my production servers and locally, although I did notice some issues recently on my local dev server, so I suspect there was a conflict with another plugin. This should all have been fixed in the latest poggit release which dktapps streamlined. As for where you spawn when you die, that is normally the default spawn of the world where you die, so this could be a useful PR if you work from the current master branch of the poggit - orphanage repo and add a config, listeners etc.
     
    jasonwynn10 likes this.
  16. iiFlamiinBlaze

    iiFlamiinBlaze Witch

    Messages:
    59
    GitHub:
    iiflamiinblaze
    Sorry, I said yours bc you maintain it, my mistake.
     
  17. QuiverlyRivalry

    QuiverlyRivalry Zombie Pigman

    Messages:
    491
    GitHub:
    quiverlyrivalry
    Okay thanks. I didnt relise it was fixed well no point making the plugin then
     
  18. DylanDao

    DylanDao Witch

    Messages:
    50
    GitHub:
    dylandao
    Lol
     
  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.