1

I'm making a server bridge for a server, but it won't load. This is the log:

[ERROR] Could not load 'plugins/MGServerBridge.jar' in folder 'plugins'
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:135) ~[server.jar:git-Spigot-21fe707-741a1bd]
at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:329) ~[server.jar:git-Spigot-21fe707-741a1bd]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:251) [server.jar:git-Spigot-21fe707-741a1bd]
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugins(CraftServer.java:292) [server.jar:git-Spigot-21fe707-741a1bd]
at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:198) [server.jar:git-Spigot-21fe707-741a1bd]
at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:525) [server.jar:git-Spigot-21fe707-741a1bd]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_312]
at java.lang.ClassLoader.defineClass1(Native Method) ~[?:1.8.0_312]
at java.lang.ClassLoader.defineClass(ClassLoader.java:757) ~[?:1.8.0_312]
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) ~[?:1.8.0_312]
at java.net.URLClassLoader.defineClass(URLClassLoader.java:473) ~[?:1.8.0_312]
at java.net.URLClassLoader.access$100(URLClassLoader.java:74) ~[?:1.8.0_312]
at java.net.URLClassLoader$1.run(URLClassLoader.java:369) ~[?:1.8.0_312]
at java.net.URLClassLoader$1.run(URLClassLoader.java:363) ~[?:1.8.0_312]
at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_312]
at java.net.URLClassLoader.findClass(URLClassLoader.java:362) ~[?:1.8.0_312]
at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:101) ~[server.jar:git-Spigot-21fe707-741a1bd]
at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:86) ~[server.jar:git-Spigot-21fe707-741a1bd]
at java.lang.ClassLoader.loadClass(ClassLoader.java:419) ~[?:1.8.0_312]
at java.lang.ClassLoader.loadClass(ClassLoader.java:352) ~[?:1.8.0_312]
at java.lang.Class.forName0(Native Method) ~[?:1.8.0_312]
at java.lang.Class.forName(Class.java:348) ~[?:1.8.0_312]
at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:64) ~[server.jar:git-Spigot-21fe707-741a1bd]
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:131) ~[server.jar:git-Spigot-21fe707-741a1bd]
... 6 more

This is the plugin.yml:

name: MPServerBridge
author: JustAdam
version: 1.0.0
main: dev.ondr.mpserverbridge.MPServerBridge

And this is the code:

package dev.ondr.mpserverbridge;

import com.google.common.io.ByteArrayDataInput;
import com.google.common.io.ByteArrayDataOutput;
import com.google.common.io.ByteStreams;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.plugin.messaging.PluginMessageListener;

public final class MPServerBridge extends JavaPlugin implements PluginMessageListener {
    @Override
    public void onEnable() {
            this.getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
            this.getServer().getMessenger().registerIncomingPluginChannel(this, "BungeeCord", this);
            Bukkit.getLogger().info("MinePractice Server Bridge online.");
    }

    @Override
    public void onDisable() {
        //make sure to unregister the registered channels in case of a reload
        this.getServer().getMessenger().unregisterOutgoingPluginChannel(this);
        this.getServer().getMessenger().unregisterIncomingPluginChannel(this);
        Bukkit.getLogger().info("MinePractice Server Bridge offline.");
    }

    @Override
    public void onPluginMessageReceived(String channel, Player player, byte[] message) {
        if (!channel.equals("BungeeCord")) {
            return;
        }
        ByteArrayDataInput in = ByteStreams.newDataInput(message);
        String subchannel = in.readUTF();
        if (subchannel.equals("SomeSubChannel")) {
            // Use the code sample in the 'Response' sections below to read
            // the data.
        }
    }

    public void sendMessage(Player p, String[] UTFs) {
        ByteArrayDataOutput out = ByteStreams.newDataOutput();
        for(String utf : UTFs) {
            out.writeUTF(utf);
        }
        Player player = Bukkit.getPlayerExact(p.getName());
        player.sendPluginMessage(this, "BungeeCord", out.toByteArray());
    }
}

I don't know what's the problem. I've been searching for the issue for a few days, but anything didn't work. I've been googling too but I couldn't find anything helpful. Please help.

Elikill58
  • 4,050
  • 24
  • 23
  • 45
JustAdam
  • 11
  • 4
  • Firstly, check that `dev.ondr.mpserverbridge.MPServerBridge` is the correct path to your main class. Secondly, ensure that you only have one copy of your jar in your plugins folder and that no other plugins have the same name. Last, if you're using Gradle, do a clean build (or the maven equivalent) then build again. – Lucan Apr 01 '22 at 22:08
  • Have you check for Java version ? Like don't compile your plugin with an unsupported version by your versions that run the server – Elikill58 Apr 02 '22 at 09:47

1 Answers1

0

Just as Lucan said, this type of error usually happens when the path is not valid. This could mean many things but it could simply be that your file plugin.yml is not in the right place, meaning it doesn’t get read.

Your file should be in the following folder: src/main/resources. Like: Folder example

It is possible, however, that depending on the IDE some other problems arise such as described here: https://bukkit.fandom.com/wiki/Plugin_Tutorial_(Eclipse)

Hope this helps!

Hynity
  • 26
  • 1