More netcode updates
This commit is contained in:
@@ -257,6 +257,7 @@ public class Net{
|
||||
* Call to handle a packet being received for the client.
|
||||
*/
|
||||
public void handleClientReceived(Packet object){
|
||||
object.handled();
|
||||
|
||||
if(object instanceof StreamBegin b){
|
||||
streams.put(b.id, currentStream = new StreamBuilder(b));
|
||||
@@ -291,6 +292,8 @@ public class Net{
|
||||
* Call to handle a packet being received for the server.
|
||||
*/
|
||||
public void handleServerReceived(NetConnection connection, Packet object){
|
||||
object.handled();
|
||||
|
||||
try{
|
||||
//handle object normally
|
||||
if(serverListeners.get(object.getClass()) != null){
|
||||
|
||||
@@ -10,6 +10,7 @@ public abstract class Packet{
|
||||
//readObject
|
||||
//readBuilding
|
||||
//readUnit (possibly)
|
||||
protected static final byte[] NODATA = {};
|
||||
protected static final ReusableByteInStream BAIS = new ReusableByteInStream();
|
||||
protected static final Reads READ = new Reads(new DataInputStream(BAIS));
|
||||
|
||||
@@ -29,6 +30,8 @@ public abstract class Packet{
|
||||
read(read);
|
||||
}
|
||||
|
||||
public void handled(){}
|
||||
|
||||
public int getPriority(){
|
||||
return priorityNormal;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user