From fcccaa8c51d4bc30bb8f911313c14673c2448a2d Mon Sep 17 00:00:00 2001 From: kookroach Date: Tue, 6 Apr 2021 23:35:02 +0200 Subject: [PATCH] fix --- ReallifeGamemode.Server/Util/AnimationSync.cs | 23 ++++++++----------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/ReallifeGamemode.Server/Util/AnimationSync.cs b/ReallifeGamemode.Server/Util/AnimationSync.cs index 3af3a0dd..b1f2dbf7 100644 --- a/ReallifeGamemode.Server/Util/AnimationSync.cs +++ b/ReallifeGamemode.Server/Util/AnimationSync.cs @@ -8,24 +8,11 @@ namespace ReallifeGamemode.Server.Util { public static class AnimationSync { - public static void SyncAnimation(this Player player, dynamic animations) + public static void SyncAnimation(this Player player, dynamic animationName) { if (!player.HasData("Animation")) player.SetData("Animation", String.Empty); - string animationName; - - if (animations is List) - { - animationName = animations.get(0); - List nextAnimations = animations.Skip(1); - player.TriggerEvent("SERVER:QueueAnimations", nextAnimations.ToArray(), animationName); - } - else - { - animationName = animations; - } - string currentAnimation = player.GetData("Animation"); string newAnimation = animationName; @@ -36,6 +23,14 @@ namespace ReallifeGamemode.Server.Util player.SetData("Animation", newAnimation); } + public static void SyncAnimation(this Player player, List animations) + { + string animationName = animations.ElementAt(0); + List nextAnimations = animations.Skip(1).ToList(); + player.SyncAnimation(animationName); + player.TriggerEvent("SERVER:QueueAnimations", nextAnimations.ToArray(), animationName); + } + /// Check if Player has any Animation playing. /// ///