Need a little help

Discussion in 'Plugin Development' started by CheifKeef, Jun 9, 2014.

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

    CheifKeef

    So once i finished this plugin i got this error:

    Could not load 'plugins/Weed.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml

    at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:150) ~[craftbukkit.jar:git-Bukkit-1.7.2-R0.3-28-g05dc94e-b3055jnks

    Anyway heres my lines of code:

    package me.Yongblood11.Weed;

    import java.util.logging.Logger;

    import org.bukkit.ChatColor;
    import org.bukkit.Material;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.block.Action;
    import org.bukkit.event.player.PlayerInteractEvent;
    import org.bukkit.plugin.java.JavaPlugin;
    import org.bukkit.potion.PotionEffectType;

    public class Weed extends JavaPlugin implements Listener{
    Logger log = Logger.getLogger("Minecraft");

    public void onEnable() {
    getServer().getPluginManager().registerEvents(this, this);
    }

    @EventHandler
    public void onPlayerInteract(PlayerInteractEvent e){
    Player player = e.getPlayer();

    if(e.getAction() == Action.RIGHT_CLICK_BLOCK && e.getClickedBlock().getType() == Material.CACTUS){
    player.addPotionEffect(PotionEffectType.CONFUSION.createEffect(1200, 4));

    player.sendMessage(ChatColor.GOLD + "You've smoked grade A kush");

    }
    }

    }



    Heres my plugin.yml:

    name: Weed
    main: me.Yongblood11.Weed
    version: 1.0
    description: >
    Smoke dat kush boi.
    commands: >
    None

    I am really new to coding so i don't know how to fix this error thought it states in the error something wrong with plugin.yml
     
  2. Offline

    MineCrashKoen

    After your package you need to add .MAINCLASS

    so if the package name is: me.MineCrashKoen.Test
    and my main class is called: MainTest

    The main in the plugin.yml needs to be: me.MineCrashKoen.Test.MainTest

    Now try fixing it :)
     
    SpongyBacon likes this.
  3. Offline

    CheifKeef

    I don't know if i did this right but I'm still getting the error:

    name: Weed
    main: me.Yongblood11.Weed.MainWeed
    version: 1.0
    description: >
    Smoke dat kush boi.
    commands: >
    None
    MineCrashKoen
     
  4. Offline

    teej107

    CheifKeef main: is the location of your JavaPlugin. It'll be the package of where your JavaPlugin is + class name of your JavaPlugin. I don't see a JavaPlugin in your code named MainWeed.

    Edit: Read this.
     
  5. Offline

    99storm2

    That should work good!
    Plugin.yml:
    name: Weed
    main: me.Yongblood11.Weed.Weed
    version: 1.0
    description: Smoke dat kush boi.
     
  6. Offline

    CheifKeef

    99storm2 teej107 MineCrashKoen Alright I used 99storm2's method and it didn't work either this is the error:
    [15:33:11 ERROR]: Could not load 'plugins/Weed.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml
    at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:150) ~[craftbukkit.jar:git-Bukkit-1.7.2-R0.3-28-g05dc94e-b3055jnks]
    at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:133) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-28-g05dc94e-b3055jnks]
    at org.bukkit.craftbukkit.v1_7_R3.CraftServer.loadPlugins(CraftServer.java:357) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-28-g05dc94e-b3055jnks]
    at org.bukkit.craftbukkit.v1_7_R3.CraftServer.<init>(CraftServer.java:319) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-28-g05dc94e-b3055jnks]
    at net.minecraft.server.v1_7_R3.PlayerList.<init>(PlayerList.java:68) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-28-g05dc94e-b3055jnks]
    at net.minecraft.server.v1_7_R3.DedicatedPlayerList.<init>(SourceFile:14) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-28-g05dc94e-b3055jnks]
    at net.minecraft.server.v1_7_R3.DedicatedServer.init(DedicatedServer.java:126) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-28-g05dc94e-b3055jnks]
    at net.minecraft.server.v1_7_R3.MinecraftServer.run(MinecraftServer.java:436) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-28-g05dc94e-b3055jnks]
    at net.minecraft.server.v1_7_R3.ThreadServerApplication.run(SourceFile:628) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-28-g05dc94e-b3055jnks]
    Caused by: java.io.FileNotFoundException: Jar does not contain plugin.yml

    ... 9 more

    Heres my line of code:
    package me.Yongblood11.Weed;

    import java.util.logging.Logger;

    import org.bukkit.ChatColor;
    import org.bukkit.Material;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.block.Action;
    import org.bukkit.event.player.PlayerInteractEvent;
    import org.bukkit.plugin.java.JavaPlugin;
    import org.bukkit.potion.PotionEffectType;

    public class Weed extends JavaPlugin implements Listener{
    Logger log = Logger.getLogger("Minecraft");

    public void onEnable() {
    getServer().getPluginManager().registerEvents(this, this);
    }

    @EventHandler
    public void onPlayerInteract(PlayerInteractEvent e){
    Player player = e.getPlayer();

    if(e.getAction() == Action.RIGHT_CLICK_BLOCK && e.getClickedBlock().getType() == Material.CACTUS){
    player.addPotionEffect(PotionEffectType.CONFUSION.createEffect(1200, 4));

    player.sendMessage(ChatColor.GOLD + "You've smoked grade A kush");

    }
    }
    }
    Here is my Plugin.yml:
    name: Weed
    main: me.Yongblood11.Weed.Weed
    version: 1.0
    description: Smoke dat kush boi.
    Am i missing something???:
    http://gyazo.com/254744aa967e4d96d286c56ee213b865
     
  7. Offline

    99storm2

    I think your plugin.yml might be in the wrong place. Try creating it again inside the src folder CheifKeef
     
  8. Offline

    MineCrashKoen

    CheifKeef You class isn't called MainWeed Right? your class is called Weed so why did you change the main to me.Yongblood11.Weed.MainWeed ? Shouldn't it be me.Yongblood11.Weed.Weed then?
     
  9. Offline

    CheifKeef

    I found out the problem no worries thank 99storm2 and others who told me to put in in the src folder
     
  10. Offline

    99storm2

    CheifKeef No problem anything to help someone out. Personally i like to post the solution or edit my main post with the solution so others who may have the same problem can google this and find the forum and the solution will be there. But its not necessary i just do it to help others in the future if they have the same problem as me.
     
Thread Status:
Not open for further replies.

Share This Page