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

Solved Plugin help

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

  1. HotFireyDeath
    Offline

    HotFireyDeath Notable Member Plugin Developer

    Joined:
    Mar 19, 2015
    Posts:
    328
    Plugins:
    1
    Minecraft User:
    HotFireyDeath
    How would you log the players that join a specific world down into a list of some sort as variables? Say player1 joined. Then player2 joined. How would you be able to log them down as variables into a list or something?

    Also, how do you assign another status on this variable? Say I define $dog = "dog". It is saved as a variable. Now I want to add a attribute to this variable. Let's define the dog's color as brown. How would you be able to list and save attribute like that?

    Thank you! :)
  2. Asparanc
    Offline

    Asparanc Active Member

    Joined:
    Feb 20, 2015
    Posts:
    210
    Minecraft User:
    Asparanc
    $this->attributes = [];
    $this->attributes["dog"]["eyes"] = array("brown","blue");

    I think it's what you want.
    HotFireyDeath likes this.
  3. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    For the first question, you won't want to do that because it will overload the memory. But if it is just for a short period of time:
    1. Put this in the class declaration in your class:
    PHP:
    class blah...{
      public 
    $log=[];
      
    Blah...
    }
    2. For $main as your main class's instance ($this if you are in the main class's context), $main->log[]=$player->getName();
    HotFireyDeath likes this.

Share This Page

Advertisement