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

Solved Help , error plugin

Discussion in 'Plugin Help' started by Qazam, Jan 17, 2022.

  1. Qazam

    Qazam Creeper

    Messages:
    3
    First of all sorry for my bad English I am French. I'm new to plugin creation (I'm really new). I would like some help because I started to create a plugin but when I put it in my server it displays an error message.

    Here is the message:

    [Server thread/ERROR]: Could not load 'C:\Users\Utilisateur\Desktop\Server\plugins\PlQazam.phar' in folder 'C:\Users\Utilisateur\Desktop\Server\plugins\': Invalid Plugin main, cannot start within the PocketMine namespace
    [21:22:34] [Server thread/CRITICAL]: pocketmine\plugin\PluginException: "Invalid Plugin main, cannot start within the PocketMine namespace" (EXCEPTION) in "pmsrc/src/pocketmine/plugin/PluginDescription" at line 113
    [21:22:34] [Server thread/CRITICAL]: #0 pmsrc/src/pocketmine/plugin/PluginDescription(95): pocketmine\plugin\PluginDescription->loadMap(array[6])
    [21:22:34] [Server thread/CRITICAL]: #1 pmsrc/src/pocketmine/plugin/PharPluginLoader(60): pocketmine\plugin\PluginDescription->__construct(string[212] name: PluginTest..version: 0.1..api: 3.22.4..main: pocketmine\Main..author: Qaza)
    [21:22:34] [Server thread/CRITICAL]: #2 pmsrc/src/pocketmine/plugin/PluginManager(238): pocketmine\plugin\PharPluginLoader->getPluginDescription(string[56] C:\Users\Utilisateur\Desktop\Server\plugins\PlQazam.phar)
    [21:22:34] [Server thread/CRITICAL]: #3 pmsrc/src/pocketmine/Server(1529): pocketmine\plugin\PluginManager->loadPlugins(string[44] C:\Users\Utilisateur\Desktop\Server\plugins\)
    [21:22:34] [Server thread/CRITICAL]: #4 pmsrc/src/pocketmine/PocketMine(314): pocketmine\Server->__construct(object BaseClassLoader, object pocketmine\utils\MainLogger, string[36] C:\Users\Utilisateur\Desktop\Server\, string[44] C:\Users\Utilisateur\Desktop\Server\plugins\)
    [21:22:34] [Server thread/CRITICAL]: #5 pmsrc/src/pocketmine/PocketMine(344): pocketmine\server()
    [21:22:34] [Server thread/CRITICAL]: #6 pmsrc(11): require(string[91] phar://C:/Users/Utilisateur/Desktop/Server/PocketMine-MP.phar/src/pocketmine/Poc)


    Yet in the plugin there is no error, I really do not understand

    Do you have a solution? I can give you info of the plugin, thank you in advance

    good day/night
     
  2. minijaham

    minijaham Skeleton

    Messages:
    801
    GitHub:
    minijaham
    Show me the namespace of your plugin's main class
     
  3. Qazam

    Qazam Creeper

    Messages:
    3


    C:\Users\Utilisateur\Desktop\PlQazam\src\pocketmine

    here is the path for the Main.php file

    ------------------------------------------------------------------------------------------------------------------------------------------
    <?php

    namespace pocketmine;

    use pocketmine\command\Command;
    use pocketmine\command\CommandSender;
    use pocketmine\event\player\PlayerJoinEvent;
    use pocketmine\event\player\PlayerQuitEvent;
    use pocketmine\plugin\PluginBase;

    class Main extends PluginBase {
    public function onEnable()
    {
    $this->getLogger()->info("le plugin a bien été activé");
    }


    public function onDisable()
    {
    $this->getLogger()->info("le plugin a bien été désactivé");
    }

    public function onJoin(PlayerJoinEvent $event){
    $player = $event->getPlayer();
    $event->setJoinMessage(joinMessage: " ");

    if(!$player->hasPlayedBefore()) {
    $player->sendMessage("NOUVEAU");
    Server::getInstance()->broadcastMessage(message:"§dBienvenue à §5" . $player->getName() . "§d sur le serveur ! Bon jeu à toi !");
    }else{
    $player->sendMessage("ANCIEN");
    Server::getInstance()->broadcastMessage(message:"§7[§a+§7]§7 " . $player->getName() );
    }
    }

    public function Onquit(PlayerQuitEvent $event){
    $player = $event->getPlayer();

    $event->setQuitMessage( quitMessage: " ");
    Server::getInstance()->broadcastMessage(message :"§7[§c-§7]§7 " . $player->getName());
    }

    public function onCommand(CommandSender $sender, Command $command, string $label, array $args): bool
    {
    switch ($command->getName()){
    case "bvn":
    $name = $sender->getName();
    $sender->sendMessage("§a§oVous avez souhaité la bienvenue.");
    Server::getInstance()->broadcastMessage("§o§b$name §r§a> §bBienvenue Sur Le Serveur Thorium !");
    break;
    }
    return true;
    }
    }
    -----------------------------------------------------------------------------------------------------------------------------------------------------------------
     
  4. minijaham

    minijaham Skeleton

    Messages:
    801
    GitHub:
    minijaham
    Yeah, the error says that the namespace cannot start with the "pocketmine"!
    You should change both of your file's path and the namespace written in your main file to something that doesn't start with pocketmine :)
     
  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.