Skip to content

Commit

Permalink
Merge pull request #239 from TiagoFar78/trapDoorsSpawnAbove
Browse files Browse the repository at this point in the history
TrapDoors spawning on upper half of block
  • Loading branch information
iquelli authored Jun 8, 2024
2 parents 6e972f6 + b2bb67d commit ec15d5c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,6 @@ public static void fillWithBars(PrisonEscapeLocation upperCorner, PrisonEscapeLo
fill(upperCorner, lowerCorner, Material.IRON_BARS);
}

public static void putVent(PrisonEscapeLocation location) {
WORLD.getBlockAt(location.getX(), location.getY(), location.getZ()).setType(Material.IRON_TRAPDOOR);
}

// ########################################
// # Util #
// ########################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
import net.tiagofar78.prisonescape.items.ToolItem;
import net.tiagofar78.prisonescape.items.WrenchItem;

import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.data.Bisected.Half;
import org.bukkit.block.data.type.TrapDoor;

public class Vent extends Obstacle {

private PrisonEscapeLocation _location;
Expand All @@ -24,11 +30,18 @@ public boolean contains(PrisonEscapeLocation location) {

@Override
public void removeFromWorld() {
BukkitWorldEditor.clear(_location, _location);
World world = BukkitWorldEditor.getWorld();
world.getBlockAt(_location.getX(), _location.getY(), _location.getZ()).setType(Material.AIR);
}

public void generate() {
BukkitWorldEditor.putVent(_location);
World world = BukkitWorldEditor.getWorld();
Block block = world.getBlockAt(_location.getX(), _location.getY(), _location.getZ());
block.setType(Material.IRON_TRAPDOOR);
TrapDoor trapdoor = (TrapDoor) block.getBlockData();
trapdoor.setHalf(Half.TOP);

block.setBlockData(trapdoor);
}

}

0 comments on commit ec15d5c

Please sign in to comment.