完善 @TCommand 注解
新增 TCommandHandler 类用于动态命令注册
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user