I need help with my abnormal plugin type error

Discussion in 'Plugin Development' started by jesus christo, Aug 26, 2020.

Thread Status:
Not open for further replies.
  1. Offline

    jesus christo

    Hi so I'm coding a plugin where a random potion effect is given and the code is this:
    Code:
    package me.goldk.max;
    
    
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.player.PlayerJoinEvent;
    import org.bukkit.potion.PotionEffect;
    import org.bukkit.potion.PotionEffectType;
    import java.util.Random;
    import org.bukkit.plugin.java.JavaPlugin;
    import org.bukkit.event.Listener;
    
    
    
    public class Main extends JavaPlugin implements Listener {
       
    public Main (Main plugin) {                       
    }
    
    
        @EventHandler
    public void onPlayerJoin(PlayerJoinEvent event) {
            Player player =  (Player) event.getPlayer();
            Random rand = new Random();
              int chance = 1;
              if (chance == 0)
              {
            player.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 60, 1));
    
              }
              else if (chance == 1)
              {
                  player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 60, 1)); 
              }
              return;
    }
    }


    but when I put the jar file into my spigot server pro server I got an error that says this:


    Code:
    Could not load 'plugins/max.jar' in folder 'plugins'
    
    org.bukkit.plugin.InvalidPluginException: Abnormal plugin type
    
    at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:80) ~[spigot-1.16.2.jar:git-Spigot-b5a13e6-0491200]
    
    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:135) ~[spigot-1.16.2.jar:git-Spigot-b5a13e6-0491200]
    
    at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:394) ~[spigot-1.16.2.jar:git-Spigot-b5a13e6-0491200]
    
    at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:301) ~[spigot-1.16.2.jar:git-Spigot-b5a13e6-0491200]
    
    at org.bukkit.craftbukkit.v1_16_R2.CraftServer.loadPlugins(CraftServer.java:381) ~[spigot-1.16.2.jar:git-Spigot-b5a13e6-0491200]
    
    at net.minecraft.server.v1_16_R2.DedicatedServer.init(DedicatedServer.java:186) ~[spigot-1.16.2.jar:git-Spigot-b5a13e6-0491200]
    
    at net.minecraft.server.v1_16_R2.MinecraftServer.w(MinecraftServer.java:808) ~[spigot-1.16.2.jar:git-Spigot-b5a13e6-0491200]
    
    at net.minecraft.server.v1_16_R2.MinecraftServer.lambda$0(MinecraftServer.java:164) ~[spigot-1.16.2.jar:git-Spigot-b5a13e6-0491200]
    
    at java.lang.Thread.run(Thread.java:748) [?:1.8.0_212]
    
    Caused by: java.lang.InstantiationException: me.goldk.max.Main
    
    at java.lang.Class.newInstance(Class.java:427) ~[?:1.8.0_212]
    
    at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:76) ~[spigot-1.16.2.jar:git-Spigot-b5a13e6-0491200]
    
    ... 8 more
    
    Caused by: java.lang.NoSuchMethodException: me.goldk.max.Main.<init>()
    
    at java.lang.Class.getConstructor0(Class.java:3082) ~[?:1.8.0_212]
    
    at java.lang.Class.newInstance(Class.java:412) ~[?:1.8.0_212]
    
    at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:76) ~[spigot-1.16.2.jar:git-Spigot-b5a13e6-0491200]
    
    ... 8 more
    
    
    does anyone know how to help? if you can that would be greatly appriciated
     
    Last edited by a moderator: Aug 26, 2020
  2. Offline

    timtower Administrator Administrator Moderator

  3. Offline

    jesus christo

    @timtower I am really dumb and I'm sorry for bothering you but what is the constructor
     
  4. Offline

    timtower Administrator Administrator Moderator

  5. Offline

    Kars

    Your (only) constructor requires an instance of itself, which is interesting lol.

    But a constructor is unnecessary here so do as tim said.
     
Thread Status:
Not open for further replies.

Share This Page