Problem/Bug ProtocolLib ServerPing

Discussion in 'Plugin Help/Development/Requests' started by ScorixEar, Jul 28, 2015.

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

    ScorixEar

    Hello Guys,
    I want to change the ServerPing into a text and used the original code from comphenix. This is his solution, but it works not:

    Code:
    package minecrafthaifl.main;
    
    import java.util.Arrays;
    
    import org.bukkit.ChatColor;
    import org.bukkit.plugin.java.JavaPlugin;
    
    import com.comphenix.protocol.PacketType;
    import com.comphenix.protocol.ProtocolLibrary;
    import com.comphenix.protocol.events.ListenerOptions;
    import com.comphenix.protocol.events.ListenerPriority;
    import com.comphenix.protocol.events.PacketAdapter;
    import com.comphenix.protocol.events.PacketEvent;
    import com.comphenix.protocol.wrappers.WrappedGameProfile;
    import com.comphenix.protocol.wrappers.WrappedServerPing;
    
    public class main extends JavaPlugin
    {
        @Override
        public void onEnable() {
            ProtocolLibrary.getProtocolManager().addPacketListener(
              // I mark my listener as async, as I don't use the Bukkit API. Please note that
              // your listener may be executed on the main thread regardless.
              new PacketAdapter(this, ListenerPriority.NORMAL,
              Arrays.asList(PacketType.Status.Server.OUT_SERVER_INFO), ListenerOptions.ASYNC) {
      
                @Override
                public void onPacketSending(PacketEvent event) {
                    handlePing(event.getPacket().getServerPings().read(0));
                }
            });
        }
      
        private void handlePing(WrappedServerPing ping) {
            ping.setPlayers(Arrays.asList(
                new WrappedGameProfile("id1", ChatColor.RED + "Hello. " + ChatColor.RESET +
                                              "This is line number one."),
                new WrappedGameProfile("id2", "Hello. This is line number two."),
                new WrappedGameProfile("id3", "Hello. This is line number three.")
            ));
        }
    }
    
    The Errors:
    Code:
    [14:17:33] [Server thread/INFO]: [ProtocolLib] Loading ProtocolLib v3.4.0
    [14:17:34] [Server thread/INFO]: [ProtocolLib] Created default configuration.
    [14:17:34] [Server thread/WARN]: [ProtocolLib] Version (MC: 1.8.3) has not yet been tested! Proceed with caution.
    [14:17:34] [Server thread/ERROR]:   [ProtocolLib] INTERNAL ERROR: Cannot load ProtocolLib.
      If this problem hasn't already been reported, please open a ticket
      at http://dev.bukkit.org/server-mods/protocollib/ with the following data:
                ===== STACK TRACE =====
      java.lang.NoSuchMethodError: com.google.common.cache.CacheBuilder.build(Lcom/google/common/cache/CacheLoader;)Lcom/google/common/cache/Cache;
          at com.comphenix.protocol.utility.MinecraftReflection.<clinit>(MinecraftReflection.java:155)
          at com.comphenix.protocol.injector.PacketFilterManager.<init>(PacketFilterManager.java:259)
          at com.comphenix.protocol.injector.PacketFilterBuilder.buildInternal(PacketFilterBuilder.java:250)
          at com.comphenix.protocol.injector.PacketFilterBuilder.build(PacketFilterBuilder.java:233)
          at com.comphenix.protocol.ProtocolLibrary.onLoad(ProtocolLibrary.java:216)
          at org.bukkit.craftbukkit.v1_8_R2.CraftServer.loadPlugins(CraftServer.java:296)
          at org.bukkit.craftbukkit.v1_8_R2.CraftServer.reload(CraftServer.java:744)
          at org.bukkit.Bukkit.reload(Bukkit.java:534)
          at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:25)
          at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141)
          at org.bukkit.craftbukkit.v1_8_R2.CraftServer.dispatchCommand(CraftServer.java:646)
          at org.bukkit.craftbukkit.v1_8_R2.CraftServer.dispatchServerCommand(CraftServer.java:632)
          at net.minecraft.server.v1_8_R2.DedicatedServer.aN(DedicatedServer.java:405)
          at net.minecraft.server.v1_8_R2.DedicatedServer.A(DedicatedServer.java:369)
          at net.minecraft.server.v1_8_R2.MinecraftServer.z(MinecraftServer.java:651)
          at net.minecraft.server.v1_8_R2.MinecraftServer.run(MinecraftServer.java:554)
          at java.lang.Thread.run(Unknown Source)
                ===== DUMP =====
      Parameters: 
        [NULL]
      Sender:
        [email protected][
          statistisc=<null>
          backgroundCompiler=<null>
          packetTask=-1
          tickCounter=0
          [email protected]7729b
          configExpectedMod=-1
          [email protected]
          [email protected]
          redirectHandler=<null>
          commandProtocol=<null>
          commandPacket=<null>
          commandFilter=<null>
          skipDisable=false
          isEnabled=false
          [email protected]
          server=CraftServer{serverName=CraftBukkit,serverVersion=git-Spigot-ea179b3-6e0120a,minecraftVersion=1.8.3}
          file=plugins\ProtocolLib-3.4.0.jar
          [email protected]
          dataFolder=plugins\ProtocolLib
          [email protected]
          naggable=true
          ebean=<null>
          newConfig=YamlConfiguration[path='', root='YamlConfiguration']
          configFile=plugins\ProtocolLib\config.yml
          [email protected]
        ]
      Version:
        ProtocolLib v3.4.0
      Server:
        git-Spigot-ea179b3-6e0120a (MC: 1.8.3)
    
    [14:17:34] [Server thread/INFO]: [ServerPing] Loading ServerPing v1.0
    [14:17:34] [Server thread/INFO]: [ProtocolLib] Enabling ProtocolLib v3.4.0
    [14:17:34] [Server thread/ERROR]:   [ProtocolLib] INTERNAL ERROR: Cannot enable ProtocolLib.
      If this problem hasn't already been reported, please open a ticket
      at http://dev.bukkit.org/server-mods/protocollib/ with the following data:
                ===== STACK TRACE =====
      java.lang.NoClassDefFoundError: Could not initialize class com.comphenix.protocol.utility.MinecraftReflection
          at com.comphenix.protocol.injector.packet.PacketRegistry.initialize(PacketRegistry.java:78)
          at com.comphenix.protocol.injector.packet.PacketRegistry.getPacketClassFromType(PacketRegistry.java:356)
          at com.comphenix.protocol.utility.ChatExtensions.getJsonFormatConstructor(ChatExtensions.java:218)
          at com.comphenix.protocol.utility.ChatExtensions.<clinit>(ChatExtensions.java:56)
          at com.comphenix.protocol.ProtocolLibrary.onEnable(ProtocolLibrary.java:377)
          at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:321)
          at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:335)
          at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:405)
          at org.bukkit.craftbukkit.v1_8_R2.CraftServer.loadPlugin(CraftServer.java:356)
          at org.bukkit.craftbukkit.v1_8_R2.CraftServer.enablePlugins(CraftServer.java:316)
          at org.bukkit.craftbukkit.v1_8_R2.CraftServer.reload(CraftServer.java:745)
          at org.bukkit.Bukkit.reload(Bukkit.java:534)
          at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:25)
          at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141)
          at org.bukkit.craftbukkit.v1_8_R2.CraftServer.dispatchCommand(CraftServer.java:646)
          at org.bukkit.craftbukkit.v1_8_R2.CraftServer.dispatchServerCommand(CraftServer.java:632)
          at net.minecraft.server.v1_8_R2.DedicatedServer.aN(DedicatedServer.java:405)
          at net.minecraft.server.v1_8_R2.DedicatedServer.A(DedicatedServer.java:369)
          at net.minecraft.server.v1_8_R2.MinecraftServer.z(MinecraftServer.java:651)
          at net.minecraft.server.v1_8_R2.MinecraftServer.run(MinecraftServer.java:554)
          at java.lang.Thread.run(Unknown Source)
                ===== DUMP =====
      Sender:
        [email protected][
          statistisc=<null>
          backgroundCompiler=<null>
          packetTask=-1
          tickCounter=0
          [email protected]7729b
          configExpectedMod=-1
          [email protected]
          [email protected]
          redirectHandler=<null>
          commandProtocol=<null>
          commandPacket=<null>
          commandFilter=<null>
          skipDisable=false
          isEnabled=true
          [email protected]
          server=CraftServer{serverName=CraftBukkit,serverVersion=git-Spigot-ea179b3-6e0120a,minecraftVersion=1.8.3}
          file=plugins\ProtocolLib-3.4.0.jar
          [email protected]
          dataFolder=plugins\ProtocolLib
          [email protected]
          naggable=true
          ebean=<null>
          newConfig=YamlConfiguration[path='', root='YamlConfiguration']
          configFile=plugins\ProtocolLib\config.yml
          [email protected]
        ]
      Version:
        ProtocolLib v3.4.0
      Server:
        git-Spigot-ea179b3-6e0120a (MC: 1.8.3)
    
    [14:17:34] [Server thread/INFO]: [ProtocolLib] Disabling ProtocolLib v3.4.0
    [14:17:34] [Server thread/INFO]: [EnderCrystal] Enabling EnderCrystal v1.0
    [14:17:34] [Server thread/INFO]: [Bansystem] Enabling Bansystem v1.0
    [14:17:34] [Server thread/INFO]: [ServerPing] Enabling ServerPing v1.0
    [14:17:34] [Server thread/ERROR]: Error occurred while enabling ServerPing v1.0 (Is it up to date?)
    java.lang.NoClassDefFoundError: com/comphenix/protocol/ProtocolLibrary
        at minecrafthaifl.main.main.onEnable(main.java:21) ~[?:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:321) ~[spigot_server.jar:git-Spigot-ea179b3-6e0120a]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:335) [spigot_server.jar:git-Spigot-ea179b3-6e0120a]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:405) [spigot_server.jar:git-Spigot-ea179b3-6e0120a]
        at org.bukkit.craftbukkit.v1_8_R2.CraftServer.loadPlugin(CraftServer.java:356) [spigot_server.jar:git-Spigot-ea179b3-6e0120a]
        at org.bukkit.craftbukkit.v1_8_R2.CraftServer.enablePlugins(CraftServer.java:316) [spigot_server.jar:git-Spigot-ea179b3-6e0120a]
        at org.bukkit.craftbukkit.v1_8_R2.CraftServer.reload(CraftServer.java:746) [spigot_server.jar:git-Spigot-ea179b3-6e0120a]
        at org.bukkit.Bukkit.reload(Bukkit.java:534) [spigot_server.jar:git-Spigot-ea179b3-6e0120a]
        at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:25) [spigot_server.jar:git-Spigot-ea179b3-6e0120a]
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141) [spigot_server.jar:git-Spigot-ea179b3-6e0120a]
        at org.bukkit.craftbukkit.v1_8_R2.CraftServer.dispatchCommand(CraftServer.java:646) [spigot_server.jar:git-Spigot-ea179b3-6e0120a]
        at org.bukkit.craftbukkit.v1_8_R2.CraftServer.dispatchServerCommand(CraftServer.java:632) [spigot_server.jar:git-Spigot-ea179b3-6e0120a]
        at net.minecraft.server.v1_8_R2.DedicatedServer.aN(DedicatedServer.java:405) [spigot_server.jar:git-Spigot-ea179b3-6e0120a]
        at net.minecraft.server.v1_8_R2.DedicatedServer.A(DedicatedServer.java:369) [spigot_server.jar:git-Spigot-ea179b3-6e0120a]
        at net.minecraft.server.v1_8_R2.MinecraftServer.z(MinecraftServer.java:651) [spigot_server.jar:git-Spigot-ea179b3-6e0120a]
        at net.minecraft.server.v1_8_R2.MinecraftServer.run(MinecraftServer.java:554) [spigot_server.jar:git-Spigot-ea179b3-6e0120a]
        at java.lang.Thread.run(Unknown Source) [?:1.8.0_45]
    Caused by: java.lang.ClassNotFoundException: com.comphenix.protocol.ProtocolLibrary
        at java.net.URLClassLoader.findClass(Unknown Source) ~[?:1.8.0_45]
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:101) ~[spigot_server.jar:git-Spigot-ea179b3-6e0120a]
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:86) ~[spigot_server.jar:git-Spigot-ea179b3-6e0120a]
        at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_45]
        at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_45]
        ... 17 more
    [14:17:34] [Server thread/INFO]: Server permissions file permissions.yml is empty, ignoring it
    [14:17:34] [Server thread/INFO]: CONSOLE: [0;32;1mReload complete.[m
    
    
    I use the 1.8 spigot jar and the 3.4.0 ProtocolLibrary
    //EDIT I forgott to plug the protocollib.jar in to plugins folder. Here are new Errors
     
    Last edited: Jul 28, 2015
  2. Offline

    ScorixEar

  3. Offline

    Boomer

    dont reload - thats going to cause problems.
    Clean restart, if you still have the same problem then, different story.
     
Thread Status:
Not open for further replies.

Share This Page