Structure at (275.1, 0.4, 1488.9) has no owner!Solved

When ever a player raids a base from the raidable bases plugin, this is spammed in console and laggs my server 
"[AntiNoobRaid] Structure at (275.1, 0.4, 1488.9) has no owner!"

Is there a way we can set AntoNoobRaid to ignore these RaidableBases? 

Thanks!

Yes, the same problem

We made a temp fix untill mod author notices this thread

BijhplR1KeVgZVT.png pandaman

Yes, the same problem

FIXED

zRku2ZqJehU4AC2.png Nanner

FIXED

21Yo4PL1SQ4YLzG.png Nanner

We made a temp fix untill mod author notices this thread

unfortunately this just mask the error in in the console. after merging it, the console was still be spammed with [Warning] Calling 'OnEntityTakeDamage' on 'AntiNoobRaid v1.8.6' took average XXXms and [Warning] Calling 'OnFireBallDamage' on 'AntiNoobRaid v1.8.6' took average XXXms and these errors are causing the lag. this is due to there being No Owner ID associated with the base.

Failed to call hook 'OnEntityTakeDamage' on plugin 'AntiNoobRaid v1.8.6' (NullReferenceException: )
at (wrapper managed-to-native) UnityEngine.Component.GetComponentFastPath(UnityEngine.Component,System.Type,intptr)
at UnityEngine.Component.GetComponent[T] () [0x00021] in <c8dc2b468d1841099baa4dd8a110cc44>:0
at Oxide.Plugins.AntiNoobRaid+<FullOwner>c__AnonStorey3.<>m__0 (BaseEntity x) [0x00000] in <24dff748ff8d4754a9c9445947
da36a9>:0
at System.Linq.Enumerable+WhereEnumerableIterator`1[TSource].ToList () [0x0001b] in <351e49e2a5bf4fd6beabb458ce2255f3>
:0
at System.Linq.Enumerable.ToList[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x0001f] in <351e49e2a
5bf4fd6beabb458ce2255f3>:0
at Oxide.Plugins.AntiNoobRaid.FullOwner (BaseEntity ent, BasePlayer p) [0x00095] in <24dff748ff8d4754a9c9445947da36a9>
:0
at Oxide.Plugins.AntiNoobRaid.OnEntityTakeDamage (BaseCombatEntity entity, HitInfo hitinfo) [0x00280] in <24dff748ff8d
4754a9c9445947da36a9>:0
at Oxide.Plugins.AntiNoobRaid.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00443]
in <24dff748ff8d4754a9c9445947da36a9>:0
at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <
3606d2af539c45e4b5c61658e6a8b307>:0
at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <c2afd8354b8b4f3ca45
1cf5a1aa111c3>:0
at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <c2afd8354b8b4f3ca451cf5
a1aa111c3>:0
7qqb6iWFy3trTfl.png pandaman
Failed to call hook 'OnEntityTakeDamage' on plugin 'AntiNoobRaid v1.8.6' (NullReferenceException: )
at (wrapper managed-to-native) UnityEngine.Component.GetComponentFastPath(UnityEngine.Component,System.Type,intptr)
at UnityEngine.Component.GetComponent[T] () [0x00021] in <c8dc2b468d1841099baa4dd8a110cc44>:0
at Oxide.Plugins.AntiNoobRaid+<FullOwner>c__AnonStorey3.<>m__0 (BaseEntity x) [0x00000] in <24dff748ff8d4754a9c9445947
da36a9>:0
at System.Linq.Enumerable+WhereEnumerableIterator`1[TSource].ToList () [0x0001b] in <351e49e2a5bf4fd6beabb458ce2255f3>
:0
at System.Linq.Enumerable.ToList[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x0001f] in <351e49e2a
5bf4fd6beabb458ce2255f3>:0
at Oxide.Plugins.AntiNoobRaid.FullOwner (BaseEntity ent, BasePlayer p) [0x00095] in <24dff748ff8d4754a9c9445947da36a9>
:0
at Oxide.Plugins.AntiNoobRaid.OnEntityTakeDamage (BaseCombatEntity entity, HitInfo hitinfo) [0x00280] in <24dff748ff8d
4754a9c9445947da36a9>:0
at Oxide.Plugins.AntiNoobRaid.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00443]
in <24dff748ff8d4754a9c9445947da36a9>:0
at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <
3606d2af539c45e4b5c61658e6a8b307>:0
at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <c2afd8354b8b4f3ca45
1cf5a1aa111c3>:0
at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <c2afd8354b8b4f3ca451cf5
a1aa111c3>:0

