sillerud / BungeeCord

BungeeCord, the 6th in a generation of server portal suites. Efficiently proxies and maintains connections and transport between multiple Minecraft servers.
http://www.spigotmc.org/threads/bungeecord.392/
Other
24 stars 25 forks source link

Add PreLoginEvent #22

Closed literalplus closed 10 years ago

literalplus commented 10 years ago

This PR adds PreLoginEvent from 1.7 BungeeCord to provide compatibility for new plugins. This implements #21 by @tf101-wizard.

Note that these changes are untested - I will pull this to master once I get confirmation that it works as intended for both protocols. Artifacts for testing are located at http://ci.nowak-at.net/job/public~TUD_Bungee_PR/

Katelyn-SN commented 10 years ago

Sadly not all is perfect i tryed testing the event it seems to work for both protocols but the main use of it i was wanting to use it for was a bungee plugin either NeverDownProxy or AlwaysOnline both had a simalier Yaml issue

21:52:09 [WARNING] Exception encountered when loading plugin: AlwaysOnline
java.lang.NoSuchMethodError: net.md_5.bungee.config.Configuration.<init>(Ljava/util/Map;Lnet/md_5/bungee/config/Configuration;)V
    at net.md_5.bungee.config.YamlConfiguration.load(YamlConfiguration.java:54)
    at net.md_5.bungee.config.YamlConfiguration.load(YamlConfiguration.java:46)
    at me.johnnywoof.AlwaysOnline.reload(AlwaysOnline.java:54)
    at me.johnnywoof.AlwaysOnline.onEnable(AlwaysOnline.java:27)
    at net.md_5.bungee.api.plugin.PluginManager.loadAndEnablePlugins(PluginManager.java:194)
    at net.md_5.bungee.BungeeCord.start(BungeeCord.java:177)
    at net.md_5.bungee.Bootstrap.main(Bootstrap.java:68)

Hopefully this can be resolved as its the main use i wanted this event for if you need any other information let me know :)

Katelyn-SN commented 10 years ago

I did some googling and came up with this http://minecraft-server.eu/board/showthread.php?19432-Eclipse-Marven-Problem seems that I'm not the only one having this issue

literalplus commented 10 years ago

Marven irgentwelchen

Does not look like a reliable source. Since it is half past 2 am and I got better things to do, so I'll do that.

(Update 3.30am) Fixed in master. https://github.com/TheUnnamedDude/BungeeCord/commit/4efa16644eb7cdc539e6e9d6efbe7f1db5e53602

Please give feedback on whether this resolves your issue and on whether this PR works.

BTW, my binary has been updated too

Katelyn-SN commented 10 years ago

Well that didn't change much

19:49:27 [WARNING] Exception encountered when loading plugin: AlwaysOnline
java.lang.NoClassDefFoundError: net/md_5/bungee/config/YamlConfiguration
    at me.johnnywoof.AlwaysOnline.onEnable(AlwaysOnline.java:37)
    at net.md_5.bungee.api.plugin.PluginManager.loadAndEnablePlugins(PluginManager.java:194)
    at net.md_5.bungee.BungeeCord.start(BungeeCord.java:177)
    at net.md_5.bungee.Bootstrap.main(Bootstrap.java:68)
Caused by: java.lang.ClassNotFoundException: net.md_5.bungee.config.YamlConfiguration
    at net.md_5.bungee.api.plugin.PluginClassloader.loadClass0(PluginClassloader.java:53)
    at net.md_5.bungee.api.plugin.PluginClassloader.loadClass(PluginClassloader.java:27)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 4 more

Your change actually caused the plugin to break completely now..

literalplus commented 10 years ago

I guess your download is corrupted. (I tested it myself now)

This doesn't change that the plugin you want to use is written for 1.7.6+, aka it uses UUIDs, which this version of BungeeCord can't support (1.6 servers, you know).

