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

So I'm trying to make a little stat indicator that shows kills and deaths stats in the corner.

 

But it doesn't work on servers, only on singleplayer.

 

I have some other listeners registered and they are all working on the server.

 

Here is the eventhandler class, I have it subscribed to Forge event bus and everything: https://gist.github.com/hjongh/6271c57ad26a4940f92714f0ff51cb9c

 

I was thinking that maybe this LivingDeathEvent is done only on server and client cannot access or something? For security/privacy reasons.

 

 

Minecraft

is a client-only class, you can't access it from common code.

 

There is no "the player" on the server, there are multiple players. Which one are you tracking the stats of?

 

Don't compare players by name, compare them by UUID.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

  • Author

I now pass the eventhandler class a reference to Minecraft from the Main class in its Constructor.

 

Also I should have said but this is a mod, not a plugin.

 

I tested it and it still doesn't work. The functionality works in singleplayer. I also have other listeners that are functioning in both singleplayer and on a server. But just this listener's code doesn't work on a server.

  • Author

Ok so I tried hardcoding the player checking, just to test it, and it still doesn't work.

 

https://gist.github.com/hjongh/b7139e7d016b3737a08effb810bc0e05

 

The mod functionality works when I'm in Singleplayer, so there isn't an issue with the player's name being returned in some weird format. It just doesn't work when I go on a server.

 

Also I'm testing it by building it each time and running it with my actual Minecraft.

just print the name in the log. you will see if the event is fired and what name is used. Or print the UUID, but for printig maybe the name is better.

catch(Exception e)

{

 

}

Yay, Pokémon exception handling, gotta catch 'em all (and then do nothing with 'em).

  • Author

LivingDeathEvent only fires on the server. It does not fire on the client.

 

awwwwwwwwwwwwwwwwwwwwwwwwwww darn ok

 

Any other way I can accomplish this then?

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.