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

I want to try to make plugins

Comments in 'Plugin Development' started by Creeperface, Apr 26, 2015.

  1. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    i can javascript and PHP too, but i don´t know exactly how used $this and arrow ->

    e.g.
    PHP:
    public function loadKit($teamkitNamePlayer $p) {
            
    //$p->sendMessage ( $this->getMsg ( "game.start-equipment" ) );
            
    $teamKit $this->getKit($teamkitName)->getAll();
      
            
    //player must clear all equipments
            
    $p->getInventory()->clearAll();
            
    //add armors
            
    if ($teamKit["armors"]["helmet"][0]!=null) {
                
    $p->getInventory ()->setHelmet ( new Item $teamKit["armors"]["helmet"][0], $teamKit["armors"]["helmet"][1], $teamKit["armors"]["helmet"][2] ) );
            }
            if (
    $teamKit["armors"]["chestplate"][0]!=null) {
                
    $p->getInventory ()->setChestplate ( new Item $teamKit["armors"]["chestplate"][0], $teamKit["armors"]["chestplate"][1], $teamKit["armors"]["chestplate"][2] ) );
            }
            if (
    $teamKit["armors"]["leggings"][0]!=null) {
                
    $p->getInventory ()->setLeggings ( new Item $teamKit["armors"]["leggings"][0], $teamKit["armors"]["leggings"][1], $teamKit["armors"]["leggings"][2] ) );
            }
            if (
    $teamKit["armors"]["boots"][0]!=null) {
                
    $p->getInventory ()->setBoots ( new Item $teamKit["armors"]["boots"][0], $teamKit["armors"]["boots"][1], $teamKit["armors"]["boots"][2] ) );
            }
    and what is the difference between public function and private function.
    thanks for any help. :)

    i looked at minecraftgenius´s plugins.
  2. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,706
    Plugins:
    22
    Minecraft User:
    Falkirknh
    $this is like this in JavaScript it is a reference to the current object.
    -> is object access operator, it lets you call methods and access properties in an object, it is like . in JavaScript.
    A public method can be called from anywhere. A private method can only be called from within your class. There is a third visibility called protected, but to understand that you will need to understand inheritance and I won't try to explain that now.
    EvolSoft and PEMapModder like this.
  3. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
  4. Martin77Epic
    Offline

    Martin77Epic Banned

    Joined:
    Mar 6, 2015
    Posts:
    164
    Minecraft User:
    CookieMonsterPE
    PLZ give this pocketmineplugin>...
  5. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    This is part of mcg76's Capture the Flag
  6. Martin77Epic
    Offline

    Martin77Epic Banned

    Joined:
    Mar 6, 2015
    Posts:
    164
    Minecraft User:
    CookieMonsterPE
    No For make in Code Editor
  7. TonyDroidd
    Offline

    TonyDroidd Active Member

    Joined:
    Sep 6, 2014
    Posts:
    180
    Minecraft User:
    TonyDroidd

Share This Page

Advertisement