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

Solved Send command as a player

Comments in 'Plugin Development' started by Andrey Nazarchuk, Oct 2, 2015.

  1. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    Use a for loop. Better than while in this case. But a common mistake: REMEMBER that if you have a loop:
    PHP:
    while(true){
        
    $this->getServer()->broadcastMessage("While loop"):
    }
    $this->getServer()->getPluginManager()->disablePlugin($this);
    The loop will go on and the code below will not be executed until the loop ends.
  2. FlamingGenius
    Offline

    FlamingGenius Active Member

    Joined:
    Sep 23, 2015
    Posts:
    173
    Minecraft User:
    FlamingGenius
    Never said it was pratical just saying its a way :p
    Legoboy0215 likes this.
  3. Andrey Nazarchuk
    Offline

    Andrey Nazarchuk Active Member

    Joined:
    Dec 30, 2013
    Posts:
    332
    Minecraft User:
    digita1eclipse
    Why are we talking about loops? lol
    Legoboy0215 likes this.
  4. Andrey Nazarchuk
    Offline

    Andrey Nazarchuk Active Member

    Joined:
    Dec 30, 2013
    Posts:
    332
    Minecraft User:
    digita1eclipse
    I know, but the posting rules say to stay on topic. @Intyre
  5. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    The function Server::getPlayer() requires a parameter.
    And you don't need to define $name. It isn't used at all.
    Last edited: Oct 4, 2015
  6. Gamecrafter
    Offline

    Gamecrafter

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
  7. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Sorry. I was talking in a Java way :p in Java, you would say "Server.getPlayer() doesn't exist. Only the function Server.getPlayer(String) exists." Because functions with different parameters are different functions in Java :p anyway I edited the list.
    Taha_The_Hacker likes this.

Share This Page

Advertisement