mirror of
https://github.com/2006-Scape/2006Scape.git
synced 2026-07-04 08:39:05 +00:00
Cleanup part 1 (#213)
* Clean up part 1 - Removed lots of dead code - Removed unncessary files not in use - Cleaned up small bits of code - Removed a few warnings - Server.java ---> GameEngine.java - Constants.java ---> GameConstants.java * Cape Dye Rewrote cape dying * Packaging - redone ----> com.rebotted * PacketSender/clean up - ActionSender ---> PacketSender - Moved many more packets to packetsender - Cleaned up more dead code * Merge Client/Player - Merged Client.java with Player.java (both were doing same thing so redundant to have both) - Removed some more dead code - Tidy a few small things up * Quests/more clean up - Removed more dead code - Made quests static in order to clean them up a bit * More cleanup - Removed some more of the dead quest code - Correcting naming of some of the shop variables
This commit is contained in:
committed by
Daniel Ginovker
parent
3d1ae1b288
commit
d876a923b9
@@ -0,0 +1,63 @@
|
||||
package com.rebotted.net;
|
||||
|
||||
import org.apache.mina.common.IdleStatus;
|
||||
import org.apache.mina.common.IoHandler;
|
||||
import org.apache.mina.common.IoSession;
|
||||
import org.apache.mina.filter.codec.ProtocolCodecFilter;
|
||||
|
||||
import com.rebotted.game.players.Client;
|
||||
|
||||
public class ConnectionHandler implements IoHandler {
|
||||
|
||||
@Override
|
||||
public void exceptionCaught(IoSession arg0, Throwable arg1)
|
||||
throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void messageReceived(IoSession arg0, Object arg1) throws Exception {
|
||||
if (arg0.getAttachment() != null) {
|
||||
Client plr = (Client) arg0.getAttachment();
|
||||
plr.queueMessage((Packet) arg1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void messageSent(IoSession arg0, Object arg1) throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sessionClosed(IoSession arg0) throws Exception {
|
||||
if (arg0.getAttachment() != null) {
|
||||
Client plr = (Client) arg0.getAttachment();
|
||||
plr.disconnected = true;
|
||||
}
|
||||
HostList.getHostList().remove(arg0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sessionCreated(IoSession arg0) throws Exception {
|
||||
if (!HostList.getHostList().add(arg0)) {
|
||||
arg0.close();
|
||||
} else {
|
||||
arg0.setAttribute("inList", Boolean.TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sessionIdle(IoSession arg0, IdleStatus arg1) throws Exception {
|
||||
arg0.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sessionOpened(IoSession arg0) throws Exception {
|
||||
arg0.setIdleTime(IdleStatus.BOTH_IDLE, 60);
|
||||
arg0.getFilterChain().addLast("protocolFilter",
|
||||
new ProtocolCodecFilter(new CodecFactory()));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user