Commit 8bc372a2 authored by Tommy Ang's avatar Tommy Ang 🤣

Implement ignite protection from lightning and trident

parent 5f2b57d5
......@@ -10,6 +10,8 @@ import:
org.bukkit.event.player.PlayerInteractEvent
org.bukkit.event.hanging.HangingBreakByEntityEvent
org.bukkit.event.block.BlockFromToEvent
org.bukkit.event.weather.LightningStrikeEvent
org.bukkit.event.block.BlockIgniteEvent
options:
ChunkPrice: 2500
......@@ -1457,63 +1459,74 @@ on damage:
stop
set {_ptowndamagechunk} to {ptown.%attacker%}
victim is not a creeper or a zombie or a skeleton or a spider or an enderman or a cave spider or a witch or a phantom or a drowned
attacker is a player
if {ptown.%attacker%} is not set:
# PvP disable
if attacker is a player:
if {ptown.%attacker%} is not set:
if {ptownlist.chunk::%chunk of victim%} is set:
cancel event
if attacker's current language is "zh_cn" or "zh_tw":
message "[&6PTown&f] &4这不是您的小镇!" to attacker
else:
message "[&6PTown&f] &4This is not your town!" to attacker
stop
if {ptownlist.chunk::%chunk of victim%} is set:
if {ptownlist.chunk::%chunk of victim%} is not equal to {_ptowndamagechunk}:
cancel event
if attacker's current language is "zh_cn" or "zh_tw":
message "[&6PTown&f] &4这不是您的小镇!" to attacker
else:
message "[&6PTown&f] &4This is not your town!" to attacker
if {ptown.%{_ptowndamagechunk}%.flag::friendlyfire} is not set:
if {ptown.%victim%} is equal to {_ptowndamagechunk}:
cancel event
message "Friendlyfire is disabled" to attacker
if {ptown.%{_ptowndamagechunk}%.flag::friendlyfire} is "true":
if {ptown.%victim%} is equal to {_ptowndamagechunk}:
cancel event
message "Friendlyfire is disabled" to attacker
# Protection from fire and lightning based on Fire flag
else if damage cause is lightning or burning:
set {_chunk} to chunk of victim
if {ptownlist.chunk::%{_chunk}%} is "Safezone":
cancel event
if attacker's current language is "zh_cn" or "zh_tw":
message "[&6PTown&f] &4这不是您的小镇!" to attacker
else:
message "[&6PTown&f] &4This is not your town!" to attacker
stop
if {ptownlist.chunk::%chunk of victim%} is set:
if {ptownlist.chunk::%chunk of victim%} is not equal to {_ptowndamagechunk}:
cancel event
if attacker's current language is "zh_cn" or "zh_tw":
message "[&6PTown&f] &4这不是您的小镇!" to attacker
else:
message "[&6PTown&f] &4This is not your town!" to attacker
if {ptown.%{_ptowndamagechunk}%.flag::friendlyfire} is not set:
if {ptown.%victim%} is equal to {_ptowndamagechunk}:
else if {ptownlist.chunk::%{_chunk}%} is set:
# if event.getDamager() has metadata "cause":
set {_town} to {ptownlist.chunk::%{_chunk}%}
if {ptown.%{_town}%.flag::fire} is not set:
cancel event
message "Friendlyfire is disabled" to attacker
if {ptown.%{_ptowndamagechunk}%.flag::friendlyfire} is "true":
if {ptown.%victim%} is equal to {_ptowndamagechunk}:
else if {ptown.%{_town}%.flag::fire} is "true":
cancel event
message "Friendlyfire is disabled" to attacker
# else if damage cause is burning:
# set {_town} to {ptownlist.chunk::%{_chunk}%}
# if {ptown.%{_town}%.flag::fire} is not set:
# cancel event
# else if {ptown.%{_town}%.flag::fire} is "true":
# cancel event
on ignite:
if {ptown.%player%.adminmode} is not set:
if {ptownlist.chunk::%chunk at event-block%} is "Safezone":
# Protection from lightning based on Fire flag
if "%event.getCause()%" is "LIGHTNING":
# This for when we want to expand to specific trident lightning
# if event.getIgnitingEntity() has metadata "cause":
# broadcast "%metadata value ""cause"" of event.getIgnitingEntity()%"
set {_chunk} to chunk at event-location
if {ptownlist.chunk::%{_chunk}%} is "Safezone":
cancel event
if player's current language is "zh_cn" or "zh_tw":
message "[&6PTown&f] &4您不能在安全地带建造!"
else:
message "[&6PTown&f] &4You are not allowed to build in Safezone!"
stop
if player is not set:
set {_town} to {ptownlist.chunk::%chunk at event-block%}
if {ptown.%{_town}%.flag::fire} is "false":
stop
if {ptown.%player%} is not set:
if {ptownlist.chunk::%chunk at event-block%} is set:
else if {ptownlist.chunk::%{_chunk}%} is set:
set {_town} to {ptownlist.chunk::%{_chunk}%}
if {ptown.%{_town}%.flag::fire} is not set:
cancel event
if player's current language is "zh_cn" or "zh_tw":
message "[&6PTown&f] &4这不是您的小镇!"
else:
message "[&6PTown&f] &4This is not your town!"
stop
set {_ptownbuildchunk} to {ptown.%player%}
if {ptownlist.chunk::%chunk at event-block%} is set:
if {ptownlist.chunk::%chunk at event-block%} is not equal to {_ptownbuildchunk}:
else if {ptown.%{_town}%.flag::fire} is "true":
cancel event
if player's current language is "zh_cn" or "zh_tw":
message "[&6PTown&f] &4这不是您的小镇!"
else:
message "[&6PTown&f] &4This is not your town!"
# This for when we want to expand to specific trident lightning
# on LightningStrikeEvent:
# if "%event.getCause()%" is "TRIDENT":
# set metadata value "cause" of event.getLightning() to "TRIDENT"
on death:
if victim is a creeper or a zombie or skeleton or a spider or an enderman or a phantom or drowned:
if victim is a creeper or a zombie or skeleton or a spider or an enderman or a phantom or a drowned:
if {ptownlist.chunk::%chunk at victim%} is "Safezone":
clear drops
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment