EcoModsDevelopers / EcoWorldEdit

WorldEdit for Eco
3 stars 0 forks source link

server error when trying to paste file #5

Open AlexALX opened 4 years ago

AlexALX commented 4 years ago

Hi, i'm getting this error in server console:

System.NullReferenceException: Ссылка на объект не указывает на экземпляр объекта.
   at Eco.Gameplay.Players.UserAlias.GetHashCode()
   at System.Collections.Generic.GenericEqualityComparer`1.GetHashCode(T obj)
   at System.Collections.Immutable.ImmutableHashSet`1.Add(T item, MutationInput origin)
   at System.Collections.Immutable.ImmutableHashSet`1.Add(T item)
   at Eco.Core.Utils.ThreadSafeHashSet`1.<>c__DisplayClass10_0.<Add>b__0(ImmutableHashSet`1 x)
   at Eco.Core.Utils.ImmutableHelper.ApplyImmutable[T](T& original, Func`2 apply)
   at Eco.Core.Utils.ThreadSafeHashSet`1.Add(T item)
   at Eco.Core.Utils.ControllerHashSet`1.<>c__DisplayClass9_0.<Add>b__0()
   at Eco.Core.Utils.ControllerHashSet`1.ApplyChange(Func`1 change)

Translation: Object reference not set to an instance of an object

When trying to paste my exported file.

Here is file: da4a.zip

Also happens with other exported files as well. plugin may paste them as half of saved area, and if use //undo - it will back blocks, but may also keep items (storage boxes/benches/chairs etc) not removed.

TheKye commented 4 years ago

Hi there! i have downloaded the repo and done some changes in the code,

i only get this error you're getting on export when i haven't used copy yet

so you would select the first area, then the second area make sure the second location is a few blocks above what you want to export, then do //copy then do //export name you should be able to do //import name straight after, then do //paste

give this a try and let me know how you go

AlexALX commented 4 years ago

did you tried my exported file? i did some other investigation and added into WorldEditUserData.cs to function LoadSelectionFromClipboard just try / catch code

                try {
                    AddBlockChangedEntry(Eco.World.World.GetBlock(web.Position), web.Position);
                    WorldEditManager.SetBlock(web.Type, web.Position, session, null, null, web.Data);
                } catch (Exception e) { }

after that i was able to paste my file, but some things was missing or fill with ground. not sure if this helps.

about your suggestion - i did used commands //expand 50 up or so to make sure it will select proper blocks. so i'm pretty sure i was copied everything correct.

TheKye commented 4 years ago

i haven't tried your file yet i will soon, but yeah adding in a check like that is a small temp fix, it should return a full error