Sign in to follow this  
Sklo:D

WU 1.8.0.2 - New players can not be created

Recommended Posts

In the new Beta new players can not be created. The server is failing with the following exception:

Error recorded in a vanilla WU server...

 

WARNING: Failed to create player with name Sklonewplayer
java.lang.NullPointerException
    at com.wurmonline.server.Players.getAnyBan(Players.java:2690)
    at com.wurmonline.server.LoginHandler.handleLogin(LoginHandler.java:1933)
    at com.wurmonline.server.LoginHandler.login(LoginHandler.java:445)
    at com.wurmonline.server.LoginHandler.reallyHandle(LoginHandler.java:312)
    at com.wurmonline.communication.SocketConnection.tick(SocketConnection.java:618)
    at com.wurmonline.communication.SocketServer.tick(SocketServer.java:172)
    at com.wurmonline.server.Server.run(Server.java:2514)
    at java.util.TimerThread.mainLoop(Timer.java:555)
    at java.util.TimerThread.run(Timer.java:505)

 

 

 

 

Reason:

I am pretty sure that the steamid isn't stored correctly at this point, fun fact if you ban the IP before you create the new player, the new player is indeed created successfully.

 

 

    public Ban getAnyBan(final String ip, final Player player) {
        Ban ban = player.getBan();
        if (ban == null) {
            ban = this.getBannedIp(ip); //All is good if the ip is banned, so only the next if statement can produce the error
        }
        if (ban == null) {
            ban = this.getBannedSteamId(player.getSteamId().toString()); //Need some more null checks here!
        }
        return ban;
    }

Share this post


Link to post
Share on other sites

Should be a patch out for that and the networking stuff in the next day or so.

Share this post


Link to post
Share on other sites
18 hours ago, Darklords said:

Should be a patch out for that and the networking stuff in the next day or so.

 

Issue is still present with the same error in Wurm Unlimited server version 1.8.0.2

 

In Wurm there is no excuse for not using null checks :P ....use null checks seriously

Edited by Sklo:D

Share this post


Link to post
Share on other sites
19 hours ago, Darklords said:

Should be a patch out for that and the networking stuff in the next day or so.

 

Without having the possibility of a debugger, I am pretty sure that you can't just say

player.setSteamID(SteamId.fromSteamID64(Long.valueOf(steamIDAsString)));

and then using a getSteamId at this early point of character creation as you did in the fix for 1.8.0.2, because it loads the steamid from the database, using the saveFile of the player.

 

But the saveFile of the player is not saved at this point. So you just can help yourself using the steamid of the player as parameter for the getAnyBan method, or add a temp object steamId to the Player class, so the steamid is available even if there is nothing written to the database yet.

Edited by Sklo:D

Share this post


Link to post
Share on other sites
On 9/8/2018 at 10:47 PM, Darklords said:

Should be a patch out for that and the networking stuff in the next day or so.

 

Just to keep track of everything. This problem has been fixed in WU version 1.8.0.3.

 

Fair warning: The change in the method setWurmId which involves the returning of the object iteself is completly unneccessary in Java.

 

player = (Player)player.setWurmId(wurmId, posX, posY, rot, 0);

is the same as

player.setWurmId(wurmId, posX, posY, rot, 0);

 

since setWurmId returns "this", which is already the object player. So in the end we have something like player = player. FindBugs should detect this as a problem.

Just the very basics of call by reference which java is all about: https://www.java-tutorial.com/java-tutorial/java-classes-methods/java-call-reference/

Edited by Sklo:D

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this