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

$issuer level getName

Comments in 'Plugin Development' started by Guillaume351, Mar 26, 2014.

  1. Guillaume351
    Offline

    Guillaume351 Active Member Plugin Developer

    Joined:
    Oct 11, 2013
    Posts:
    150
    Plugins:
    1
    Minecraft User:
    Guillaume351
    Code:
    [77]    public function mode($cmd,$issuer){
    [78]        $world = $issuer->entity->level->getName();
    [79]            if($issuer instanceof Player){
    [80]                     $output .= "Please run this command in-game.\n";
    [81]                     break;
    [82]                 }
    Hello, 1st : When I run command from the console, it don't display the message and do as normal. 2nd : How to get issuer level name ? Because with this, it says
    "
    Error: array (
    'type' => 'E_ERROR',
    'message' => 'Call to a member function getName() on a non-object'"

    Thank you.
  2. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,710
    Plugins:
    22
    Minecraft User:
    Falkirknh
    Try accepting all the parameters of a commandHandler, also if you you want to see if $issuer isn't a player you need ! to check if it returns false. In addition to this, I don't think break; will have the effect you intend.
    PHP:
    public function mode ($cmd$params$issuer$alias$args$issuer){
    $world $issuer->entity->level->getName();
    if(!(
    $issuer instanceof Player)){
    $output .= "Please run this command in-game.\n";
    break;
    }
    ...
  3. Guillaume351
    Offline

    Guillaume351 Active Member Plugin Developer

    Joined:
    Oct 11, 2013
    Posts:
    150
    Plugins:
    1
    Minecraft User:
    Guillaume351
    Thank you, I try.
  4. Guillaume351
    Offline

    Guillaume351 Active Member Plugin Developer

    Joined:
    Oct 11, 2013
    Posts:
    150
    Plugins:
    1
    Minecraft User:
    Guillaume351
    Work ! Thank you a lot for all the help ;))
    Falk likes this.
  5. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    $issuer repeated argument?
  6. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Also you didnt init $output so assignments cant work on it.
  7. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,710
    Plugins:
    22
    Minecraft User:
    Falkirknh
    Yeah, I wonder how that happened :)
    $args I don't think is used anymore either.

Share This Page

Advertisement