org.bukkit.plugin.InvalidPluginException: Abnormal plugin type

Solution for org.bukkit.plugin.InvalidPluginException: Abnormal plugin type
is Given Below:

——————————————————————————————————————————————

I try to code my first plugin, and it’s not working, someone help me please. I’m using i use Spigot 1.17.1 to make the plugin, and i run on PaperMC 1.17.1.

——————————————————————————————————————————————

Server message

org.bukkit.plugin.InvalidPluginException: Abnormal plugin type
        at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:87) ~[patched_1.17.1.jar:git-Paper-100]
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:153) ~[patched_1.17.1.jar:git-Paper-100]
        at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:414) ~[patched_1.17.1.jar:git-Paper-100]
        at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:322) ~[patched_1.17.1.jar:git-Paper-100]
        at org.bukkit.craftbukkit.v1_17_R1.CraftServer.loadPlugins(CraftServer.java:393) ~[patched_1.17.1.jar:git-Paper-100]
        at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:276) ~[patched_1.17.1.jar:git-Paper-100]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1126) ~[patched_1.17.1.jar:git-Paper-100]
        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:316) ~[patched_1.17.1.jar:git-Paper-100]
        at java.lang.Thread.run(Thread.java:831) [?:?]
Caused by: java.lang.InstantiationException: me.sakuraidev.main
        at java.lang.Class.newInstance(Class.java:636) ~[?:?]
        at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:83) ~[patched_1.17.1.jar:git-Paper-100]
        ... 8 more
Caused by: java.lang.NoSuchMethodException: me.sakuraidev.main.<init>()
        at java.lang.Class.getConstructor0(Class.java:3517) ~[?:?]
        at java.lang.Class.newInstance(Class.java:623) ~[?:?]
        at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:83) ~[patched_1.17.1.jar:git-Paper-100]
        ... 8 more

My code

package me.sakuraidev;

import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;

public class main extends JavaPlugin implements CommandExecutor{
    @SuppressWarnings("unused")
    private main Plugin;
    public main(main Plugin) {
        this.Plugin = Plugin;
        Plugin.getCommand("hello").setExecutor(this);
    }
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        if (!(sender instanceof Player)) {
            sender.sendMessage("Sorry, only players can run this command");
            return true;
        }
        Player p = (Player) sender;
        
        if(p.hasPermission("hello.use")) {
            sender.sendMessage("hi");
        } else {
            sender.sendMessage("Sorry, but you don't have permission to use this command");
        }
        return false;
    }
}

plugin.yml

main: me.sakuraidev.main
name: plugin
version: '1.0'
description: A plugin
author: SakuraiDev
commands:
  hello:
   description: Hello Command
   permission: hello.use
   permission-message: You do not have permission!
permissions:
  hello.use:
   description: Allows use hello
   default: op

——————————————————————————————————————————————

if necessery, here is the download link
https://file.io/IXD3wqBZ6VJh

——————————————————————————————————————————————

The Bukkit API doesn’t take constructor methods. Try changing the main method to @Override and named “onEnable”. Your main.java should look like this:

package me.sakuraidev;

import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;

public class main extends JavaPlugin implements CommandExecutor{
    @SuppressWarnings("unused")
    private main Plugin;
    @Override
    public void onEnable(main Plugin) {
        this.Plugin = Plugin;
        Plugin.getCommand("hello").setExecutor(this);
    }
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        if (!(sender instanceof Player)) {
            sender.sendMessage("Sorry, only players can run this command");
            return true;
        }
        Player p = (Player) sender;
        
        if(p.hasPermission("hello.use")) {
            sender.sendMessage("hi");
        } else {
            sender.sendMessage("Sorry, but you don't have permission to use this command");
        }
        return false;
    }
} 

Hope that helped 🙂