Resolve particle effects correctly on MC 1.8.8, fixes #1231

This commit is contained in:
PikaMug 2020-04-23 03:01:43 -04:00
parent 06fa805a3c
commit 77bc015340
2 changed files with 6 additions and 12 deletions

View File

@ -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<String, PreBuiltParticle> 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);
}
}

View File

@ -67,7 +67,11 @@ public class NpcEffectThread implements Runnable {
if (plugin.getDependencies().getCitizens() != null) {
Location eyeLoc = npc.getEntity().getLocation();
eyeLoc.setY(eyeLoc.getY() + 2);
try {
ParticleProvider.sendToPlayer(player, eyeLoc, effectType.toUpperCase());
} catch (NoClassDefFoundError e) {
// Unsupported Minecraft version
}
}
}
}