Skip to content

Commit 0f2f98c

Browse files
committed
Fixed bugs.
1 parent da47eca commit 0f2f98c

File tree

18 files changed

+479
-299
lines changed

18 files changed

+479
-299
lines changed

common/src/main/kotlin/me/scoretwo/fastscript/FastScript.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,6 @@ class FastScript(val plugin: ScriptPlugin) {
136136
when (mode) {
137137
"config" -> {
138138
settings.reload()
139-
if (stats == ScriptPluginState.RUNNING)
140-
if (settings.getBoolean(settings.ignoreCase("options.debug")))
141-
plugin.server.dispatchCommand(plugin.server.console, "fs ::enable_debug")
142-
else
143-
plugin.server.dispatchCommand(plugin.server.console, "fs ::disable_debug")
144139
reloadLanguage()
145140
}
146141
"script" -> {
@@ -154,6 +149,11 @@ class FastScript(val plugin: ScriptPlugin) {
154149
}
155150
"plugin" -> {
156151
plugin.reload()
152+
if (stats == ScriptPluginState.RUNNING)
153+
if (settings.getBoolean(settings.ignoreCase("options.debug")))
154+
plugin.server.dispatchCommand(plugin.server.console, "fs ::enable_debug")
155+
else
156+
plugin.server.dispatchCommand(plugin.server.console, "fs ::disable_debug")
157157
}
158158
}
159159
}

common/src/main/kotlin/me/scoretwo/fastscript/api/language/Language.kt

Lines changed: 1 addition & 188 deletions
Original file line numberDiff line numberDiff line change
@@ -13,194 +13,7 @@ class Language(val version: String, val name: String = "en_US") {
1313

1414
val file: File = File(plugin.dataFolder, "language/$name.yml")
1515

16-
val defaultConfig = YamlConfiguration().also {
17-
it["FORMAT-HEADER"] = YamlConfiguration().also {
18-
it["INFO"] = "&7[&3Fast&bScript&7] &bINFO &8| &7"
19-
it["WARN"] = "&7[&3Fast&bScript&7] &eWARN &8| &7"
20-
it["ERROR"] = "&7[&3Fast&bScript&7] &cERROR &8| &7"
21-
it["TIPS"] = "&7[&3Fast&bScript&7] &2TIPS &8| &7"
22-
it["HOOKED"] = "&7[&3Fast&bScript&7] &6HOOKED &8| &7"
23-
it["DEBUG"] = "&7[&3Fast&bScript&7] &3DEBUG &8| &7"
24-
}
25-
it["SUBSTANTIVE"] = YamlConfiguration().also {
26-
it["ARGS"] = "args"
27-
it["USAGE"] = "usage"
28-
it["EVALUATED"] = "evaluated"
29-
}
30-
it["EXEC-ID"] = YamlConfiguration().also {
31-
it["CONFIGS"] = "configs"
32-
it["LIBS"] = "libs"
33-
it["SCRIPT-MANAGER"] = "script manager"
34-
it["EXPANSION-MANAGER"] = "expansion manager"
35-
it["COMMAND-NEXUS"] = "CommandNexus"
36-
}
37-
it["DOWNLOADED-LIB"] = "Downloaded &b{lib_name}&7...&8({millisecond}ms)"
38-
it["DOWNLOAD-LIBS-FAILED"] = "&cFailed to download the pre-library file, please check your network, FastScript failed to start."
39-
it["HOOKED-PLUGIN"] = "Hook to the plugin &e{plugin_name} &7successfully, now you can use the relevant functions of this plugin!"
40-
it["COMMAND-NEXUS"] = YamlConfiguration().also {
41-
it["TIPS"] = YamlConfiguration().also {
42-
it["ONLY-CONSOLE"] = "&cThis command can only be executed on the console."
43-
it["ONLY-PLAYER"] = "&cThis command can only be executed by the player."
44-
it["NO-PERMISSION"] = "&cYou do not have permission to execute the command."
45-
it["UNKNOWN-USAGE"] = "&cUsage &e{usage_error} &cis incorrect, you may want to use &e{usage_guess}&c."
46-
}
47-
it["HELPER"] = YamlConfiguration().also {
48-
it["NOT-FOUND-COMMANDS"] = "&7No command data available."
49-
it["CLICK-INSERT-COMMAND"] = "&7Click insert command: &f/{command}"
50-
it["CLICK-TO-GO-URL"] = "&7Click to go to url: &f{url}"
51-
it["PLAYER-IS-OFFLINE"] = "&7Player &a{player_name} &7is not online"
52-
}
53-
it["COMMANDS"] = YamlConfiguration().also {
54-
it["MIGRATE"] = YamlConfiguration().also {
55-
it["DESCRIPTION"] = "Migrate from other plugins."
56-
57-
it["UNKNOWN-ACTION"] = "No action found {action_name}"
58-
}
59-
60-
it["EXPANSION"] = YamlConfiguration().also {
61-
it["NOT-FOUND-NAME-OR-SIGN"] = "Cannot find the extension name or sign &c{expansion_name}&7! Please check the name."
62-
it["LOADED-EXPANSIONS"] = "Currently available extensions: &6{expansions}"
63-
it["DESCRIPTION"] = "View all expansions or operations."
64-
it["SUB-EXPANSION-DESCRIPTION"] = "About {expansion_name} commands."
65-
66-
it["INFO"] = YamlConfiguration().also {
67-
it["DESCRIPTION"] = "View the information of this expansion."
68-
it["TITLE"] = "Expansion &6{expansion_name}&7's information."
69-
it["TEXTS"] = mutableListOf(
70-
" &3&l* &7Sign: &a{expansion_sign}",
71-
" &3&l* &7File suffix: &a{expansion_file_suffix}",
72-
" &3&l* &7Bind scripts: &f{expansion_bind_scripts}",
73-
"",
74-
" &7About expansions &6{expansion_name} &7more help, please enter:"
75-
76-
)
77-
}
78-
it["EVALUATE"] = YamlConfiguration().also {
79-
it["DESCRIPTION"] = "Evaluate the specified content to get the return value (':s' added at the end does not return a message)"
80-
it["EVALUATE-RESULT"] = "Use extension &6{expansion_name} &7to evaluate the result of the content: &b{result}"
81-
}
82-
}
83-
it["SCRIPT"] = YamlConfiguration().also {
84-
it["DESCRIPTION"] = "View the information of this script."
85-
it["NOT-FOUND-SCRIPT"] = "Not found script &b{script_name}&7! Please check the name."
86-
it["SUB-SCRIPT-DESCRIPTION"] = "About {script_name} commands."
87-
88-
it["EXECUTE"] = YamlConfiguration().also {
89-
it["DESCRIPTION"] = "Execute the specified content to get the return value (':s' added at the end does not return a message)"
90-
91-
it["EXECUTE-RESULT"] = "Execute script &b{script_name} &7used expansion &6{expansion_name} &7to return result: {result}"
92-
}
93-
it["EVALUATE"] = YamlConfiguration().also {
94-
it["DESCRIPTION"] = "Evaluate the specified content to get the return value (':s' added at the end does not return a message)"
95-
96-
it["EXECUTE-RESULT"] = "Evaluate script &b{script_name} &7used expansion &6{expansion_name} &7to return result: {result}"
97-
}
98-
it["RELOAD"] = YamlConfiguration().also {
99-
it["DESCRIPTION"] = "Reload this script."
100-
it["RELOADED-SCRIPT"] = "Reloaded script &b{script_name} &7successful!"
101-
}
102-
103-
it["INFO"] = YamlConfiguration().also {
104-
it["DESCRIPTION"] = "View the information of this script."
105-
it["TITLE"] = "Script &b{script_name}&7's information."
106-
it["TEXTS"] = mutableListOf(
107-
" &3&l* &7Version: &2{script_version}",
108-
" &3&l* &7Authors: &3{script_authors}",
109-
" &3&l* &7Description: &f{script_description}",
110-
" &3&l* &7Main: &f{script_main}",
111-
" &3&l* &7Bind expansions: &6{script_bind_expansions}",
112-
"",
113-
" &7About script &6{script_name} &7more help, please enter:"
114-
115-
)
116-
}
117-
118-
}
119-
it["RELOAD"] = YamlConfiguration().also {
120-
it["DESCRIPTION"] = "Reload configuration files or settings."
121-
it["MODE"] = YamlConfiguration().also {
122-
it["ALL"] = "Reload all."
123-
it["CONFIG"] = "Reload configuration file."
124-
it["SCRIPT"] = "Reload script file."
125-
it["PLUGIN"] = "Reload plugin settings."
126-
}
127-
it["LOADED-ALL"] = "Loaded all settings successful."
128-
it["LOADED-CONFIG"] = "Loaded configuration file successful."
129-
it["LOADED-SCRIPT"] = "Loaded script file successful."
130-
it["LOADED-PLUGIN"] = "Loaded plugin settings successful."
131-
132-
it["ASYNC-LOADED-ALL"] = "Async loaded all settings successful."
133-
it["ASYNC-LOADED-CONFIG"] = "Async loaded configuration file successful."
134-
it["ASYNC-LOADED-SCRIPT"] = "Async loaded script file successful."
135-
it["ASYNC-LOADED-PLUGIN"] = "Async loaded plugin settings successful."
136-
}
137-
it["TOOLS"] = YamlConfiguration().also {
138-
it["DESCRIPTION"] = "Some useful tool libraries."
139-
140-
it["COMMAND"] = YamlConfiguration().also {
141-
it["DESCRIPTION"] = "Send a command as sender('@CONSOLE' means console)."
142-
}
143-
144-
it["BUKKIT"] = YamlConfiguration().also {
145-
it["SOUNDS"] = YamlConfiguration().also {
146-
it["DESCRIPTION"] = "Play Sound to the player."
147-
it["NOT-FOUND-SOUND"] = "Sound &8{sound_name} &7not found."
148-
}
149-
}
150-
}
151-
it["DEBUG"] = YamlConfiguration().also {
152-
it["DESCRIPTION"] = "Used to start debugging or view some debugging information."
153-
}
154-
}
155-
}
156-
it["EXPANSION"] = YamlConfiguration().also {
157-
it["TYPE-ENGINE"] = YamlConfiguration().also {
158-
it["EVALUATE-SCRIPT-ERROR"] = "An error occurred during script {script_name} evaluation, please check the script format. reason: \n&8{reason}"
159-
it["EVALUATE-TEMP-SCRIPT-ERROR"] = "An error occurred during temp script evaluation, please check the script format. reason: \n&8{reason}"
160-
it["EXECUTE-SCRIPT-ERROR"] = "An error occurred when the script {script_name} executes the function {execute_main}, please check the script format. reason: \n&8{reason}"
161-
it["EXECUTE-SCRIPT-FUNCTION-NOT-FOUND-ERROR"] = "An error occurred when the script {script_name} executes the function {execute_main}, reason: &8this function not found!"
162-
it["EXECUTE-TEMP-SCRIPT-ERROR"] = "An error occurred when the temp script executes the function {execute_main}, please check the script format, reason: \n&8{reason}"
163-
it["EXECUTE-SCRIPT-FUNCTION-NOT-FOUND-ERROR"] = "An error occurred when the temp script executes the function {execute_main}, reason: &8this function not found!"
164-
}
165-
it["ERROR-BY-CAUSE"] = YamlConfiguration().also {
166-
it["LOAD-ERROR"] = "An exception occurred while loading expansion {file_name}, reason: \n&8{reason}"
167-
it["LOAD-DESCRIPTION-FILE-ERROR"] = "An error occurred while loading the expansion '{file_name}' description file, reason: \n&8{reason}"
168-
it["LOAD-MAIN-CLASS-ERROR"] = "An error occurred while loading the main class {description_main} of expansion '{file_name}', reason: \n&8{reason}"
169-
it["LOAD-MAIN-CLASS-MAIN-NOT-DEPEND"] = "An error occurred while loading the main class {description_main} of expansion '{file_name}', reason: &cThe main class does not depend on FastScriptExpansion."
170-
it["CAN-NOT-LOAD-MAIN-CLASS"] = "Unable to load the extension '{file_name}' because it has no FastScriptExpansion class available!"
171-
}
172-
}
173-
it["SCRIPT"] = YamlConfiguration().also {
174-
it["PROCESS-RESULT"] = YamlConfiguration().also {
175-
it["SCRIPT-OPTION-FILE-NOT-EXISTS"] = "Script option file exists!"
176-
it["SCRIPT-TYPE-NOT-SUPPORTED"] = "The script file extension is not supported!"
177-
it["SCRIPT-FILE-NAME-CANNOT-SPACES"] = "File name cannot contain spaces!"
178-
}
179-
it["SCRIPT-FAILED-LOAD-BY-PROCESS-RESULT"] = "An error occurred while loading script &3{file_name}&7, reason: &8{reason}"
180-
}
181-
it["LOADED-COUNTS-PROCESS-SUCCESS"] = "Loaded &b{total} &7{id}, &a{success} &7successes.&8({millisecond}ms)"
182-
it["LOADED-COUNTS-PROCESS-SUCCESS-HAS-FAILED"] = "Loaded &b{total} &7{id}, &a{success} &7successes, &c{fail} &7failures.&8({millisecond}ms)"
183-
184-
185-
it["INVOKE"] = YamlConfiguration().also {
186-
it["ASYNC-SUCCESS"] = "Async {exec_type} {exec_name}.&8({millisecond}ms)"
187-
it["ASYNC-SUCCESS-HAS-DESCRIPTION"] = "Async {exec_type} {exec_name}, {exec_description}.&8({millisecond}ms)"
188-
it["ASYNC-FAILED"] = "&cAsync failed to invoke {exec_name}, reason:\n&8{reason}"
189-
190-
it["SUCCESS"] = "{exec_type} {exec_name}.&8({millisecond}ms)"
191-
it["SUCCESS-HAS-DESCRIPTION"] = "{exec_type} {exec_name}, {exec_description}.&8({millisecond}ms)"
192-
it["FAILED"] = "&cFailed to invoke {exec_name}, reason:\n&8{reason}"
193-
}
194-
195-
it["FILE-LISTENER"] = YamlConfiguration().also {
196-
it["SCRIPT"] = YamlConfiguration().also {
197-
it["LOADED"] = "Detected file &6{file_name} &7changes, successfully reloaded script &b{script_name}&7.&8({millisecond}ms)"
198-
}
199-
}
200-
201-
it["VERSION"] = version
202-
203-
}
16+
var defaultConfig = en_US
20417

20518
val config = YamlConfiguration()
20619

common/src/main/kotlin/me/scoretwo/fastscript/api/language/LanguageManager.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class LanguageManager {
1313
}
1414

1515
it["en_US"] = defaultLanguage
16-
it["zh_CN"] = Language(version, "zh_CN")
16+
it["zh_CN"] = Language(version, "zh_CN").also { it.defaultConfig = zh_CN }
1717
}
1818

1919
init {

0 commit comments

Comments
 (0)