1234567891011121314151617181920212223242526272829303132333435 |
- msg("dev", "§bPumpkinPie §rloaded.");
- event.load("block_click");
- times = map.new();
- pumpkin_wait_time = 3; //seconds
- pumpkin = read.item("minecraft:pumpkin_pie", 1, "PumpkinMinusOneEighthCake");
- lore_list = list.new();
- list.add(lore_list, "An almost whole pumpkin pie");
- list.add(lore_list, "Herobrine has already eaten a piece.");
- item.setLore(pumpkin, lore_list);
- pumpkin_loc = loc.new(world.getOverWorld(), 228, 71, 235);
- @wait
- wait();
- if(event == "block_click" && block_loc == pumpkin_loc) {
- if(hand == "OFF_HAND") {
- goto("wait");
- }
- if(action == "left") {
- goto("wait");
- }
- player_uuid = player.getUuid(player);
- now_time = time.getMillis();
- time = map.getOrDefault(times, player_uuid, 0);
- diff_time = (now_time - time) / 1000;
- if(diff_time > pumpkin_wait_time) {
- map.add(times, player_uuid, now_time);
- player.giveItem(player, pumpkin);
- } else {
- msg.prefix(player, "§6FoodGiver", concat("Please wait for ", text.number(math.round(pumpkin_wait_time - diff_time)), " seconds."));
- }
- }
- goto("wait");
|