diff --git a/src/main/java/com/github/manevolent/ts3j/protocol/packet/handler/client/LocalClientHandlerConnecting.java b/src/main/java/com/github/manevolent/ts3j/protocol/packet/handler/client/LocalClientHandlerConnecting.java index b99d34f..af5c2ca 100644 --- a/src/main/java/com/github/manevolent/ts3j/protocol/packet/handler/client/LocalClientHandlerConnecting.java +++ b/src/main/java/com/github/manevolent/ts3j/protocol/packet/handler/client/LocalClientHandlerConnecting.java @@ -10,7 +10,7 @@ import com.github.manevolent.ts3j.protocol.packet.PacketBody8Init1; import com.github.manevolent.ts3j.protocol.socket.client.LocalTeamspeakClientSocket; import com.github.manevolent.ts3j.util.Ts3Crypt; import com.github.manevolent.ts3j.util.Ts3Debugging; -import javafx.util.Pair; +import com.github.manevolent.ts3j.util.Pair; import org.bouncycastle.math.ec.ECPoint; import java.io.IOException; diff --git a/src/main/java/com/github/manevolent/ts3j/protocol/packet/transformation/InitPacketTransformation.java b/src/main/java/com/github/manevolent/ts3j/protocol/packet/transformation/InitPacketTransformation.java index b245fcb..9d54fb6 100644 --- a/src/main/java/com/github/manevolent/ts3j/protocol/packet/transformation/InitPacketTransformation.java +++ b/src/main/java/com/github/manevolent/ts3j/protocol/packet/transformation/InitPacketTransformation.java @@ -2,7 +2,7 @@ package com.github.manevolent.ts3j.protocol.packet.transformation; import com.github.manevolent.ts3j.protocol.header.PacketHeader; -import javafx.util.Pair; +import com.github.manevolent.ts3j.util.Pair; public class InitPacketTransformation extends PacketTransformation { private static final byte[] key = diff --git a/src/main/java/com/github/manevolent/ts3j/protocol/packet/transformation/PacketTransformation.java b/src/main/java/com/github/manevolent/ts3j/protocol/packet/transformation/PacketTransformation.java index a1f7da2..b9cead1 100644 --- a/src/main/java/com/github/manevolent/ts3j/protocol/packet/transformation/PacketTransformation.java +++ b/src/main/java/com/github/manevolent/ts3j/protocol/packet/transformation/PacketTransformation.java @@ -4,7 +4,7 @@ import com.github.manevolent.ts3j.protocol.Packet; import com.github.manevolent.ts3j.protocol.ProtocolRole; import com.github.manevolent.ts3j.protocol.header.PacketHeader; import com.github.manevolent.ts3j.util.Ts3Crypt; -import javafx.util.Pair; +import com.github.manevolent.ts3j.util.Pair; import org.bouncycastle.crypto.CipherParameters; import org.bouncycastle.crypto.InvalidCipherTextException; import org.bouncycastle.crypto.engines.AESEngine; diff --git a/src/main/java/com/github/manevolent/ts3j/protocol/socket/client/AbstractTeamspeakClientSocket.java b/src/main/java/com/github/manevolent/ts3j/protocol/socket/client/AbstractTeamspeakClientSocket.java index 665b8bf..196f544 100644 --- a/src/main/java/com/github/manevolent/ts3j/protocol/socket/client/AbstractTeamspeakClientSocket.java +++ b/src/main/java/com/github/manevolent/ts3j/protocol/socket/client/AbstractTeamspeakClientSocket.java @@ -20,7 +20,7 @@ import com.github.manevolent.ts3j.protocol.socket.AbstractTeamspeakSocket; import com.github.manevolent.ts3j.util.QuickLZ; import com.github.manevolent.ts3j.util.Ts3Crypt; import com.github.manevolent.ts3j.util.Ts3Debugging; -import javafx.util.Pair; +import com.github.manevolent.ts3j.util.Pair; import org.bouncycastle.crypto.InvalidCipherTextException; import java.io.IOException; diff --git a/src/main/java/com/github/manevolent/ts3j/protocol/socket/client/LocalTeamspeakClientSocket.java b/src/main/java/com/github/manevolent/ts3j/protocol/socket/client/LocalTeamspeakClientSocket.java index 52040bf..d79860c 100644 --- a/src/main/java/com/github/manevolent/ts3j/protocol/socket/client/LocalTeamspeakClientSocket.java +++ b/src/main/java/com/github/manevolent/ts3j/protocol/socket/client/LocalTeamspeakClientSocket.java @@ -22,7 +22,7 @@ import com.github.manevolent.ts3j.protocol.packet.PacketBody2Command; import com.github.manevolent.ts3j.protocol.packet.statistics.PacketStatistics; import com.github.manevolent.ts3j.util.HighPrecisionRecurrentTask; import com.github.manevolent.ts3j.util.Ts3Debugging; -import javafx.util.Pair; +import com.github.manevolent.ts3j.util.Pair; import java.io.IOException; import java.net.*; diff --git a/src/main/java/com/github/manevolent/ts3j/util/Pair.java b/src/main/java/com/github/manevolent/ts3j/util/Pair.java new file mode 100644 index 0000000..5cc3c1a --- /dev/null +++ b/src/main/java/com/github/manevolent/ts3j/util/Pair.java @@ -0,0 +1,100 @@ +package com.github.manevolent.ts3j.util; + +import java.io.Serializable; + +/** + *
A convenience class to represent name-value pairs.
+ */ +public class PairPair.
+ */
+ private K key;
+
+ /**
+ * Gets the key for this pair.
+ * @return key for this pair
+ */
+ public K getKey() { return key; }
+
+ /**
+ * Value of this this Pair.
+ */
+ private V value;
+
+ /**
+ * Gets the value for this pair.
+ * @return value for this pair
+ */
+ public V getValue() { return value; }
+
+ /**
+ * Creates a new pair
+ * @param key The key for this pair
+ * @param value The value to use for this pair
+ */
+ public Pair(K key, V value) {
+ this.key = key;
+ this.value = value;
+ }
+
+ /**
+ * String representation of this
+ * Pair.
The default name/value delimiter '=' is always used.
+ * + * @returnString representation of this Pair
+ */
+ @Override
+ public String toString() {
+ return key + "=" + value;
+ }
+
+ /**
+ * Generate a hash code for this Pair.
The hash code is calculated using both the name and
+ * the value of the Pair.
Pair
+ */
+ @Override
+ public int hashCode() {
+ // name's hashCode is multiplied by an arbitrary prime number (13)
+ // in order to make sure there is a difference in the hashCode between
+ // these two parameters:
+ // name: a value: aa
+ // name: aa value: a
+ return key.hashCode() * 13 + (value == null ? 0 : value.hashCode());
+ }
+
+ /**
+ * Test this Pair for equality with another
+ * Object.
If the Object to be tested is not a
+ * Pair or is null, then this method
+ * returns false.
Two Pairs are considered equal if and only if
+ * both the names and values are equal.
Object to test for
+ * equality with this Pair
+ * @return true if the given Object is
+ * equal to this Pair else false
+ */
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o instanceof Pair) {
+ Pair pair = (Pair) o;
+ if (key != null ? !key.equals(pair.key) : pair.key != null) return false;
+ if (value != null ? !value.equals(pair.value) : pair.value != null) return false;
+ return true;
+ }
+ return false;
+ }
+ }
\ No newline at end of file
diff --git a/src/main/java/com/github/manevolent/ts3j/util/Ts3Crypt.java b/src/main/java/com/github/manevolent/ts3j/util/Ts3Crypt.java
index a1cea6c..635ef39 100644
--- a/src/main/java/com/github/manevolent/ts3j/util/Ts3Crypt.java
+++ b/src/main/java/com/github/manevolent/ts3j/util/Ts3Crypt.java
@@ -7,7 +7,7 @@ import Punisher.NaCl.Internal.Ed25519Ref10.ScalarOperations;
import Punisher.NaCl.Internal.Sha512;
import com.github.manevolent.ts3j.identity.*;
import com.github.manevolent.ts3j.license.License;
-import javafx.util.Pair;
+import com.github.manevolent.ts3j.util.Pair;
import org.bouncycastle.asn1.*;
import org.bouncycastle.crypto.digests.SHA256Digest;
import org.bouncycastle.crypto.params.ECDomainParameters;