Skip to content
Merged

Fixes #1104

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void initialize(@NotNull String var) {
int interval = Integer.parseInt(var);
ticker = new Ticker(passiveSpell, interval);
} catch (NumberFormatException e) {
// ignored
return;
}

for (World world : Bukkit.getWorlds()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,22 +105,18 @@ public CastResult castAtLocation(SpellData data) {
private CastResult layCarpet(SpellData data) {
Location loc = data.location();

if (!loc.getBlock().getType().isOccluding()) {
if (!loc.getBlock().isSolid()) {
int c = 0;
while (!loc.getBlock().getRelative(0, -1, 0).getType().isOccluding() && c <= 2) {
while (!loc.getBlock().getRelative(0, -1, 0).isSolid() && c <= 2) {
loc.subtract(0, 1, 0);
c++;
}

data = data.location(loc);
} else {
int c = 0;
while (loc.getBlock().getType().isOccluding() && c <= 2) {
while (loc.getBlock().isSolid() && c <= 2) {
loc.add(0, 1, 0);
c++;
}

data = data.location(loc);
}

Block b;
Expand All @@ -141,10 +137,10 @@ private CastResult layCarpet(SpellData data) {
b = loc.getWorld().getBlockAt(x, y, z);
if (circle && loc.getBlock().getLocation().distanceSquared(b.getLocation()) > rad * rad) continue;

if (b.getType().isOccluding()) b = b.getRelative(0, 1, 0);
else if (!b.getRelative(0, -1, 0).getType().isOccluding()) b = b.getRelative(0, -1, 0);
if (b.isSolid()) b = b.getRelative(0, 1, 0);
else if (!b.getRelative(0, -1, 0).isSolid()) b = b.getRelative(0, -1, 0);

if (!b.getType().isAir() && !b.getRelative(0, -1, 0).getType().isSolid()) continue;
if (!b.isEmpty() || !b.getRelative(0, -1, 0).isSolid()) continue;

blocks.put(b, new CarpetData(data, material, b.getType(), removeOnTouch));
b.setType(material, false);
Expand Down
Loading