Archived
0

del trash files

This commit is contained in:
2018-04-09 08:47:02 +03:00
parent de654742f8
commit 5ce8af061d
5 changed files with 0 additions and 112 deletions

View File

@@ -1,8 +0,0 @@
/*
* DmitriyMX <dimon550@gmail.com>
* 2018-03-25
*/
package mc.core;
public class NotSupportException extends RuntimeException {
}

View File

@@ -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);
}

View File

@@ -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);
}
}

View File

@@ -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();
}
}

View File

@@ -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);
}
}