try the new update I just pushed and let me know if it still happens

Edit: also is that with RaidableBases Installed?

K0ybW8dMvniUzdt.png pandaman
Failed to call hook 'OnEntityTakeDamage' on plugin 'AntiNoobRaid v1.8.6' (NullReferenceException: )
at (wrapper managed-to-native) UnityEngine.Component.GetComponentFastPath(UnityEngine.Component,System.Type,intptr)
at UnityEngine.Component.GetComponent[T] () [0x00021] in <c8dc2b468d1841099baa4dd8a110cc44>:0
at Oxide.Plugins.AntiNoobRaid+<FullOwner>c__AnonStorey3.<>m__0 (BaseEntity x) [0x00000] in <24dff748ff8d4754a9c9445947
da36a9>:0
at System.Linq.Enumerable+WhereEnumerableIterator`1[TSource].ToList () [0x0001b] in <351e49e2a5bf4fd6beabb458ce2255f3>
:0
at System.Linq.Enumerable.ToList[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x0001f] in <351e49e2a
5bf4fd6beabb458ce2255f3>:0
at Oxide.Plugins.AntiNoobRaid.FullOwner (BaseEntity ent, BasePlayer p) [0x00095] in <24dff748ff8d4754a9c9445947da36a9>
:0
at Oxide.Plugins.AntiNoobRaid.OnEntityTakeDamage (BaseCombatEntity entity, HitInfo hitinfo) [0x00280] in <24dff748ff8d
4754a9c9445947da36a9>:0
at Oxide.Plugins.AntiNoobRaid.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00443]
in <24dff748ff8d4754a9c9445947da36a9>:0
at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <
3606d2af539c45e4b5c61658e6a8b307>:0
at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <c2afd8354b8b4f3ca45
1cf5a1aa111c3>:0
at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <c2afd8354b8b4f3ca451cf5
a1aa111c3>:0

Thanks for the quick update and reply! 
Yes this is with the Raidablebases plugin installed



Merged post

The new update still spams the console z9RZeQ9lGYKwe8Q.png
NByYE8jJpyi8fvD.png Nanner

Thanks for the quick update and reply! 
Yes this is with the Raidablebases plugin installed



Merged post

The new update still spams the console z9RZeQ9lGYKwe8Q.png
Yea it's because the structure's that Raidiblebases places are SERVER spawn therefore it doesn't get assign a player ID. this conlict is a hard one too narrow down compared  to the negitive countdown issue. have some ideas on what I could do so let's cross our fingers it works. But it may come down to raidable bases needing to add an option to add an OwnerID to the base.

EDIT: If I dose work I'll pm you the patch link to test for me 
R2vrrh4yXk6Ze8J.png Nanner

Thanks for the quick update and reply! 
Yes this is with the Raidablebases plugin installed



Merged post

The new update still spams the console z9RZeQ9lGYKwe8Q.png

Sounds great dude thanks!!!

Do you think a if statement would do the trick?

if = have no owner
return false //do nothing

else

All the other things the plug-in do.

I do believe that the problem is not the spam in console, but that the plug-in check buildings with no owner

is there already an update on this? As soon as the Raidbaisen are geraidet the plugin AntiNoobRaid Serverlags ;D

derWusel

is there already an update on this? As soon as the Raidbaisen are geraidet the plugin AntiNoobRaid Serverlags ;D

LtsZBlKUBxikqvT.png bjarkeh

Do you think a if statement would do the trick?

if = have no owner
return false //do nothing

else

All the other things the plug-in do.

I do believe that the problem is not the spam in console, but that the plug-in check buildings with no owner

NPAFmPllQ060TiF.png Nanner

Sounds great dude thanks!!!

sxNY3xZOgufrE1L.png pandaman
Failed to call hook 'OnEntityTakeDamage' on plugin 'AntiNoobRaid v1.8.6' (NullReferenceException: )
at (wrapper managed-to-native) UnityEngine.Component.GetComponentFastPath(UnityEngine.Component,System.Type,intptr)
at UnityEngine.Component.GetComponent[T] () [0x00021] in <c8dc2b468d1841099baa4dd8a110cc44>:0
at Oxide.Plugins.AntiNoobRaid+<FullOwner>c__AnonStorey3.<>m__0 (BaseEntity x) [0x00000] in <24dff748ff8d4754a9c9445947
da36a9>:0
at System.Linq.Enumerable+WhereEnumerableIterator`1[TSource].ToList () [0x0001b] in <351e49e2a5bf4fd6beabb458ce2255f3>
:0
at System.Linq.Enumerable.ToList[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x0001f] in <351e49e2a
5bf4fd6beabb458ce2255f3>:0
at Oxide.Plugins.AntiNoobRaid.FullOwner (BaseEntity ent, BasePlayer p) [0x00095] in <24dff748ff8d4754a9c9445947da36a9>
:0
at Oxide.Plugins.AntiNoobRaid.OnEntityTakeDamage (BaseCombatEntity entity, HitInfo hitinfo) [0x00280] in <24dff748ff8d
4754a9c9445947da36a9>:0
at Oxide.Plugins.AntiNoobRaid.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00443]
in <24dff748ff8d4754a9c9445947da36a9>:0
at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <
3606d2af539c45e4b5c61658e6a8b307>:0
at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <c2afd8354b8b4f3ca45
1cf5a1aa111c3>:0
at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <c2afd8354b8b4f3ca451cf5
a1aa111c3>:0


the latest patch should be resolved this issue from my testing

ah, I did not read this thread before submitting my patch.

as such, the last issue is not fixed

GetComponent and its LINQ is quite expensive so both should not be used. GetComponent is causing the error, and the combination of both searching every entity every time is very demanding of the server and causes the lag

private List<BuildingBlock> _blocks = new List<BuildingBlock>();

        private void OnEntitySpawned(BuildingBlock block) => _blocks.Add(block);

        private void OnEntityDeath(BuildingBlock block, HitInfo hitInfo) => _blocks.Remove(block);

        private void OnEntityKill(BuildingBlock block) => _blocks.Remove(block);

        private void Init()
        {
            Unsubscribe(nameof(OnEntityDeath));
            Unsubscribe(nameof(OnEntityKill));
            Unsubscribe(nameof(OnEntitySpawned));
        }

        private void OnServerInitialized(bool isStartup) // use this hook instead of Loaded()
        {
            foreach (var block in BaseEntity.saveList.OfType<BuildingBlock>()) _blocks.Add(block);

            Subscribe(nameof(OnEntityDeath));
            Subscribe(nameof(OnEntityKill));
            Subscribe(nameof(OnEntitySpawned));
        }

        private ulong FullOwner(BaseEntity ent, BasePlayer p = null)
        {
            if (ent == null) return 0u;

            var block = ent as BuildingBlock;
            if (block == null) return ent.OwnerID;

            var cached = BuildingInfo.GetByBuildingID(block.buildingID);
            if (cached != null)
                if (cached.GetCacheAge() < 180 && cached.GetCacheAge() != -1) return cached.OwnerID;

            var ownership = new Dictionary<ulong, int>();

            _blocks.RemoveAll(x => x == null || x.IsDestroyed || x.OwnerID == 0u);

            foreach (var x in _blocks) // no more expensive LINQ
            {
                if (x.buildingID != block.buildingID || config.IgnoreTwig && x.grade == BuildingGrade.Enum.Twigs)
                {
                    continue;
                }

                if (!ownership.ContainsKey(x.OwnerID)) ownership[x.OwnerID] = 1;
                else ownership[x.OwnerID]++;
            }

            if (ownership.Count == 0)
            {
                //Should this even happen?
                PrintWarning(lang.GetMessage("struct_noowner", this, null), ent.transform.position);
                return ent.OwnerID;
            }

            var owner = ownership.Max(x => x.Key);

            if (cached != null)
            {
                cached.OwnerID = owner;
                cached.lastUpdate = DateTime.UtcNow;
            }

            else BuildingInfo.buildCache.Add(new BuildingInfo { buildingID = block.buildingID, lastUpdate = DateTime.UtcNow, OwnerID = owner });

            return owner;
        }​

