Skript is a Spigot plugin which allows server admins to customize their server easily, but without the hassle of programming a plugin or asking/paying someone to program a plugin for them.
I noticed an issue someone brought forward the other day, when using BlockData, the data is created at parse time.
If you manipulate the data in a command for instance, the original object is manipulated.
EX:
(this uses reflect, as that is what they were using in their for instance)
import:
org.bukkit.block.structure.StructureRotation
command /test:
trigger:
set {_d} to oak_stairs[]
send "Before: &a%{_d}%"
{_d}.rotate(StructureRotation.CLOCKWISE_90)
send "After: &b%{_d}%"
When running the command several times:
> test
[10:19:48 INFO]: Before: minecraft:oak_stairs[facing=north;half=bottom;shape=straight;waterlogged=false]
[10:19:48 INFO]: After: minecraft:oak_stairs[facing=east;half=bottom;shape=straight;waterlogged=false]
> test
[10:19:50 INFO]: Before: minecraft:oak_stairs[facing=east;half=bottom;shape=straight;waterlogged=false]
[10:19:50 INFO]: After: minecraft:oak_stairs[facing=south;half=bottom;shape=straight;waterlogged=false]
> test
[10:19:50 INFO]: Before: minecraft:oak_stairs[facing=south;half=bottom;shape=straight;waterlogged=false]
[10:19:50 INFO]: After: minecraft:oak_stairs[facing=west;half=bottom;shape=straight;waterlogged=false]
> test
[10:19:51 INFO]: Before: minecraft:oak_stairs[facing=west;half=bottom;shape=straight;waterlogged=false]
[10:19:51 INFO]: After: minecraft:oak_stairs[facing=north;half=bottom;shape=straight;waterlogged=false]
> test
[10:19:51 INFO]: Before: minecraft:oak_stairs[facing=north;half=bottom;shape=straight;waterlogged=false]
[10:19:51 INFO]: After: minecraft:oak_stairs[facing=east;half=bottom;shape=straight;waterlogged=false]
(take note on "facing")
As you can see, the original data is being modified.
Adding a cloner solves this problem.
After this PR:
Description
This PR aims to add a cloner to BlockData.
I noticed an issue someone brought forward the other day, when using BlockData, the data is created at parse time. If you manipulate the data in a command for instance, the original object is manipulated.
EX: (this uses reflect, as that is what they were using in their for instance)
When running the command several times:
(take note on "facing") As you can see, the original data is being modified.
Adding a cloner solves this problem. After this PR:
(that note that "shape" doesn't persist)
Target Minecraft Versions: any Requirements: none Related Issues: none