Skip to content

Commit

Permalink
fix: sculk sensor not triggering when placing/breaking furniture
Browse files Browse the repository at this point in the history
  • Loading branch information
Boy0000 committed Jan 30, 2024
1 parent d54d50d commit 6cde0e8
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions core/src/main/java/io/th0rgal/oraxen/api/OraxenBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ private static void removeNoteBlock(Block block, @Nullable Player player, boolea
if (forceDrop || player.getGameMode() != GameMode.CREATIVE)
drop = noteBlockBreakEvent.getDrop();

player.getWorld().sendGameEvent(null, GameEvent.BLOCK_DESTROY, block.getLocation().toVector());
block.getWorld().sendGameEvent(null, GameEvent.BLOCK_DESTROY, block.getLocation().toVector());
}
if (drop != null) drop.spawns(block.getLocation(), itemInHand);

Expand Down Expand Up @@ -281,7 +281,7 @@ private static void removeStringBlock(Block block, @Nullable Player player, bool
if (forceDrop || player.getGameMode() != GameMode.CREATIVE)
drop = wireBlockBreakEvent.getDrop();

player.getWorld().sendGameEvent(null, GameEvent.BLOCK_DESTROY, block.getLocation().toVector());
block.getWorld().sendGameEvent(null, GameEvent.BLOCK_DESTROY, block.getLocation().toVector());
}
if (drop != null) drop.spawns(block.getLocation(), itemInHand);

Expand Down
3 changes: 3 additions & 0 deletions core/src/main/java/io/th0rgal/oraxen/api/OraxenFurniture.java
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ public static boolean remove(@NotNull Location location, @Nullable Player player
StorageMechanic storage = mechanic.getStorage();
if (storage != null && (storage.isStorage() || storage.isShulker()))
storage.dropStorageContent(mechanic, baseEntity);

baseEntity.getWorld().sendGameEvent(null, GameEvent.BLOCK_DESTROY, baseEntity.getLocation().toVector());
}

if (mechanic.hasBarriers())
Expand Down Expand Up @@ -206,6 +208,7 @@ public static boolean remove(Entity baseEntity, @Nullable Player player, @Nullab
StorageMechanic storage = mechanic.getStorage();
if (storage != null && (storage.isStorage() || storage.isShulker()))
storage.dropStorageContent(mechanic, baseEntity);
baseEntity.getWorld().sendGameEvent(null, GameEvent.BLOCK_DESTROY, baseEntity.getLocation().toVector());
}

// Check if the mechanic or the baseEntity has barriers tied to it
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@
import io.th0rgal.oraxen.utils.breaker.BreakerSystem;
import io.th0rgal.oraxen.utils.breaker.HardnessModifier;
import io.th0rgal.protectionlib.ProtectionLib;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Rotation;
import org.bukkit.*;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.data.BlockData;
Expand Down Expand Up @@ -185,6 +182,7 @@ public void onFurniturePlace(final PlayerInteractEvent event) {
if (!player.getGameMode().equals(GameMode.CREATIVE))
item.setAmount(item.getAmount() - 1);
event.setUseInteractedBlock(Event.Result.DENY);
baseEntity.getWorld().sendGameEvent(null, GameEvent.BLOCK_PLACE, baseEntity.getLocation().toVector());
}

Check notice on line 187 in core/src/main/java/io/th0rgal/oraxen/mechanics/provided/gameplay/furniture/FurnitureListener.java

View check run for this annotation

codefactor.io / CodeFactor

core/src/main/java/io/th0rgal/oraxen/mechanics/provided/gameplay/furniture/FurnitureListener.java#L128-L187

Complex Method
private Block getTarget(Block placedAgainst, BlockFace blockFace) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ public void makePlayerPlaceBlock(final Player player, final EquipmentSlot hand,
target.setType(Material.AIR);
BlockHelpers.correctAllBlockStates(placedAgainst, player, hand, face, item, newData);
}
player.getWorld().sendGameEvent(null, GameEvent.BLOCK_PLACE, target.getLocation().toVector());
target.getWorld().sendGameEvent(null, GameEvent.BLOCK_PLACE, target.getLocation().toVector());
}

// Used to determine what instrument to use when playing a note depending on below block
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ private void makePlayerPlaceBlock(final Player player, final EquipmentSlot hand,
target.setType(Material.AIR);
BlockHelpers.correctAllBlockStates(placedAgainst, player, hand, face, item, newData);
}
player.getWorld().sendGameEvent(null, GameEvent.BLOCK_PLACE, target.getLocation().toVector());
target.getWorld().sendGameEvent(null, GameEvent.BLOCK_PLACE, target.getLocation().toVector());
}

Check notice on line 431 in core/src/main/java/io/th0rgal/oraxen/mechanics/provided/gameplay/stringblock/StringBlockMechanicListener.java

View check run for this annotation

codefactor.io / CodeFactor

core/src/main/java/io/th0rgal/oraxen/mechanics/provided/gameplay/stringblock/StringBlockMechanicListener.java#L378-L431

Complex Method
public static void fixClientsideUpdate(Location loc) {
Expand Down

0 comments on commit 6cde0e8

Please sign in to comment.