From 91c2987cfe05914db061d9d1bdbec06cc75cc25b Mon Sep 17 00:00:00 2001 From: KennyTV <28825609+KennyTV@users.noreply.github.com> Date: Sat, 31 Aug 2019 09:28:56 +0200 Subject: [PATCH] Minor change Fixes #1431 (also trying the awesome GitHub auto-closing) --- .../listeners/multiversion/PlayerSneakListener.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bukkit/src/main/java/us/myles/ViaVersion/bukkit/listeners/multiversion/PlayerSneakListener.java b/bukkit/src/main/java/us/myles/ViaVersion/bukkit/listeners/multiversion/PlayerSneakListener.java index 7ec2d281a..867561286 100644 --- a/bukkit/src/main/java/us/myles/ViaVersion/bukkit/listeners/multiversion/PlayerSneakListener.java +++ b/bukkit/src/main/java/us/myles/ViaVersion/bukkit/listeners/multiversion/PlayerSneakListener.java @@ -39,13 +39,13 @@ public class PlayerSneakListener extends ViaBukkitListener { final String packageName = plugin.getServer().getClass().getPackage().getName(); getHandle = Class.forName(packageName + ".entity.CraftPlayer").getMethod("getHandle"); + final Class entityPlayerClass = Class.forName(packageName + .replace("org.bukkit.craftbukkit", "net.minecraft.server") + ".EntityPlayer"); try { - setSize = Class.forName(packageName - .replace("org.bukkit.craftbukkit", "net.minecraft.server") + ".EntityPlayer").getMethod("setSize", Float.TYPE, Float.TYPE); - } catch (ClassNotFoundException | NoSuchMethodException e) { + setSize = entityPlayerClass.getMethod("setSize", Float.TYPE, Float.TYPE); + } catch (NoSuchMethodException e) { // Don't catch this one - setSize = Class.forName(packageName - .replace("org.bukkit.craftbukkit", "net.minecraft.server") + ".EntityPlayer").getMethod("a", Float.TYPE, Float.TYPE); + setSize = entityPlayerClass.getMethod("a", Float.TYPE, Float.TYPE); }