1
0
mirror of https://e.coding.net/circlecloud/Soulbound.git synced 2024-11-21 01:39:10 +00:00

add reload lang and fix some bug...

This commit is contained in:
j502647092 2015-04-30 16:32:38 +08:00
parent 2777e7d9aa
commit 49eefa3b28
3 changed files with 18 additions and 5 deletions

View File

@ -45,12 +45,12 @@ public class Soulbound extends JavaPlugin {
public FileConfiguration msgConfig;
public void onLoad() {
this.saveResource("message.yml", false);
msgfile = new File(this.getDataFolder(), "message.yml");
msgConfig = YamlConfiguration.loadConfiguration(msgfile);
try {
LoadConfig (msgConfig ,msgfile);
} catch (FileNotFoundException e) {
this.saveResource("message.yml", false);
this.saveResource("message.yml", true);
} catch (IOException e) {
this.getLogger().info("语言文件读取错误...");
} catch (InvalidConfigurationException e) {
@ -164,6 +164,18 @@ public class Soulbound extends JavaPlugin {
return message;
}
public void reloadmessage(){
try {
LoadConfig (msgConfig ,msgfile);
} catch (FileNotFoundException e) {
this.saveResource("message.yml", true);
} catch (IOException e) {
this.getLogger().info("语言文件读取错误...");
} catch (InvalidConfigurationException e) {
this.saveResource("message.yml", true);
}
}
public String getlang(String type) {
return this.getmessage("Message." + type);
}

View File

@ -1,6 +1,5 @@
package com.me.tft_02.soulbound.commands;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@ -42,7 +41,8 @@ public class SoulboundCommand implements CommandExecutor {
}
Soulbound.p.reloadConfig();
sender.sendMessage(ChatColor.GREEN + "Configuration reloaded.");
sender.sendMessage(Soulbound.p.getlang("RELOAD"));
return false;
}

View File

@ -37,4 +37,5 @@ Message:
CMD_BIND_ON_USE: '&4* &a/bindonuse &7将当前物品标记为 &4使用后绑定'
CMD_UNBIND: '&4* &a/unbind &7解除手中物品的绑定。'
CMD_NEXT: '&6使用 /soulbound help %nextPage% 查看更多'
CMD_USE: '使用: /soulbound [reload | help]'
CMD_USE: '使用: /soulbound [reload | help]'
RELOAD: '&a配置文件已重载...'