Hello everyone. I am trying to make my first plugin an am having some issues. The plugin is called "Clans" and is basically a modified fork of FactionsPro, in witch I am modifying to where the "factions" are called "clans" and the main command is "/c" instead of "/f". (I want my first plugin to be simple of course.) However, when I tested the plugin, the server crashed and I got a crash dump. When I submitted the crash dump at http://pmt.mcpe.me/, it gave error code, containing "ClassNotFoundException". So I was wondering if some more experienced plugin developers could please help me with this.
ClassNotFoundException -> (a) Class (has) Not (been) Found -> A class hasn't been found -> Somewhere in your code, you are using an unknown class. -> Send us your code.
I seem to have some problems downloading files from this site on mobile, so I can't check it. But remember: 1. Your files must be placed in the src directory according to PSR-0 standards. 2. Check your cases, in case your plugin is run on a case sensitive filesystem. 3. Correct imports?
I thought it was what was supposed to go there. But I found out it wasn't. This is my current plugin.yml. PHP: name: Clansauthor: Edwardthedog2description: A plugin for giving your server a clans system.version: 1.0.0main: Clans\Mainapi: [1.12.0]commands: c: description: use /c help for all commands permission: c.commandpermissions: f.command: default: true description: "Allow use of all clan commands" f.override: default: op description: "Allows op users to override clans"
Create a new folder called "Clans" in src folder and move everything in the src folder into the "Clans" folder in your plugin.yml, change Code: main: Clans\Main to Code: main: Clans\ClanMain
Make sure you're declaring the right class in your PHP file... BTW, I suggest you learn PHP and the PocketMine API before you start making a plugin like this.
Make your file into a zip, submit it to http://pmt.mcpe.me with all three inspections at the bottom enabled and see the results.
Okay, done. The "Bad Practice" and "Syntax Errors" inspections passed, but the " Classpath" inspection returned an error that says " Main class file expected at src/Clans/ClanMain.php but it is not a file"
Because it is src, not scr. It means source. Remember this lesson. You will keep facing conditions like this in the future, like reading "a"s as "u"s.
Like I said earlier, make sure you have it pointing to the right class. How it should go: PluginFoler(folder) -> plugin.yml & src -> Clans\Main.php And in the plugin.yml file make sure you have it set like: Code: main: Clans\Main
Awesome now the plugin doesn't crash the server. However even though it has /c in the help menu when I type "/c" (the plugins main command) it doesn't do anything. Plus this appears in the console when I first start the server. Code: [15:30:00] [Server thread/NOTICE]: InvalidArgumentException: "Argument 1 passed to Clans\ClanListener::__construct() must be an instance of Clans\ClanMain, instance of Clans\Main given, called in phar://C:/Users/edwar/Desktop/PocketMine-MP/plugins/ClansBuild19.phar/src/Clans/Main.php on line 49 and defined" (E_RECOVERABLE_ERROR) in "/ClansBuild19.phar/src/Clans/ClanListener" at line 27