Can someone help me with my plugin.yml file?

Discussion in 'Programming' started by Discordgoat, Jul 30, 2020.

  1. so, ive been making a plugin recently, and i need help with my plugin.yml file. can someone please help me? this is always the step that makes me rage quit coding plugins. heres my source code of my plugin.yml and main class, and my events class.
    (events class)
    package fasteat;



    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.player.PlayerItemConsumeEvent;
    import org.bukkit.plugin.java.JavaPlugin;
    import org.bukkit.potion.PotionEffect;
    import org.bukkit.potion.PotionEffectType;

    import net.md_5.bungee.api.ChatColor;

    public class Events extends JavaPlugin implements Listener{
    @Override
    public void onEnable() {
    getServer().getPluginManager().registerEvents(this, this);
    }



    @EventHandler
    public void onLogin(PlayerItemConsumeEvent event) {
    Player p = event.getPlayer();
    p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 10, 2));
    p.sendMessage("You ate some food and are gifted with " + ChatColor.AQUA + "Speed II!");


    }
    }

    (main class)
    package fasteat;

    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.plugin.java.JavaPlugin;
    public class Main extends JavaPlugin {
    @Override
    public void onEnable() {
    }
    @Override
    public void onDisable() {
    }
    @Override
    public boolean onCommand(CommandSender sender,
    Command command,
    String label,
    String[] args) {
    if (command.getName().equalsIgnoreCase("fasteat")) {
    sender.sendMessage("You ran /fasteat!");
    return true;
    }
    return false;
    }
    }


    (plugin.yml)
    name: MyPlugin
    version: 1.4.1
    description: yay i made a plugin
    author: DiscordGoat
    main: fasteat.Main
    PLEASE HELP!
     
  2. oh, also here's my errors as listed in the console.
    [17:20:28] [Server thread/ERROR]: Could not load 'plugins\fasteat.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml
    at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:158) ~[craftbukkit.jar:git-Bukkit-7560f5f]
    at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:144) ~[craftbukkit.jar:git-Bukkit-7560f5f]
    at org.bukkit.craftbukkit.v1_16_R1.CraftServer.loadPlugins(CraftServer.java:378) ~[craftbukkit.jar:git-Bukkit-7560f5f]
    at org.bukkit.craftbukkit.v1_16_R1.CraftServer.reload(CraftServer.java:847) ~[craftbukkit.jar:git-Bukkit-7560f5f]
    at org.bukkit.Bukkit.reload(Bukkit.java:642) ~[craftbukkit.jar:git-Bukkit-7560f5f]
    at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:27) ~[craftbukkit.jar:git-Bukkit-7560f5f]
    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:148) ~[craftbukkit.jar:git-Bukkit-7560f5f]
    at org.bukkit.craftbukkit.v1_16_R1.CraftServer.dispatchCommand(CraftServer.java:734) ~[craftbukkit.jar:git-Bukkit-7560f5f]
    at org.bukkit.craftbukkit.v1_16_R1.CraftServer.dispatchServerCommand(CraftServer.java:720) ~[craftbukkit.jar:git-Bukkit-7560f5f]
    at net.minecraft.server.v1_16_R1.DedicatedServer.handleCommandQueue(DedicatedServer.java:372) ~[craftbukkit.jar:git-Bukkit-7560f5f]
    at net.minecraft.server.v1_16_R1.DedicatedServer.b(DedicatedServer.java:342) ~[craftbukkit.jar:git-Bukkit-7560f5f]
    at net.minecraft.server.v1_16_R1.MinecraftServer.a(MinecraftServer.java:965) ~[craftbukkit.jar:git-Bukkit-7560f5f]
    at net.minecraft.server.v1_16_R1.MinecraftServer.v(MinecraftServer.java:813) ~[craftbukkit.jar:git-Bukkit-7560f5f]
    at net.minecraft.server.v1_16_R1.MinecraftServer.lambda$0(MinecraftServer.java:155) ~[craftbukkit.jar:git-Bukkit-7560f5f]
    at java.lang.Thread.run(Unknown Source) [?:1.8.0_261]
    Caused by: java.io.FileNotFoundException: Jar does not contain plugin.yml
    ... 15 more
     
  3. ex4

    ex4 Previously skater77i

    Well, what's the error?
    Edit: didn't refresh
     
  4. ex4

    ex4 Previously skater77i

    Here's your problem right here. Your plugin.yml isn't being compiled into the jar. If you're building with maven make sure your plugin.yml is in the resources folder.
     
  5. im not using maven, i think its just an eclipse java project
     
  6. how do i get it to compile with the rest of it?
     
  7. wait! i just fixed it! so, i was keeping the plugin.yml file in the package! thank yuo so so so much! this means so much to me! i can finally continue coding! i hope you have a great day, and tysm!