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

[NewAPI] Running commands once

Comments in 'Plugin Development' started by iFootball, Jul 3, 2014.

  1. iFootball
    Offline

    iFootball Active Member

    Joined:
    Jun 9, 2014
    Posts:
    84
    Minecraft User:
    iFootball
    I'm am planing to put my parameters in a separate document to keep organized. As I've said, I am still working on the MySQL. It's not my favorite part so I'm delaying it....
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    You just don't understand.
  3. iFootball
    Offline

    iFootball Active Member

    Joined:
    Jun 9, 2014
    Posts:
    84
    Minecraft User:
    iFootball
    What parameters did I not specify? X1, x2, y1 do not need to be specified since they are being received from the MySQL database....
  4. Dinokiller
    Offline

    Dinokiller Notable Member

    Joined:
    Sep 22, 2013
    Posts:
    376
    Minecraft User:
    Dinokiller_
    Imagine I have a simple table of different materials like so:

    | Name | Solid | Waterproof |
    ---------------------------------
    | Wood | true | true |
    ---------------------------------
    | Paper | false | false |
    ---------------------------------
    | Metal | true | false |
    ---------------------------------
    | Sponge| false | true |

    What if I need to retrieve all materials that are solid and waterproof?
    What if I need to retrieve all materials that aren't waterproof?
    You could just loop through all the records to find the ones you want and put them into an array of some sort.
    This would work well at first but imagine I had thousands of records. Looping through them all would cost valuable time.
    MySQL just retrieves things from the table in a quick way and is mostly used for user databases on forums and such.

    But I honestly don't see why you need MySQL for something like this. Just load the YAML file into an array and you probably won't have any major slowdown.
    Tuff likes this.
  5. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Yes, but MySQL ≠ PocketMine. The arguments are sent from PocketMine, and PocketMine doesn't know you want MySQL. Moreover, PHP never cares how you name your parameters.
    Tuff likes this.
  6. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Nvm I got the wrong source.

    Anyway, don't do anything at onLoad().
  7. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    What about the StatsCore table?
  8. Dinokiller
    Offline

    Dinokiller Notable Member

    Joined:
    Sep 22, 2013
    Posts:
    376
    Minecraft User:
    Dinokiller_
    I haven't had a chance to see that.
  9. iFootball
    Offline

    iFootball Active Member

    Joined:
    Jun 9, 2014
    Posts:
    84
    Minecraft User:
    iFootball
    Why should I not do anything on load?
  10. iFootball
    Offline

    iFootball Active Member

    Joined:
    Jun 9, 2014
    Posts:
    84
    Minecraft User:
    iFootball
    I could but, MySQL is better, so why not do MySQL.:p
  11. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Ask @shoghicp. He discourages that. Because, onLoad() is when the player is not yet enabled, and server owners don't like it when you do something on their servers when you are not enabled.
  12. iFootball
    Offline

    iFootball Active Member

    Joined:
    Jun 9, 2014
    Posts:
    84
    Minecraft User:
    iFootball
    Ok I'll change
  13. Dinokiller
    Offline

    Dinokiller Notable Member

    Joined:
    Sep 22, 2013
    Posts:
    376
    Minecraft User:
    Dinokiller_
    Because MySQL is supposed to fetch data from huge tables (I'm talking over 1000 records). I can't imagine server owners creating that many areas.
  14. iFootball
    Offline

    iFootball Active Member

    Joined:
    Jun 9, 2014
    Posts:
    84
    Minecraft User:
    iFootball
    True, but it can also fetch small amounts of data faster then YAML.
  15. Dinokiller
    Offline

    Dinokiller Notable Member

    Joined:
    Sep 22, 2013
    Posts:
    376
    Minecraft User:
    Dinokiller_
    Wrong, MySQL is slower then YAML but is faster then YAML if you had loads of records. It's kind of hard to explain though.
  16. Dinokiller
    Offline

    Dinokiller Notable Member

    Joined:
    Sep 22, 2013
    Posts:
    376
    Minecraft User:
    Dinokiller_
    Use what you want, I'm just making a recommendation.
  17. iFootball
    Offline

    iFootball Active Member

    Joined:
    Jun 9, 2014
    Posts:
    84
    Minecraft User:
    iFootball
    Hmm, then why are so many plugin developers using MySQL for plugin development in the new API?
  18. iFootball
    Offline

    iFootball Active Member

    Joined:
    Jun 9, 2014
    Posts:
    84
    Minecraft User:
    iFootball
    Well you know best
    Dinokiller likes this.
  19. Dinokiller
    Offline

    Dinokiller Notable Member

    Joined:
    Sep 22, 2013
    Posts:
    376
    Minecraft User:
    Dinokiller_
    Give me some examples of plugins you've seen do this.
  20. Dinokiller
    Offline

    Dinokiller Notable Member

    Joined:
    Sep 22, 2013
    Posts:
    376
    Minecraft User:
    Dinokiller_
    I had a look at it. So far it's looking great, do you have any plans for it? I would like to see some methods to retrieve every records that has a certain value like MySQL can. That would be quite useful.

Share This Page

Advertisement