Skip to content

Commit

Permalink
animate command cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed May 14, 2021
1 parent c4a9ccd commit 7300315
Showing 1 changed file with 7 additions and 3 deletions.
Expand Up @@ -100,10 +100,10 @@ public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException
if (arg.matchesEnum(PlayerAnimation.values())) {
scriptEntry.addObject("animation", PlayerAnimation.valueOf(arg.getValue().toUpperCase()));
}
else if (arg.matchesEnum(EntityEffect.values())) {
if (arg.matchesEnum(EntityEffect.values())) {
scriptEntry.addObject("effect", EntityEffect.valueOf(arg.getValue().toUpperCase()));
}
else if (animationHelper.hasEntityAnimation(arg.getValue())) {
if (animationHelper.hasEntityAnimation(arg.getValue())) {
scriptEntry.addObject("nms_animation", arg.getValue());
}
}
Expand Down Expand Up @@ -148,13 +148,17 @@ else if (effect != null) {
entity.getBukkitEntity().playEffect(effect);
}
}
else {
else if (nmsAnimation != null) {
EntityAnimation entityAnimation = NMSHandler.getAnimationHelper().getEntityAnimation(nmsAnimation);
entityAnimation.play(entity.getBukkitEntity());
}
else {
Debug.echoError("No way to play the given animation on entity '" + entity + "'");
}
}
catch (Exception e) {
Debug.echoError(scriptEntry.getResidingQueue(), "Error playing that animation!");
Debug.echoError(e);
}
}
}
Expand Down

0 comments on commit 7300315

Please sign in to comment.