-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
101 additions
and
27 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
core/src/main/java/com/sekwah/advancedportals/core/network/Packet.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.sekwah.advancedportals.core.network; | ||
|
||
public interface Packet { | ||
byte[] encode(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
core/src/main/java/com/sekwah/advancedportals/core/network/ProxyTransferDestiPacket.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.sekwah.advancedportals.core.network; | ||
|
||
import com.google.common.io.ByteArrayDataInput; | ||
import com.google.common.io.ByteArrayDataOutput; | ||
import com.google.common.io.ByteStreams; | ||
import com.sekwah.advancedportals.core.ProxyMessages; | ||
|
||
public class ProxyTransferDestiPacket implements Packet { | ||
|
||
private final String serverName; | ||
private final String destination; | ||
|
||
public ProxyTransferDestiPacket(String serverName, String destination) { | ||
this.serverName = serverName; | ||
this.destination = destination; | ||
} | ||
|
||
public byte[] encode() { | ||
ByteArrayDataOutput buffer = ByteStreams.newDataOutput(); | ||
buffer.writeUTF(ProxyMessages.PROXY_TRANSFER_DESTI); | ||
buffer.writeUTF(this.serverName); | ||
buffer.writeUTF(this.destination); | ||
return buffer.toByteArray(); | ||
|
||
} | ||
|
||
public static ProxyTransferDestiPacket decode(ByteArrayDataInput buffer) { | ||
return new ProxyTransferDestiPacket(buffer.readUTF(), buffer.readUTF()); | ||
} | ||
|
||
public String getServerName() { | ||
return serverName; | ||
} | ||
|
||
public String getDestination() { | ||
return destination; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
...src/main/java/com/sekwah/advancedportals/proxycore/connector/container/ProxyJoinData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.sekwah.advancedportals.proxycore.connector.container; | ||
|
||
public class ProxyJoinData { | ||
|
||
private final String destination; | ||
private final String serverName; | ||
|
||
public ProxyJoinData(String destination, String serverName) { | ||
this.destination = destination; | ||
this.serverName = serverName; | ||
} | ||
} |