del trash files
This commit is contained in:
@@ -1,8 +0,0 @@
|
|||||||
/*
|
|
||||||
* DmitriyMX <dimon550@gmail.com>
|
|
||||||
* 2018-03-25
|
|
||||||
*/
|
|
||||||
package mc.core;
|
|
||||||
|
|
||||||
public class NotSupportException extends RuntimeException {
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
/*
|
|
||||||
* DmitriyMX <dimon550@gmail.com>
|
|
||||||
* 2018-03-25
|
|
||||||
*/
|
|
||||||
package mc.core;
|
|
||||||
|
|
||||||
public interface Packet {
|
|
||||||
int getSize();
|
|
||||||
int getId();
|
|
||||||
|
|
||||||
void readSelf(NetStream netStream);
|
|
||||||
void writeSelf(NetStream netStream);
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
/*
|
|
||||||
* DmitriyMX <dimon550@gmail.com>
|
|
||||||
* 2018-03-26
|
|
||||||
*/
|
|
||||||
package mc.core.netty;
|
|
||||||
|
|
||||||
public class UnknowState extends RuntimeException {
|
|
||||||
public UnknowState(int numberOfState) {
|
|
||||||
super("Unknown state: " + numberOfState);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
/*
|
|
||||||
* DmitriyMX <dimon550@gmail.com>
|
|
||||||
* 2018-03-25
|
|
||||||
*/
|
|
||||||
package mc.core.netty;
|
|
||||||
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.ToString;
|
|
||||||
import mc.core.NetStream;
|
|
||||||
import mc.core.NotSupportException;
|
|
||||||
import mc.core.Packet;
|
|
||||||
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
@Getter
|
|
||||||
@ToString
|
|
||||||
class UnknownPacket implements Packet {
|
|
||||||
private final int length;
|
|
||||||
private final int id;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getSize() {
|
|
||||||
return length;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readSelf(NetStream netStream) {
|
|
||||||
throw new NotSupportException();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeSelf(NetStream netStream) {
|
|
||||||
throw new NotSupportException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
/*
|
|
||||||
* DmitriyMX <dimon550@gmail.com>
|
|
||||||
* 2018-03-25
|
|
||||||
*/
|
|
||||||
package mc.core.netty;
|
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import mc.core.Packet;
|
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class Utils {
|
|
||||||
public static int lengthVarInt(int value) {
|
|
||||||
return lengthVarLong(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int lengthVarLong(long value) {
|
|
||||||
int result = 0;
|
|
||||||
|
|
||||||
do {
|
|
||||||
value >>>= 7;
|
|
||||||
result++;
|
|
||||||
} while (value != 0);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int lengthUnsignedShort(int value) {
|
|
||||||
int result = 0;
|
|
||||||
|
|
||||||
do {
|
|
||||||
value >>>= 8;
|
|
||||||
result++;
|
|
||||||
} while (value != 0);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int lengthString(String value) {
|
|
||||||
return lengthVarInt(value.length()) + value.length();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean equalsPacket(Packet packet, String name) {
|
|
||||||
return packet.getClass().getSimpleName().equals(name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user