Files
blocksystem.sk
Code
1 237
blocksystem.sk
# نظام حماية البلوكات والجمع التلقائي ومؤقت الاختفاء
on script load:
if {blocktime} is not set:
set {blocktime} to 5
command /blocksystem [<text>] [<text>]:
permission: op
trigger:
if arg-1 is "allow":
if player's tool is air:
send "&c[!] أمسك البلوكة أولاً." to player
stop
set {_block} to "%type of player's tool%"
if arg-2 is "place":
set {allowed::place::%{_block}%} to true
send "&a[+] أُضيفت قائمة الوضع: &e%{_block}%" to player
else if arg-2 is "mine":
set {allowed::mine::%{_block}%} to true
send "&a[+] أُضيفت قائمة الكسر: &e%{_block}%" to player
else:
send "&eالاستخدام: /blocksystem allow <place/mine>" to player
else if arg-1 is "remove":
if player's tool is air:
send "&c[!] أمسك البلوكة أولاً." to player
stop
set {_block} to "%type of player's tool%"
if arg-2 is "place":
delete {allowed::place::%{_block}%}
send "&c[-] أُزيلت من قائمة الوضع: &e%{_block}%" to player
else if arg-2 is "mine":
delete {allowed::mine::%{_block}%}
send "&c[-] أُزيلت من قائمة الكسر: &e%{_block}%" to player
else:
send "&eالاستخدام: /blocksystem remove <place/mine>" to player
else if arg-1 is "clearall":
if arg-2 is "place":
delete {allowed::place::*}
send "&c[!] تم مسح قائمة الوضع." to player
else if arg-2 is "mine":
delete {allowed::mine::*}
send "&c[!] تم مسح قائمة الكسر." to player
else:
send "&eالاستخدام: /blocksystem clearall <place/mine>" to player
else if arg-1 is "test":
if {blocksystem::testmode::%player's uuid%} is set:
delete {blocksystem::testmode::%player's uuid%}
send "&c[!] تم إيقاف وضع التجربة." to player
else:
set {blocksystem::testmode::%player's uuid%} to true
send "&a[✓] تم تفعيل وضع التجربة." to player
else if arg-1 is "wand":
give 1 blaze rod named "&d&lعصا تحديد المناطق" to player
send "&d[✓] تم إعطاؤك عصا تحديد المناطق." to player
else if arg-1 is "createzone":
if arg-2 is not set:
send "&eالاستخدام: /blocksystem createzone <name>" to player
stop
if {zone::pos1::%player's uuid%} is not set:
send "&c[!] حدد النقطة الأولى بالعصا أولاً." to player
stop
if {zone::pos2::%player's uuid%} is not set:
send "&c[!] حدد النقطة الثانية بالعصا أولاً." to player
stop
set {_p1} to {zone::pos1::%player's uuid%}
set {_p2} to {zone::pos2::%player's uuid%}
if world of {_p1} is not world of {_p2}:
send "&c[!] يجب أن تكون النقطتان في العالم نفسه." to player
stop
if {zones::%arg-2%::pos1} is not set:
add arg-2 to {zoneNames::*}
set {zones::%arg-2%::pos1} to {_p1}
set {zones::%arg-2%::pos2} to {_p2}
send "&a[✓] تم إنشاء المنطقة الحرة &e%arg-2%&a." to player
else if arg-1 is "deletezone":
if arg-2 is not set:
send "&eالاستخدام: /blocksystem deletezone <name>" to player
stop
if {zones::%arg-2%::pos1} is set:
delete {zones::%arg-2%::pos1}
delete {zones::%arg-2%::pos2}
remove arg-2 from {zoneNames::*}
send "&c[-] تم حذف المنطقة &e%arg-2%&c." to player
else:
send "&c[!] هذه المنطقة غير موجودة." to player
else:
send "&eالأوامر: /blocksystem allow, remove, clearall, test, wand, createzone, deletezone" to player
command /blocktime <integer>:
permission: op
trigger:
if arg-1 < 0:
send "&c[!] يجب أن يكون الوقت صفرًا أو أكبر." to player
stop
set {blocktime} to arg-1
send "&a[✓] تم ضبط مؤقت اختفاء البلوكات إلى &e%{blocktime}% &aثوانٍ." to player
on left click with blaze rod:
if player is op:
if name of player's tool is "&d&lعصا تحديد المناطق":
cancel event
set {zone::pos1::%player's uuid%} to location of event-block
send "&a[النقطة 1] تم التحديد." to player
on right click with blaze rod:
if player is op:
if name of player's tool is "&d&lعصا تحديد المناطق":
cancel event
set {zone::pos2::%player's uuid%} to location of event-block
send "&a[النقطة 2] تم التحديد." to player
function isInFreeZone(loc: location) :: boolean:
loop {zoneNames::*}:
set {_zone} to loop-value
set {_p1} to {zones::%{_zone}%::pos1}
set {_p2} to {zones::%{_zone}%::pos2}
if {_p1} is set:
if {_p2} is set:
if world of {_loc} is world of {_p1}:
set {_minX} to x-coordinate of {_p1}
set {_maxX} to x-coordinate of {_p2}
if {_minX} > {_maxX}:
set {_temp} to {_minX}
set {_minX} to {_maxX}
set {_maxX} to {_temp}
set {_minY} to y-coordinate of {_p1}
set {_maxY} to y-coordinate of {_p2}
if {_minY} > {_maxY}:
set {_temp} to {_minY}
set {_minY} to {_maxY}
set {_maxY} to {_temp}
set {_minZ} to z-coordinate of {_p1}
set {_maxZ} to z-coordinate of {_p2}
if {_minZ} > {_maxZ}:
set {_temp} to {_minZ}
set {_minZ} to {_maxZ}
set {_maxZ} to {_temp}
if x-coordinate of {_loc} >= {_minX}:
if x-coordinate of {_loc} <= {_maxX}:
if y-coordinate of {_loc} >= {_minY}:
if y-coordinate of {_loc} <= {_maxY}:
if z-coordinate of {_loc} >= {_minZ}:
if z-coordinate of {_loc} <= {_maxZ}:
return true
return false
on break:
set {_restricted} to true
if player is op:
if {blocksystem::testmode::%player's uuid%} is not set:
set {_restricted} to false
if isInFreeZone(location of event-block) is true:
set {_restricted} to false
if {_restricted} is true:
set {_block} to "%type of event-block%"
if {allowed::mine::%{_block}%} is not set:
cancel event
stop
if player's gamemode is survival:
cancel drops
if player's tool is enchanted with silk touch:
give event-block to player's inventory
stop
set {_drops::*} to drops of event-block using player's tool
if size of {_drops::*} is 0:
stop
if player's tool is enchanted with fortune:
set {_level} to level of fortune of player's tool
set {_maxMultiplier} to {_level} + 1
set {_multiplier} to random integer between 1 and {_maxMultiplier}
loop {_drops::*}:
set {_item} to loop-value
set item amount of {_item} to item amount of {_item} * {_multiplier}
give {_item} to player's inventory
else:
loop {_drops::*}:
give loop-value to player's inventory
on place: