2

I have got a error in this plugin, which i dont know how to fix. The error (copied from console) is

[18:21:25 ERROR]: Error loading plugin: File 'plugins\lobbyplugin.jar' failed to load!
java.lang.RuntimeException: File 'plugins\lobbyplugin.jar' failed to load!
    at io.papermc.paper.plugin.provider.source.FileProviderSource.registerProviders(FileProviderSource.java:59) ~[paper-1.19.3.jar:git-Paper-448]
    at io.papermc.paper.plugin.provider.source.DirectoryProviderSource.lambda$registerProviders$2(DirectoryProviderSource.java:32) ~[paper-1.19.3.jar:git-Paper-448]
    at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183) ~[?:?]
    at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179) ~[?:?]
    at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) ~[?:?]
    at java.util.Iterator.forEachRemaining(Iterator.java:133) ~[?:?]
    at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1921) ~[?:?]
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) ~[?:?]
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[?:?]
    at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150) ~[?:?]
    at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173) ~[?:?]
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
    at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596) ~[?:?]
    at io.papermc.paper.plugin.provider.source.DirectoryProviderSource.registerProviders(DirectoryProviderSource.java:30) ~[paper-1.19.3.jar:git-Paper-448]
    at io.papermc.paper.plugin.provider.source.DirectoryProviderSource.registerProviders(DirectoryProviderSource.java:14) ~[paper-1.19.3.jar:git-Paper-448]
    at io.papermc.paper.plugin.util.EntrypointUtil.registerProvidersFromSource(EntrypointUtil.java:14) ~[paper-1.19.3.jar:git-Paper-448]
    at io.papermc.paper.plugin.PluginInitializerManager.load(PluginInitializerManager.java:100) ~[paper-1.19.3.jar:git-Paper-448]
    at net.minecraft.server.Main.main(Main.java:114) ~[paper-1.19.3.jar:git-Paper-448]
    at org.bukkit.craftbukkit.Main.main(Main.java:302) ~[paper-1.19.3.jar:git-Paper-448]
    at io.papermc.paperclip.Paperclip.lambda$main$0(Paperclip.java:42) ~[app:?]
    at java.lang.Thread.run(Thread.java:1589) ~[?:?]
Caused by: java.lang.IllegalArgumentException: File 'plugins\lobbyplugin.jar' is not a valid plugin file, cannot load a plugin from it!
    at io.papermc.paper.plugin.provider.source.FileProviderSource.registerProviders(FileProviderSource.java:54) ~[paper-1.19.3.jar:git-Paper-448]
    ... 20 more

I tried the old way of checking for errors, but it didnt work. The code is:

package com.gmail.AAAA.SpleefClicker;


import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.persistence.PersistentDataType;
import org.bukkit.plugin.java.JavaPlugin;

import com.google.common.io.ByteArrayDataOutput;
import com.google.common.io.ByteStreams;
public final class SpleefClicker extends JavaPlugin implements Listener {
    @Override
    public void onEnable() {
        getLogger().info("onEnable has been invoked!");
    }


    @Override
    public void onDisable() {
        // TODO Put stuff to clean the plugin up.
    }
    @SuppressWarnings("deprecation")
    @EventHandler
    public void onArmorStandDamage(EntityDamageByEntityEvent event) {
        if (!(event.getEntity() instanceof ArmorStand)) {
            return;
        }

        ArmorStand armorStand = (ArmorStand) event.getEntity();

        if (!armorStand.getPersistentDataContainer().has(new NamespacedKey(this, "tag"), PersistentDataType.STRING)) {
            return;
        }

        if (!armorStand.getPersistentDataContainer().get(new NamespacedKey(this, "tag"), PersistentDataType.STRING).equals("spleefclicker")) {
            return;
        }

        if (!(event.getDamager() instanceof Player)) {
            return;
        }

        Player player = (Player) event.getDamager();

        if (player.getInventory().getItemInMainHand().getType() != Material.STICK) {
            return;
        }

        player.sendMessage("We are attempting to teleport you");
        // TODO Add bungeecord pluginmessages to teleport the player to another server
        armorStand.setHealth(armorStand.getMaxHealth()); // Heal the armor stand to prevent it breaking.
    }
}

I tried to make a plugin to interact with the world and send a player to minigame server.

I expected it to send a message and teleport the player (not currently implemented)

However, it failed to load. The plugin.yml exists and the code is OK.

Sigge
  • 23
  • 6
  • 1
    Does this answer your question? [Could not Load Plugin due to Error: "Jar does not contain plugin.yml"](https://stackoverflow.com/questions/67925186/could-not-load-plugin-due-to-error-jar-does-not-contain-plugin-yml) or [this one](https://stackoverflow.com/a/74732824/10952503) – Elikill58 Apr 19 '23 at 13:53

1 Answers1

1

It would be nice to be able to see your plugin.yml, but with the information you've given, there are a few possible solutions I can think of.

  1. Check and make sure the plugin is located in the correct plugins folder. I've seen one time when there was a duplicate for some reason, so I'd check that.
  2. This is gonna sound like a really stupid fix, but make sure that your plugin is compatible with the version of Minecraft your server is in. I've done this before, so that's why I'm including it.
  3. You could also try redownloading the .jar file to see if it possibly got corrupted in any way.
  4. Make sure that your plugin.yml file is included on the jar.

I mainly develop in Spigot and not Paper, and I know there are a few differences between the two, so I may be missing an obvious solution.

atlaska826
  • 64
  • 7