Posted July 26, 20205 yr 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); }
July 26, 20205 yr 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?
July 26, 20205 yr 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.