feat: 添加命令别名
This commit is contained in:
@@ -9,7 +9,10 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.script.*;
|
||||
import javax.script.Bindings;
|
||||
import javax.script.Invocable;
|
||||
import javax.script.ScriptEngine;
|
||||
import javax.script.ScriptEngineManager;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
@@ -64,16 +67,15 @@ public class HamsterScriptPlugin extends JavaPlugin {
|
||||
Class<?> clazz = Class.forName(className);
|
||||
engine.put(simpleName, clazz);
|
||||
engine.eval(String.format("%s = %s.static;", simpleName, simpleName));
|
||||
getLogger().info("将 " + className + " 导入为 " + simpleName);
|
||||
getLogger().info("已导入 " + className);
|
||||
} catch (ClassNotFoundException e) {
|
||||
getLogger().warning("将 " + className + " 导入为 " + simpleName + " 失败:未找到这个类");
|
||||
getLogger().warning("导入 " + className + " 失败:未找到这个类");
|
||||
} catch (Exception e) {
|
||||
getLogger().warning("将 " + className + " 导入为 " + simpleName + " 失败");
|
||||
getLogger().warning("导入 " + className + " 失败");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user