完善 @TCommand 注解

新增 TCommandHandler 类用于动态命令注册
This commit is contained in:
坏黑
2018-08-27 00:21:06 +08:00
parent 20ec68ff7f
commit 1e50bd526b
33 changed files with 474 additions and 788 deletions

View File

@@ -2,6 +2,7 @@ package me.skymc.taboolib.string.obfuscated;
import javax.xml.bind.DatatypeConverter;
@Deprecated
public class CT {
public static String decode(CodeType type, String string) {
@@ -16,34 +17,36 @@ public class CT {
}
return text.toString();
}
default:
}
return "";
}
public static String encode(CodeType type, String string) {
switch (type) {
case BASE64: {
return DatatypeConverter.printBase64Binary(string.getBytes());
}
case BINARY: {
StringBuilder binary = new StringBuilder();
for (byte b: string.getBytes()) {
int value = b;
for (int i = 0; i < 8; i++) {
binary.append((value & 128) == 0 ? 0: 1);
value <<= 1;
}
binary.append(" ");
}
return binary.toString();
}
}
return "";
}
}
public static String encode(CodeType type, String string) {
switch (type) {
case BASE64: {
return DatatypeConverter.printBase64Binary(string.getBytes());
}
case BINARY: {
StringBuilder binary = new StringBuilder();
for (byte b : string.getBytes()) {
int value = b;
for (int i = 0; i < 8; i++) {
binary.append((value & 128) == 0 ? 0 : 1);
value <<= 1;
}
binary.append(" ");
}
return binary.toString();
}
default:
}
return "";
}
public enum CodeType {
BASE64,
BINARY
}
}
}