Files
TEKCHUNK.sk
Code
1 218
TEKCHUNK.sk
# TEKCHUNK
# Gereksinim: Skript ve WorldEdit
# Schematic dosyaları: plugins/WorldEdit/schematics/ada1.schem - ada10.schem
# Kurulumdan sonra: /sk reload TEKCHUNK
# Komutlar tekchunk.admin yetkisi ister. Önce hedef alanı ve güvenli noktayı ayarlayın.
options:
prefix: &6[TEKCHUNK]&r
# Süre ve ada sırası kayıtlı değişkenlerdir; script yeniden yüklenince çalışma durumu sıfırlanır.
on script load:
if {tekchunk.time} is not set:
set {tekchunk.time} to 15
if {tekchunk.index} is not set:
set {tekchunk.index} to 0
set {tekchunk.running} to false
set {tekchunk.busy} to false
delete {tekchunk.executor}
# Konumun ayarlanan dünyada ve hedef chunk'ın 16x16 yatay sınırları içinde olup olmadığını kontrol eder.
function tekchunk_is_inside(loc: location) :: boolean:
if {tekchunk.world} is not set:
return false
if {tekchunk.minX} is not set:
return false
if world of {_loc} is not {tekchunk.world}:
return false
if x-coordinate of {_loc} < {tekchunk.minX}:
return false
if x-coordinate of {_loc} > {tekchunk.minX} + 15:
return false
if z-coordinate of {_loc} < {tekchunk.minZ}:
return false
if z-coordinate of {_loc} > {tekchunk.minZ} + 15:
return false
return true
# Oyuncuları hedef alandan çıkarır, sıradaki schem'i WorldEdit ile yükleyip chunk'a yapıştırır.
# WorldEdit komutlarını çalıştırabilmesi için çağrıyı yapan oyuncunun WorldEdit erişimi olmalıdır.
function tekchunk_refresh(executor: player):
if {tekchunk.world} is not set:
send "{@prefix} &cÖnce /tekchunk set kullanmalısın." to {_executor}
stop
if {tekchunk.spawn} is not set:
send "{@prefix} &cÖnce /tekchunk setspawn kullanmalısın." to {_executor}
stop
set {tekchunk.busy} to true
set {tekchunk.executor} to name of {_executor}
# Yenileme öncesinde hedef chunk'ın içindeki oyuncuları güvenli noktaya taşır.
loop all players:
if tekchunk_is_inside(location of loop-player) is true:
teleport loop-player to {tekchunk.spawn}
# Ada numarasını 1-10 arasında döndürür.
set {_next} to {tekchunk.index} + 1
if {_next} > 10:
set {_next} to 1
# WorldEdit seçimini hedef chunk'a alır, içini temizler ve sıradaki ada schematic'ini yapıştırır.
teleport {_executor} to {tekchunk.paste}
make {_executor} execute command "//schem load ada%{_next}%"
make {_executor} execute command "//chunk"
make {_executor} execute command "//set air"
teleport {_executor} to {tekchunk.paste}
make {_executor} execute command "//paste"
# Son kullanılan ada numarasını kaydeder ve komut uygulayıcısını güvenli noktaya yollar.
set {tekchunk.index} to {_next}
teleport {_executor} to {tekchunk.spawn}
delete {tekchunk.executor}
set {tekchunk.busy} to false
command /tekchunk [<text>] [<integer>]:
permission: tekchunk.admin
permission message: {@prefix} &cBu komutu kullanma yetkin yok.
trigger:
if arg-1 is not set:
send "{@prefix} &6&lTEKCHUNK Komut Listesi" to player
send "{@prefix} &e/tekchunk set &7- Bulunduğun chunk'ı hedef alan yapar." to player
send "{@prefix} &e/tekchunk setspawn &7- Güvenli ışınlanma noktasını ayarlar." to player
send "{@prefix} &e/tekchunk start &7- Otomatik yenileme geri sayımını başlatır." to player
send "{@prefix} &e/tekchunk stop &7- Otomatik yenilemeyi durdurur." to player
send "{@prefix} &e/tekchunk reset &7- Beklemeden sıradaki arenayı yükler." to player
send "{@prefix} &e/tekchunk info &7- Sistem ayarlarını ve durumunu gösterir." to player
send "{@prefix} &e/tekchunk settime <dakika> &7- Yenileme süresini ayarlar." to player
send "{@prefix} &eSchematic sırası: &fada1.schem, ada2.schem, ada3.schem, ada4.schem, ada5.schem, ada6.schem, ada7.schem, ada8.schem, ada9.schem, ada10.schem" to player
send "{@prefix} &6Not: &e/start geri sayımı başlatır; süre dolunca sıradaki ada yüklenir. /reset beklemeden sıradaki adaya geçer." to player
stop
if arg-1 is "set":
# Oyuncunun bulunduğu chunk'ın kuzeybatı başlangıç koordinatını bulur.
set {_minX} to floor(x-coordinate of player / 16) * 16
set {_minZ} to floor(z-coordinate of player / 16) * 16
set {_pasteY} to floor(y-coordinate of player)
set {tekchunk.minX} to {_minX}
set {tekchunk.minZ} to {_minZ}
set {tekchunk.world} to world of player
set {tekchunk.paste} to location at {_minX}, {_pasteY}, {_minZ} in world of player
send "{@prefix} &aHedef chunk ayarlandı. Dünya: &f%world of player% &aBaşlangıç: &f%{_minX}%, %{_pasteY}%, %{_minZ}%" to player
stop
if arg-1 is "setspawn":
# Yenileme sırasında oyuncuların gönderileceği, hedef alan dışındaki konumu kaydeder.
if {tekchunk.world} is set:
if tekchunk_is_inside(location of player) is true:
send "{@prefix} &cGüvenli nokta hedef chunk'ın dışında olmalı." to player
stop
set {tekchunk.spawn} to location of player
send "{@prefix} &aGüvenli nokta ayarlandı." to player
stop
if arg-1 is "start":
if {tekchunk.world} is not set:
send "{@prefix} &cÖnce /tekchunk set kullanmalısın." to player
stop
if {tekchunk.spawn} is not set:
send "{@prefix} &cÖnce /tekchunk setspawn kullanmalısın." to player
stop
if {tekchunk.running} is true:
send "{@prefix} &eSistem zaten çalışıyor." to player
stop
set {tekchunk.running} to true
# Start yalnızca geri sayımı başlatır; ilk otomatik yenileme süre dolunca yapılır.
set {tekchunk.remaining} to {tekchunk.time} * 60
send "{@prefix} &aSistem başlatıldı. Yenileme aralığı: &f%{tekchunk.time}% dakika." to player
stop
if arg-1 is "stop":
set {tekchunk.running} to false
delete {tekchunk.remaining}
send "{@prefix} &cSistem durduruldu." to player
stop
if arg-1 is "reset":
if {tekchunk.world} is not set:
send "{@prefix} &cÖnce /tekchunk set kullanmalısın." to player
stop
if {tekchunk.spawn} is not set:
send "{@prefix} &cÖnce /tekchunk setspawn kullanmalısın." to player
stop
# Beklemeden sıradaki adaya geçer; sistem çalışıyorsa geri sayımı baştan başlatır.
tekchunk_refresh(player)
if {tekchunk.running} is true:
set {tekchunk.remaining} to {tekchunk.time} * 60
send "{@prefix} &aYenileme işlemi başlatıldı." to player
stop
if arg-1 is "settime":
if arg-2 is not set:
send "{@prefix} &cKullanım: /tekchunk settime <dakika>" to player
stop
if arg-2 <= 0:
send "{@prefix} &cSüre 0'dan büyük olmalı." to player
stop
set {tekchunk.time} to arg-2
# Çalışan sistemde yeni süre hemen yeni geri sayım olarak uygulanır.
if {tekchunk.running} is true:
set {tekchunk.remaining} to {tekchunk.time} * 60
send "{@prefix} &aYenileme süresi &f%{tekchunk.time}% dakika &aolarak ayarlandı." to player
stop
if arg-1 is "info":
send "&6--- TEKCHUNK Bilgileri ---" to player
if {tekchunk.world} is set:
send "&eDünya: &f%{tekchunk.world}%" to player
send "&eChunk başlangıcı: &f%{tekchunk.minX}%, %{tekchunk.minZ}%" to player
else:
send "&eHedef chunk: &cAyarlanmamış" to player
if {tekchunk.spawn} is set:
send "&eGüvenli nokta: &aAyarlanmış" to player
else:
send "&eGüvenli nokta: &cAyarlanmamış" to player
send "&eSon kullanılan ada: &fada%{tekchunk.index}%" to player
send "&eYenileme aralığı: &f%{tekchunk.time}% dakika" to player
if {tekchunk.running} is true:
send "&eDurum: &aÇalışıyor" to player
else:
send "&eDurum: &cDurduruldu" to player
stop
send "{@prefix} &cBilinmeyen işlem. Komut listesini görmek için /tekchunk yaz." to player
every 1 second:
# Geri sayım bittiğinde çevrimiçi bir yetkili seçer; yetkili yoksa bir saniye sonra tekrar dener.
if {tekchunk.running} is true:
remove 1 from {tekchunk.remaining}
if {tekchunk.remaining} <= 0:
delete {_executor}
loop all players:
if loop-player has permission "tekchunk.admin":
set {_executor} to loop-player
stop loop
if {_executor} is set:
if {tekchunk.world} is set:
if {tekchunk.spawn} is set:
tekchunk_refresh({_executor})
set {tekchunk.remaining} to {tekchunk.time} * 60
else: