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

help me wit my plugin

Comments in 'Plugin Development' started by Wantedkillerss, Jun 7, 2014.

  1. Wantedkillerss
    Offline

    Wantedkillerss Active Member Plugin Developer

    Joined:
    May 9, 2014
    Posts:
    142
    Plugins:
    1
    Minecraft User:
    Wantedkillers
    Hey guys what do I do here:
    if($data["target"]->getID() == SaplingBlock::OAK);
    If($data["target"]->getD() == SaplingBlock::BIRCH);
    //what do I write here
    case SaplingBlock::SPRUCE:

    So it doesnt crash my server
  2. DA_Swagnemite
    Offline

    DA_Swagnemite Notable Member Plugin Developer

    Joined:
    Nov 17, 2013
    Posts:
    388
    Plugins:
    7
    Minecraft User:
    DA_SWAGNEMITE
    What is it your trying to do exactly?
  3. Wantedkillerss
    Offline

    Wantedkillerss Active Member Plugin Developer

    Joined:
    May 9, 2014
    Posts:
    142
    Plugins:
    1
    Minecraft User:
    Wantedkillers
    Im trying to make trees grow automatically (someones request)
  4. DA_Swagnemite
    Offline

    DA_Swagnemite Notable Member Plugin Developer

    Joined:
    Nov 17, 2013
    Posts:
    388
    Plugins:
    7
    Minecraft User:
    DA_SWAGNEMITE
    Ok i see... Are you making this for API 12 or 1.0.0?
  5. Wantedkillerss
    Offline

    Wantedkillerss Active Member Plugin Developer

    Joined:
    May 9, 2014
    Posts:
    142
    Plugins:
    1
    Minecraft User:
    Wantedkillers
    12 im gonna update it later
  6. DA_Swagnemite
    Offline

    DA_Swagnemite Notable Member Plugin Developer

    Joined:
    Nov 17, 2013
    Posts:
    388
    Plugins:
    7
    Minecraft User:
    DA_SWAGNEMITE
    Ok replace the SaplingBlock::... with the actual ID of the item.
    Example:
    Say you want to se if the player was hitting air (again just an example XD)
    if($data["target"]->getID() == "0"){
    //What happens if the item is air
    }
    64FF00 likes this.
  7. Wantedkillerss
    Offline

    Wantedkillerss Active Member Plugin Developer

    Joined:
    May 9, 2014
    Posts:
    142
    Plugins:
    1
    Minecraft User:
    Wantedkillers
    Yeah but I need 6:1 6:2 6:3
    And when I write ":" it crashes
    (If u put the id to 0 it wouldnt work cause my handler is player.block.place
    Last edited: Jun 7, 2014
  8. Darunia18
    Offline

    Darunia18 Staff Member Sectional Moderator

    Joined:
    Aug 23, 2013
    Posts:
    755
    Plugins:
    2
    Minecraft User:
    Darunia18
    Just a tip, "updating it later" isn't just changing a few lines of code or anything. It's recoding the entire plugin. So take that into consideration if you're not too far into development with this plugin ;)
    PEMapModder, 64FF00 and Comedyman937 like this.
  9. tnpxxsheepdog
    Offline

    tnpxxsheepdog Notable Member

    Joined:
    Dec 31, 2013
    Posts:
    356
    Minecraft User:
    TNPXXSHEEPDOG
    Dun dun dunnnnnn
    64FF00, LDX and Darunia18 like this.
  10. Wantedkillerss
    Offline

    Wantedkillerss Active Member Plugin Developer

    Joined:
    May 9, 2014
    Posts:
    142
    Plugins:
    1
    Minecraft User:
    Wantedkillers
    Yeah ok I know but could u plz help me
    LDX likes this.
  11. LDX
    Offline

    LDX Notable Member Plugin Developer

    Joined:
    Oct 2, 2013
    Posts:
    1,434
    Plugins:
    14
    PHP:
    if($data["item"] == $this->api->block->getItem("6","0")) {
    // Oak sapling
    } else if($data["item"] == $this->api->block->getItem("6","1")) {
    // Spruce sapling
    } else if($data["item"] == $this->api->block->getItem("6","2")) {
    // Birch sapling
    // Continue IF statement as needed.
    Last edited: Jun 7, 2014
  12. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,710
    Plugins:
    22
    Minecraft User:
    Falkirknh
    You could also use the getMetadata() function, then you could have a switch statement.
    Wantedkillerss likes this.
  13. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    String literals aren't required.
    Wantedkillerss likes this.
  14. hamachichi
    Offline

    hamachichi Banned

    Joined:
    Jun 5, 2014
    Posts:
    43
    Minecraft User:
    hamachichi
    btw wies have that plugin already
  15. Wantedkillerss
    Offline

    Wantedkillerss Active Member Plugin Developer

    Joined:
    May 9, 2014
    Posts:
    142
    Plugins:
    1
    Minecraft User:
    Wantedkillers
    LDX likes this.
  16. Wantedkillerss
    Offline

    Wantedkillerss Active Member Plugin Developer

    Joined:
    May 9, 2014
    Posts:
    142
    Plugins:
    1
    Minecraft User:
    Wantedkillers
    ?
    ?
  17. Wantedkillerss
    Offline

    Wantedkillerss Active Member Plugin Developer

    Joined:
    May 9, 2014
    Posts:
    142
    Plugins:
    1
    Minecraft User:
    Wantedkillers
    You guys never awnsered my question
    I asked what do I put in between the getid
    and the case or do change the case?
  18. xpyctum
    Offline

    xpyctum Active Member Plugin Developer

    Joined:
    Jan 13, 2014
    Posts:
    292
    Plugins:
    4
    Minecraft User:
    tylerdisney
    You can use getMeta() === 1 and getMeta() === 2 and getMeta() === 3
  19. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    No such function getMeta...
    LDX likes this.
  20. xpyctum
    Offline

    xpyctum Active Member Plugin Developer

    Joined:
    Jan 13, 2014
    Posts:
    292
    Plugins:
    4
    Minecraft User:
    tylerdisney

Share This Page

Advertisement