Jump to content

[1.7.10] How to log player join event?


zcarl

Recommended Posts

What exactly do you want to "log"?

 

Do you want to store who entered in a server in a given time (lets say for a block that does X thing) or simply catch the event so that you can do something based on a player's entry in the game?

 

In both you should look at forge events and event handling, these link should help you

 

http://jabelarminecraft.blogspot.ca/p/minecraft-forge-172-event-handling.html

http://bedrockminer.jimdo.com/modding-tutorials/advanced-modding/event-handler/

http://minecraftforgetutorials.weebly.com/event-introduction.html

 

And the best tutorial imo: http://greyminecraftcoder.blogspot.ca/2013/12/forge-techniques-events.html

When they say your code doesn't follow convention but ur edgy so u dont care

d-d-d-dab on them haterz

 

Link to comment
Share on other sites

I want to log and save a list: players joined the server

 

inside log file:

MC username, and time they joined, and how many have joined

Note that PlayerLoggedInEvent has the joined player as public field.

1. MC username: player.getDisplayName()

2. Time they joined: I'd assume that you know how to get system time.

To get minecraft time, use World#getWorldTime(). (Player has public field named worldObj)

Get the Overworld using MinecraftServer#getEntityWorld() to get universal server time.

3. How many players have joined:

  - length of World#playerEntities for players in the world.

  - MinecraftServer#getCurrentPlayerCount() for all players in the server.

 

And what do you mean (EDIT) by saving the list?

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Link to comment
Share on other sites

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.