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 trying to use World Capabilities to save data for all Players. It is currently working fine on the Client side. However, when I run it on a Dedicated Server, the event is never called. I even put a print statement to make sure that the event wasn't running. Is there another event I should use? How should I go about this?
 

   @SubscribeEvent
    public void onPlayerJoin(PlayerEvent.PlayerLoggedInEvent event) {
        System.out.println("Player Logged in"); 

		ServerPlayerEntity player = (ServerPlayerEntity) event.getPlayer();
        ServerWorld world = player.getServerWorld();
        LazyOptional<ICrystalLevel> crystalLevelCapability = world.getCapability(CrystalLevelProvider.CRYSTAL_LEVEL_CAPABILITY);
        ICrystalLevel crystalLevelInstance = crystalLevelCapability.orElse(new CrystalLevelInstance());
        crystalLevelInstance.setCrystalLevel(crystalLevel);
        
        player.getPersistentData().putInt("crystal_level", crystalLevel);
        SendAffinityToClientPlayer msg = new SendAffinityToClientPlayer(player.getUniqueID().toString(), crystalLevel);
        EtherGems.simpleChannel.send(PacketDistributor.PLAYER.with(() -> player), msg);
    }

 

57 minutes ago, sirfredrick said:

However, when I run it on a Dedicated Server, the event is never called

Strange, because the PlayerLoggedInEvent fires for me when I log on to a dedicated server. What version are you running? And how are you registering your event listener?

  • Author

Thanks I just needed someone else to check it! I was using a Docker container to run it before. I ran a fresh server and it worked perfectly! It must have been something with the Docker container or a setting in the config file! Thanks for helping!

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.