Skip to content

User Join Room

Ta Van Dung edited this page Jun 14, 2016 · 1 revision
import java.util.List;

import com.tvd12.ezyfox.core.annotation.RoomName;
import com.tvd12.ezyfox.core.annotation.ServerEventHandler;
import com.tvd12.ezyfox.core.command.FetchBuddyList;
import com.tvd12.ezyfox.core.command.Log;
import com.tvd12.ezyfox.core.command.Response;
import com.tvd12.ezyfox.core.command.UserInfo;
import com.tvd12.ezyfox.core.config.ServerEvent;
import com.tvd12.ezyfox.core.content.AppContext;
import com.tvd12.ezyfox.core.model.ApiBuddy;

@RoomName("v") // Room prefix or room Name (i.e v and va both are valid)
@ServerEventHandler(event = ServerEvent.USER_JOIN_ROOM)
public class UserJoinRoomHandler {

    public void handle(AppContext context, YourRoom room, YourUser user) {
        context.command(Log.class).from(this).info("user " + user.getName() + 
                " joined room " + room.getName() + 
                " playerId = " + context.command(UserInfo.class).user(user).getPlayerId());
        // your business
    }
    
}

Hello World

Clone this wiki locally