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

Code Snippet sharing.

Comments in 'Resources' started by Primus, Aug 25, 2015.

  1. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    I want to suggest to add place where developer could share with code snippets.

    example:

    How Item is rare?
    PHP:
    /*
    * 1 - Very Common
    * 2 - Common
    * 3 - Could struggle to get
    * 4 - Rare
    * 5 - Very Rare
    * 6 - Almost impossible to get
    */
    public function howRare(Item $item){
    switch(
    $item->getId()){
    case 
    264:
    return 
    5;
    break;
    case 
    1:
    return 
    2;
    break;
    case 
    3:
    return 
    1;
    break;
    .
    .
    .
    .
    .
    }
    }
    Ignore me ^

    I hope you got the idea :D
    Last edited: Aug 29, 2015
  2. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,706
    Plugins:
    22
    Minecraft User:
    Falkirknh
  3. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    Yeah kinda, but just only with snippets and gallery view.
  4. DunxandMinecraft
    Offline

    DunxandMinecraft Active Member

    Joined:
    Oct 26, 2014
    Posts:
    158
    I don't understand what you are aasking
  5. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    BTW, you should use integers instead of strings.
    DunxandMinecraft likes this.
  6. Gamecrafter
    Offline

    Gamecrafter

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
    I believe this should be the right place to share code snippets: gist.github.com
  7. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    But they're all messed up. I tought it could be only for PM Development. But actually everyonr who wants to give snippet should use PocketMine-Mp\SnippetName
  8. Gamecrafter
    Offline

    Gamecrafter

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
    What do you mean by "all messed up"?
  9. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    There no categories no groups or anything of that they're in the same list
  10. Gamecrafter
    Offline

    Gamecrafter

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
    Who cares? Life never goes in a straight line. Same thing here. Are you OCD or something?
  11. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    Ouh, searched for "PocketMine" now it looks better :)
  12. Gamecrafter
    Offline

    Gamecrafter

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
    :p
  13. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    Could be, who knows :D
  14. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Again, move this to the resources forum please.
  15. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    Can i?

Share This Page

Advertisement