pumpkin.txt 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. msg("dev", "§bPumpkinPie §rloaded.");
  2. event.load("block_click");
  3. times = map.new();
  4. pumpkin_wait_time = 3; //seconds
  5. pumpkin = read.item("minecraft:pumpkin_pie", 1, "PumpkinMinusOneEighthCake");
  6. lore_list = list.new();
  7. list.add(lore_list, "An almost whole pumpkin pie");
  8. list.add(lore_list, "Herobrine has already eaten a piece.");
  9. item.setLore(pumpkin, lore_list);
  10. pumpkin_loc = loc.new(world.getOverWorld(), 228, 71, 235);
  11. @wait
  12. wait();
  13. if(event == "block_click" && block_loc == pumpkin_loc) {
  14. if(hand == "OFF_HAND") {
  15. goto("wait");
  16. }
  17. if(action == "left") {
  18. goto("wait");
  19. }
  20. player_uuid = player.getUuid(player);
  21. now_time = time.getMillis();
  22. time = map.getOrDefault(times, player_uuid, 0);
  23. diff_time = (now_time - time) / 1000;
  24. if(diff_time > pumpkin_wait_time) {
  25. map.add(times, player_uuid, now_time);
  26. player.giveItem(player, pumpkin);
  27. } else {
  28. msg.prefix(player, "§6FoodGiver", concat("Please wait for ", text.number(math.round(pumpkin_wait_time - diff_time)), " seconds."));
  29. }
  30. }
  31. goto("wait");