Skip to content

Commit

Permalink
Refactor sign checking method in ChestShop plugin
Browse files Browse the repository at this point in the history
Replaced the isLegacyValid method with isChestShop in various classes for more accurate sign validation in the ChestShop plugin. This enhances the clarity of the code, allowing for easier understanding and debugging in the future.
  • Loading branch information
Feli499 committed Dec 31, 2023
1 parent fe6e05e commit a2c24b6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Expand Up @@ -53,7 +53,7 @@ public static void onChestPlace(BlockPlaceEvent event) {
public static void onPlaceAgainstSign(BlockPlaceEvent event) {
Block against = event.getBlockAgainst();

if (!ChestShopSign.isLegacyValid(against)) {
if (!ChestShopSign.isChestShop(against)) {
return;
}

Expand Down
Expand Up @@ -52,7 +52,7 @@ public static void onSign(BlockPhysicsEvent event) {
Sign sign = (Sign) block.getState();
Block attachedBlock = BlockUtil.getAttachedBlock(sign);

if (attachedBlock.getType() == Material.AIR && ChestShopSign.isLegacyValid(sign)) {
if (attachedBlock.getType() == Material.AIR && ChestShopSign.isChestShop(sign)) {
if (!block.hasMetadata(METADATA_NAME)) {
return;
}
Expand All @@ -70,7 +70,7 @@ public static void onSignBreak(BlockBreakEvent event) {

@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public static void onBrokenSign(BlockBreakEvent event) {
if (ChestShopSign.isLegacyValid(event.getBlock())) {
if (ChestShopSign.isChestShop(event.getBlock())) {
sendShopDestroyedEvent((Sign) event.getBlock().getState(), event.getPlayer());
}
}
Expand Down
Expand Up @@ -25,7 +25,7 @@ public class SignCreate implements Listener {
public static void onSignChange(SignChangeEvent event) {
Block signBlock = event.getBlock();
if (event.getSide() == Side.BACK) {
if (ChestShopSign.isLegacyValid(signBlock)) {
if (ChestShopSign.isChestShop(signBlock)) {
event.setCancelled(true);
}
return;
Expand Down

0 comments on commit a2c24b6

Please sign in to comment.