Advertisement
Guest User

Untitled

a guest
Aug 12th, 2021
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. public class OpenInvCommand implements CommandExecutor {
  2.  
  3. private int TaskID;
  4.  
  5. @Override
  6. public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
  7. if (sender instanceof Player) {
  8. Player player = (Player) sender;
  9. Inventory inventory = Bukkit.createInventory(null, 9 * 1, "§aMenü");
  10.  
  11. ItemStack item = new ItemStack(Material.GRAY_STAINED_GLASS_PANE);
  12. ItemMeta itemMeta = item.getItemMeta();
  13. itemMeta.setDisplayName("§7Bitte habe einen Moment geduld...");
  14. item.setItemMeta(itemMeta);
  15. inventory.addItem(item);
  16. for (int i = 0; i < 9; i++) {
  17. inventory.setItem(i, item);
  18. player.openInventory(inventory);
  19. }
  20. TaskID = Bukkit.getScheduler().scheduleSyncRepeatingTask(LoadingScreen.getPlugin(), new Runnable() {
  21. @Override
  22. public void run() {
  23.  
  24. ItemStack item = new ItemStack(Material.GREEN_STAINED_GLASS_PANE);
  25. ItemMeta itemMeta = item.getItemMeta();
  26. itemMeta.setDisplayName("");
  27. item.setItemMeta(itemMeta);
  28. inventory.addItem(item);
  29. for (int i = 0; i < 9; i++) {
  30. inventory.setItem(i, item);
  31. player.openInventory(inventory);
  32.  
  33. Bukkit.getScheduler().cancelTask(TaskID);
  34. }
  35. }
  36. }, 0, 40);
  37. }
  38. return false;
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement