Solved Abnormal plugin type error

Discussion in 'Plugin Development' started by Ilomiswir, Feb 5, 2017.

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

    Ilomiswir

    Hello im making a skyblock challenge plugin but i get an abnormal plugin type error

    this is the error:
    Code:
    [19:16:04 ERROR]: Could not load 'plugins\SkyBlockChallenges.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidPluginException: Abnormal plugin type
            at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:80) ~[spigot-1.11.2-R0.1-SNAPSHOT.jar:git-Spigot-6de2fbc-c1aa859]
            at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:129) ~[spigot-1.11.2-R0.1-SNAPSHOT.jar:git-Spigot-6de2fbc-c1aa859]
            at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:329) ~[spigot-1.11.2-R0.1-SNAPSHOT.jar:git-Spigot-6de2fbc-c1aa859]
            at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:251) [spigot-1.11.2-R0.1-SNAPSHOT.jar:git-Spigot-6de2fbc-c1aa859]
            at org.bukkit.craftbukkit.v1_11_R1.CraftServer.loadPlugins(CraftServer.java:301) [spigot-1.11.2-R0.1-SNAPSHOT.jar:git-Spigot-6de2fbc-c1aa859]
            at org.bukkit.craftbukkit.v1_11_R1.CraftServer.reload(CraftServer.java:748) [spigot-1.11.2-R0.1-SNAPSHOT.jar:git-Spigot-6de2fbc-c1aa859]
            at org.bukkit.Bukkit.reload(Bukkit.java:540) [spigot-1.11.2-R0.1-SNAPSHOT.jar:git-Spigot-6de2fbc-c1aa859]
            at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:25) [spigot-1.11.2-R0.1-SNAPSHOT.jar:git-Spigot-6de2fbc-c1aa859]
            at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141) [spigot-1.11.2-R0.1-SNAPSHOT.jar:git-Spigot-6de2fbc-c1aa859]
            at org.bukkit.craftbukkit.v1_11_R1.CraftServer.dispatchCommand(CraftServer.java:650) [spigot-1.11.2-R0.1-SNAPSHOT.jar:git-Spigot-6de2fbc-c1aa859]
            at org.bukkit.craftbukkit.v1_11_R1.CraftServer.dispatchServerCommand(CraftServer.java:636) [spigot-1.11.2-R0.1-SNAPSHOT.jar:git-Spigot-6de2fbc-c1aa859]
            at net.minecraft.server.v1_11_R1.DedicatedServer.aM(DedicatedServer.java:437) [spigot-1.11.2-R0.1-SNAPSHOT.jar:git-Spigot-6de2fbc-c1aa859]
            at net.minecraft.server.v1_11_R1.DedicatedServer.D(DedicatedServer.java:400) [spigot-1.11.2-R0.1-SNAPSHOT.jar:git-Spigot-6de2fbc-c1aa859]
            at net.minecraft.server.v1_11_R1.MinecraftServer.C(MinecraftServer.java:675) [spigot-1.11.2-R0.1-SNAPSHOT.jar:git-Spigot-6de2fbc-c1aa859]
            at net.minecraft.server.v1_11_R1.MinecraftServer.run(MinecraftServer.java:574) [spigot-1.11.2-R0.1-SNAPSHOT.jar:git-Spigot-6de2fbc-c1aa859]
            at java.lang.Thread.run(Unknown Source) [?:1.8.0_111]
    Caused by: java.lang.InstantiationException: me.IWM.AI.Main
            at java.lang.Class.newInstance(Unknown Source) ~[?:1.8.0_111]
            at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:76) ~[spigot-1.11.2-R0.1-SNAPSHOT.jar:git-Spigot-6de2fbc-c1aa859]
            ... 15 more
    Caused by: java.lang.NoSuchMethodException: me.IWM.AI.Main.<init>()
            at java.lang.Class.getConstructor0(Unknown Source) ~[?:1.8.0_111]
            at java.lang.Class.newInstance(Unknown Source) ~[?:1.8.0_111]
            at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:76) ~[spigot-1.11.2-R0.1-SNAPSHOT.jar:git-Spigot-6de2fbc-c1aa859]
            ... 15 more
    Main class:
    Code:
    package me.IWM.AI;
    import java.util.List;
    import java.util.logging.Logger;
    import org.bukkit.ChatColor;
    import org.bukkit.Material;
    import org.bukkit.enchantments.Enchantment;
    import org.bukkit.entity.Player;
    import org.bukkit.inventory.ItemStack;
    import org.bukkit.inventory.meta.ItemMeta;
    import org.bukkit.plugin.RegisteredServiceProvider;
    import org.bukkit.plugin.java.JavaPlugin;
    import me.IWM.AI.Easy.CobblestoneGenerator;
    import net.milkbowl.vault.economy.Economy;
    public class Main extends JavaPlugin{
         public static Economy econ = null;
         public String Prefix = ChatColor.GRAY+"["+ChatColor.GOLD+"CrownNetwork"+ChatColor.GRAY+"] ";
        
         @Override
        public void onEnable() {
            if (!setupEconomy() ) {
                Logger.getLogger("Minecraft").severe(String.format("[%s] - Disabled due to no Vault dependency found!", getDescription().getName()));
                getServer().getPluginManager().disablePlugin(this);
                return;
            
            }
        }
      
        @Override
        public void onDisable() {
          
        }
      
        private CobblestoneGenerator beta;
           public Main(CobblestoneGenerator beta) {
             this.beta = beta;
           }
          
      
        private boolean setupEconomy() {
            if (getServer().getPluginManager().getPlugin("Vault") == null) {
                return false;
            }
            RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
            if (rsp == null) {
                return false;
            }
            econ = rsp.getProvider();
            return econ != null;
        }
      
      
        public Boolean contains(Player p,Material m,int a) {
            if (p.getInventory().containsAtLeast(new ItemStack(m, 1), a)) {
                return true;
            }else{
                return false;
            }
        }
      
          
        public void am(Player p, Double a) {
            econ.depositPlayer(p, a);
            p.sendMessage(Prefix+ChatColor.DARK_GREEN+"$"+a);
        }
      
      
        public ItemStack gi(Material m,int a,String n) {
            ItemStack item = new ItemStack(m,a);
            ItemMeta meta = item.getItemMeta();
            meta.setDisplayName(n);
            item.setItemMeta(meta);
            return item;
          
        }
      
        public ItemStack al(ItemStack i,String lore) {
            ItemMeta meta = i.getItemMeta();
            List<String> lores = meta.getLore();
            lores.add(lore);
            meta.setLore(lores);
            i.setItemMeta(meta);
            return i;
        }
        public ItemStack ae(ItemStack i,Enchantment e,int h) {
            i.addUnsafeEnchantment(e, h);
            return i;
        }
      
      
        public void ri(Player p,Material m,int a) {
            ItemStack item = new ItemStack(m,a);
            p.getInventory().remove(item);
        }
      
    }
     
  2. Offline

    mehboss

    Plugin.yml please.
     
  3. Offline

    Ilomiswir

    main : me.IWM.AI.Main
    name: AcidIslandChallenges
    version: 1.0
    author: [Ilomiswir]
     
  4. Offline

    ipodtouch0218

    It may have something to do with your constructor.
    Code:
           public Main(CobblestoneGenerator beta) {
             this.beta = beta;
           }
    
    Try removing that and see if it will work.
     
  5. Offline

    Ilomiswir

    now it works but how can i make the constructor working?
     
  6. Offline

    ipodtouch0218

    @Ilomiswir
    Well, what is the "CobblestoneGenerator" class? Use different classes, make a "CobbleGenHandler" class or something of the sort.

    Where are you getting the instance of the CobblestoneGenerator?

    EDIT: If you truly do want the cobblestone generator instance in your class, create a new CobblestoneGenerator() and save that instead of having it passed through a constructor, or use a getter from the CobblestoneGenerator class
     
  7. Offline

    Ilomiswir

    in the cobblestonegenerator class is a public void who checks of you can complete the challenge and give you your items/money

    what do you mean with a "new cobblestonegenerator()"?
     
  8. Offline

    Zombie_Striker

    @Ilomiswir
    You can not create a constructor for the main class. How can bukkit ever create that CobbleStoneGenerator without knowing that your plugin needs one? Not only that, but how could it possibly get the instance if it is only in your plugin. Remove the constructor and move the code to the onEnable.
     
  9. Offline

    Ilomiswir

    what do i need to move to the onenable?
    this?
    public Main(CobblestoneGenerator beta) {
    this.beta = beta;
    }
     
  10. Offline

    Zombie_Striker

    @Ilomiswir
    [Edit] You don't actually need to move anything. Delete the whole constructor and add this line to the onEnable
    Code:
    this.beta = new =CobblestoneGenerator();
     
  11. Offline

    Ilomiswir

    thx it worked
     
Thread Status:
Not open for further replies.

Share This Page