Advertisement
Guest User

Method to set Navigations in a Teleporter Menu

a guest
Jul 28th, 2016
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. public static void SetNavigation(String name, Material itemid, int guiposition) {
  2.  
  3. ItemStack item = new ItemStack (itemid);
  4. ItemMeta itemMeta = item.getItemMeta();
  5. itemMeta.setDisplayName(name);
  6. itemMeta.setLore(null);
  7. item.setItemMeta(itemMeta);
  8.  
  9. LobbyItems.navigatorInventory.setItem(guiposition, item);
  10.  
  11. }
  12.  
  13. @Override
  14. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
  15.  
  16. Player p = (Player) sender;
  17.  
  18. if (p.hasPermission("lobbysystem.setnavigation")) {
  19.  
  20. if (cmd.getName().equalsIgnoreCase("setnavigation")) {
  21.  
  22. if (args.length == 3) {
  23.  
  24. String name = args[0];
  25.  
  26. Material itemid = Material.valueOf(args[1]);
  27.  
  28. int guiposition = Integer.valueOf(args[2]);
  29.  
  30. Files.CheckFileExists(Files.navigations);
  31.  
  32. Files.navigationscfg.set("Navigations." + name + ".Item-ID", itemid);
  33.  
  34. Files.navigationscfg.set("Navigations." + name + ".Slot", guiposition);
  35.  
  36. SetNavigation(name, itemid, guiposition);
  37.  
  38. } else {
  39.  
  40. p.sendMessage(ChatColor.translateAlternateColorCodes('&', pl.getConfig().getString("ArgumentsError")));
  41.  
  42. }
  43.  
  44. }
  45.  
  46. } else {
  47.  
  48. p.sendMessage(ChatColor.translateAlternateColorCodes('&', pl.getConfig().getString("NoPermissions")));
  49.  
  50. }
  51.  
  52. return false;
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement