#Player.Get error with IGameComponent

1 messages · Page 1 of 1 (latest)

opal wasp
#

So, I updated LabAPI build to the latest version and I'm getting following error. Everything worked before, even with LabAPI (it issue only after latest update). How can I fix it?

topaz epoch
#

wait what

#

are you sure ur using Labapi Player

opal wasp
opal wasp
terse owl
#

should not be the latest version of LabAPI (0.5.0.0)

#

Player.Get(ReferenceHub) was added in 0.0.5.0

#

or using problem

opal wasp
#

nope, using is good

dark flax
#

show the Dependencies->Asssembly

opal wasp
dark flax
#

are you sure your publizied one is 14.0.3 / labapi beta?

opal wasp
#

Also whole file for reference (it's not only isssue with this file but still)

using HarmonyLib;
using LabApi.Features.Wrappers;
using ServerCore.Subclass.Models;
using PlayerStatsSystem;

namespace ServerCore.Subclass.Patches
{
    [HarmonyPatch(typeof(HealthStat))]
    internal static class HealthStatPatch
    {
        [HarmonyPatch(nameof(HealthStat.MaxValue), MethodType.Getter)]
        private static bool Prefix(ref float __result, HealthStat __instance)
        {
            if (__instance?.Hub == null || Player.Get(__instance.Hub) == null || !SubclassAPI.AsignedRoles.TryGetValue(Player.Get(__instance.Hub).UserId, out CustomClass playerRole) || playerRole.MaxHp == -1)
                return true;

            __result = playerRole.MaxHp;
            return false;
        }
    }
}```
opal wasp
#

I will validate it again tho, just to be sure

dark flax
#

no error for me

opal wasp
#

So basically my skill issue

#

thanks

#

I still don't know how no other thing was wrong tho