options:
remove_delay: 10
time_unit: "minutes" # (minutes/seconds)
prefix: "<##4DE9FF>[AutoRemove] "
success_color: "<##4DFF88>"
error_color: "<##FF4D4D>"
info_color: "<##FFD44D>"
text_color: "<##E6E6E6>"
variables:
{blocks::*} = ""
{block_times::*} = 0
function convertToSeconds(time: number, unit: text) :: number:
if {_unit} is "minutes":
return {_time} * 60
else if {_unit} is "seconds":
return {_time}
return {_time} * 60
function addBlockToRemove(loc: location, p: player):
if {_p}'s world is "world":
set {_index} to size of {blocks::*} + 1
set {_seconds} to convertToSeconds({@remove_delay}, {@time_unit})
set {_removal_time} to unix timestamp of now + {_seconds}
set {blocks::%{_index}%} to "%{_loc}%"
set {block_times::%{_index}%} to {_removal_time}
send "{@prefix}{@text_color}Blok {@remove_delay} {@time_unit} sonra silinecek!" to {_p}
checkBlock({_index})
function checkBlock(index: number):
while {blocks::%{_index}%} is set:
set {_loc} to location of {blocks::%{_index}%} parsed as location
set {_time} to {block_times::%{_index}%}
if unix timestamp of now >= {_time}:
if block at {_loc} is not air:
set block at {_loc} to air
delete {blocks::%{_index}%}
delete {block_times::%{_index}%}
wait 5 seconds
on place:
addBlockToRemove(location of event-block, player)
command /autoremduration <number> [<text>]:
permission: autoremove.admin
trigger:
if arg-1 > 0:
set {@remove_delay} to arg-1
if arg-2 is set:
if arg-2 is "minutes" or "seconds":
set {@time_unit} to arg-2
send "{@prefix}{@success_color}Blok silme süresi {@text_color}%arg-1% %arg-2% olarak ayarlandı!" to player
else:
send "{@prefix}{@error_color}Geçersiz zaman birimi! {@text_color}Sadece 'minutes' veya 'seconds' kullanabilirsiniz." to player
else:
send "{@prefix}{@success_color}Blok silme süresi {@text_color}%arg-1% {@time_unit} olarak ayarlandı!" to player
else:
send "{@prefix}{@error_color}Lütfen 0'dan büyük bir değer girin!" to player
command /autoremstatus:
permission: autoremove.admin
trigger:
send "{@prefix}{@info_color}Mevcut Ayarlar:" to player
send "{@text_color}Süre: {@success_color}{@remove_delay}" to player
send "{@text_color}Birim: {@success_color}{@time_unit}" to player
on script load:
loop {blocks::*}:
checkBlock(loop-index)