From 77bc015340c8ed60f166e3c59cafa3c9f9242fa5 Mon Sep 17 00:00:00 2001 From: PikaMug <2267126+PikaMug@users.noreply.github.com> Date: Thu, 23 Apr 2020 03:01:43 -0400 Subject: [PATCH] Resolve particle effects correctly on MC 1.8.8, fixes #1231 --- .../blackvein/quests/particle/PreBuiltParticle.java | 12 +----------- .../me/blackvein/quests/tasks/NpcEffectThread.java | 6 +++++- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/main/src/main/java/me/blackvein/quests/particle/PreBuiltParticle.java b/main/src/main/java/me/blackvein/quests/particle/PreBuiltParticle.java index 3460d50e0..e755c636d 100644 --- a/main/src/main/java/me/blackvein/quests/particle/PreBuiltParticle.java +++ b/main/src/main/java/me/blackvein/quests/particle/PreBuiltParticle.java @@ -12,10 +12,6 @@ package me.blackvein.quests.particle; -import java.util.HashMap; -import java.util.Map; -import java.util.stream.Stream; - import org.bukkit.util.Vector; public enum PreBuiltParticle { @@ -33,12 +29,6 @@ public enum PreBuiltParticle { SPLASH("splash", 0, 0, 0, 1, 4, new Vector(0, .5, 0)), SMOKE("smoke", 0, 1, 0, 1, 20); - private static Map FROM_IDENTIFIER = new HashMap<>(); - - static { - Stream.of(values()).forEach(p -> FROM_IDENTIFIER.put(p.identifier, p)); - } - private String identifier; private float offsetX, offsetY, offsetZ, speed; private int count; @@ -99,6 +89,6 @@ public enum PreBuiltParticle { * @return the PreBuiltParticle represented by the specified identifier */ public static PreBuiltParticle fromIdentifier(String identifier) { - return FROM_IDENTIFIER.get(identifier); + return valueOf(identifier); } } diff --git a/main/src/main/java/me/blackvein/quests/tasks/NpcEffectThread.java b/main/src/main/java/me/blackvein/quests/tasks/NpcEffectThread.java index 1d6438fc7..c8b3a9507 100644 --- a/main/src/main/java/me/blackvein/quests/tasks/NpcEffectThread.java +++ b/main/src/main/java/me/blackvein/quests/tasks/NpcEffectThread.java @@ -67,7 +67,11 @@ public class NpcEffectThread implements Runnable { if (plugin.getDependencies().getCitizens() != null) { Location eyeLoc = npc.getEntity().getLocation(); eyeLoc.setY(eyeLoc.getY() + 2); - ParticleProvider.sendToPlayer(player, eyeLoc, effectType.toUpperCase()); + try { + ParticleProvider.sendToPlayer(player, eyeLoc, effectType.toUpperCase()); + } catch (NoClassDefFoundError e) { + // Unsupported Minecraft version + } } } }