1
0
mirror of https://github.com/LOOHP/Limbo.git synced 2026-06-08 05:51:43 +00:00

Made packet intercepting possible

This commit is contained in:
LOOHP
2022-02-10 01:54:13 +00:00
parent 00600647ae
commit 4353859951
11 changed files with 346 additions and 109 deletions
@@ -52,7 +52,7 @@ public class DataTypeIO {
public static int getStringLength(String string, Charset charset) throws IOException {
byte[] bytes = string.getBytes(charset);
return bytes.length;
return getVarIntLength(bytes.length) + bytes.length;
}
public static void writeString(DataOutputStream out, String string, Charset charset) throws IOException {
@@ -0,0 +1,40 @@
package com.loohp.limbo.utils;
import java.util.Objects;
public class Pair<F, S> {
private final F first;
private final S second;
public Pair(F first, S second) {
this.first = first;
this.second = second;
}
public F getFirst() {
return first;
}
public S getSecond() {
return second;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Pair<?, ?> pair = (Pair<?, ?>) o;
return Objects.equals(first, pair.first) && Objects.equals(second, pair.second);
}
@Override
public int hashCode() {
return Objects.hash(first, second);
}
}