Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

I am making a mod that when a player joins the world it detects what their name is and if they have a certain name it gives them an item. How would I go about doing that?

  • Author

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?

 

  • Author

I know Java, I think I'm just not reading it right. Could you point me to a video tutorial because those are what I learn from the best?

  • Author

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.

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.

  • Author

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

}

}

 

}

So you claim to know Java, yet to access a variable from another class you extend that class? I'm out. Learn Java before you try making a mod.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.