Commit a22902d3 authored by Tommy Ang's avatar Tommy Ang 🤣

Fix item frame protection

parent 33f12b29
......@@ -8,6 +8,7 @@
import:
org.bukkit.event.player.PlayerInteractEvent
org.bukkit.event.hanging.HangingBreakByEntityEvent
options:
ChunkPrice: 5000
......@@ -1355,6 +1356,40 @@ on break:
message "[&6PTown&f] &4这不是您的小镇!"
if {language.%player%} is "english":
message "[&6PTown&f] &4This is not your town!"
# Protect item frames
on HangingBreakByEntityEvent:
set {_player} to event.getRemover()
set {_eventLocation} to event.getRemover().getLocation().getChunk()
if {ptown.%{_player}%.adminmode} is not set:
if {ptownlist.chunk::%{_eventLocation}%} is "Safezone":
cancel event
if {language.%{_player}%} is "chinese":
message "[&6PTown&f] &4您不能摧毁安全地带!" to {_player}
if {language.%{_player}%} is "english":
message "[&6PTown&f] &4You are not allowed to destroy in Safezone!" to {_player}
stop
set {_town} to {ptownlist.chunk::%{_eventLocation}%}
loop {ptown.%{_town}%.prlist::*}:
if loop-value is {_player}'s name:
if {ptown.%{_town}%.prflag::break} is "false":
stop
if {ptown.%{_player}%} is not set:
if {ptownlist.chunk::%{_eventLocation}%} is set:
cancel event
if {language.%{_player}%} is "chinese":
message "[&6PTown&f] &4这不是您的小镇!" to {_player}
if {language.%{_player}%} is "english":
message "[&6PTown&f] &4This is not your town!" to {_player}
stop
set {_ptownbreakchunk} to {ptown.%{_player}%}
if {ptownlist.chunk::%{_eventLocation}%} is set:
if {ptownlist.chunk::%{_eventLocation}%} is not equal to {_ptownbreakchunk}:
cancel event
if {language.%{_player}%} is "chinese":
message "[&6PTown&f] &4这不是您的小镇!" to {_player}
if {language.%{_player}%} is "english":
message "[&6PTown&f] &4This is not your town!" to {_player}
on block damage:
if {ptown.%player%.adminmode} is not set:
......
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