what would be the cause of a org.bukkit.plugin.InvalidPluginException: java.lang.NoSuchMethodException: plugins.plugin.<init>() i'm getting one and i have no clue what it means A) i want to know the cause. B)thanks in advance C) no code. i want to know the cause.
4:10:52 PM [SEVERE] Could not load 'plugins\plugin.jar in folder 'plugins' 4:10:52 PM org.bukkit.plugin.InvalidPluginException: java.lang.NoSuchMethodException: plugins.plugin.<init>() 4:10:52 PM at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:184) 4:10:52 PM at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:305) 4:10:52 PM at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:230) 4:10:52 PM at org.bukkit.craftbukkit.v1_6_R2.CraftServer.loadPlugins(CraftServer.java:239) 4:10:52 PM at org.bukkit.craftbukkit.v1_6_R2.CraftServer.<init>(CraftServer.java:217) 4:10:53 PM at net.minecraft.server.v1_6_R2.PlayerList.<init>(PlayerList.java:56) 4:10:53 PM at net.minecraft.server.v1_6_R2.DedicatedPlayerList.<init>(SourceFile:11) 4:10:53 PM at net.minecraft.server.v1_6_R2.DedicatedServer.init(DedicatedServer.java:106) 4:10:53 PM at net.minecraft.server.v1_6_R2.MinecraftServer.run(MinecraftServer.java:391) 4:10:53 PM at net.minecraft.server.v1_6_R2.ThreadServerApplication.run(SourceFile:582) 4:10:53 PM Caused by: java.lang.NoSuchMethodException: plugins.plugin.<init>() 4:10:53 PM at java.lang.Class.getConstructor0(Unknown Source) 4:10:53 PM at java.lang.Class.getConstructor(Unknown Source) 4:10:53 PM at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:176)
Well, obviously it means it doesn't have a constructor. But i don't see why that wouldn't allow a plugin to load. Although i think i saw this error a while ago on these forums. I don't even know why it wants a constructor. Unless you have a private constructor and it cant load it but that would cause an IllegalAccessException. My guess is as good as your's tbh xD.
code: Code:java package plugins.MDFix; import java.util.ArrayList;import java.util.logging.Logger; import me.drakespirit.plugins.moneydrop.MoneyDrop;import me.drakespirit.plugins.moneydrop.events.MoneyDropEvent; import org.bukkit.Location;import org.bukkit.command.Command;import org.bukkit.command.CommandSender;import org.bukkit.entity.EntityType;import org.bukkit.entity.Player;import org.bukkit.event.Listener;import org.bukkit.event.entity.CreatureSpawnEvent;import org.bukkit.event.entity.EntityDeathEvent;import org.bukkit.plugin.java.JavaPlugin; class fix extends JavaPlugin implements Listener { protected static fix instance; protected static ArrayList<Long> tracker = new ArrayList<Long>(); //you can configure this. higher = more lag. less = less of a chance of finding a grinder. private static final int loghist = 10; //you can configure this. search radius for players. won't affect lag. more = higher chance of catching innocent players. //less = less chance of finding guilty players. private static final int radius = 2; protected static ArrayList<String> revokedPlayers = new ArrayList<String>(); protected static ArrayList<Location> Ltrack = new ArrayList<Location>(); protected static short[] LtrackS = new short[loghist]; private static int trackindex = 0; protected static Logger log = Logger.getLogger("Minecraft"); protected static MoneyDrop min; @Override public void onEnable() { getServer().getPluginManager().registerEvents(this, this); for (int x = 0; x < LtrackS.length; x++) { LtrackS[x] = 0; } } public boolean onCommand(CommandSender SND, Command CMD, String CMDLabel, String[] args) {return false;} public void onDisable() { } // add creature to list on spawn public void CSE(CreatureSpawnEvent e) { for (int x = -5; x < 6; x++) { for (int y = -5; y < 6; y++) { for (int z = -5; z < 6; z++) { if (e.getEntity() .getWorld() .getBlockAt( e.getEntity().getLocation().getBlockX() + x, e.getEntity().getLocation().getBlockY() + y, e.getEntity().getLocation().getBlockZ() + z) .getTypeId() == 52) { // only check for vanilla spawners tracker.add(e.getEntity().getUniqueId().node()); } } } } } public void EDE(EntityDeathEvent e) { int index = -1; if(e.getEntityType().equals(EntityType.PLAYER)){// if the killer is not a player we won't go thru this hoopla. Player p = (Player) e.getEntity(); for (int i = 0; i < Ltrack.size(); i++) {// tracker itreator // IF Add if (getL(e.getEntity().getLocation().getBlockX(), Ltrack.get(i).getBlockX()) <= radius) { if (getL(e.getEntity().getLocation().getBlockY(), Ltrack.get(i).getBlockY()) <= radius) { if (getL(e.getEntity().getLocation().getBlockZ(), Ltrack.get(i).getBlockZ()) <= radius) { index = i; LtrackS[i]++;// found a match!!!!! now we break &check break; } } } // IF Add end } if (index != -1) { if (LtrackS[index] == 3) {// if we hit the same location 3 times p.sendMessage("[BugFix] Spawners aren't made to give money, please stop"); p.sendMessage("[BugFix] warning level: 1/3"); } if(LtrackS[index] == 5){ p.sendMessage("[BugFix] warning level: 2/3"); } if(LtrackS[index] == 6){ p.sendMessage("[BugFix] warning level: 3/3. moneydrop privilages revoked until next restart."); revokedPlayers.add(p.getDisplayName()); } } else {// if we didn't hit that location Ltrack.set(trackindex, e.getEntity().getLocation()); } }// we want to add indexes in not an infinite series. if(trackindex == loghist - 1){ trackindex = 0; }else { trackindex++; } } private int getL(int blockX, int blockX2) {// simple distance value return Math.abs(Math.abs(blockX) - Math.abs(blockX2)); } public void MDE(MoneyDropEvent e) {// when money is dropped if (tracker.contains(e.getEntity().getUniqueId().node())) { e.setCancelled(true); return; } Player p = (Player) e.getEntity(); if(revokedPlayers.contains(p.getDisplayName())){ e.setCancelled(true); } } }[/i]
Does your plugin.yml properly point to your main class? Meanwhile: Your class name should start with a capital letter and be more descriptive Your variable "instance" has no purpose; use "this" instead. You need to mark your event methods as EventHandlers with @EventHandler(priority = EventPriority.<some priority>, ignoreCancelled = true) see http://forums.bukkit.org/threads/getting-your-priorities-straight-the-plugin-version.788/ for choosing a priority You want PlayerDeathEvent, not EntityDeathEvent More names: loghist -> logHistory or logHist trackindex -> trackIndex CSE -> onCreatureSpawn EDE -> onPlayerDeath everything with L -> whatever L stands for (I certainly can't tell)
Your problem might be similar to this: https://forums.bukkit.org/threads/solved-nosuchmethoderror.69864/
the instance varible is static, and can be used statically across my classes I will look into event priority, but as of now it is irrellevant no, i want entity death event. as in when a creature dies. all below yes, I get that my naming is vague, but it doesn't mave the method istelf any harder to understand. post under him: I tried making a whole new project but i get the same exact stacktrace as above ( with adjusted names for my classes)