Can't find main class

Discussion in 'Spigot Plugin Development' started by OliverBZ, Feb 14, 2018.

  1. So when i start up my server i get a error with
    Could not load 'plugins\Gang2.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidPluginException: Cannot find main class `com.Stausi.bande.Main'
    at org.bukkit.plugin.java.PluginClassLoader.

    /* */ package com.Stausi.bande;
    /* */
    /* */ import com.Stausi.bande.Chat.BandeChat;
    /* */ import com.Stausi.bande.Chat.Prefix;
    /* */ import com.Stausi.bande.Commands.Bande;
    /* */ import com.Stausi.bande.Commands.BandeUtils;
    /* */ import com.Stausi.bande.Configs.Config;
    /* */ import com.Stausi.bande.Events.ClickEvent;
    /* */ import com.Stausi.bande.Events.PlayerHitEvent;
    /* */ import com.Stausi.bande.Events.PlayerJoin;
    /* */ import com.Stausi.bande.Events.PlayerKillEvent;
    /* */ import com.Stausi.bande.LevelSystem.KillDelaySystem;
    /* */ import com.Stausi.bande.LevelSystem.PromoteClass;
    /* */ import com.Stausi.bande.PlaceHolder.PlaceHolders;
    /* */ import com.Stausi.bande.Players.Users;
    /* */ import com.Stausi.bande.Ranks.Ranks;
    /* */ import com.Stausi.bande.Utils.BandeLists;
    /* */ import com.Stausi.bande.Utils.Create;
    /* */ import com.Stausi.bande.Utils.Delete;
    /* */ import com.Stausi.bande.Utils.Info;
    /* */ import com.Stausi.bande.Utils.Invites;
    /* */ import com.Stausi.bande.Utils.LaunchFireworks;
    /* */ import com.Stausi.bande.Utils.Prices;
    /* */ import com.Stausi.bande.Utils.SetInfo;
    /* */ import com.Stausi.bande.Vaults.VaultsUtils;
    /* */ import java.io.File;
    /* */ import java.util.HashMap;
    /* */ import java.util.logging.Logger;
    /* */ import net.milkbowl.vault.economy.Economy;
    /* */ import org.bukkit.Bukkit;
    /* */ import org.bukkit.Server;
    /* */ import org.bukkit.command.PluginCommand;
    /* */ import org.bukkit.configuration.file.YamlConfiguration;
    /* */ import org.bukkit.plugin.PluginDescriptionFile;
    /* */ import org.bukkit.plugin.PluginManager;
    /* */ import org.bukkit.plugin.RegisteredServiceProvider;
    /* */ import org.bukkit.plugin.ServicesManager;
    /* */ import org.bukkit.plugin.java.JavaPlugin;
    /* */
    /* */ public class Main extends JavaPlugin
    /* */ {
    /* 43 */ public String ConsolePrefix = "[Gang] ";
    /* 44 */ public String prefix = "§7[§bGang§7] §7➯ §f";
    /* */
    /* 46 */ private static final Logger log = Logger.getLogger("Minecraft");
    /* 47 */ public Economy econ = null;
    /* */
    /* */ public void onEnable()
    /* */ {
    /* 51 */ if (!setupEconomy()) {
    /* 52 */ log.severe(String.format("[%s] - Disabled due to no Vault dependency found!", new Object[] { getDescription().getName() }));
    /* 53 */ getServer().getPluginManager().disablePlugin(this);
    /* 54 */ return;
    /* */ }
    /* */
    /* 57 */ new Config(this);
    /* 58 */ new PlayerJoin(this);
    /* 59 */ new PlayerKillEvent(this);
    /* 60 */ new ClickEvent(this);
    /* 61 */ new Create(this);
    /* 62 */ new Delete(this);
    /* 63 */ new Bande(this);
    /* 64 */ new BandeUtils(this);
    /* 65 */ new BandeChat(this);
    /* 66 */ new Users(this);
    /* 67 */ new BandeLists(this);
    /* 68 */ new Info(this);
    /* 69 */ new Ranks(this);
    /* 70 */ new SetInfo(this);
    /* 71 */ new Invites(this);
    /* 72 */ new VaultsUtils(this);
    /* 73 */ new Prices();
    /* 74 */ new KillDelaySystem(this);
    /* 75 */ new PromoteClass(this);
    /* 76 */ new LaunchFireworks(this);
    /* 77 */ new Prefix(this);
    /* */
    /* 79 */ Config.configFile = new File(getDataFolder(), "config.yml");
    /* 80 */ Config.pricesFile = new File(getDataFolder(), "prices.yml");
    /* 81 */ Config.levelFile = new File(getDataFolder(), "level.yml");
    /* 82 */ Config.shopFile = new File(getDataFolder(), "shop.yml");
    /* */
    /* 84 */ Invites.targetPlayer = new HashMap();
    /* 85 */ Invites.cooldownTime = new HashMap();
    /* 86 */ KillDelaySystem.targetPlayers = new HashMap();
    /* 87 */ KillDelaySystem.CooldownPlayer = new HashMap();
    /* 88 */ Create.chatPlayer = new HashMap();
    /* 89 */ ClickEvent.invitePlayer = new HashMap();
    /* 90 */ ClickEvent.names = new HashMap();
    /* 91 */ ClickEvent.desposit = new HashMap();
    /* 92 */ ClickEvent.renameRank = new HashMap();
    /* */ try
    /* */ {
    /* 95 */ Config.firstRun();
    /* */ } catch (Exception e) {
    /* 97 */ e.printStackTrace();
    /* */ }
    /* */
    /* 100 */ Config.config = new YamlConfiguration();
    /* 101 */ Config.prices = new YamlConfiguration();
    /* 102 */ Config.level = new YamlConfiguration();
    /* 103 */ Config.Shop = new YamlConfiguration();
    /* 104 */ Config.loadYamls();
    /* */
    /* 106 */ PluginManager pm = Bukkit.getPluginManager();
    /* 107 */ pm.registerEvents(new PlayerJoin(this), this);
    /* 108 */ pm.registerEvents(new PlayerKillEvent(this), this);
    /* 109 */ pm.registerEvents(new ClickEvent(this), this);
    /* 110 */ pm.registerEvents(new Prefix(this), this);
    /* 111 */ pm.registerEvents(new PlayerHitEvent(), this);
    /* */
    /* 113 */ getCommand("Gang").setExecutor(new Bande(this));
    /* 114 */ getCommand("GangChat").setExecutor(new Bande(this));
    /* */
    /* 116 */ if (Bukkit.getServer().getPluginManager().isPluginEnabled("MVdWPlaceholderAPI")) {
    /* 117 */ new PlaceHolders(this);
    /* 118 */ PlaceHolders.getPlacerHolder();
    /* */ }
    /* */ }
    /* */
    /* */ private boolean setupEconomy() {
    /* 123 */ if (getServer().getPluginManager().getPlugin("Vault") == null) {
    /* 124 */ return false;
    /* */ }
    /* 126 */ RegisteredServiceProvider rsp = getServer().getServicesManager().getRegistration(Economy.class);
    /* 127 */ if (rsp == null) {
    /* 128 */ return false;
    /* */ }
    /* 130 */ this.econ = ((Economy)rsp.getProvider());
    /* 131 */ return this.econ != null;
    /* */ }
    /* */ }

    name: Gang
    version: 1.0
    main: com.Stausi.bande.Main
    description: Gang
    author: DKProductions
    depend: [Vault]
    softdepend: [PermissionsEx, MVdWPlaceholderAPI]

    commands:
    Gang:
    usage: /<command>
    description: Gang commands.
    GangChat:
    usage: /<command>
    aliases: [gc]
    description: Send Gang messages.
     
  2. Try opening the jar with winrar/7zip, see if the file gets compiled and put in the right place. The spelling of the package/class seems fine, so a broken export would be the most logical.
    Also, whats with the comments before each line?


    And just in case, are you properly restarting your server for testing or are you just reloading it?
     
    • Agree Agree x 1
  3. Newhttps://gyazo.com/7d11d7b2cbae063e14515f6f983988e1 This is how i export the Plugin.
     
  4. Yeah i changed the name is that a problem?
     
  5. Well, if you kept the old jar in your plugins folder or if youre not completely shutting down the server, yes
     
  6. I completely shut down the server
     
  7. And did you look if the class was put in the .jar correctly?
     
    • Like Like x 1
  8. And how do i do that?
     
  9. As @Proximyst said, its not being compiled, there are probably some warnings/errors that eclipse gives.

    .java files are raw uncompiled sourcecodes, anything in your jar should be a .class.
    Its probably because youre trying to recompile something, stuff like that happens because decompiling is not flawless and will create some useless code that wont compile 99% of the time.
     
  10. I get a error when i'm exporting one with Manifest or something like that.. ?
     
  11. You shouldnt even be doing anything with a manifest... The plugin.jar replaces the function of a manifest, you shouldnt be making a manifest for plugins afaik
     
  12. I deleted it but its still not working, and yes i'm recompiling something with permissions because i wanted the plugin in a different language, But he said its your own problem if there will come some errors.
     
  13. fuck knows with eclipse, try to use a proper build tool such as maven or gradle
     

Share This Page