Skip to content

Commit

Permalink
将插件id强制转换为小写,修复大小写差异导致的各类问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Xwdit committed Jun 16, 2022
1 parent 5217801 commit a06c46b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
13 changes: 11 additions & 2 deletions Core/API/Plugin.gd
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,22 @@ func _plugin_timer_timeout():
## 最后一项可选参数为此插件的依赖插件列表(数组),需要以所依赖的插件的ID作为列表中的元素,如:["example","example_1"]
## 设置了插件依赖后,可以保证所依赖的插件一定在此插件之前被加载
func set_plugin_info(p_id:String,p_name:String,p_author:String,p_version:String,p_description:String,p_dependency=[]):
plugin_info.id = p_id
plugin_info.id = p_id.to_lower()
plugin_info.name = p_name
plugin_info.author = p_author
plugin_info.version = p_version
plugin_info.description = p_description
if p_dependency is String:
p_dependency = [p_dependency]
p_dependency = [p_dependency.to_lower()]
elif p_dependency is Array:
for i in range(p_dependency.size()):
if p_dependency[i] is String:
p_dependency[i]=p_dependency[i].to_lower()
else:
p_dependency.clear()
break
else:
p_dependency = []
plugin_info.dependency = p_dependency


Expand Down
2 changes: 1 addition & 1 deletion Core/Core.gd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class_name RainyBotCore


const VERSION = "V2.0-Beta-5"
const VERSION = "V2.0-Beta-6"


static func start():
Expand Down
2 changes: 1 addition & 1 deletion Core/Modules/PluginManager.gd
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ func load_plugin(file:String,files_dic=null,source:String=""):
var plugin_res = load_plugin_script(plugin_path + file)
var plugin_ins:Plugin = plugin_res.new()
var _plugin_info = plugin_ins.get_plugin_info()
plugin_ins.name = _plugin_info["id"]
plugin_ins.name = _plugin_info["id"].to_lower()
plugin_ins.plugin_path = plugin_path + file
plugin_ins.plugin_file = file
plugin_ins.add_to_group("Plugin")
Expand Down

0 comments on commit a06c46b

Please sign in to comment.