Commit 9cd7f1e4 authored by Tommy Ang's avatar Tommy Ang 🤣

Fix double chest detection for place event

parent b5e6d3b9
......@@ -8,8 +8,6 @@ options:
Prefix: [&6PotatoLock&r]
import:
org.bukkit.block.Block as cBlock
org.bukkit.block.DoubleChest
org.bukkit.event.block.BlockPlaceEvent
command /potatolock <text="help"> [<text>]:
......@@ -55,26 +53,42 @@ command /potatolock <text="help"> [<text>]:
if {plock.readytounlock.%player%} is 1:
clear {plock.readytounlock.%player%}
message "{@Prefix} &cTimed out."
on BlockPlaceEvent:
# Chest #
on place of a chest:
# skript-mirror get block data using Bukkit API
set {_blockData} to "%event.getBlockPlaced().getBlockData().getAsString()%"
broadcast "%event.getBlockPlaced().getBlockData().getAsString()%"
# type left and right means double chest
if {_blockData} contains "type=left" or "type=right":
broadcast "Double Chest"
# Chest #
on place of a chest:
if block 1 meter south of event-block is a chest:
set {_lockcheck} to block 1 meter south of event-block
if block 1 meter north of event-block is a chest:
set {_lockcheck} to block 1 meter north of event-block
if block 1 meter west of event-block is a chest:
set {_lockcheck} to block 1 meter west of event-block
if block 1 meter east of event-block is a chest:
set {_lockcheck} to block 1 meter east of event-block
# Face North:
# Left - Check east for right block
# Right - Check west for left block
# Face West:
# Left - Check north for right block
# Right - Check south for left block
# Face South:
# Left - Check west for right block
# Right - Check east for left block
# Face East:
# Left - Check south for right block
# Right - Check north for left block
if {_blockData} contains "facing=east,type=left" or "facing=west,type=right":
set {_lockcheck} to block 1 meter south of event-block
else if {_blockData} contains "facing=west,type=left" or "facing=east,type=right":
set {_lockcheck} to block 1 meter north of event-block
else if {_blockData} contains "facing=north,type=right" or "facing=south,type=left":
set {_lockcheck} to block 1 meter west of event-block
else if {_blockData} contains "facing=south,type=right" or "facing=north,type=left":
set {_lockcheck} to block 1 meter east of event-block
if {plock.%{_lockcheck}%} is "chest":
if "%{plock.%{_lockcheck}%.owner}%" is player's name:
set {plock.%block%} to "chest"
......
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