Untitled
unknown
java
3 years ago
976 B
31
Indexable
public void onPlayerClickBed(PlayerInteractEvent event) { Player player = event.getPlayer(); Block block; if (event.getAction() != Action.RIGHT_CLICK_BLOCK) return; block = event.getClickedBlock(); if (block == null || !Tag.BEDS.isTagged(block.getType())) return; Bed bed = getBed(block.getLocation()); Bed.Part bedPart = bed.getPart(); BlockFace blockFace = bed.getFacing(); if (bed.isOccupied()) {return;} if (!(bedPart == Bed.Part.HEAD)) {block = block.getRelative(blockFace);} switch (blockFace) { case NORTH -> GSitAPI.createPose(block, player, Pose.SLEEPING, 0, true); case SOUTH -> GSitAPI.createPose(block, player, Pose.SLEEPING, 180, true); case EAST -> GSitAPI.createPose(block, player, Pose.SLEEPING, 90, true); case WEST -> GSitAPI.createPose(block, player, Pose.SLEEPING, -90, true); }
Editor is loading...