From 3fe7b725abe05859be976b968faaa637efb0fefa Mon Sep 17 00:00:00 2001 From: B1G-FUNGUS Date: Sun, 3 Oct 2021 12:32:00 -0700 Subject: [PATCH] Adds a block shift ritual --- .../quidproquo/rituals/BlockShiftRitual.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/main/java/top/penowl/quidproquo/rituals/BlockShiftRitual.java b/src/main/java/top/penowl/quidproquo/rituals/BlockShiftRitual.java index b1663ed..28199e8 100644 --- a/src/main/java/top/penowl/quidproquo/rituals/BlockShiftRitual.java +++ b/src/main/java/top/penowl/quidproquo/rituals/BlockShiftRitual.java @@ -2,7 +2,9 @@ package top.penowl.quidproquo.rituals; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.block.Block; import org.bukkit.entity.Player; +import java.util.Random; import top.penowl.quidproquo.Ritual; @@ -37,6 +39,18 @@ public class BlockShiftRitual extends Ritual { @Override public void execute(Player caster, Player target, Location location) { + Random random = new Random(); + Material fromMat = pMat[random.nextInt(64)]; + Material toMat = pMat[random.nextInt(64)]; + for(int x = -5; x <= 5; x ++) { + for(int y = -5; y <= 5; y ++) { + for(int z = -5; z <= 5; z ++) { + Block testBlock = target.getLocation().getBlock().getRelative(x, y, z); + if(testBlock.getType() == fromMat) + testBlock.setType(toMat); + } + } + } } }