Server packet priority fix
This commit is contained in:
@@ -322,7 +322,7 @@ public class NetClient implements ApplicationListener{
|
|||||||
ui.join.connect(ip, port);
|
ui.join.connect(ip, port);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Remote(targets = Loc.client)
|
@Remote(targets = Loc.client, priority = PacketPriority.high)
|
||||||
public static void ping(Player player, long time){
|
public static void ping(Player player, long time){
|
||||||
Call.pingResponse(player.con, time);
|
Call.pingResponse(player.con, time);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -632,7 +632,7 @@ public class NetServer implements ApplicationListener{
|
|||||||
return Float.isInfinite(f) || Float.isNaN(f);
|
return Float.isInfinite(f) || Float.isNaN(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Remote(targets = Loc.client, unreliable = true)
|
@Remote(targets = Loc.client, unreliable = true, priority = PacketPriority.high)
|
||||||
public static void clientSnapshot(
|
public static void clientSnapshot(
|
||||||
Player player,
|
Player player,
|
||||||
int snapshotID,
|
int snapshotID,
|
||||||
@@ -830,7 +830,7 @@ public class NetServer implements ApplicationListener{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Remote(targets = Loc.client)
|
@Remote(targets = Loc.client, priority = PacketPriority.high)
|
||||||
public static void connectConfirm(Player player){
|
public static void connectConfirm(Player player){
|
||||||
if(player.con.kicked) return;
|
if(player.con.kicked) return;
|
||||||
|
|
||||||
|
|||||||
@@ -306,15 +306,18 @@ public class Net{
|
|||||||
* Call to handle a packet being received for the server.
|
* Call to handle a packet being received for the server.
|
||||||
*/
|
*/
|
||||||
public void handleServerReceived(NetConnection connection, Packet object){
|
public void handleServerReceived(NetConnection connection, Packet object){
|
||||||
object.handled();
|
|
||||||
|
|
||||||
try{
|
try{
|
||||||
|
if(connection.hasConnected || object.getPriority() == Packet.priorityHigh){
|
||||||
|
object.handled();
|
||||||
|
|
||||||
//handle object normally
|
//handle object normally
|
||||||
if(serverListeners.get(object.getClass()) != null){
|
if(serverListeners.get(object.getClass()) != null){
|
||||||
serverListeners.get(object.getClass()).get(connection, object);
|
serverListeners.get(object.getClass()).get(connection, object);
|
||||||
}else{
|
}else{
|
||||||
object.handleServer(connection);
|
object.handleServer(connection);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}catch(ValidateException e){
|
}catch(ValidateException e){
|
||||||
//ignore invalid actions
|
//ignore invalid actions
|
||||||
debug("Validation failed for '@': @", e.player, e.getMessage());
|
debug("Validation failed for '@': @", e.player, e.getMessage());
|
||||||
|
|||||||
@@ -157,5 +157,10 @@ public class Packets{
|
|||||||
mods.add(TypeIO.readString(buffer));
|
mods.add(TypeIO.readString(buffer));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getPriority(){
|
||||||
|
return priorityHigh;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user