Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class PacketRequestFOO implements IMessage{
- public PacketRequestFOO(){}
- @Override
- public void fromBytes(ByteBuf buf) {
- //I don't need to do anything here since I have no data to transmit, right?
- //I'm just signaling the server to do something
- System.out.println("X - " + SIDE);
- }
- @Override
- public void toBytes(ByteBuf buf) {
- System.out.println("Y - " + SIDE);
- };
- public static class Handler implements IMessageHandler<PacketRequestFOO, IMessage>{
- @Override
- public IMessage onMessage(PacketRequestFOO message, MessageContext ctx) {
- if(SIDE == SERVER){
- System.out.println("PACKET RECEIVED");
- IThreadListener mainThread = (WorldServer) ctx.getServerHandler().playerEntity.worldObj;
- mainThread.addScheduledTask(new Runnable(){
- @Override
- public void run() {
- Main.getFOO().doBAR((ctx.getServerHandler().playerEntity));
- }
- });
- return null;
- }
- else{
- return null;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement