Need help to get Offline-User
I'm working on a way to unclaim a users property.
Currently this is what I have:
Player OtherPlayer = UserManager.FindUser("R4mbo").Player;
The problem I have is: It finds only online Players.
I need to somehow get the "Player" from a person which is offline.
Any quick Idea?
I know Devs already work on a way to let Admins unclaim any properties, but until then I would like to have a fast fix, since there are some problems with griefers on our Server.
OK... it seems a User is detected...
I think I figured out how it works...
User = all Users
User.Player / Player are only the Player Instances of the Users which are currently active.... so I have to find a way to remove Properties of Users, not Players, therefore need another command...
Right, player only exists while the player is connected to the server and will null otherwise. All saved player data lies on their User object.
This makes me mad ...
I won't give up ;P
That means... a Plot can only be unclaimed if the Owner is online... as far as I can see..
that method is just using the current players position to remove the plot where they are standing - you'll need a different solution to remove it otherwise.
Is there a bug for this command? If not please add one and we can make it.
OK, I found a mad solution...
creating a dummy-Player for an offline-User, Teleporting it to the Admins Location, unclaiming the Property, removing dummyplayer... job done...
Now I just need to test often enough, since it could break something and to enhance it...
noblackthunder is already working on an official command.
Until it is released I gonna provide a mod which does the job.
Unfortunately I didn't find a direct way to unclaim land which is claimed by another User.
So my workaround is to use
User OtherUser = UserManager.FindUser("OtherUserName");
Player Bot = new Player (OtherUser.Name, 30f, null);
OtherUser.OnLogin (Bot, null);
... kinda funny.
Howdy @R4mbo Did already my first pass on that , Though i am not a coder and did that in my spare time. I created a pull request and asked if eric can help me with that. right now he his working on some more important bugs so no guarantees when it will come in game since Eric needs to do some fixing on my code. I also did not manage to figure out how to do the plot thing ( kinda a bit to complicated to find out where i need to go to get that data and how to do that. I think you have to expand some core code to get that to work in a good way ? )