All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.nadron.event.impl.SessionMessageHandler Maven / Gradle / Ivy

Go to download

Nadron is a high speed socket based java game server written using Netty and Mike Rettig's Jetlang. It is specifically tuned for network based multiplayer games and supports TCP and UDP network protocols.

There is a newer version: 0.7
Show newest version
package io.nadron.event.impl;

import io.nadron.app.Session;
import io.nadron.event.Events;
import io.nadron.event.SessionEventHandler;

/**
 * This abstract helper class can be used to quickly create a listener which
 * listens for SESSION_MESSAGE events. Child classes need to override the
 * onEvent to plugin the logic.
 * 
 * @author Abraham Menacherry
 * 
 */
public abstract class SessionMessageHandler implements SessionEventHandler {

	private final Session session;
	
	public SessionMessageHandler(Session session)
	{
		this.session = session;
	}
	
	@Override
	public int getEventType() {
		return Events.SESSION_MESSAGE;
	}

	@Override
	public Session getSession() {
		return session;
	}

	@Override
	public void setSession(Session session)
			throws UnsupportedOperationException {
		throw new UnsupportedOperationException(
				"Session instance is final and cannot be reset on this handler");
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy