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

Remove all entities

Discussion in 'Facepalm' started by kaliiks, Dec 19, 2016.

  1. kaliiks

    kaliiks Zombie

    Messages:
    250
    Hello, my code to remove entites do not work
    CODE:
    PHP:
    public function removeKADefender($player)
    {
       
    $this->getServer()->removeEntities();

        }

    }

    }
     
  2. Sandertv

    Sandertv Zombie Pigman Poggit Reviewer

    Messages:
    786
    GitHub:
    Sandertv
    Your title and description don't work together. Do you want to remove all humans, or all entities.
     
  3. kaliiks

    kaliiks Zombie

    Messages:
    250
    entities, sorry
     
  4. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    And why do you expect the method Server::removeEntities() to exist in the first place?
     
  5. kaliiks

    kaliiks Zombie

    Messages:
    250
    Because it is in ClearLag plugin
     
  6. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    And you don't try to verify it yourself when it is not working?
    How many times I've been saying, code is not like items you just put into your inventory to use it. It is like wands in Harry Potter; you have to do something to use someone else's code...

    So far you have just been telling us it "do not work" but no elaboration. Ever read the README of this forum?
    And I wonder where exactly is that ClearLag plugin you found that uses that nonexistent method? What you need to know is just that that method doesn't exist.
     
  7. kaliiks

    kaliiks Zombie

    Messages:
    250
  8. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
  9. kaliiks

    kaliiks Zombie

    Messages:
    250
    GetPlugin dont work so i used getserver
     
  10. robske_110 (Tim)

    robske_110 (Tim) Wither Skeleton Poggit Reviewer

    Messages:
    1,342
    GitHub:
    robske110
    :facepalm:
     
  11. robske_110 (Tim)

    robske_110 (Tim) Wither Skeleton Poggit Reviewer

    Messages:
    1,342
    GitHub:
    robske110
    Although I think all hope is lost here is some explanation:
    $this->getPlugin() is referring to a method that returns the Plugin Main object. That contains the method removeEntities(). Why do you expect the Server object to magically have that function?
     
  12. kaliiks

    kaliiks Zombie

    Messages:
    250
    I do not know anything about getplugin so I just tried it
     
  13. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    Because getPlugin() is defined by ClearLagg. Mind reading?

    You have successfully inspired me to create this forum. Great contribution. :facepalm:
    https://forums.pmmp.io/forums/dev-facepalm/
     
  14. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    This thread is not even about removing all entities. It is just about how to properly copy code from another plugin, which is totally not constructive to plugin development. Moved to :facepalm: forum.
     
  15. robske_110 (Tim)

    robske_110 (Tim) Wither Skeleton Poggit Reviewer

    Messages:
    1,342
    GitHub:
    robske110
    Sorry, but you should learn OOP, general programming, and PHP first and then come back. Please note that that is not a task that can be done in a few hours.
     
  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.