Skip to content
Merged
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
43 changes: 37 additions & 6 deletions src/main/java/com/griefcraft/modules/doors/DoorsModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -204,20 +204,51 @@ private void changeDoorStates(LWCProtectionInteractEvent event, boolean allowDoo

// make the correct door sound
if (DoorMatcher.WOODEN_DOORS.contains(door.getType())) {
door.getWorld().playSound(door.getLocation(),
doorIsOpen ? Sound.BLOCK_WOODEN_DOOR_CLOSE : Sound.BLOCK_WOODEN_DOOR_OPEN, 1, 1);
door.getWorld().playSound(door.getLocation(), switch (door.getType()) {
case CHERRY_DOOR ->
doorIsOpen ? Sound.BLOCK_CHERRY_WOOD_DOOR_CLOSE : Sound.BLOCK_CHERRY_WOOD_DOOR_OPEN;
case BAMBOO_DOOR ->
doorIsOpen ? Sound.BLOCK_BAMBOO_WOOD_DOOR_CLOSE : Sound.BLOCK_BAMBOO_WOOD_DOOR_OPEN;
case CRIMSON_DOOR, WARPED_DOOR ->
doorIsOpen ? Sound.BLOCK_NETHER_WOOD_DOOR_CLOSE : Sound.BLOCK_NETHER_WOOD_DOOR_OPEN;
case IRON_DOOR -> doorIsOpen ? Sound.BLOCK_IRON_DOOR_CLOSE : Sound.BLOCK_IRON_DOOR_OPEN;
case COPPER_DOOR, EXPOSED_COPPER_DOOR, WEATHERED_COPPER_DOOR, OXIDIZED_COPPER_DOOR,
WAXED_COPPER_DOOR, WAXED_EXPOSED_COPPER_DOOR, WAXED_WEATHERED_COPPER_DOOR,
WAXED_OXIDIZED_COPPER_DOOR ->
doorIsOpen ? Sound.BLOCK_COPPER_DOOR_CLOSE : Sound.BLOCK_COPPER_DOOR_OPEN;
default -> doorIsOpen ? Sound.BLOCK_WOODEN_DOOR_CLOSE : Sound.BLOCK_WOODEN_DOOR_OPEN;
}, 1, 1);
} else if (Material.IRON_DOOR.equals(door.getType())) {
door.getWorld().playSound(door.getLocation(),
doorIsOpen ? Sound.BLOCK_IRON_DOOR_CLOSE : Sound.BLOCK_IRON_DOOR_OPEN, 1, 1);
} else if (DoorMatcher.WOODEN_TRAP_DOORS.contains(door.getType())) {
door.getWorld().playSound(door.getLocation(),
doorIsOpen ? Sound.BLOCK_WOODEN_TRAPDOOR_CLOSE : Sound.BLOCK_WOODEN_TRAPDOOR_OPEN, 1, 1);
door.getWorld().playSound(door.getLocation(), switch (door.getType()) {
case CHERRY_TRAPDOOR ->
doorIsOpen ? Sound.BLOCK_CHERRY_WOOD_TRAPDOOR_CLOSE : Sound.BLOCK_CHERRY_WOOD_TRAPDOOR_OPEN;
case BAMBOO_TRAPDOOR ->
doorIsOpen ? Sound.BLOCK_BAMBOO_WOOD_TRAPDOOR_CLOSE : Sound.BLOCK_BAMBOO_WOOD_TRAPDOOR_OPEN;
case CRIMSON_TRAPDOOR, WARPED_TRAPDOOR ->
doorIsOpen ? Sound.BLOCK_NETHER_WOOD_TRAPDOOR_CLOSE : Sound.BLOCK_NETHER_WOOD_TRAPDOOR_OPEN;
case IRON_TRAPDOOR -> doorIsOpen ? Sound.BLOCK_IRON_TRAPDOOR_CLOSE : Sound.BLOCK_IRON_TRAPDOOR_OPEN;
case COPPER_TRAPDOOR, EXPOSED_COPPER_TRAPDOOR, WEATHERED_COPPER_TRAPDOOR, OXIDIZED_COPPER_TRAPDOOR,
WAXED_COPPER_TRAPDOOR, WAXED_EXPOSED_COPPER_TRAPDOOR, WAXED_WEATHERED_COPPER_TRAPDOOR,
WAXED_OXIDIZED_COPPER_TRAPDOOR ->
doorIsOpen ? Sound.BLOCK_COPPER_TRAPDOOR_CLOSE : Sound.BLOCK_COPPER_TRAPDOOR_OPEN;
default -> doorIsOpen ? Sound.BLOCK_WOODEN_TRAPDOOR_CLOSE : Sound.BLOCK_WOODEN_TRAPDOOR_OPEN;
}, 1, 1);
} else if (Material.IRON_TRAPDOOR.equals(door.getType())) {
door.getWorld().playSound(door.getLocation(),
doorIsOpen ? Sound.BLOCK_IRON_TRAPDOOR_CLOSE : Sound.BLOCK_IRON_TRAPDOOR_OPEN, 1, 1);
} else if (DoorMatcher.FENCE_GATES.contains(door.getType())) {
door.getWorld().playSound(door.getLocation(),
doorIsOpen ? Sound.BLOCK_FENCE_GATE_CLOSE : Sound.BLOCK_FENCE_GATE_OPEN, 1, 1);
door.getWorld().playSound(door.getLocation(), switch (door.getType()) {
case CHERRY_FENCE_GATE ->
doorIsOpen ? Sound.BLOCK_CHERRY_WOOD_FENCE_GATE_CLOSE : Sound.BLOCK_CHERRY_WOOD_FENCE_GATE_OPEN;
case BAMBOO_FENCE_GATE ->
doorIsOpen ? Sound.BLOCK_BAMBOO_WOOD_FENCE_GATE_CLOSE : Sound.BLOCK_BAMBOO_WOOD_FENCE_GATE_OPEN;
case CRIMSON_FENCE_GATE, WARPED_FENCE_GATE ->
doorIsOpen ? Sound.BLOCK_NETHER_WOOD_FENCE_GATE_CLOSE : Sound.BLOCK_NETHER_WOOD_FENCE_GATE_OPEN;
default -> doorIsOpen ? Sound.BLOCK_FENCE_GATE_CLOSE : Sound.BLOCK_FENCE_GATE_OPEN;
}, 1, 1);
}
}
}
Expand Down
9 changes: 9 additions & 0 deletions src/main/java/com/griefcraft/util/matchers/DoorMatcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.bukkit.block.BlockState;

