From fd2592bd99b450b34b446794bbcc0ed946391633 Mon Sep 17 00:00:00 2001 From: FlorianFun Date: Thu, 5 Jan 2017 15:03:53 +0100 Subject: [PATCH] Bug correction MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the server version is supérior to 1.9, charAt() points to an incorrect location and believes the server is in 1.1, and try to send the old version packet. Fixed by looking at the next character if it's '_'. --- .../com/darkblade12/particleeffect/ParticleEffect.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/darkblade12/particleeffect/ParticleEffect.java b/src/main/java/com/darkblade12/particleeffect/ParticleEffect.java index 6db6726..c57e669 100644 --- a/src/main/java/com/darkblade12/particleeffect/ParticleEffect.java +++ b/src/main/java/com/darkblade12/particleeffect/ParticleEffect.java @@ -1403,7 +1403,13 @@ public static void initialize() throws VersionIncompatibleException { return; } try { - version = Integer.parseInt(Character.toString(PackageType.getServerVersion().charAt(3))); + if (PackageType.getServerVersion().charAt(4) == '_') { + version = Integer.parseInt(Character.toString(PackageType.getServerVersion().charAt(3))); + } + else { + version = Integer.parseInt(Character.toString(PackageType.getServerVersion().charAt(3))) * 10; + version += Integer.parseInt(Character.toString(PackageType.getServerVersion().charAt(4))); + } if (version > 7) { enumParticle = PackageType.MINECRAFT_SERVER.getClass("EnumParticle"); } @@ -1602,4 +1608,4 @@ public PacketSendingException(String message, Throwable cause) { } } } -} \ No newline at end of file +}