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

Help with my plugin

Discussion in 'Development' started by Blip, Jul 10, 2021.

  1. Blip

    Blip Spider

    Messages:
    6
    GitHub:
    lanternserver
    Hey! I literally just started coding plugins today, following Kyeg's very helpful tutorial. It all seemed to be going well, but when I put the plugin in plugins and reloaded the server, it displayed quite a lot of error messages and I don't know what any of them mean! Plus, the plugin isn't even in the plugins list so it must have gone really wrong :"D Can someone shed some light?
    Here is my error message:

    [14:08:37] [Server thread/CRITICAL]: #3 pmsrc/src/pocketmine/plugin/PluginManager(238): FolderPluginLoader\FolderPluginLoader->getPluginDescription(string[30] /opt/service/plugins/lanternMC)
    [14:08:37] [Server thread/CRITICAL]: #4 plugins/PocketMine-DevTools.phar/src/DevTools/DevTools(69): pocketmine\plugin\PluginManager->loadPlugins(string[21] /opt/service/plugins/, array[1])
    [14:08:37] [Server thread/CRITICAL]: #6 pmsrc/src/pocketmine/plugin/PluginManager(552): pocketmine\plugin\PluginBase->setEnabled(boolean 1)
    [14:08:37] [Server thread/CRITICAL]: #5 pmsrc/src/pocketmine/plugin/PluginBase(116): DevTools\DevTools->onEnable()
    [14:08:37] [Server thread/CRITICAL]: #8 pmsrc/src/pocketmine/Server(1771): pocketmine\Server->enablePlugin(object DevTools\DevTools)
    [14:08:37] [Server thread/CRITICAL]: #7 pmsrc/src/pocketmine/Server(1785): pocketmine\plugin\PluginManager->enablePlugin(object DevTools\DevTools)
    [14:08:37] [Server thread/CRITICAL]: #9 pmsrc/src/pocketmine/Server(1530): pocketmine\Server->enablePlugins(integer 0)
    [14:08:37] [Server thread/CRITICAL]: #10 pmsrc/src/pocketmine/PocketMine(291): pocketmine\Server->__construct(object BaseClassLoader, object pocketmine\utils\MainLogger, string[13] /opt/service/, string[21] /opt/service/plugins/)
    [14:08:37] [Server thread/CRITICAL]: #12 pmsrc(11): require(string[68] phar:///opt/service/PocketMine-MP.phar/src/pocketmine/PocketMine.php)
    [14:08:37] [Server thread/CRITICAL]: #11 pmsrc/src/pocketmine/PocketMine(321): pocketmine\server()

    And here is my code:
    <?php

    namespace LanternServer\lanternMC

    use pocketmine\plugin\PluginBase
    use pocketmine\plugin\commandSender
    use pocketmine\command\Command;

    class Main extends PluginBase {

    public function onEnable() {
    $this->getServer()->getLogger()->info("[LanternMC custom plugin enabled!]")
    }

    public function onDisable() {
    $this->getServer()->getLogger()->info("[LanternMC custom plugin disabled..]")
    }

    public function onCommand(commandSender $sender, Command $command, string $label, array $args) : bool {
    switch ($command->getName()) {
    case "lanternMC":
    $sender->sendMessage("[§6Lantern§4MC]§rWelcome to §6Lantern§4MC§r!");
    }
    return true;
    }

    }
     
  2. minijaham

    minijaham Skeleton

    Messages:
    801
    GitHub:
    minijaham
    PHP is case-sensitive.
    Change use pocketmine\plugin\commandSender to use pocketmine\plugin\CommandSender

    P.S. onEnable function and onDisable function isn't needed in your case, since all you do is just the messages
     
    Agent likes this.
  3. minijaham

    minijaham Skeleton

    Messages:
    801
    GitHub:
    minijaham
    Another note, it's not pocketmine\plugin\CommandSender
    it's pocketmine\command\CommandSender;
     
    Agent likes this.
  4. minijaham

    minijaham Skeleton

    Messages:
    801
    GitHub:
    minijaham
    You also forgot semicolons almost everywhere. Good luck finding them.
     
    Agent likes this.
  5. Blip

    Blip Spider

    Messages:
    6
    GitHub:
    lanternserver
    um thanks! I got it to register as a plugin, but now it gives me the 119 seconds throttle message and I have to take it out of the plugins folder and restart to fix it..
     
  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.