Fix ClassCastException in tabCompletor (fixes #942)

This commit is contained in:
Shane Freeder 2017-11-27 16:52:32 +00:00
parent 147081d0ff
commit f0e225b526
No known key found for this signature in database
GPG key ID: A3F61EA5A085289C

View file

@ -1,4 +1,4 @@
From bf4f19f91435c909b7d3f1a7cd16fb1eaf8c834a Mon Sep 17 00:00:00 2001 From ffc314382bb537a85a3e0f1deb92137679ae98a4 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Sun, 26 Nov 2017 13:19:58 -0500 Date: Sun, 26 Nov 2017 13:19:58 -0500
Subject: [PATCH] AsyncTabCompleteEvent Subject: [PATCH] AsyncTabCompleteEvent
@ -80,15 +80,17 @@ index 5a620f3fd..35774f8bf 100644
public void a(PacketPlayInSettings packetplayinsettings) { public void a(PacketPlayInSettings packetplayinsettings) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index aa098172f..883aca80a 100644 index aa098172f..09eb79439 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1641,7 +1641,7 @@ public final class CraftServer implements Server { @@ -1640,8 +1640,8 @@ public final class CraftServer implements Server {
} else {
offers = tabCompleteChat(player, message); offers = tabCompleteChat(player, message);
} }
-
- TabCompleteEvent tabEvent = new TabCompleteEvent(player, message, offers); - TabCompleteEvent tabEvent = new TabCompleteEvent(player, message, offers);
+ TabCompleteEvent tabEvent = new TabCompleteEvent(player, message, offers, message.startsWith("/") || forceCommand, pos != null ? MCUtil.toLocation(((EntityPlayer) player).world, pos) : null); // Paper +
+ TabCompleteEvent tabEvent = new TabCompleteEvent(player, message, offers, message.startsWith("/") || forceCommand, pos != null ? MCUtil.toLocation(((CraftWorld) player.getWorld()).getHandle(), pos) : null); // Paper
getPluginManager().callEvent(tabEvent); getPluginManager().callEvent(tabEvent);
return tabEvent.isCancelled() ? Collections.EMPTY_LIST : tabEvent.getCompletions(); return tabEvent.isCancelled() ? Collections.EMPTY_LIST : tabEvent.getCompletions();