this will fix the issues, and cache the blocks so that there is far less load on the server. merge into the existing hooks and replace the existing FullOwner method. i would have submitted it but it is not tested

nivex

ah, I did not read this thread before submitting my patch.

as such, the last issue is not fixed

GetComponent and its LINQ is quite expensive so both should not be used. GetComponent is causing the error, and the combination of both searching every entity every time is very demanding of the server and causes the lag

private List<BuildingBlock> _blocks = new List<BuildingBlock>();

        private void OnEntitySpawned(BuildingBlock block) => _blocks.Add(block);

        private void OnEntityDeath(BuildingBlock block, HitInfo hitInfo) => _blocks.Remove(block);

        private void OnEntityKill(BuildingBlock block) => _blocks.Remove(block);

        private void Init()
        {
            Unsubscribe(nameof(OnEntityDeath));
            Unsubscribe(nameof(OnEntityKill));
            Unsubscribe(nameof(OnEntitySpawned));
        }

        private void OnServerInitialized(bool isStartup) // use this hook instead of Loaded()
        {
            foreach (var block in BaseEntity.saveList.OfType<BuildingBlock>()) _blocks.Add(block);

            Subscribe(nameof(OnEntityDeath));
            Subscribe(nameof(OnEntityKill));
            Subscribe(nameof(OnEntitySpawned));
        }

        private ulong FullOwner(BaseEntity ent, BasePlayer p = null)
        {
            if (ent == null) return 0u;

            var block = ent as BuildingBlock;
            if (block == null) return ent.OwnerID;

            var cached = BuildingInfo.GetByBuildingID(block.buildingID);
            if (cached != null)
                if (cached.GetCacheAge() < 180 && cached.GetCacheAge() != -1) return cached.OwnerID;

            var ownership = new Dictionary<ulong, int>();

            _blocks.RemoveAll(x => x == null || x.IsDestroyed || x.OwnerID == 0u);

            foreach (var x in _blocks) // no more expensive LINQ
            {
                if (x.buildingID != block.buildingID || config.IgnoreTwig && x.grade == BuildingGrade.Enum.Twigs)
                {
                    continue;
                }

                if (!ownership.ContainsKey(x.OwnerID)) ownership[x.OwnerID] = 1;
                else ownership[x.OwnerID]++;
            }

            if (ownership.Count == 0)
            {
                //Should this even happen?
                PrintWarning(lang.GetMessage("struct_noowner", this, null), ent.transform.position);
                return ent.OwnerID;
            }

            var owner = ownership.Max(x => x.Key);

            if (cached != null)
            {
                cached.OwnerID = owner;
                cached.lastUpdate = DateTime.UtcNow;
            }

            else BuildingInfo.buildCache.Add(new BuildingInfo { buildingID = block.buildingID, lastUpdate = DateTime.UtcNow, OwnerID = owner });

            return owner;
        }​

this will fix the issues, and cache the blocks so that there is far less load on the server. merge into the existing hooks and replace the existing FullOwner method. i would have submitted it but it is not tested

thanks for the info and everything will merge it in a bit and test. But what you submitted before has seem to help alot, was able to throw a ton of c4 at a raid base while shooting it with Explosive ammo using a m249 and the Server FPS didnt budge abit unlike before and didnt spam the console with "Structure at X,X,X,X has no owner" only showed up once at the end
Locked automatically