Skip to content

Buddy Online State Update

Ta Van Dung edited this page Jun 15, 2016 · 1 revision
import com.tvd12.ezyfox.core.annotation.ServerEventHandler;
import com.tvd12.ezyfox.core.command.Log;
import com.tvd12.ezyfox.core.config.ServerEvent;
import com.tvd12.ezyfox.core.content.AppContext;
import com.tvd12.ezyfox.core.model.ApiZone;

@ServerEventHandler(event = ServerEvent.BUDDY_ONLINE_STATE_UPDATE)
public class BuddyOnlineStateChangeEventHandler {

    public void handle(AppContext context, ApiZone zone, GameUser user) {
        boolean isOnline = user.getBuddyProperties().isOnline();
        context.command(Log.class).from(this).info(
                "user {} now is {}", user.getName(), isOnline ? "online" : "offline");
    }
    
}

Hello World

Clone this wiki locally