Jump to content

[1.6.4][SOLVED!] How to get a players instance (SERVER SIDE)


pokeyletsplays

Recommended Posts

I realize 1.6.4 is ancient lets just say I have my reasons and move on. I was wondering how i would get a player with a certain username's instance my mobs entity file. i have tried

if(MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(this.getUser()) != null){
             	this.setLocationAndAngles((double)MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(this.getUser()).posX  + 0.0D, (double)MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(this.getUser()).posY + 0.0D, (double)MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(this.getUser()).posZ +  0.0D, 0.0F, 0.0F);
             	}

which works on client but not on server which is weird cause it bases it off the username.

Its best to only ask questions when you did most of the work yourself.

Link to comment
Share on other sites

Hi

 

The fact that it works client side makes me think that this.getUser() is null or is the wrong username on the server side.  Have you checked using System.out.println() or a breakpoint?

 

-TGG

 

 

 

 

You know I cant believe I didn't add a check to make sure that getUser didn't equal null I am sorry for you're trouble thank you :)

Its best to only ask questions when you did most of the work yourself.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.