I made a plugin that teleports you to the surface when you type /surface but i have no idea how to get the highest block of the world PHP: <?phpnamespace Indexfire\SurfaceCommanduse pocketmine\command\Command;use pocketmine\command\CommandSender;use pocketmine\Player;use pocketmine\plugin\PluginBase;class SurfaceCommand extends PluginBase{ public function onEnable(){getLogger()->info("Indexfire's first Plugin"); }public function onCommand(CommandSender sender, Command $cmd, String label, String[] args){ }if ($cmd->getName() == "surface" && sender instanceof Player) im stuck halfway can anyone help?
Are you sure you know what you're doing? Pocketmine is made in PHP not Java, therefore plugins must be written in PHP. In your code it seems that you're mixing Java with PHP and that's never going to work. There is a server software made in Java, which I am unable to mention here.
Code: if (cmd.getName().equalsIgnoreCase("surface") && sender instanceof Player) This is java code bud
You can get the highest block of the world at a position using $this->level->getHighestBlockAt($x, $z).
Sadly, no. PHP strings are no objects in that way. You cannot call functions on strings. You'll get a funny error message. (called blah on string) You should learn php a bit more. you can simply do == "surface" and if you want to ignore the case strtolower($cmd->getName()) == "surface"