import java.util.EnumSet;
import java.util.Optional;
import java.util.Set;

/**
Expand Down Expand Up @@ -130,6 +131,14 @@ public class DoorMatcher implements ProtectionFinder.Matcher {
Material.OXIDIZED_COPPER_TRAPDOOR, Material.WAXED_COPPER_TRAPDOOR,
Material.WEATHERED_COPPER_TRAPDOOR, Material.WAXED_EXPOSED_COPPER_TRAPDOOR,
Material.WAXED_OXIDIZED_COPPER_TRAPDOOR, Material.WAXED_WEATHERED_COPPER_TRAPDOOR));
// Added in 1.21.4
Optional.ofNullable(Material.getMaterial("PALE_OAK_DOOR")).ifPresent(PROTECTABLES_DOORS::add);
Optional.ofNullable(Material.getMaterial("PALE_OAK_DOOR")).ifPresent(WOODEN_DOORS::add);
Optional.ofNullable(Material.getMaterial("PALE_OAK_FENCE_GATE")).ifPresent(FENCE_GATES::add);
Optional.ofNullable(Material.getMaterial("PALE_OAK_FENCE_GATE")).ifPresent(WOODEN_FENCE_GATES::add);
Optional.ofNullable(Material.getMaterial("PALE_OAK_TRAPDOOR")).ifPresent(TRAP_DOORS::add);
Optional.ofNullable(Material.getMaterial("PALE_OAK_TRAPDOOR")).ifPresent(WOODEN_TRAP_DOORS::add);
Optional.ofNullable(Material.getMaterial("PALE_OAK_PRESSURE_PLATE")).ifPresent(PRESSURE_PLATES::add);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import org.bukkit.block.BlockFace;

import java.util.EnumSet;
import java.util.Optional;
import java.util.Set;

/**
Expand Down Expand Up @@ -76,6 +77,12 @@ public class GravityMatcher implements ProtectionFinder.Matcher {
Material.BAMBOO_SIGN, Material.CHERRY_BUTTON, Material.CHERRY_PRESSURE_PLATE,
Material.CHERRY_SIGN));
}
if (VersionUtil.getMinorVersion() > 20) {
// Added in 1.21.4
Optional.ofNullable(Material.getMaterial("PALE_OAK_BUTTON")).ifPresent(PROTECTABLES_POSTS::add);
Optional.ofNullable(Material.getMaterial("PALE_OAK_PRESSURE_PLATE")).ifPresent(PROTECTABLES_POSTS::add);
Optional.ofNullable(Material.getMaterial("PALE_OAK_SIGN")).ifPresent(PROTECTABLES_POSTS::add);
}
}

public boolean matches(ProtectionFinder finder) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.bukkit.block.BlockFace;

import java.util.EnumSet;
import java.util.Optional;
import java.util.Set;

/**
Expand All @@ -22,6 +23,10 @@ public class HangingMatcher implements ProtectionFinder.Matcher {
Material.DARK_OAK_HANGING_SIGN, Material.CRIMSON_HANGING_SIGN, Material.WARPED_HANGING_SIGN,
Material.MANGROVE_HANGING_SIGN, Material.BAMBOO_HANGING_SIGN, Material.CHERRY_HANGING_SIGN));
}
if (VersionUtil.getMinorVersion() > 20) {
// Added in 1.21.4
Optional.ofNullable(Material.getMaterial("PALE_OAK_HANGING_SIGN")).ifPresent(PROTECTABLES_HANGING::add);
}
}

@Override
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/com/griefcraft/util/matchers/WallMatcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.bukkit.block.data.Directional;

import java.util.EnumSet;
import java.util.Optional;
import java.util.Set;

/**
Expand Down Expand Up @@ -73,6 +74,10 @@ public class WallMatcher implements ProtectionFinder.Matcher {
if (VersionUtil.getMinorVersion() > 19) {
PROTECTABLES_WALL.addAll(EnumSet.of(Material.BAMBOO_WALL_SIGN, Material.CHERRY_WALL_SIGN));
}
if (VersionUtil.getMinorVersion() > 20) {
// Added in 1.21.4
Optional.ofNullable(Material.getMaterial("PALE_OAK_SIGN")).ifPresent(PROTECTABLES_WALL::add);
}
}

/**
Expand Down
8 changes: 8 additions & 0 deletions src/main/resources/config/core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,8 @@ protections:
enabled: true
cherry_hanging_sign:
enabled: true
pale_oak_hanging_sign:
enabled: true
iron_door:
enabled: true
oak_door:
Expand All @@ -310,6 +312,8 @@ protections:
enabled: true
cherry_door:
enabled: true
pale_oak_door:
enabled: true
copper_door:
enabled: true
exposed_copper_door:
Expand Down Expand Up @@ -350,6 +354,8 @@ protections:
enabled: true
cherry_trapdoor:
enabled: true
pale_oak_trapdoor:
enabled: true
copper_trapdoor:
enabled: true
exposed_copper_trapdoor:
Expand Down Expand Up @@ -388,6 +394,8 @@ protections:
enabled: true
cherry_fence_gate:
enabled: true
pale_oak_fence_gate:
enabled: true
white_banner:
enabled: true
orange_banner:
Expand Down