Hello, I would like to add this "Leaping feather" item (https://github.com/dostaljsembanalemamnovyucet/SuperLeap/tree/master/) to the 1vs1 match (https://github.com/TheFixerDevelopment/1vs1/tree/master/) I would like to add the leap feather to the 1vs1 match, what should I do?
PHP: $player->getInventory()->addItem(Item::get(Item::FEATHER)->setCustomName(TextFormat::RESET . TextFormat::GREEN . "Super Leap"));
Add the player in an array and schedule a repeating task. In the task file use public $time = 0 and onRun you $this->time++; Check if the time is 1 and unset from the array On the interact function you check if the player's name is in_array so you do not leap and return false. 20 ticks = 1 second so 100 ticks = 5 seconds. Hope you undertand.
Whenever that code gets called, save the playername (key) and a timestamp (value, using time()) into an array. And before that, check whether the player is already in that array and if their timestamp is old enough (at least 5 seconds old), if it is, remove it from that array. If the player isn't in the array or the timestamp was old enough, give them the item, then save their name and new timestamp into the array.