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

Solved My plugin doesn't load and it don't show any error

Discussion in 'Plugin Help' started by GeistFan, Feb 22, 2021.

  1. GeistFan

    GeistFan Slime

    Messages:
    86
    GitHub:
    GeistFan
    Yours haven't player $player
     
    minijaham likes this.
  2. minijaham

    minijaham Skeleton

    Messages:
    801
    GitHub:
    minijaham
    You’re correct! Now delete that and there you go, a working onCommand function!
     
    DavyCraft648 likes this.
  3. GeistFan

    GeistFan Slime

    Messages:
    86
    GitHub:
    GeistFan
    Thank you. The plugin loads with Devtools but the command function doesn't work
     
  4. minijaham

    minijaham Skeleton

    Messages:
    801
    GitHub:
    minijaham
    Did you write down the commands in the plugin.yml folder?
     
  5. GeistFan

    GeistFan Slime

    Messages:
    86
    GitHub:
    GeistFan
    Yes here:
    -------------------------------------------------------------
    name: JoinLeave
    version: 1.1.0
    main: JoinLeave\Main
    api: [3.0.0, 4.0.0]
    author: GeistFan
    command:
    tjl:
    description: Testet ob JoinLeave aktiv ist.
    permission: JoinLeaveTest.cmd

    permissons:
    JoinLeaveTest.cmd:
    default: op
    description: Darf /tjl benutzen.
    -------------------------------------------------------------
    -GeistFan
     
  6. Primus

    Primus Zombie Pigman

    Messages:
    749
    YAML is space sensitive, by pasting it here it completely dismantled it. Next time try using code blocks or pastebin.

    The issue is that the command key must be in plural, check this example plugin https://github.com/pmmp/ExamplePlugin/blob/master/plugin.yml

    TL;DR add 's' to 'command' key
     
    minijaham likes this.
  7. GeistFan

    GeistFan Slime

    Messages:
    86
    GitHub:
    GeistFan
    Now the command says the message but when i use the command the server crash
    -GeistFan
     
  8. Primus

    Primus Zombie Pigman

    Messages:
    749
    Good, now it would be helpful if you posted here the crash message.
     
    minijaham likes this.
  9. GeistFan

    GeistFan Slime

    Messages:
    86
    GitHub:
    GeistFan
    PocketMine-MP Crash Dump Fri Mar 26 19:37:29 GMT 2021

    Error: Return value of JoinLeave\Main::eek:nCommand() must be of the type bool, none returned
    File: plugins/JoinLeave-1.1.1/src/JoinLeave/Main
    Line: 42
    Type: TypeError

    THIS CRASH WAS CAUSED BY A PLUGIN
    BAD PLUGIN: JoinLeave v1.1.1

    Code:
    [33] public function onCommand(CommandSender $sender, Command $cmd, string $label, array $args):bool
    [34] {
    [35] if($cmd->getName() === "tjl")
    [36] {
    [37] if($sender->hasPermission("JoinLeaveTest.cmd"))
    [38] {
    [39] $sender->sendMessage("JoinLeave ist Aktiv!");
    [40] }
    [41] }
    [42] }
    [43]
    [44] }

    Backtrace:
    #0 pmsrc/src/pocketmine/command/PluginCommand(54): JoinLeave\Main->onCommand(object pocketmine\command\ConsoleCommandSender, object pocketmine\command\PluginCommand, string[3] tjl, array[0])
    #1 pmsrc/src/pocketmine/command/SimpleCommandMap(248): pocketmine\command\PluginCommand->execute(object pocketmine\command\ConsoleCommandSender, string[3] tjl, array[0])
    #2 pmsrc/src/pocketmine/Server(1809): pocketmine\command\SimpleCommandMap->dispatch(object pocketmine\command\ConsoleCommandSender, string[3] tjl)
    #3 pmsrc/src/pocketmine/Server(1422): pocketmine\Server->dispatchCommand(object pocketmine\command\ConsoleCommandSender, string[3] tjl)
    #4 pmsrc/vendor/pocketmine/snooze/src/SleeperHandler(113): pocketmine\Server->pocketmine\{closure}()
    #5 pmsrc/vendor/pocketmine/snooze/src/SleeperHandler(75): pocketmine\snooze\SleeperHandler->processNotifications()
    #6 pmsrc/src/pocketmine/Server(2155): pocketmine\snooze\SleeperHandler->sleepUntil(double 1616787449.9529)
    #7 pmsrc/src/pocketmine/Server(1992): pocketmine\Server->tickProcessor()
    #8 pmsrc/src/pocketmine/Server(1586): pocketmine\Server->start()
    #9 pmsrc/src/pocketmine/PocketMine(291): pocketmine\Server->__construct(object BaseClassLoader, object pocketmine\utils\MainLogger, string[44] C:\Users\arese\Desktop\MineWars Test Server\, string[52] C:\Users\arese\Desktop\MineWars Test Server\plugins\)
    #10 pmsrc/src/pocketmine/PocketMine(321): pocketmine\server()
    #11 pmsrc(11): require(string[99] phar://C:/Users/arese/Desktop/MineWars Test Server/PocketMine-MP.phar/src/pocket)

    PocketMine-MP version: 3.18.0 [Protocol 428]
    Git commit: 3f6490626319152dca07a5c61a1e94f8d5793d56
    uname -a: Windows NT LAPTOP-ASN2539Q 10.0 build 18363 (Windows 10) AMD64
    PHP Version: 7.4.15
    Zend version: 3.4.0
    OS : WINNT, win
    Composer libraries:
    - adhocore/json-comment 0.1.0@8448076039389f558f39ad0553aab87db3f81614
    - daverandom/callback-validator unknown@unknown
    - pocketmine/binaryutils 0.1.13@0abee38d4e2861621f262c79a2a3d699d8a697f4
    - pocketmine/callback-validator 1.0.3@64787469766bcaa7e5885242e85c23c25e8c55a2
    - pocketmine/classloader 0.1.2@9757928424652393b178a3760073113aa7c9911b
    - pocketmine/log 0.2.1@830b44a2cf96ef703c550abe64302f230231ca49
    - pocketmine/log-pthreads 0.1.3@e477ecf6ec214fdd4415ea1da3fdd9d73bf699ea
    - pocketmine/math 0.2.6@43057cb8c179a9859677b496a788db922fd5cfc3
    - pocketmine/nbt 0.2.18@9f82ca4d7f97fcd9a566e44b63c4f18a7657ae82
    - pocketmine/pocketmine-mp 3.18.0@3f6490626319152dca07a5c61a1e94f8d5793d56
    - pocketmine/raklib 0.12.11@9cce458b8bfde3e4dfdbf70c659fc7b7fe26b5c4
    - pocketmine/snooze 0.1.5@70b5e7937a06878dd321a3182ceb76d56298f2cd
    - pocketmine/spl 0.4.2@6b08b7cf8c4afa17139c9a1b3bf1b408531de161

    Loaded plugins:
    DevTools 1.13.0 by PocketMine Team for API(s) 3.0.0
    JoinLeave 1.1.1 by GeistFan for API(s) 3.0.0, 4.0.0
     
  10. minijaham

    minijaham Skeleton

    Messages:
    801
    GitHub:
    minijaham
    You forgot return true; at the end of the oncommand function
     
    Rafmex and Primus like this.
  11. GeistFan

    GeistFan Slime

    Messages:
    86
    GitHub:
    GeistFan
    Thank you it perfect!!!!
     
    minijaham likes this.
  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.