mirror of
https://e.coding.net/circlecloud/ProtectItem.git
synced 2024-12-27 20:48:51 +00:00
fix config null and add command color...
Signed-off-by: j502647092 <jtb1@163.com>
This commit is contained in:
parent
8d627c0443
commit
6341c07819
@ -30,16 +30,16 @@ public class CommandBan extends BaseCommand {
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
plugin.getItemManager().banItem(item);
|
||||
p.sendMessage("当前物品 " + itemname + " 已被禁封!");
|
||||
p.sendMessage(plugin.pluginname + "§c当前物品 §a" + itemname + " §c已被禁封!");
|
||||
return;
|
||||
case 1:
|
||||
|
||||
try {
|
||||
final ActionType action = Enum.valueOf(ActionType.class, args[0]);
|
||||
plugin.getItemManager().banItem(item, action);
|
||||
p.sendMessage("当前物品 " + itemname + " 已被禁封 操作" + action.toString() + "!");
|
||||
p.sendMessage(plugin.pluginname + "§c当前物品 §a" + itemname + " §c已被禁封 §c操作 §b" + action.toString() + "!");
|
||||
} catch (final Exception e) {
|
||||
p.sendMessage("未知的操作类型" + args[0] + "!");
|
||||
p.sendMessage(plugin.pluginname + "§c未知的操作类型" + args[0] + "!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,16 +30,16 @@ public class CommandUnban extends BaseCommand {
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
plugin.getItemManager().unBanItem(item);
|
||||
p.sendMessage("当前物品 " + itemname + " 已被解禁!");
|
||||
p.sendMessage(plugin.pluginname + "§a当前物品 " + itemname + " 已被解禁!");
|
||||
return;
|
||||
case 1:
|
||||
|
||||
try {
|
||||
final ActionType action = Enum.valueOf(ActionType.class, args[0]);
|
||||
plugin.getItemManager().unBanItem(item, action);
|
||||
p.sendMessage("当前物品 " + itemname + " 已被解禁 操作" + action.toString() + "!");
|
||||
p.sendMessage(plugin.pluginname + "§a当前物品 " + itemname + " 已被解禁 操作 §b" + action.toString() + "!");
|
||||
} catch (final Exception e) {
|
||||
p.sendMessage("未知的操作类型" + args[0] + "!");
|
||||
p.sendMessage(plugin.pluginname + "§c未知的操作类型" + args[0] + "!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
@ -22,6 +23,8 @@ public class ItemManager {
|
||||
public ItemManager(final ProtectItem main) {
|
||||
plugin = main;
|
||||
itemconfig = new FileConfig(plugin, "banitems.yml");
|
||||
final ConfigurationSection cfg = itemconfig.getConfigurationSection("banitems");
|
||||
if (cfg != null) {
|
||||
final Set<String> items = itemconfig.getConfigurationSection("banitems").getKeys(false);
|
||||
if (items != null) {
|
||||
for (final String banitem : items) {
|
||||
@ -35,8 +38,7 @@ public class ItemManager {
|
||||
}
|
||||
itemlist.put(banitem, actlist);
|
||||
}
|
||||
} else {
|
||||
itemlist = new HashMap<String, List<ActionType>>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user