WARNING: Error dispatching event PostLoginEvent(player=xxyy98) to listener me.johnnywoof.AOListener@1d76aeea
java.lang.NoSuchMethodError: net.md_5.bungee.api.connection.ProxiedPlayer.getUniqueId()Ljava/util/UUID;
    at me.johnnywoof.AOListener.onPost(AOListener.java:158)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at net.md_5.bungee.event.EventHandlerMethod.invoke(EventHandlerMethod.java:20)
    at net.md_5.bungee.event.EventBus.post(EventBus.java:42)
    at net.md_5.bungee.api.plugin.PluginManager.callEvent(PluginManager.java:332)
    at net.md_5.bungee.connection.InitialHandler.handle(InitialHandler.java:619)
    at net.md_5.bungee.connection.InitialHandler$10$1.run(InitialHandler.java:580)
    at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:354)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:353)
    at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101)
    at java.lang.Thread.run(Unknown Source)

Anyways, this event seems to be working, so I'll just merge into master. The binary containing the changes will be on the main CI now.

Katelyn-SN commented 10 years ago

Anyway to get it to work? Using that plugin is quite essential for the long periods of Mojang outages which recently have been happening quite a bit

literalplus commented 10 years ago

As I said, it is not possible to have UUIDs with this version of BungeeCord, since 1.6.4 backends don't support UUIDs (Any attempts to fix this will be ugly hacks and probably have huge caveats).

I don't know how long your plugin has been out there, but maybe there's an old version which doesn't have UUIDs (or an older version of a similar plugin) - You could probably use that, if available. Other than that, the only way to fix this I can think of is ask pay the author to make you a non-UUID version.

Katelyn-SN commented 10 years ago

Alright well I might take a shot at writing my own first. I thought this version of bungee appended a fake uuid to older clients..

literalplus commented 10 years ago

I think you mean PR #20 - This adds something with UUIDs iirc (I probably should take a look at that some time)

Katelyn-SN commented 10 years ago

Already added to my version and working flawlessly but its not the cause of the AlwaysOnline plugin not functioning something to do with Yaml.

literalplus commented 10 years ago

I fixed the YAML thing here, if you're using their fork, you need to ask them to update from this repo.

Katelyn-SN commented 10 years ago

Ive added your changes to it and it still errors it was 1 commit with the config to conf packet changes correctly

literalplus commented 10 years ago

As I said, I can't reproduce the issue on this repo. Could you decompile your JAR and check if it actually contains the mentioned class?

-- Above message was sent from my mobile phone. There may and will be all kinds of errors included. For free! On 7 Aug 2014 02:08, "Kevin Hawkins" notifications@github.com wrote:

Ive added your changes to it and it still errors it was 1 commit with the config to conf packet changes correctly

— Reply to this email directly or view it on GitHub https://github.com/TheUnnamedDude/BungeeCord/pull/22#issuecomment-51414660 .

Katelyn-SN commented 10 years ago

Your change caused

java.lang.NoClassDefFoundError: net/md_5/bungee/config/YamlConfiguration

To be in

net/md_5/bungee/conf/YamlConfig

Causing the error ill get on irc and we chat about this.

literalplus commented 10 years ago

I moved the other package, the one in proxy. If you have the config one in your binary, something is severely wrong with your merge tool.

-- Above message was sent from my mobile phone. There may and will be all kinds of errors included. For free! On 7 Aug 2014 02:58, "Kevin Hawkins" notifications@github.com wrote:

Your change caused

java.lang.NoClassDefFoundError: net/md_5/bungee/config/YamlConfiguration

To be in

net/md_5/bungee/conf/YamlConfig

Causing the error

— Reply to this email directly or view it on GitHub https://github.com/TheUnnamedDude/BungeeCord/pull/22#issuecomment-51418115 .

literalplus commented 10 years ago

Or with my eyesight and IDEA and jd-gui.

-- Above message was sent from my mobile phone. There may and will be all kinds of errors included. For free! On 7 Aug 2014 03:27, "Philipp N." supertux22@gmail.com wrote:

I moved the other package, the one in proxy. If you have the config one in your binary, something is severely wrong with your merge tool.

-- Above message was sent from my mobile phone. There may and will be all kinds of errors included. For free! On 7 Aug 2014 02:58, "Kevin Hawkins" notifications@github.com wrote:

Your change caused

java.lang.NoClassDefFoundError: net/md_5/bungee/config/YamlConfiguration

To be in

net/md_5/bungee/conf/YamlConfig

Causing the error

— Reply to this email directly or view it on GitHub https://github.com/TheUnnamedDude/BungeeCord/pull/22#issuecomment-51418115 .

Katelyn-SN commented 10 years ago

Seems there is something wrong with my source it worked first try for me on this source ill slowly start merging everything with the 1.7.6+ Patches and we will see how this goes..

literalplus commented 10 years ago

Either player or player.getServer() is null. The plugin is missing a null check there. getInfo() is very unlikely to be null. If player is null, we have a severe problem on our side and I guess half of bungee wouldn't work then, which you probably would have noticed (or the player left the server immediately , if you happen to test in production). I might be able to debug this next week - you could try to add debug messages and find out what exactly is null and why if you have time. Oh yeah, and please verify that this error also happens on TheUnnamedDude and SpigotMC w/o modifications. -- Above message was sent from my mobile phone. There may and will be all kinds of errors included. For free! On 7 Aug 2014 07:34, "Kevin Hawkins" notifications@github.com wrote:

Added and working fine but now i get a new error on player joins:

01:33:25 [SEVERE] Task BungeeTask(sched=net.md_5.bungee.scheduler.BungeeScheduler@5b76b0ad, id=26, owner=com.minecraftdimensions.bungeesuite.BungeeSuite@66f40ddf, task=com.minecraftdimensions.bungeesuite.listeners.SpawnListener$1@f5a7d7f, delay=300, period=0, running=true) encountered an exception java.lang.NullPointerException at com.minecraftdimensions.bungeesuite.managers.SpawnManager.sendPlayerToProxySpawn(SpawnManager.java:70) at com.minecraftdimensions.bungeesuite.listeners.SpawnListener$1.run(SpawnListener.java:24) at net.md_5.bungee.scheduler.BungeeTask.run(BungeeTask.java:59) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745)

— Reply to this email directly or view it on GitHub https://github.com/TheUnnamedDude/BungeeCord/pull/22#issuecomment-51432971 .

Katelyn-SN commented 10 years ago

Sorry about that I sent you a bungeesuite error and not a error from NeverDownProxy here

13:32:05 [SEVERE] Task BungeeTask(sched=net.md_5.bungee.scheduler.BungeeScheduler@3699d67f, id=16588, owner=me.kyledag500.NeverDownProxy.Main@14b9337f, task=me.kyledag500.NeverDownProxy.Login$2@6861328a, delay=100, period=0, running=true) encountered an exception
java.lang.NoSuchMethodError: net.md_5.bungee.api.connection.ProxiedPlayer.getUniqueId()Ljava/util/UUID;
    at me.kyledag500.NeverDownProxy.Login$2.run(Login.java:154)
    at net.md_5.bungee.scheduler.BungeeTask.run(BungeeTask.java:59)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
literalplus commented 10 years ago

That's the UUID method missing. Please contact your fork 🍴 for that :)

-- Above message was sent from my mobile phone. There may and will be all kinds of errors included. For free! On 7 Aug 2014 19:33, "Kevin Hawkins" notifications@github.com wrote:

Sorry about that I sent you a bungeesuite error and not a error from NeverDownProxy here

