Jump to content

Recommended Posts

Posted

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?

 

Posted

How do I compair the name that was given by the event to squirlemaster or BUilder_BRP because when I try to do it with an if statement it says the it can't convert a boolean to a string but all my variables are strings?

I fixed it nevermind.

Posted

Erm... if you set playername to event.player.getCommandSenderName(), think about what type of variable that is. Now think about what you're trying to do with that variable.

Posted

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));

}

}

 

}

Posted

I done that but mine is different since i learn java . Heres a tip for you make a string to boolean which detects it into true then u can put an if statement then put your event .

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.