Consoles
Consoles copied to clipboard
Could not pass event PlayerMoveEvent to ConsolesCore v1.2
[10:47:13 ERROR]: Could not pass event PlayerMoveEvent to ConsolesCore v1.2
org.bukkit.event.EventException
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:310) ~[spigot-1.8.8.jar:git-Spigot-db6de12-07c3001]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[spigot-1.8.8.jar:git-Spigot-db6de12-07c3001]
at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:502) [spigot-1.8.8.jar:git-Spigot-db6de12-07c3001]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:487) [spigot-1.8.8.jar:git-Spigot-db6de12-07c3001]
at net.minecraft.server.v1_8_R3.PlayerConnection.a(PlayerConnection.java:270) [spigot-1.8.8.jar:git-Spigot-db6de12-07c3001]
at net.minecraft.server.v1_8_R3.PacketPlayInFlying.a(SourceFile:126) [spigot-1.8.8.jar:git-Spigot-db6de12-07c3001]
at net.minecraft.server.v1_8_R3.PacketPlayInFlying$PacketPlayInPosition.a(SourceFile:57) [spigot-1.8.8.jar:git-Spigot-db6de12-07c3001]
at net.minecraft.server.v1_8_R3.PlayerConnectionUtils$1.run(SourceFile:13) [spigot-1.8.8.jar:git-Spigot-db6de12-07c3001]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_66]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_66]
at net.minecraft.server.v1_8_R3.SystemUtils.a(SourceFile:44) [spigot-1.8.8.jar:git-Spigot-db6de12-07c3001]
at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:715) [spigot-1.8.8.jar:git-Spigot-db6de12-07c3001]
at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:374) [spigot-1.8.8.jar:git-Spigot-db6de12-07c3001]
at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:654) [spigot-1.8.8.jar:git-Spigot-db6de12-07c3001]
at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:557) [spigot-1.8.8.jar:git-Spigot-db6de12-07c3001]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_66]
Caused by: java.lang.IllegalArgumentException: Cannot measure distance between survival and hub
at org.bukkit.Location.distanceSquared(Location.java:456) ~[spigot-1.8.8.jar:git-Spigot-db6de12-07c3001]
at ca.jarcode.consoles.internal.ConsolePixelBuffer$PlayerListener.onPlayerMove(ConsolePixelBuffer.java:170) ~[?:?]
at sun.reflect.GeneratedMethodAccessor61.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_66]
at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_66]
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[spigot-1.8.8.jar:git-Spigot-db6de12-07c3001]
... 15 more
The money line from the traceback is of course Caused by: java.lang.IllegalArgumentException: Cannot measure distance between survival and hub at org.bukkit.Location.distanceSquared(Location.java:456)
The onPlayerMove() handler has an explicit check to make sure the renderer is in the same world as the player. Except at the point the event fires, the player hasn't actually moved yet, so you're checking against the source of the move. If the player is moving from the world with the renderer to a different one (stepped into a portal), then this check will pass because they are currently in the same world. Except then you're trying to do distance math on the destination of the move, which doesn't work since the destination wasn't in the same world.
The fix is to check the world of the destination instead of the player's current world.
diff --git a/consoles-core/src/main/java/ca/jarcode/consoles/internal/ConsolePixelBuffer.java b/consoles-core/src/main/java/ca/jarcode/consoles/internal/ConsolePixelBuffer.java
index 02e5025..5bbde59 100644
--- a/consoles-core/src/main/java/ca/jarcode/consoles/internal/ConsolePixelBuffer.java
+++ b/consoles-core/src/main/java/ca/jarcode/consoles/internal/ConsolePixelBuffer.java
@@ -166,7 +166,7 @@ public class ConsolePixelBuffer {
@SuppressWarnings("unused")
public void onPlayerMove(PlayerMoveEvent e) {
boolean last = inside;
- inside = renderer.pos.getWorld() == e.getPlayer().getWorld()
+ inside = renderer.pos.getWorld() == e.getTo().getWorld()
&& renderer.pos.distanceSquared(e.getTo()) <= 1280;
// if the player entered the radius, update the painting
if (!last && inside)
Thanks for the detailed report and fix, I will get this change in once I can get version 1.3
working. I've been incredibly busy with other things and trying to get the native component for Consoles to work has been a chore (if anyone is able to help me with the codebase, that would be great).