13:32:05 [SEVERE] Task BungeeTask(sched=net.md_5.bungee.scheduler.BungeeScheduler@3699d67f, id=16588, owner=me.kyledag500.NeverDownProxy.Main@14b9337f, task=me.kyledag500.NeverDownProxy.Login$2@6861328a, delay=100, period=0, running=true) encountered an exception java.lang.NoSuchMethodError: net.md_5.bungee.api.connection.ProxiedPlayer.getUniqueId()Ljava/util/UUID; at me.kyledag500.NeverDownProxy.Login$2.run(Login.java:154) at net.md_5.bungee.scheduler.BungeeTask.run(BungeeTask.java:59) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745)

— Reply to this email directly or view it on GitHub https://github.com/TheUnnamedDude/BungeeCord/pull/22#issuecomment-51504695 .

Katelyn-SN commented 10 years ago

Looks like it will have to be fixed bungee side because the NeverDownProxy creator has not answered my email yet.

literalplus commented 10 years ago

This plugin is not related to the issue at all. With "fork", I meant the PR introducing 1.7.5 & UUID support. On 7 Aug 2014 21:05, "Kevin Hawkins" notifications@github.com wrote:

Looks like it will have to be fixed bungee side because the NeverDownProxy creator has not answered my email yet.

— Reply to this email directly or view it on GitHub https://github.com/TheUnnamedDude/BungeeCord/pull/22#issuecomment-51516941 .

Katelyn-SN commented 10 years ago

Yes i did understand that. Im currently trying to add the method myself before commenting on the pull request

literalplus commented 10 years ago

Pretty sure the pr already has that (don't know exactly which repo)

-- Above message was sent from my mobile phone. There may and will be all kinds of errors included. For free! On 7 Aug 2014 23:13, "Kevin Hawkins" notifications@github.com wrote:

Yes i did understand that. Im currently trying to add the method myself before commenting on the pull request

— Reply to this email directly or view it on GitHub https://github.com/TheUnnamedDude/BungeeCord/pull/22#issuecomment-51532651 .

Katelyn-SN commented 10 years ago

I checked through it all and saw nothing like that @Sn0wStorm Repo showed alot of UUID changes that were not in others but none of them had that method.

Katelyn-SN commented 10 years ago

Well maybe i shouldn't do java on a hour and a half of sleep. @net32 added it i skimed over it so fast i did not see it.

Katelyn-SN commented 10 years ago

Got the UUID issue figured out now we are on to error on the event itself

This happens while pinging the server.

16:35:42 [SEVERE] Aug 07, 2014 4:35:42 PM net.md_5.bungee.event.EventBus post
WARNING: Error dispatching event ProxyPingEvent(connection=[/127.0.0.1:62501] <-
> InitialHandler, response=ServerPing(protocolVersion=78, gameVersion=1.6.2-1.7.
10, motd=Another Bungee server, currentPlayers=0, maxPlayers=1), newResponse=nul
l, isNewProtocol=false) to listener me.kyledag500.NeverDownProxy.Login@6f0ac4be
java.lang.NullPointerException
    at me.kyledag500.NeverDownProxy.Login.onPing(Login.java:47)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at net.md_5.bungee.event.EventHandlerMethod.invoke(EventHandlerMethod.java:2
0)
    at net.md_5.bungee.event.EventBus.post(EventBus.java:42)
    at net.md_5.bungee.api.plugin.PluginManager.callEvent(PluginManager.java:332
)
    at net.md_5.bungee.connection.InitialHandler$2.done(InitialHandler.java:171)

    at net.md_5.bungee.connection.InitialHandler$2.done(InitialHandler.java:163)

    at net.md_5.bungee.connection.InitialHandler.respondToPing(InitialHandler.ja
va:190)
    at net.md_5.bungee.connection.InitialHandler.handle(InitialHandler.java:141)

    at net.md_5.bungee.protocol.packet.PacketFAPluginMessage.handle(PacketFAPlug
inMessage.java:52)
    at net.md_5.bungee.netty.HandlerBoss.channelRead(HandlerBoss.java:83)
    at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultCh
annelHandlerContext.java:338)
    at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChan
nelHandlerContext.java:324)
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDeco
der.java:153)
    at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultCh
annelHandlerContext.java:338)
    at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChan
nelHandlerContext.java:324)
    at io.netty.handler.timeout.ReadTimeoutHandler.channelRead(ReadTimeoutHandle
r.java:149)
    at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultCh
annelHandlerContext.java:338)
    at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChan
nelHandlerContext.java:324)
    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPip
eline.java:785)
    at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNi
oByteChannel.java:122)
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:48
5)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLo
op.java:452)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:346)
    at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEven
tExecutor.java:101)
    at java.lang.Thread.run(Unknown Source)
literalplus commented 10 years ago

Not having looked at the plugin source (2am), I have to note that your stacktrace is about ProxyPingEvent, not PreLoginEvent. I might look at your specific problem tomorrow evening (~17h from now). Although NPEs are always suspicious and could be caused by your plugin not checking for remote cases.

-- Above message was sent from my mobile phone. There may and will be all kinds of errors included. For free! On 8 Aug 2014 01:45, "Kevin Hawkins" notifications@github.com wrote:

Got the UUID issue figured out now we are on to error on the event itself

16:35:42 [SEVERE] Aug 07, 2014 4:35:42 PM net.md_5.bungee.event.EventBus post WARNING: Error dispatching event ProxyPingEvent(connection=[/127.0.0.1:62501] <-

InitialHandler, response=ServerPing(protocolVersion=78, gameVersion=1.6.2-1.7. 10, motd=Another Bungee server, currentPlayers=0, maxPlayers=1), newResponse=nul l, isNewProtocol=false) to listener me.kyledag500.NeverDownProxy.Login@6f0ac4be java.lang.NullPointerException at me.kyledag500.NeverDownProxy.Login.onPing(Login.java:47) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.md_5.bungee.event.EventHandlerMethod.invoke(EventHandlerMethod.java:2 0) at net.md_5.bungee.event.EventBus.post(EventBus.java:42) at net.md_5.bungee.api.plugin.PluginManager.callEvent(PluginManager.java:332 ) at net.md_5.bungee.connection.InitialHandler$2.done(InitialHandler.java:171)

at net.md_5.bungee.connection.InitialHandler$2.done(InitialHandler.java:163)

at net.md_5.bungee.connection.InitialHandler.respondToPing(InitialHandler.ja

va:190) at net.md_5.bungee.connection.InitialHandler.handle(InitialHandler.java:141)

at net.md_5.bungee.protocol.packet.PacketFAPluginMessage.handle(PacketFAPlug

inMessage.java:52) at net.md_5.bungee.netty.HandlerBoss.channelRead(HandlerBoss.java:83) at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultCh annelHandlerContext.java:338) at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChan nelHandlerContext.java:324) at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDeco der.java:153) at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultCh annelHandlerContext.java:338) at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChan nelHandlerContext.java:324) at io.netty.handler.timeout.ReadTimeoutHandler.channelRead(ReadTimeoutHandle r.java:149) at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultCh annelHandlerContext.java:338) at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChan nelHandlerContext.java:324) at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPip eline.java:785) at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNi oByteChannel.java:122) at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:48 5) at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLo op.java:452) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:346) at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEven tExecutor.java:101) at java.lang.Thread.run(Unknown Source)

— Reply to this email directly or view it on GitHub https://github.com/TheUnnamedDude/BungeeCord/pull/22#issuecomment-51547351 .

Katelyn-SN commented 10 years ago

Its quite weird ill fork this repo and add all my changes so it will make it easier for you to replicate.

literalplus commented 10 years ago

Actually, I'm sorry, but I can't look at the source of the plugin you're using (NeverDownProxy), since it seems to be a paid plugin. NPEs are really hard to debug without source, so I think you need the author to help or find out what's null yourself.

Katelyn-SN commented 10 years ago

Ive gotten access to the source by decompiling I've yet to figure it out but a nice alternative would be AlwaysOnline which is free