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

[Solved][NEWAPI] Checking server name

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

Thread Status:
Not open for further replies.
  1. iFootball
    Offline

    iFootball Active Member

    Joined:
    Jun 9, 2014
    Posts:
    84
    Minecraft User:
    iFootball
    How would I check the name of a server in a if statement? (NewAPI) I'm still new and unexperienced like a lot of people to it.
  2. xpyctum
    Offline

    xpyctum Active Member Plugin Developer

    Joined:
    Jan 13, 2014
    Posts:
    292
    Plugins:
    4
    Minecraft User:
    tylerdisney
    PHP:
    use pocketmine\Server;
    //code
    $this->getServerName();
  3. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    No need to use pocketmine\Server.
  4. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Also, what is $this?
  5. xpyctum
    Offline

    xpyctum Active Member Plugin Developer

    Joined:
    Jan 13, 2014
    Posts:
    292
    Plugins:
    4
    Minecraft User:
    tylerdisney
    I'm trying help him ;)
  6. xpyctum
    Offline

    xpyctum Active Member Plugin Developer

    Joined:
    Jan 13, 2014
    Posts:
    292
    Plugins:
    4
    Minecraft User:
    tylerdisney
    PHP:
    $name $this->getServer()->getServerName();
    if(
    $name == "test"){
    //code
    }else{
    //else code
    }
    //i'm not sure, it maybe not work
  7. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    This should work.
  8. iFootball
    Offline

    iFootball Active Member

    Joined:
    Jun 9, 2014
    Posts:
    84
    Minecraft User:
    iFootball
    Ok thanks
Thread Status:
Not open for further replies.

Share This Page

Advertisement