mirror of
https://e.coding.net/circlecloud/Soulbound.git
synced 2025-11-24 21:36:20 +00:00
add reload lang and fix some bug...
This commit is contained in:
@@ -45,12 +45,12 @@ public class Soulbound extends JavaPlugin {
|
|||||||
public FileConfiguration msgConfig;
|
public FileConfiguration msgConfig;
|
||||||
|
|
||||||
public void onLoad() {
|
public void onLoad() {
|
||||||
this.saveResource("message.yml", false);
|
|
||||||
msgfile = new File(this.getDataFolder(), "message.yml");
|
msgfile = new File(this.getDataFolder(), "message.yml");
|
||||||
|
msgConfig = YamlConfiguration.loadConfiguration(msgfile);
|
||||||
try {
|
try {
|
||||||
LoadConfig (msgConfig ,msgfile);
|
LoadConfig (msgConfig ,msgfile);
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
this.saveResource("message.yml", false);
|
this.saveResource("message.yml", true);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
this.getLogger().info("语言文件读取错误...");
|
this.getLogger().info("语言文件读取错误...");
|
||||||
} catch (InvalidConfigurationException e) {
|
} catch (InvalidConfigurationException e) {
|
||||||
@@ -164,6 +164,18 @@ public class Soulbound extends JavaPlugin {
|
|||||||
return message;
|
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) {
|
public String getlang(String type) {
|
||||||
return this.getmessage("Message." + type);
|
return this.getmessage("Message." + type);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.me.tft_02.soulbound.commands;
|
package com.me.tft_02.soulbound.commands;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@@ -42,7 +41,8 @@ public class SoulboundCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Soulbound.p.reloadConfig();
|
Soulbound.p.reloadConfig();
|
||||||
sender.sendMessage(ChatColor.GREEN + "Configuration reloaded.");
|
|
||||||
|
sender.sendMessage(Soulbound.p.getlang("RELOAD"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,3 +38,4 @@ Message:
|
|||||||
CMD_UNBIND: '&4* &a/unbind &7<><37><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD>İ<C4B0>'
|
CMD_UNBIND: '&4* &a/unbind &7<><37><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD>İ<C4B0>'
|
||||||
CMD_NEXT: '&6ʹ<36><CAB9> /soulbound help %nextPage% <20>鿴<EFBFBD><E9BFB4><EFBFBD><EFBFBD>'
|
CMD_NEXT: '&6ʹ<36><CAB9> /soulbound help %nextPage% <20>鿴<EFBFBD><E9BFB4><EFBFBD><EFBFBD>'
|
||||||
CMD_USE: 'ʹ<><CAB9>: /soulbound [reload | help]'
|
CMD_USE: 'ʹ<><CAB9>: /soulbound [reload | help]'
|
||||||
|
RELOAD: '&a<><61><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...'
|
||||||
Reference in New Issue
Block a user