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

add auto fix message.yml function...

This commit is contained in:
j502647092 2015-04-30 16:14:10 +08:00
parent 236abc0ab7
commit 2777e7d9aa
8 changed files with 41 additions and 90 deletions

View File

@ -47,7 +47,15 @@ public class Soulbound extends JavaPlugin {
public void onLoad() {
this.saveResource("message.yml", false);
msgfile = new File(this.getDataFolder(), "message.yml");
msgConfig = Loadcfg(msgfile);
try {
LoadConfig (msgConfig ,msgfile);
} catch (FileNotFoundException e) {
this.saveResource("message.yml", false);
} catch (IOException e) {
this.getLogger().info("语言文件读取错误...");
} catch (InvalidConfigurationException e) {
this.saveResource("message.yml", true);
}
}

View File

@ -43,7 +43,6 @@ public class BindCommand implements CommandExecutor {
case 2:
if (!args[1].equalsIgnoreCase("inventory")) {
sender.sendMessage(Soulbound.p.getlang("BIND_INVENTORY"));
//sender.sendMessage(ChatColor.RED + "Proper usage: " + ChatColor.GREEN + "/bind <player> inventory");
return true;
}
@ -67,7 +66,6 @@ public class BindCommand implements CommandExecutor {
if ((itemInHand.getType() == Material.AIR) || ItemUtils.isSoulbound(itemInHand)) {
sender.sendMessage(Soulbound.p.getlang("CAN_NOT_BIND"));
//sender.sendMessage(ChatColor.GRAY + "You can't " + soulbound + ChatColor.GRAY + "this item.");
return false;
}
@ -75,7 +73,6 @@ public class BindCommand implements CommandExecutor {
if (ItemUtils.isSoulbound(itemInHand) && Config.getInstance().getFeedbackEnabled()) {
sender.sendMessage(Soulbound.p.getlang("BINDED").replace("%target%", target.getName()));
//sender.sendMessage(ChatColor.GRAY + "Item is now " + soulbound + ChatColor.GRAY + "to " + ChatColor.DARK_AQUA + target.getName());
}
return true;
}
@ -91,7 +88,6 @@ public class BindCommand implements CommandExecutor {
player.sendMessage(Soulbound.p.getlang("BIND_FULL_INEVNTORY").
replace("%player%", player.getName()).
replace("%target%", target.getName()));
//player.sendMessage(ChatColor.GRAY + "All items in " + ChatColor.DARK_AQUA + player.getName() + ChatColor.GRAY + "'s inventory are now " + soulbound + ChatColor.GRAY + "to " + ChatColor.DARK_AQUA + target.getName());
}
return true;
}

View File

@ -38,11 +38,9 @@ public class BindOnEquipCommand implements CommandExecutor {
if (ItemUtils.isBindOnEquip(itemInHand)) {
player.sendMessage(Soulbound.p.getlang("BIND_ON_EQUIP"));
//player.sendMessage(ChatColor.GRAY + "Item is now " + ChatColor.DARK_RED + "Bind on Equip");
}
else {
player.sendMessage(Soulbound.p.getlang("CAN_NOT_BIND_ON_EQUIP"));
//player.sendMessage(ChatColor.RED + "Cannot mark this item as " + ChatColor.DARK_RED + "Bind on Equip");
}
return true;

View File

@ -30,14 +30,12 @@ public class BindOnPickupCommand implements CommandExecutor {
if ((itemInHand.getType() == Material.AIR) || ItemUtils.isSoulbound(itemInHand)) {
sender.sendMessage(Soulbound.p.getlang("CAN_NOT_BIND_ON_PICKUP"));
//player.sendMessage(ChatColor.GRAY + "You can't " + ChatColor.GOLD + "Soulbound " + ChatColor.GRAY + "this item.");
return false;
}
ItemUtils.unbindItem(itemInHand);
ItemUtils.bopItem(itemInHand);
sender.sendMessage(Soulbound.p.getlang("BIND_ON_PICKUP"));
//player.sendMessage(ChatColor.GRAY + "Item is now " + ChatColor.DARK_RED + "Bind on pickup");
return true;
default:

View File

@ -30,14 +30,12 @@ public class BindOnUseCommand implements CommandExecutor {
if ((itemInHand.getType() == Material.AIR) || ItemUtils.isSoulbound(itemInHand)) {
sender.sendMessage(Soulbound.p.getlang("CAN_NOT_BIND_ON_USE"));
//player.sendMessage(ChatColor.GRAY + "You can't " + ChatColor.GOLD + "Soulbound " + ChatColor.GRAY + "this item.");
return false;
}
ItemUtils.unbindItem(itemInHand);
ItemUtils.bouItem(itemInHand);
sender.sendMessage(Soulbound.p.getlang("BIND_ON_USE"));
//player.sendMessage(ChatColor.GRAY + "Item is now " + ChatColor.DARK_RED + "Bind on Use");
return true;
default:
return false;

View File

@ -21,6 +21,11 @@ public class SoulboundCommand implements CommandExecutor {
if (args[0].equalsIgnoreCase("reload")) {
return reloadConfiguration(sender);
}
if (args[0].equalsIgnoreCase("help")
|| args[0].equalsIgnoreCase("?")) {
getHelpPage(1, sender);
return true;
}
default:
if (args[0].equalsIgnoreCase("help")
|| args[0].equalsIgnoreCase("?")) {
@ -60,15 +65,8 @@ public class SoulboundCommand implements CommandExecutor {
if (page > maxPages) {
sender.sendMessage(Soulbound.p.getlang("PAGE_NOT_EXIST".
replace("%maxPages%", maxPages+"")));
//sender.sendMessage(ChatColor.RED + "This page does not exist."
//+ ChatColor.GOLD + " /help [0-" + maxPages + "]");
return;
}
//String dot = ChatColor.DARK_RED + "* ";
// sender.sendMessage(ChatColor.GRAY + "-----[ " + ChatColor.GOLD
// + "Soulbound Help" + ChatColor.GRAY + " ]----- Page " + page
// + "/" + maxPages);
sender.sendMessage(Soulbound.p.getlang("HELP_TITLE").
replace("%page%", page+"").
replace("%maxPages%", maxPages+"")
@ -81,79 +79,37 @@ public class SoulboundCommand implements CommandExecutor {
sender.sendMessage(Soulbound.p.getlang("HOW_DOES_IT_WORK_4"));
sender.sendMessage(Soulbound.p.getlang("HOW_DOES_IT_WORK_5"));
sender.sendMessage(Soulbound.p.getlang("HOW_DOES_IT_WORK_6"));
// sender.sendMessage(ChatColor.GOLD + "How does it work?");
// sender.sendMessage(dot
// + ChatColor.GRAY
// + "Soulbound items are special items which are bound to a sender.");
// sender.sendMessage(dot
// + ChatColor.GRAY
// + "Players are prevented from doing certain actions with Soulbound items, such as:");
// sender.sendMessage(dot
// + ChatColor.GRAY
// + "dropping them on the ground, storing them in chests or giving them to other players.");
// sender.sendMessage(dot
// + ChatColor.GRAY
// + "Items marked as 'Bind on Pickup' will get Soulbound as soon as they get picked up.");
// sender.sendMessage(dot
// + ChatColor.GRAY
// + "Items marked as 'Bind on Use' will get Soulbound as soon as they get used.");
// sender.sendMessage(dot
// + ChatColor.GRAY
// + "Items marked as 'Bind on Equip' will get Soulbound as soon as they get equipped.");
}
if (page == 2) {
sender.sendMessage(Soulbound.p.getlang("CMD"));
//sender.sendMessage(ChatColor.GOLD + "Commands:");
if (sender.hasPermission("soulbound.commands.bind")) {
sender.sendMessage(Soulbound.p.getlang("CMDVERSION"));
//sender.sendMessage(dot + ChatColor.GREEN + "/soulbound"
//+ ChatColor.GRAY + " Check the status of the plugin.");
}
if (sender.hasPermission("soulbound.commands.bind")) {
sender.sendMessage(Soulbound.p.getlang("CMD_BIND"));
//sender.sendMessage(dot + ChatColor.GREEN + "/bind <sender>"
//+ ChatColor.GRAY
//+ " Soulbound the item currently in hand.");
sender.sendMessage(Soulbound.p.getlang("CMD_BIND_FULL_INVENTORY"));
//sender.sendMessage(dot + ChatColor.GREEN
//+ "/bind <sender> inventory" + ChatColor.GRAY
//+ " Soulbound an entire inventory.");
}
if (sender.hasPermission("soulbound.commands.bindonpickup")) {
sender.sendMessage(Soulbound.p.getlang("CMD_BIND_ON_PICKUP"));
//sender.sendMessage(dot + ChatColor.GREEN + "/bindonpickup"
//+ ChatColor.GRAY
//+ " Mark the item in hand as 'Bind on Pickup'");
}
if (sender.hasPermission("soulbound.commands.bindonuse")) {
sender.sendMessage(Soulbound.p.getlang("CMD_BIND_ON_USE"));
//sender.sendMessage(dot + ChatColor.GREEN + "/bindonuse"
//+ ChatColor.GRAY
//+ " Mark the item in hand as 'Bind on Use'");
}
if (sender.hasPermission("soulbound.commands.bindonequip")) {
sender.sendMessage(Soulbound.p.getlang("CMD_BIND_ON_EQUIP"));
//sender.sendMessage(dot + ChatColor.GREEN + "/bindonequip"
//+ ChatColor.GRAY
//+ " Mark the item in hand as 'Bind on Equip'");
}
if (sender.hasPermission("soulbound.commands.unbind")) {
sender.sendMessage(Soulbound.p.getlang("CMD_UNBIND"));
//sender.sendMessage(dot + ChatColor.GREEN + "/unbind"
//+ ChatColor.GRAY + " Unbind the item in hand.");
}
}
if (nextPage <= maxPages) {
sender.sendMessage(Soulbound.p.getlang("CMD_NEXT").replace("%nextPage%", nextPage+""));
//sender.sendMessage(ChatColor.GOLD + "Type /soulbound help "
//+ nextPage + " for more");
}
}
private boolean printUsage(CommandSender sender) {
sender.sendMessage(Soulbound.p.getlang("CMD_USE"));
//sender.sendMessage("Usage: /soulbound [reload | help]");
return false;
}
}

View File

@ -30,17 +30,14 @@ public class UnbindCommand implements CommandExecutor {
if ((itemInHand.getType() == Material.AIR) || !ItemUtils.isSoulbound(itemInHand)) {
player.sendMessage(Soulbound.p.getlang("CAN_NOT_UNBIND"));
//player.sendMessage(ChatColor.GRAY + "You can't " + ChatColor.GOLD + "Unbind " + ChatColor.GRAY + "this item.");
return false;
}
if (ItemUtils.unbindItem(itemInHand)==null ){
player.sendMessage(Soulbound.p.getlang("CAN_NOT_UNBIND"));
//player.sendMessage(ChatColor.GRAY + "You can't " + ChatColor.GOLD + "Unbind " + ChatColor.GRAY + "this item.");
return false;
}
player.sendMessage(Soulbound.p.getlang("UNBINDED"));
//player.sendMessage(ChatColor.GRAY + "Item no longer Soulbound.");
return true;
default:
return false;

View File

@ -1,40 +1,40 @@
#提示消息
Message:
CAN_NOT_BIND: '&8你不能&c绑定&8这个物品'
CAN_NOT_UNBIND: '&8你不能&6解绑&8这个物品'
CAN_NOT_BIND: '&7你不能&c绑定&7这个物品'
CAN_NOT_UNBIND: '&7你不能&6解绑&7这个物品'
BINDED: '&8物品已经&a绑定&8到玩家&c%target%'
UNBINDED: '&8物品已经解绑'
BINDED: '&7物品已经&a绑定&7到玩家&c%target%'
UNBINDED: '&7物品已经解绑'
BIND_FULL_INEVNTORY: '&a玩家&c%player%&a背包内的所有物品已绑定到玩家&6%target%'
BIND_INVENTORY: '&4你可能需要的命令: &a/bind <player> inventory'
BIND_INVENTORY: '&c你可能需要的命令: &a/bind <player> inventory'
BIND_ON_EQUIP: '&8当前物品已标记为 &4装备后绑定'
BIND_ON_PICKUP: '&8当前物品已标记为 &4拾取后绑定'
BIND_ON_USE: '&8当前物品已标记为 &4使用后绑定'
BIND_ON_EQUIP: '&7当前物品已标记为 &4装备后绑定'
BIND_ON_PICKUP: '&7当前物品已标记为 &4拾取后绑定'
BIND_ON_USE: '&7当前物品已标记为 &4使用后绑定'
CAN_NOT_BIND_ON_EQUIP: '&8当前物品不能标记为 &4装备后绑定'
CAN_NOT_BIND_ON_PICKUP: '&8当前物品不能标记为 &4拾取后绑定'
CAN_NOT_BIND_ON_USE: '&8当前物品不能标记为 &4使用后绑定'
CAN_NOT_BIND_ON_EQUIP: '&7当前物品不能标记为 &4装备后绑定'
CAN_NOT_BIND_ON_PICKUP: '&7当前物品不能标记为 &4拾取后绑定'
CAN_NOT_BIND_ON_USE: '&7当前物品不能标记为 &4使用后绑定'
VERSION: '灵魂绑定(修改by喵♂呜) 版本号:'
CAN_NOT_USE_ON_CONSOLE: '抱歉 此命令不能在控制台使用'
PAGE_NOT_EXIST: '&c帮助页面不存在 请输入 /Soulbound help [0-%maxPages%]'
HELP_TITLE: '&8--[ &灵魂绑定 帮助 -汉化by邱 -修改by喵♂呜 &8 ]-- 页面 %page%/%maxPages%'
HOW_DOES_IT_WORK: '&4* 它是如何工作的?'
HOW_DOES_IT_WORK_1: '&4* 灵魂绑定的物品只有自己才能使用。'
HOW_DOES_IT_WORK_2: '&4* 绑定后的物品,某些行为将会被阻止:'
HOW_DOES_IT_WORK_3: '&4* 扔在地上、或者放到箱子里让其他玩家拿。'
HOW_DOES_IT_WORK_4: '&4* 标记为 拾取后绑定 的物品,一旦被玩家捡起来就会立即绑定成为该玩家的物品。'
HOW_DOES_IT_WORK_5: '&4* 标记为 使用后绑定 的物品,只要拿在手中左键或者右键就会立即绑定成为该玩家的物品。'
HOW_DOES_IT_WORK_6: '&4* 标记为 装备后绑定 的物品,装备到身上后就能立即绑定成为该玩家的物品。'
HELP_TITLE: '&7--[ &6灵魂绑定 帮助 &a-汉化by邱 &c-修改by喵♂呜 &7 ]-- 页面 %page%/%maxPages%'
HOW_DOES_IT_WORK: '&c* 它是如何工作的?'
HOW_DOES_IT_WORK_1: '&c* 灵魂绑定的物品只有自己才能使用。'
HOW_DOES_IT_WORK_2: '&c* 绑定后的物品,某些行为将会被阻止:'
HOW_DOES_IT_WORK_3: '&c* 扔在地上、或者放到箱子里让其他玩家拿。'
HOW_DOES_IT_WORK_4: '&c* 标记为 拾取后绑定 的物品\n一旦被玩家捡起来就会立即绑定成为该玩家的物品。'
HOW_DOES_IT_WORK_5: '&c* 标记为 使用后绑定 的物品\n只要拿在手中左键或者右键就会立即绑定成为该玩家的物品。'
HOW_DOES_IT_WORK_6: '&c* 标记为 装备后绑定 的物品\n装备到身上后就能立即绑定成为该玩家的物品。'
CMD: '&6指令:'
CMDVERSION: '&4* &a/soulbound &8查看插件版本。'
CMD_BIND: '&4* &a/bind <sender> &8绑定手上的物品。'
CMD_BIND_FULL_INVENTORY: '&4* &a/bind <sender> inventory &8绑定玩家背包里的所有物品。'
CMD_BIND_ON_EQUIP: '&4* &a/bindonequip &8将当前物品标记为 &4装备后绑定'
CMD_BIND_ON_PICKUP: '&4* &a/bindonpickup &8将当前物品标记为 &4拾取后绑定'
CMD_BIND_ON_USE: '&4* &a/bindonuse &8将当前物品标记为 &4使用后绑定'
CMD_UNBIND: '&4* &a/unbind &8解除手中物品的绑定。'
CMDVERSION: '&4* &a/soulbound &7查看插件版本。'
CMD_BIND: '&4* &a/bind <sender> &7绑定手上的物品。'
CMD_BIND_FULL_INVENTORY: '&4* &a/bind <sender> inventory &7绑定玩家背包里的所有物品。'
CMD_BIND_ON_EQUIP: '&4* &a/bindonequip &7将当前物品标记为 &4装备后绑定'
CMD_BIND_ON_PICKUP: '&4* &a/bindonpickup &7将当前物品标记为 &4拾取后绑定'
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]'