Help With Plugin.yml File

Discussion in 'Plugin Development' started by _EnderWizard_, Aug 11, 2020.

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

    _EnderWizard_

    I am writing a double jump plugin.
    My Code:
    Code:
    package me._EnderWizard_.DoubleJump;
    import org.bukkit.Material;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.entity.EntityDamageEvent;
    import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
    import org.bukkit.event.player.PlayerMoveEvent;
    import org.bukkit.plugin.java.JavaPlugin;
    public class Main extends JavaPlugin implements Listener{
        @Override
        public void onEnable() {
            this.getServer().getPluginManager().registerEvents(this, this);
        }
        @Override
        public void onDisable() {
        }
        @EventHandler
        public void onJump(PlayerMoveEvent event) {
            Player player = (Player) event.getPlayer();
            if(event.getFrom().getY() < event.getTo().getY() &&
                    player.getLocation().subtract(0, 1, 0).getBlock().getType() == Material.AIR) {
                player.setVelocity(player.getLocation().getDirection().multiply(2).setY(2));
            }
        }
      
        @EventHandler
        public void onFall(EntityDamageEvent event) {
            if(event.getEntity() instanceof Player) {
                Player player = (Player) event.getEntity();
                if(event.getCause() == DamageCause.FALL) {
                    event.setCancelled(true);
                }
            }
              
        }
          
    }
    My plugin.yml:
    Code:
    main: me._EnderWizard_.DoubleJump.Main
    name: DoubleJump
    version: 1.0.0
    author: _EnderWizard_
    The console is saying that there is an error in my plugin.yml, but I don't see it. Help?
    I know that there are probably some bugs in my code, but none that should affect the plugin's ability to run. Any help is appreciated.
     
    Last edited by a moderator: Aug 11, 2020
  2. Offline

    timtower Moderator Moderator

  3. Offline

    _EnderWizard_

    Thank you so much for replying.
    The error:
    [Server thread/ERROR]: Could not load 'plugins\DoubleJump.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml
    at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:160) ~[spigot-1.15.2.jar:git-Spigot-800b93f-8160e29]
    at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:138) [spigot-1.15.2.jar:git-Spigot-800b93f-8160e29]
    at org.bukkit.craftbukkit.v1_15_R1.CraftServer.loadPlugins(CraftServer.java:351) [spigot-1.15.2.jar:git-Spigot-800b93f-8160e29]
    at net.minecraft.server.v1_15_R1.DedicatedServer.init(DedicatedServer.java:203) [spigot-1.15.2.jar:git-Spigot-800b93f-8160e29]
    at net.minecraft.server.v1_15_R1.MinecraftServer.run(MinecraftServer.java:784) [spigot-1.15.2.jar:git-Spigot-800b93f-8160e29]
    at java.lang.Thread.run(Unknown Source) [?:1.8.0_261]
    Caused by: java.io.FileNotFoundException: Jar does not contain plugin.yml
     
  4. Offline

    KarimAKL

    @_EnderWizard_ Where is your plugin.yml? Can you show an image of your project tree?
     
  5. Offline

    _EnderWizard_

    I have added an image with the tree. Let me know if you need anything else.
     

    Attached Files:

  6. Offline

    pseudo_su

    Hm. Try moving your plugin.yml out of the package it's in and put it in the "src" folder.
     
  7. Offline

    _EnderWizard_

    I see what I did wrong, I put the yml in the package instead of outside. Thank you @KarimAKL and @timtower and @psuedo_su!
     
    Last edited: Aug 12, 2020
Thread Status:
Not open for further replies.

Share This Page