1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Solved help

Discussion in 'Plugin Help' started by IceCruelStuff, Sep 4, 2019.

  1. IceCruelStuff

    IceCruelStuff Silverfish

    Messages:
    16
    GitHub:
    icecruelstuff
    So I tried to make my own plugin but it always gives me error and I don't know what's wrong with it. Please help me

    Code:
    <?php
    namespace ServerCore;
    use pocketmine\plugin\PluginBase;
    use pocketmine\command\CommandSender;
    use pocketmine\command\Command;
    use pocketmine\Player;
    use pocketmine\Server;
    use pocketmine\utils\TextFormat as c;
    class ServerCore extends PluginBase{
      public function onEnable(){
        $this->getLogger()->notice(c::BOLD.c::DARK_AQUA."(!)".c::RESET.c::DARK_PURPLE." ServerCore has been enabled");
      }
     
      public function onCommand(CommandSender $sender, Command $cmd, $label, array $args){
        if(strtolower($cmd->getName()) == "heal"){
          if($sender->hasPermission("Mod")){
            $sender->sendMessage(c::BOLD.c::DARK_AQUA."(!)",c::DARK_PURPLE." You have been healed");
            $sender->setHealth(20.0);
          }elseif(!$sender->hasPermission("Mod")){
                 $sender->sendMessage(c::BOLD.c::DARK_RED."(!)".c::RESET.c::RED." You do not have permission to run this command");
          }
        }
      }
     
      public function onDisable(){
        $this->getLogger()->warning(c::BOLD.c::DARK_RED."(!)".c::RESET.c::RED." ServerCore has been disabled")
      }
    }
     
  2. Mango

    Mango Spider

    Messages:
    9
    A. Post the error you're getting. It tells us what happened, what went wrong, etc. The problem here was simple enough to be solved without it, but you should always post error logs with it if you want help. "It gives me error" doesn't describe a thing.
    B. You're missing a semicolon. You really should use an IDE.
     
  3. IceCruelStuff

    IceCruelStuff Silverfish

    Messages:
    16
    GitHub:
    icecruelstuff
    i added in the semicolon and still it gives me an error
     
  4. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    Are you sure you actually saved the file? Because that error should definitely not be there.
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.