Jump to content

[1.7.2]How do I tell what a players name is?


squirlemaster

Recommended Posts

I think the we have both confused each other. Right now I have an event that is triggered when a player logs into the world or server. I want it so that when that player logs in it gets their username. If their username is squirlemaster of Builder_BRP I want it to give them an item. How do I do that?

 

Link to comment
Share on other sites

It didn't work. Here is what I have:

public class EventHookContainerClass extends ItemRegistry{

 

@EventHandler

public void playerLogginEvent(PlayerLoggedInEvent Event){

String playername = Event.player.getCommandSenderName();

String squirlemaster = "squirlemaster";

String Builder_BRP = "Builder_BRP";

 

 

if (playername.equals(squirlemaster)){

Event.player.inventory.addItemStackToInventory(new ItemStack(YAKOB_SWORD, 1));

}

}

 

}

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.

Announcements



×
×
  • Create New...

Important Information

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