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

when I log out, I want all effects to be removed

Discussion in 'Plugin Help' started by EnderXPs, Apr 28, 2021.

  1. EnderXPs

    EnderXPs Spider Jockey

    Messages:
    27
    GitHub:
    EnderPMMPyea
    Hello, I need something if I go out and rejoine again it will erase all of my effects. thanks
     
  2. Mcbeany

    Mcbeany Spider Jockey

    Messages:
    33
    GitHub:
    mcbeany
    PHP:
    public function onQuit(PlayerQuitEvent $event) {
        
    $event->getPlayer->removeAllEffects();
    }
     
    minijaham likes this.
  3. EnderXPs

    EnderXPs Spider Jockey

    Messages:
    27
    GitHub:
    EnderPMMPyea
    where should I enter it?
     
  4. Mcbeany

    Mcbeany Spider Jockey

    Messages:
    33
    GitHub:
    mcbeany
    the class that implements with Listener
    and make sure you already register event with that class
     
  5. EnderXPs

    EnderXPs Spider Jockey

    Messages:
    27
    GitHub:
    EnderPMMPyea
    do not understand where to write it
     
  6. DavyCraft648

    DavyCraft648 Spider Jockey

    Messages:
    40
    GitHub:
    DavyCraft648
  7. minijaham

    minijaham Skeleton

    Messages:
    801
    GitHub:
    minijaham
    A little typo. getPlayer to getPlayer()
     
    Mcbeany likes this.
  8. Mcbeany

    Mcbeany Spider Jockey

    Messages:
    33
    GitHub:
    mcbeany
    agh i forgot
     
  9. Axon

    Axon Zombie

    Messages:
    276
    Here is a little plugin I wrote[lol].
    PHP:
    <?php

    namespace Spoon\Feeding=D;

    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\event\Listener;



    class 
    Main extends PluginBase implements Listener {
        public function 
    onEnable() {
          
    $this->getServer()->getPluginManager()->registerEvents($this,$this);
        }
       

        public function 
    onQuit(PlayerQuitEvent $event) {
            
    $event->getPlayer()->removeAllEffects();
        }

    }
     
    Last edited: May 5, 2021
    Agent likes this.
  10. EnderXPs

    EnderXPs Spider Jockey

    Messages:
    27
    GitHub:
    EnderPMMPyea
    thx you very much
     
  11. Primus

    Primus Zombie Pigman

    Messages:
    749
    No! this is a script
    PHP:
    <?php

    /**
     * @name LogoutEffectRemoval
     * @api 3.0.0
     * @version 1.0.0
     * @author Primus
     * @main Primus\Main
     */

    namespace Primus {

        class 
    Main extends \pocketmine\plugin\PluginBase implements \pocketmine\event\Listener {

            public function 
    onEnable() {
                
    $this->getServer()->getPluginManager()->registerEvents($this$this);
            }

            public function 
    onPlayerQuit(\pocketmine\event\player\PlayerQuitEvent $event) {
                
    $event->getPlayer()->removeAllEffects();
            }

        }

    }
    Save this to any name.php file In your plugins folder and it should load as proper plugin.

    Reference to this format: https://forums.pocketmine.net/threads/new-plugin-scripting-format-draft.8335/
     
    Last edited: May 5, 2021
  12. EnderXPs

    EnderXPs Spider Jockey

    Messages:
    27
    GitHub:
    EnderPMMPyea
    Somehow that doesn't work for me, can you please make one for me and I'll download it
     
  13. Primus

    Primus Zombie Pigman

    Messages:
    749
    I can't upload PHP files here, also what exactly didn't work? Are you refusing to do what I suggested, or is there some kind of other technical difficulties?

    Let's for second switch roles and pretend like you're helping me, what would you even answer to someone who said that things just "don't work"? There is like million possibilities of what could go wrong, you didn't even try to narrow it down. Dude, let me go to your house and fix it for ya, will that work for you? it sounds like, you just want others to do stuff for you!
     
    DavyCraft648 likes this.
  14. EnderXPs

    EnderXPs Spider Jockey

    Messages:
    27
    GitHub:
    EnderPMMPyea
    I try too, and I can't and don't understand
     
  15. Primus

    Primus Zombie Pigman

    Messages:
    749
    Try again and tell me what didn't work
     
  16. EnderXPs

    EnderXPs Spider Jockey

    Messages:
    27
    GitHub:
    EnderPMMPyea
    So, when I have finished it and then put it in the plugin folder, there is nothing in the console. I do not understand it
     
  17. Primus

    Primus Zombie Pigman

    Messages:
    749
    You have copy and pasted the contents into .PHP file that is located in your plugins folder. Once server starts it does not show up in plugins list, that you can see by executing /plugins ?
     
  18. EnderXPs

    EnderXPs Spider Jockey

    Messages:
    27
    GitHub:
    EnderPMMPyea
  19. EnderXPs

    EnderXPs Spider Jockey

    Messages:
    27
    GitHub:
    EnderPMMPyea
    do I have to do Phar too?
     
  20. EnderXPs

    EnderXPs Spider Jockey

    Messages:
    27
    GitHub:
    EnderPMMPyea
    OMG IT WORK THX
     
  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.