I'm trying to get the players in a level and send them a message usng this code: PHP: $winner = $sender->getServer()->getLevelByName("world")->getPlayers(); $winner->sendMessage("you won!"); in console its saying [13:15:32] [Server thread/CRITICAL]: Error: "Call to a member function sendMessage() on array" (EXCEPTION) please help
try PHP: foreach ($sender->getServer()->getLevelByName("world")->getPlayers() as $winner) $winner->sendMessage("you won!");
for anyone who wonders why... getPlayers() returns an array of Player objects, not a single Player object.