Solved Plugin failing to enable...

Discussion in 'Spigot Plugin Development' started by DecisionsYT, May 22, 2016.

Thread Status:
Not open for further replies.
  1. Hey!

    I've just set out a template for my kits plugin. When restarting my server, the plugin doesn't start up. I don't see any errors in my code.

    CODE:

    Code (Text):
    package me.DecisionsYT.UberKits;

    import java.util.Arrays;

    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.Material;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.inventory.Inventory;
    import org.bukkit.inventory.ItemStack;
    import org.bukkit.inventory.meta.ItemMeta;
    import org.bukkit.plugin.java.JavaPlugin;

    public class Main extends JavaPlugin {
       
       
      public void onEnable() {
          saveDefaultConfig();
          Bukkit.getServer().getConsoleSender().sendMessage("§b§lUberKits has been enabled!");
      }

      public void onDisable() {
          Bukkit.getServer().getConsoleSender().sendMessage("§b§lUberKits has been disabled!");
      }
     
     
      Inventory inv = Bukkit.createInventory(null, getConfig().getInt("GUI-Rows"), ChatColor.translateAlternateColorCodes('&', getConfig().getString("GUI-Name")));
      Material Kit1 = Material.getMaterial(getConfig().getString("Kit1-Material"));
      Material Kit2 = Material.getMaterial(getConfig().getString("Kit2-Material"));
             
              public boolean onCommand(CommandSender sender, Command cmd, String Label, String[] args) {
                Player player = (Player) sender;
                 
                  if (cmd.getName().equalsIgnoreCase("Kits")) {
                      if (player.hasPermission("UberKits.GUI")) {
                         
                          ItemStack kit1 = new ItemStack(Kit1, getConfig().getInt("Kit1-Amount"));
                          ItemMeta kit1meta = kit1.getItemMeta();
                          kit1meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', getConfig().getString("Kit1-Name")));
                          kit1meta.setLore(Arrays.asList(new String[] { ChatColor.translateAlternateColorCodes('&', getConfig().getString("Kit1-Lore")) }));
                          kit1.setItemMeta(kit1meta);
                         
                          ItemStack kit2 = new ItemStack(Kit2, getConfig().getInt("Kit2-Amount"));
                          ItemMeta kit2meta = kit1.getItemMeta();
                          kit2meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', getConfig().getString("Kit2-Name")));
                          kit2meta.setLore(Arrays.asList(new String[] { ChatColor.translateAlternateColorCodes('&', getConfig().getString("Kit2-Lore")) }));
                          kit2.setItemMeta(kit2meta);
                         
                          inv.setItem(getConfig().getInt("Kit1-Slot"), kit1);
                          inv.setItem(getConfig().getInt("Kit2-Slot"), kit2);
                          player.openInventory(inv);
                      }
                  }
                 
                 
                 
                  return true;
         
      }
    }
    PLUGIN.YML:

    Code (Text):
    name: UberKits
    main: me.DecisionsYT.UberKits.Main
    version: 1.0
    author: DecisionsYT
    commands:
       Kits:
          description: Opens the UberKits GUI.
          usage: /<command>
     
  2. Any error in console?
     
  3. As stated above, please provide stacktrace (all the error on plugin load)
     
  4. Nope, nothing loads at all.
     
  5. There is none xD
     
  6. tf, so nothing happens, what so ever?

    Is the plugin even in your server xD
     
  7. Put entire stacktrace. From when the server starts to when the server closes.
     
    • Agree Agree x 1
  8. Got it working. Just messed with random stuff xD
     
    • Funny Funny x 1
Thread Status:
Not open for further replies.