options:
protectionDuration: 720 # dakika cinsinden
worldName: "boxpvpdünyaismi" # dünya ismi
protectionEndedMessage: "&cKoruman bitti! Artık diğer oyuncular sana saldırabilir."
on world change:
if event-world is {@worldName}:
if {boxpvp.playerProtectionLeft::%player%} isn't set:
set {boxpvp.playerProtectionLeft::%player%} to 0
if {boxpvp.firstJoinProtectionGiven::%player%} isn't set:
set {boxpvp.firstJoinProtectionGiven::%player%} to true
set {boxpvp.protection.protecting::%player%} to true
set {boxpvp.playerProtectionLeft::%player%} to {@protectionDuration} * 60
wait 3 seconds
set {_t} to {@protectionDuration} / 60
send "&a%{_t}% saat boyunca PvP'lere karşı korunacaksın!"
on damage:
if victim is a player:
if attacker is a player:
if {boxpvp.protection.protecting::%victim%} is true:
cancel event
send "&cBu oyuncu saldırılara karşı korunuyor!" to attacker
play sound "minecraft:item.shield.break" to attacker
on join:
protectionHandler(player)
command /korumakapat:
trigger:
if {boxpvp.protection.protecting::%player%} is true:
set {boxpvp.protection.protecting::%player%} to false
send "&cKoruman başarıyla devre dışı bırakıldı!" to player
play sound "entity.player.levelup" to player
else:
send "&cKoruman zaten aktif değil!" to player
play sound "block.note_block.bass" at pitch 0.5 to player
local function protectionHandler(p: player):
while {_p} is online:
while {boxpvp.protection.protecting::%{_p}%} is true:
if {boxpvp.playerProtectionLeft::%{_p}%} > 0:
remove 1 from {boxpvp.playerProtectionLeft::%{_p}%}
else:
set {boxpvp.protection.protecting::%{_p}%} to false
send {@protectionEndedMessage} to {_p}
wait 10 second # lag çıkmasın diye 10, bunu düşürebilirsin istersen.