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

Effect in lobby

Comments in 'Plugin Development' started by TheLucyClub, Apr 20, 2015.

  1. TheLucyClub
    Offline

    TheLucyClub Banned

    Joined:
    Jan 31, 2015
    Posts:
    53
    Minecraft User:
    iCreepyKid
    I want speed and jump boost effect when player is in lobby world only. Please help!
  2. TheLucyClub
    Offline

    TheLucyClub Banned

    Joined:
    Jan 31, 2015
    Posts:
    53
    Minecraft User:
    iCreepyKid
    Is it like
    PHP:
    if {
    $this->getPlayer()->getLevel == "Lobby"
    }
    or something?
    DunxandMinecraft likes this.
  3. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    When player joins, check if he is in lobby, if he is, add the effects with addEffect(Effect).
    When player teleports between worlds, remove or add effect by checking from and to.
    Angelo Vidrio, xpyctum and hoyinm14mc like this.
  4. TheLucyClub
    Offline

    TheLucyClub Banned

    Joined:
    Jan 31, 2015
    Posts:
    53
    Minecraft User:
    iCreepyKid
    Can you give me a code? I am newb :)
  5. TheLucyClub
    Offline

    TheLucyClub Banned

    Joined:
    Jan 31, 2015
    Posts:
    53
    Minecraft User:
    iCreepyKid
    I need help
  6. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,747
    Minecraft User:
    Legoboy0215
    A little off topic... May I ask what is $this? Thought it is a var that can not be assigned
  7. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    If you learn about object-oriented programming, you would know that each class is a type of objects. When loading your plugin, PocketMine creates a new object instance of your plugin class. $this refers to the object of the current running instanace of your class.
    It may be easier to understand with tasks. When you instantiate a `new MyPluginTask()` object, you create a new instance of MyPluginTask. The code inside MyPluginTask, unless they are static, $this refers to the object you instantiated and is running.
    So basically, you can assume $this is the class you are currently in.
    You may wonder where getServer() comes from. Since your plugin main class extends PluginBase, it inherits the functions from Pluginnase. One of them is getServer(). They also include getConfig(), etc. Read API docs for ref.
    RekkuzaRage, Legoboy0215 and Mat like this.
  8. TheLucyClub
    Offline

    TheLucyClub Banned

    Joined:
    Jan 31, 2015
    Posts:
    53
    Minecraft User:
    iCreepyKid
    Can you just give me the code I need?
  9. Gamecrafter
    Offline

    Gamecrafter Notable Member Plugin Developer

    Joined:
    Nov 20, 2014
    Posts:
    981
    Plugins:
    9
    No, he won't just give you the code you need. YOU have to do the coding YOURSELF. The members will only correct you and tell you where you messed up, and suggest corrections. You're just trying to freeload off of @PEMapModder.
    Last edited: Apr 21, 2015
  10. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,747
    Minecraft User:
    Legoboy0215
    Get it yourself.
    You are sooooo right. Learn it yourself for neat plugins. Only yourself limit what you think.
  11. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    I don't really care. I don't mind to contribute but it must be in the condition that it is open-source, or if there are special reasons, I want it to be at least open-source one day. But if it is too simple, it won't favour the community's development, so I don't bother to do so.
  12. RekkuzaRage
    Offline

    RekkuzaRage Active Member

    Joined:
    Apr 15, 2014
    Posts:
    252
    Minecraft User:
    RekkuzaRage
    Great reference, sometimes I forget about certain things about classes. :)

Share This Page

Advertisement