Annotation system bugs fixed

This commit is contained in:
Anuken
2018-06-06 20:56:59 -04:00
parent 9e136bad94
commit c443eee15d
9 changed files with 60 additions and 35 deletions

View File

@@ -80,6 +80,7 @@ public class NetClient extends Module {
Net.handleClient(InvokePacket.class, packet -> {
//TODO invoke it
});
}

View File

@@ -4,6 +4,7 @@ import com.badlogic.gdx.utils.IntMap;
import com.badlogic.gdx.utils.TimeUtils;
import io.anuke.mindustry.core.GameState.State;
import io.anuke.mindustry.entities.Player;
import io.anuke.mindustry.gen.RemoteReadServer;
import io.anuke.mindustry.net.Administration;
import io.anuke.mindustry.net.Administration.PlayerInfo;
import io.anuke.mindustry.net.Net;
@@ -49,7 +50,7 @@ public class NetServer extends Module{
Net.handleServer(InvokePacket.class, (id, packet) -> {
//TODO implement
//CallServer.readPacket(packet.writeBuffer, packet.type, connections.get(id));
RemoteReadServer.readPacket(packet.writeBuffer, packet.type, connections.get(id));
});
}

View File

@@ -1,5 +1,18 @@
package io.anuke.mindustry.net;
import io.anuke.annotations.Annotations.Remote;
import io.anuke.mindustry.entities.Player;
import io.anuke.mindustry.world.Tile;
public class NetEvents {
@Remote(unreliable = true, one = true)
public static void callClientMethod(int something, Player player, String str, boolean bool){
System.out.println("Called " + something + " ? " + bool);
}
@Remote(local = false)
public static void someOtherMethod(Tile tile){
System.out.println("Called with tile " + tile);
}
}

View File

@@ -3,6 +3,7 @@ package io.anuke.mindustry.net;
import com.badlogic.gdx.utils.TimeUtils;
import io.anuke.mindustry.Vars;
import io.anuke.mindustry.entities.Player;
import io.anuke.mindustry.gen.RemoteReadClient;
import io.anuke.mindustry.net.Packet.ImportantPacket;
import io.anuke.mindustry.net.Packet.UnimportantPacket;
@@ -38,6 +39,7 @@ public class Packets {
if(Net.client()){
//TODO implement
//CallClient.readPacket(buffer, type);
RemoteReadClient.readPacket(buffer, type);
}else{
byte[] bytes = new byte[writeLength];
buffer.get(bytes);