Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"bound must be positive" when calling getRandomPlayer #49

Open
RoboMWM opened this issue Dec 14, 2016 · 4 comments
Open

"bound must be positive" when calling getRandomPlayer #49

RoboMWM opened this issue Dec 14, 2016 · 4 comments

Comments

@RoboMWM
Copy link

RoboMWM commented Dec 14, 2016

I'll investigate more if need be, but I have things to do and may PR a fix later if someone else doesn't find it before me.

[08:42:15] [Server thread/ERROR]: Could not pass event PlayerQuitEvent to FirstJoinPlus v2.4.1
org.bukkit.event.EventException
	at org.bukkit.plugin.EventExecutor$1.execute(EventExecutor.java:46) ~[patched_1.11.jar:git-Paper-962]
	at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:78) ~[patched_1.11.jar:git-Paper-962]
	at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[patched_1.11.jar:git-Paper-962]
	at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:517) [patched_1.11.jar:git-Paper-962]
	at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:502) [patched_1.11.jar:git-Paper-962]
	at net.minecraft.server.v1_11_R1.PlayerList.disconnect(PlayerList.java:410) [patched_1.11.jar:git-Paper-962]
	at net.minecraft.server.v1_11_R1.PlayerConnection.a(PlayerConnection.java:1055) [patched_1.11.jar:git-Paper-962]
	at net.minecraft.server.v1_11_R1.NetworkManager.handleDisconnection(NetworkManager.java:322) [patched_1.11.jar:git-Paper-962]
	at net.minecraft.server.v1_11_R1.ServerConnection.c(ServerConnection.java:184) [patched_1.11.jar:git-Paper-962]
	at net.minecraft.server.v1_11_R1.MinecraftServer.D(MinecraftServer.java:912) [patched_1.11.jar:git-Paper-962]
	at net.minecraft.server.v1_11_R1.DedicatedServer.D(DedicatedServer.java:403) [patched_1.11.jar:git-Paper-962]
	at net.minecraft.server.v1_11_R1.MinecraftServer.C(MinecraftServer.java:749) [patched_1.11.jar:git-Paper-962]
	at net.minecraft.server.v1_11_R1.MinecraftServer.run(MinecraftServer.java:648) [patched_1.11.jar:git-Paper-962]
	at java.lang.Thread.run(Unknown Source) [?:1.8.0_111]
Caused by: java.lang.IllegalArgumentException: bound must be positive
	at java.util.Random.nextInt(Unknown Source) ~[?:1.8.0_111]
	at com.chaseoes.firstjoinplus.utilities.Utilities.getRandomPlayer(Utilities.java:153) ~[?:?]
	at com.chaseoes.firstjoinplus.utilities.Utilities.replaceVariables(Utilities.java:163) ~[?:?]
	at com.chaseoes.firstjoinplus.PlayerListeners.onPlayerQuit(PlayerListeners.java:72) ~[?:?]
	at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor111.execute(Unknown Source) ~[?:?]
	at org.bukkit.plugin.EventExecutor$1.execute(EventExecutor.java:44) ~[patched_1.11.jar:git-Paper-962]
	... 13 more
@chaseoes
Copy link
Owner

chaseoes commented Dec 14, 2016

From what I can tell on that line, this should only happen if getServer().getOnlinePlayers() is empty (returns a size of 0); which should theoretically never be the case since it's being called during PlayerQuitEvent and that list shouldn't be empty until after the event has completed.

Not too sure, I would have to do some more research myself as well.

@RoboMWM
Copy link
Author

RoboMWM commented Dec 14, 2016

This is all I've got in the logs:

[08:41:42] [LoginProcessingThread/INFO]: UUID of player kaptein2plays is nobodycaressoiremovedit
[08:41:43] [Server thread/INFO]: kaptein2plays[/removed] logged in with entity id 981608 at ([lazypvpworld]13.175060740610363, 11.0, 34.294799782587994)
[08:41:43] [Craft Scheduler Thread - 1006/INFO]: [GAListener] Player: kaptein2plays has 0 votes
[08:42:15] [Server thread/INFO]: kaptein2plays lost connection: Timed out
[08:42:15] [Server thread/ERROR]: Could not pass event PlayerQuitEvent to FirstJoinPlus v2.4.1
org.bukkit.event.EventException
	at org.bukkit.plugin.EventExecutor$1.execute(EventExecutor.java:46) ~[patched_1.11.jar:git-Paper-962]
	at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:78) ~[patched_1.11.jar:git-Paper-962]
	at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[patched_1.11.jar:git-Paper-962]
	at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:517) [patched_1.11.jar:git-Paper-962]
	at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:502) [patched_1.11.jar:git-Paper-962]
	at net.minecraft.server.v1_11_R1.PlayerList.disconnect(PlayerList.java:410) [patched_1.11.jar:git-Paper-962]
	at net.minecraft.server.v1_11_R1.PlayerConnection.a(PlayerConnection.java:1055) [patched_1.11.jar:git-Paper-962]
	at net.minecraft.server.v1_11_R1.NetworkManager.handleDisconnection(NetworkManager.java:322) [patched_1.11.jar:git-Paper-962]
	at net.minecraft.server.v1_11_R1.ServerConnection.c(ServerConnection.java:184) [patched_1.11.jar:git-Paper-962]
	at net.minecraft.server.v1_11_R1.MinecraftServer.D(MinecraftServer.java:912) [patched_1.11.jar:git-Paper-962]
	at net.minecraft.server.v1_11_R1.DedicatedServer.D(DedicatedServer.java:403) [patched_1.11.jar:git-Paper-962]
	at net.minecraft.server.v1_11_R1.MinecraftServer.C(MinecraftServer.java:749) [patched_1.11.jar:git-Paper-962]
	at net.minecraft.server.v1_11_R1.MinecraftServer.run(MinecraftServer.java:648) [patched_1.11.jar:git-Paper-962]
	at java.lang.Thread.run(Unknown Source) [?:1.8.0_111]
Caused by: java.lang.IllegalArgumentException: bound must be positive
	at java.util.Random.nextInt(Unknown Source) ~[?:1.8.0_111]
	at com.chaseoes.firstjoinplus.utilities.Utilities.getRandomPlayer(Utilities.java:153) ~[?:?]
	at com.chaseoes.firstjoinplus.utilities.Utilities.replaceVariables(Utilities.java:163) ~[?:?]
	at com.chaseoes.firstjoinplus.PlayerListeners.onPlayerQuit(PlayerListeners.java:72) ~[?:?]
	at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor111.execute(Unknown Source) ~[?:?]
	at org.bukkit.plugin.EventExecutor$1.execute(EventExecutor.java:44) ~[patched_1.11.jar:git-Paper-962]
	... 13 more
[08:42:15] [Server thread/INFO]: kaptein2plays left the game

I am running waterfall (fork of bungee). But yea, doesn't make much sense to me either.

@chaseoes
Copy link
Owner

chaseoes commented Dec 14, 2016

That explains some more, specifically these lines:

[08:42:15] [Server thread/INFO]: kaptein2plays lost connection: Timed out
[08:42:15] [Server thread/INFO]: kaptein2plays left the game

I'm pretty sure that should not have happened. The same user somehow disconnected from the server twice despite only being connected once. I could be wrong but I think only one of those messages should have appeared.

FirstJoinPlus would have worked properly on the first disconnect it saw (when they timed out), but when it saw the second it resulted in an error since they were already removed from the player list on the first disconnect.

Possibly a bug in the server code? I'm assuming this was only a one time occurrence.

Again, just not really sure how getOnlinePlayers could ever be empty during that event otherwise this would happen every single time a user left the server when they're the only one online.

@RoboMWM
Copy link
Author

RoboMWM commented Dec 14, 2016

The same user somehow disconnected from the server twice despite only being connected once. I could be wrong but I think only one of those messages should have appeared.

I'll double check, but if I recall it always prints their reason for losing connection (disconnected being the normal way), and then prints whatever is in event#getQuitMessage (which is interesting, because I silence quit messages, so normally for me this would not print). So probably is a server bug(?) since it seems quitevent was called too late?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants