20

I have a small Minecraft server (beta 1.5), and every time I log in via offline mode from a client, my name is "Player". How can I change that?

I know of a way to do it in Windows but it doesn't help.

The major problem is when others connect to my server they take "Player" as a name and it kicks me off.

The server's property is set to:

online-mode=false

I can't change this to true.

I'm running the latest version of Ubuntu, and running the client from the terminal using the following command (EDIT: running with sudo, not a good idea, I know...need to get that fixed):

sudo ./minecraft-1.5.jar

EDIT: I found the code that I was talking about but it never worked for me:

java -cp ~/.minecraft/bin/minecraft.jar:~/.minecraft/bin/lwjgl.jar:~/.minecraft/bin/lwjgl_util.jar:~/.minecraft/bin/jinput.jar: -Djava.library.path=~/.minecraft/bin/natives -Xmx1024M -Xms512M net.minecraft.client.Minecraft '"'$USER'"'

and for Windows:

java -Xms512m -Xmx1024m -cp "%APPDATA%\.minecraft\bin\*" -Djava.library.path="%APPDATA%\.minecraft\bin\natives" net.minecraft.client.Minecraft '"'%1'"'

Latest update: it works!

I didn't realize that the first part (starting with -cp), was the folder that I ran my game from was the wrong directory, remember that I start the game with sudo, that was the reason I failed, it should have been:

/root/.minecraft/bin/*

Also I have to run this with 'sudo' or it won't work...the errors pile up, which as it turns out, and I didn't realize, is because it couldn't find any main class files, which I figured out rereading the man for 'java'

As a side win, this code now allows me to press the "Quit" button which was missing because of the way I started the game in the terminal.

Glorfindel
  • 1,307
  • 2
  • 17
  • 28
krack krackerz
  • 319
  • 1
  • 2
  • 8

5 Answers5

12

I don't have access to Minecraft on Linux at the moment, but that command line looks suspicious. Give this a try:

java -Xms512m -Xmx1024m -cp "$HOME/.minecraft/bin/*" -Djava.library.path="$HOME/.minecraft/bin/natives" net.minecraft.client.Minecraft "$USER"

If it still isn't working for you, knowing what does happen (error messages, lets you in but has wrong name, …) would be helpful for further troubleshooting. :-)

Edited: Work on Ubuntu 12.04 x32

*P.S.: after "$USER" you can also add "$PASSWORD" "$SERVER" *

iegik
  • 103
  • 2
Ben Blank
  • 17,963
  • 28
  • 80
  • 117
  • http://pastebin.com/MVDvj1xM <-- error log –  Jun 15 '11 at 00:49
  • Not possible without modification to jars. No builtin support for command-line parameters. – xfs Jun 15 '11 at 05:23
  • @xfs, the code above, doesnt modify jar file, instead its supposed to inject a name, original files stay the same – krack krackerz Jun 15 '11 at 06:44
  • That asterisk (…/bin/*) is expanded by the shell; you need to quote it so java sees it correctly. – Fred Nurk Jun 15 '11 at 08:59
  • @Fred Nurk — I know shell expansion is causing problems, but I can't seem to find docs on whether Java will do its own expansion and it turns out I don't have a system to test this on. :-/ – Ben Blank Jun 15 '11 at 15:44
  • @Ben Blank: I tried, it failed, i'll keep at it, will let u know if anythin changes – krack krackerz Jun 15 '11 at 19:16
  • 1
    Java does its own expansion, according to the java manpage: "As a special convenience, a class path element containing a basename of * is considered equivalent to specifying a list of all the files in the directory with the extension .jar or .JAR (a java program cannot tell the difference between the two invocations)." – Fred Nurk Jun 15 '11 at 23:36
  • The tildes are not expanded. If you remove the tilde, it will work fine (a "Quit Game" button!). This method is actually bypassing the game launcher and directly running the main game. I was wrong because I thought you were passing arguments into the game launcher and looked into the wrong part of code. Upvoted. – xfs Jun 17 '11 at 13:00
  • @xfs — Good catch. Hopefully, this latest update does the trick. It lets the shell perform tilde substitution but leaves the asterisk for Java. – Ben Blank Jun 17 '11 at 15:54
  • @Ben Note that there is a second tilde unexpanded. OK just replace the tildes with $HOME like how the shell expands tildes. – xfs Jun 18 '11 at 00:24
  • Ok so I finally cracked it, it was a silly mistake on my part and your command modification that worked, so you get a gold star, and all thanks to all who contributed! – krack krackerz Jun 19 '11 at 05:41
  • Can anyone help me combine the above solution (for windows) with the solution that I use to start minecraft due to the laptop graphics card? java -Xmx800m -jar "path of minecraft.jar file" is what I use to open Minecraft currently. How do I combine this with the solution above? –  Sep 19 '11 at 09:14
  • @Aram — Your fix bumps up the maximum memory available to Minecraft. The Windows command in the OP bumps it up even higher, so it should work for you unaltered. If not, bring it back down by changing the 1024 to 800. – Ben Blank Sep 19 '11 at 16:35
5

TL;DR: Use a launcher which can modify the name. Or use some long-winded terminal command to manipulate it.

Long answer:

The offline mode in the Minecraft server does not require players to authenticate with the Minecraft account database. However, when you:

  • Directly run the minecraft.jar file
  • Use the "Play Offline" function of the original Minecraft launcher.

Your in-game name would be "Player".

The only way to change this is to:

  • Use an un-offical launcher which can change the name (eg. MinecraftSP)
  • The command line
  • Editing the source code and recompiling it

When you do any of these methods successfully, your in-game name will then be different, without requiring to authenticate with the Minecraft account database for verification. This verification is done with servers with online-mode=true, thus people who use these methods are unable to join those servers.

Please note that when you use any of these methods in conjunction with the Minecraft files (minecraft.jar and others), it is illegal if you did not buy the game.

  • 5
    On what grounds is changing a string in the bytecode illegal? – Kevin Reid Jun 14 '11 at 14:34
  • what i meant was illegal launchers for minecraft which can change the player name. –  Jun 14 '11 at 14:44
  • 2
    what a person does with software after purchase, in terms of modding isnt illigal(if its my server), anyway this isnt an answer. Also, the way u say is illigal, is by having a .minecraft folder in ure home folder isnt an illigal jar file, the jar is always original, non modded (at least in this case). – krack krackerz Jun 14 '11 at 18:00
  • 1
    AN example of this low level modding is: if i were to use google chrome to edit a string on this page, its only limited to me, upon refresh it would disappear, as i only changed a string on how i see it, no laws broken, only what i see it different, like the server which is mine – krack krackerz Jun 14 '11 at 18:07
  • @krack I'm sure it's illegal when you don't buy it. Unless you actually bought it. –  Jun 14 '11 at 23:48
  • 2
    @bckbck: there is no illigal launchers, you run minecraft in linux with a script, aka launcher", the way i wanna start minecraft is my business, it canot be illigal, ie: inside my bash script: sleep 5s; echo "this is my launcher"; sudo ./minecraft.jar; exit 0; – krack krackerz Jun 15 '11 at 06:48
  • @krack I meant the minecraft.jar and the related files. If you didn't buy it, then launching it would be illegal. –  Jun 15 '11 at 07:07
  • 2
    @krack I have updated my answer –  Jun 15 '11 at 12:41
  • i like you answer (^ arrow pressed). So we r getting closer to the solution, you have forged a great start, by any chance do u know the command that would let me do that? If not, can u point me in a direction where I can learn the java ':' stuff? I cant exactly google= 'linux java :' – krack krackerz Jun 15 '11 at 19:11
  • The whole point of my question is to get the command code, I should have made that clear in the title and desc. – krack krackerz Jun 15 '11 at 19:13
  • Go google the first option of my solutions. It is much much simpler than the commands. –  Jun 16 '11 at 01:46
  • @krack krackerz: I hope that sudo ./minecraft.jar was a joke or typo. :X – Bobby Jun 25 '11 at 10:00
  • @Bobby It isnt :( Also, after the fix i use sudo java... instead of sudo ./minecraft.jar – krack krackerz Jun 25 '11 at 23:48
  • @krack krackerz: Oh dear...please fix that ASAP. I mean, fix that on your machine, and please stick a warning label on your question that you shouldn't do it like that. MC Accounts have been compromised by mods before, this would open up the door for full system access as well. – Bobby Jun 27 '11 at 07:37
  • @Bobby Can you point me in the right direction on how i would fix that? I'm not sure wat i'd even search in google... – krack krackerz Jul 13 '11 at 06:52
  • @krack krackerz: It would be better if you opened up a new question on Ask Ubuntu on how to properly migrate the MC-profile from root to your user. That way you'll get better information on why this is needed and steps to avoid that in the future in the first place. At the moment your setup is a mess (from a security and usability point of view) and a reinstall would most likely wipe your MC-Profile completely. Do also not forget to link back to this question for reference reasons (also mostly to blame me that I told you to go to AU ;P ). – Bobby Jul 13 '11 at 07:24
  • Pshh. People! Modding something without permission is legal. It's only distributing something without permission (whether modded or not) that's illegal. – SevenSidedDie Sep 19 '11 at 15:22
2

Although the title only mentions linux, the OP mentions Windows, and searching brought me here.

I thought I might share my Windows offline name changing solution which I use for testing my plugins when I need multiple clients connected all under different names, naturally.

@SET /P IGN=IGN=
@java -Xms512m -Xmx512m -cp "%APPDATA%/.minecraft/bin/*" -Djava.library.path="%APPDATA%/.minecraft/bin/natives" net.minecraft.client.Minecraft %IGN%

I put the above into a file named Offline.bat When I double click that file, it will open a command window and prompt you to enter the In-Game Name (IGN) you wish to use. Simply enter the name you want to use in and press enter to launch Minecraft in offline mode with that name.

EdGruberman
  • 743
  • 3
  • 10
1

For Linux, if you use sudo, the ~ will be the root home folder, so it needs to be:

sudo java -cp /home/"username"/.minecraft/bin/minecraft.jar:/home/"username"/.minecraft/bin/lwjgl.jar:/home/"username"/.minecraft/bin/lwjgl_util.jar:~/.minecraft/bin/jinput.jar: -Djava.library.path=/home/"username"/.minecraft/bin/natives -Xmx1024M -Xms512M net.minecraft.client.Minecraft '"'$USER'"'

Where it says "username", substitute your user name without the quotes.

It worked for me on Ubuntu 11.04.

a cat
  • 25,880
  • 31
  • 154
  • 189
  • 2
    You should not need to use sudo to play minecraft. In fact, I'd recommend AGAINST it. – Broam Feb 03 '12 at 13:53
1

I was googling offline mode minecraft mac, this was the first site on the list. Thanks to the Unix code I was able make an easy workaround the the info here. I wrote a simple and ugly AppleScript for mac/osx to accomplish the same if you have it installed in the default path. I'm working off of OS X 10.6.8, so I'm unsure if it will work with other versions.

Copy + Paste to new applescript, compile, save as application, launch.

property user_name : "Player"
display dialog "Enter A User Name" default answer "" buttons {"Cancel", "Continue"} default button 2
set the user_name to text returned of the result

set UsrApp to (path to current user folder)
set UsrApp_unx to POSIX path of UsrApp

set MineScript to "java -cp " & UsrApp_unx & "Library/Application\\ Support/minecraft/bin/minecraft.jar:" & UsrApp_unx & "Library/Application\\ Support/minecraft/bin/lwjgl.jar:" & UsrApp_unx & "Library/Application\\ Support/minecraft/bin/lwjgl_util.jar:" & UsrApp_unx & "Library/Application\\ Support/minecraft/bin/jinput.jar: -Djava.library.path=" & UsrApp_unx & "Library/Application\\ Support/minecraft/bin/natives -Xmx1024M -Xms512M net.minecraft.client.Minecraft '" & user_name & "'"

do shell script MineScript

Edit: Also works in Lion

Naschroe
  • 11
  • 1
  • The code posted above is not the correct syntax for Mac OSX 10.6.8 with Java 1.6.0.29. I am working on the correct syntax but I don't know AppleScript. Can you post a corrected (working) version of the code if you get a chance? Thanks – kpuffs Jan 11 '12 at 18:49