Jump to content

Recommended Posts

Posted

I want the player to get healed when he wakes up in the morning.

But the PlayerWakeUpEvent also gets triggered when you press the wake up button in bed and don't actually sleep 'till the next day. :L

Does anyone have an idea how I could do that, that the player only gets healed when he stays in the bed? :)

 

@SubscribeEvent
public void PlayerWakeUpEvent(PlayerWakeUpEvent event)
{
    event.entityPlayer.heal(20);
}
}

  • 3 months later...
Posted (edited)

Hi @weeeee

 

currently I'm using 1.12.1 and it seems that the event will not be called. How did you manage it?

 

@SubscribeEvent
public void onPlayerWakeUpEvent( PlayerWakeUpEvent event )
{
    MyMod.getLogger().warn( "onPlayerWakeUpEvent" ); //do warn message 'onPlayerWakeUpEvent' in the console
}

 

Currently I'm thinking that this event gets only fired on the client side, or am I wrong?

 

Kind regards,

Pixtar

 

UPDATE / EDIT: weeeee did the same mistake like me. I looked at the Type Hierarchy and saw the little 'S'. The methods needs to be declared as static. Now it's working - on both sides. ^^
(Navigate with Eclipse to the base Event class and right click the class -> Open Type Hierarchy)

 

public static void onPlayerWakeUpEvent( PlayerWakeUpEvent event )

Edited by Pixtar
It's working now ^^
  • 11 months later...
Posted (edited)
  On 4/15/2018 at 5:06 AM, Pixtar said:

The methods needs to be declared as static.

Expand  

No. This depends on how you register the event bus subscriber.

Nothing needs to be static.

 

Refer to this post:

 

@fallOut015 As a suggestion, next time please create your own thread; this thread is almost a year old.

Edited by DavidM

Some tips:

  Reveal hidden contents

 

Posted
  On 4/5/2019 at 1:05 AM, DavidM said:

No. This depends on how you register the event bus subscriber.

Nothing needs to be static.

 

Refer to this post:

 

@fallOut015 As a suggestion, next time please create your own thread; this thread is almost a year old.

Expand  

I did. But this person seemed to have an answer to my question

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.