Added Type argument to '/mi browse'

This commit is contained in:
ASangarin 2019-08-28 13:45:46 +01:00
parent 9464adee21
commit 8e5fe8df7b
2 changed files with 13 additions and 4 deletions

View File

@ -85,7 +85,16 @@ public class MMOItemsCommand implements CommandExecutor {
return true;
}
new ItemBrowser((Player) sender).open();
if (args.length < 2) {
new ItemBrowser((Player) sender).open();
}
if (!Type.isValid(args[1])) {
sender.sendMessage(MMOItems.plugin.getPrefix() + ChatColor.RED + "Please specify a valid item type.");
return true;
}
new ItemBrowser((Player) sender, Type.get(args[1])).open();
}
// ==================================================================================================================================
else if (args[0].equalsIgnoreCase("update")) {
@ -583,11 +592,11 @@ public class MMOItemsCommand implements CommandExecutor {
if (MMOItems.plugin.getVersion().getDurabilityHandler().isDamaged(item, item.getItemMeta()))
config.getConfig().set(name + ".durability", MMOItems.plugin.getVersion().getDurabilityHandler().getDurability(item, item.getItemMeta()));
if (item.getItemMeta().hasDisplayName())
config.getConfig().set(name + ".name", item.getItemMeta().getDisplayName().replace("§", "&"));
config.getConfig().set(name + ".name", item.getItemMeta().getDisplayName().replace("<EFBFBD>", "&"));
if (item.getItemMeta().hasLore()) {
List<String> lore = new ArrayList<>();
for (String line : item.getItemMeta().getLore())
lore.add(line.replace("§", "&"));
lore.add(line.replace("<EFBFBD>", "&"));
config.getConfig().set(name + ".lore", lore);
}
if (item.getItemMeta().hasItemFlag(ItemFlag.HIDE_ENCHANTS))

View File

@ -72,7 +72,7 @@ public class MMOItemsCompletion implements TabCompleter {
list.add("spirit");
}
else if (args[0].equalsIgnoreCase("itemlist") || args[0].equalsIgnoreCase("drop") || args[0].equalsIgnoreCase("create") || args[0].equalsIgnoreCase("delete") || args[0].equalsIgnoreCase("remove") || args[0].equalsIgnoreCase("edit") || args[0].equalsIgnoreCase("copy") || args[0].equalsIgnoreCase("load"))
else if (args[0].equalsIgnoreCase("browse") || args[0].equalsIgnoreCase("itemlist") || args[0].equalsIgnoreCase("drop") || args[0].equalsIgnoreCase("create") || args[0].equalsIgnoreCase("delete") || args[0].equalsIgnoreCase("remove") || args[0].equalsIgnoreCase("edit") || args[0].equalsIgnoreCase("copy") || args[0].equalsIgnoreCase("load"))
for (Type type : MMOItems.plugin.getTypes().getAll())
list.add(type.getId());