1
mirror of https://github.com/CarmJos/UltraDepository.git synced 2026-06-05 00:58:22 +08:00

完成出售GUI,插件更名

This commit is contained in:
2021-12-28 19:31:03 +08:00
parent a8a8f11799
commit 7011d55707
64 changed files with 1169 additions and 1038 deletions
+51
View File
@@ -0,0 +1,51 @@
import cc.carm.plugin.ultrastorehouse.configuration.gui.GUIActionType;
import cc.carm.plugin.ultrastorehouse.manager.ConfigManager;
import org.bukkit.event.inventory.ClickType;
import org.junit.Test;
import java.util.Arrays;
import java.util.List;
public class ActionReadTest {
@Test
public void test() {
List<String> actions = Arrays.asList(
"[CHAT] 123123",
"[SHIFT_LEFT:CHAT] /test qwq",
"[CONSOLE] say hello",
"[CLOSE]"
);
for (String actionString : actions) {
int prefixStart = actionString.indexOf("[");
int prefixEnd = actionString.indexOf("]");
if (prefixStart < 0 || prefixEnd < 0) continue;
String prefix = actionString.substring(prefixStart + 1, prefixEnd);
ClickType clickType = null;
GUIActionType actionType;
if (prefix.contains(":")) {
String[] args = prefix.split(":");
clickType = ConfigManager.readClickType(args[0]);
actionType = GUIActionType.readActionType(args[1]);
} else {
actionType = GUIActionType.readActionType(prefix);
}
if (actionType == null) {
System.out.println("# " + actionString);
System.out.println("- actionType is Null");
continue;
}
System.out.println("# " + actionType.name() + " " + (clickType == null ? "" : clickType.name()));
System.out.println("- " + actionString.substring(prefixEnd + 1).trim());
}
}
}