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.potion.PotionEffect;
    import org.bukkit.potion.PotionEffectType;

    import net.md_5.bungee.api.ChatColor;

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

    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;
    public class Main extends JavaPlugin {
    public void onEnable() {
    public void onDisable() {
    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;

    name: MyPlugin
    version: 1.4.1
    description: yay i made a plugin
    author: DiscordGoat
    main: fasteat.Main
  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 ~[craftbukkit.jar:git-Bukkit-7560f5f]
    at org.bukkit.plugin.SimplePluginManager.loadPlugins( ~[craftbukkit.jar:git-Bukkit-7560f5f]
    at org.bukkit.craftbukkit.v1_16_R1.CraftServer.loadPlugins( ~[craftbukkit.jar:git-Bukkit-7560f5f]
    at org.bukkit.craftbukkit.v1_16_R1.CraftServer.reload( ~[craftbukkit.jar:git-Bukkit-7560f5f]
    at org.bukkit.Bukkit.reload( ~[craftbukkit.jar:git-Bukkit-7560f5f]
    at org.bukkit.command.defaults.ReloadCommand.execute( ~[craftbukkit.jar:git-Bukkit-7560f5f]
    at org.bukkit.command.SimpleCommandMap.dispatch( ~[craftbukkit.jar:git-Bukkit-7560f5f]
    at org.bukkit.craftbukkit.v1_16_R1.CraftServer.dispatchCommand( ~[craftbukkit.jar:git-Bukkit-7560f5f]
    at org.bukkit.craftbukkit.v1_16_R1.CraftServer.dispatchServerCommand( ~[craftbukkit.jar:git-Bukkit-7560f5f]
    at net.minecraft.server.v1_16_R1.DedicatedServer.handleCommandQueue( ~[craftbukkit.jar:git-Bukkit-7560f5f]
    at net.minecraft.server.v1_16_R1.DedicatedServer.b( ~[craftbukkit.jar:git-Bukkit-7560f5f]
    at net.minecraft.server.v1_16_R1.MinecraftServer.a( ~[craftbukkit.jar:git-Bukkit-7560f5f]
    at net.minecraft.server.v1_16_R1.MinecraftServer.v( ~[craftbukkit.jar:git-Bukkit-7560f5f]
    at net.minecraft.server.v1_16_R1.MinecraftServer.lambda$0( ~[craftbukkit.jar:git-Bukkit-7560f5f]
    at Source) [?:1.8.0_261]
    Caused by: 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!