File tree Expand file tree Collapse file tree 3 files changed +11
-2
lines changed
java/me/rothes/protocolstringreplacer Expand file tree Collapse file tree 3 files changed +11
-2
lines changed Original file line number Diff line number Diff line change 1818import org .apache .commons .lang .Validate ;
1919import org .bukkit .Bukkit ;
2020import org .bukkit .configuration .ConfigurationSection ;
21+ import org .bukkit .configuration .InvalidConfigurationException ;
2122import org .bukkit .entity .Player ;
2223import org .bukkit .plugin .PluginLogger ;
2324import org .bukkit .plugin .PluginManager ;
@@ -275,8 +276,14 @@ private void enableModify(ConfigManager.LifeCycle lifeCycle) {
275276 }
276277
277278 private void loadConfig () {
278- configFile = new File (instance .getDataFolder () + "/Config.yml" );
279- config = CommentYamlConfiguration .loadConfiguration (configFile );
279+ try {
280+ configFile = new File (instance .getDataFolder () + "/Config.yml" );
281+ config = new CommentYamlConfiguration ();
282+ config .load (configFile );
283+ } catch (IOException | InvalidConfigurationException e ) {
284+ error (PsrLocalization .getLocaledMessage ("Console-Sender.Messages.Initialize.Config-Failed-To-Load" ), e );
285+ config = PsrLocalization .getDefaultLocaledConfig ();
286+ }
280287 }
281288
282289 private void checkConfig () {
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ Console-Sender:
22 Messages :
33 Command-Not-Available : ' &cOnly players can execute this command.'
44 Initialize :
5+ Config-Failed-To-Load : ' &cFailed to load global config. Please fix the problem with the trace stack. Using defaults.'
56 Require-Spigot : ' &cThis plugin must run on Spigot server or its fork.'
67 Recommend-Paper : ' You are not running Paper server or its fork. It'' s recommended to switch to Paper for full supports.'
78 Out-Dated-Server : ' Your server version is too outdated, and may not enjoy some features normally...'
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ Console-Sender:
22 Messages :
33 Command-Not-Available : ' &c仅玩家可使用该指令.'
44 Initialize :
5+ Config-Failed-To-Load : ' &c无法载入全局配置文件. 请通过下面的报错堆栈检查错误. 正在使用默认值.'
56 Require-Spigot : ' &c本插件需要使用 Spigot 或其衍生服务端.'
67 Recommend-Paper : ' 您未使用 Paper 或其衍生服务端核心. 建议使用 Paper 以获得完整功能.'
78 Out-Dated-Server : ' 您使用的服务端过旧, 可能无法正常享受一些功能..'
You can’t perform that action at this time.
0 commit comments