From 0941eeb30ec11d78772f956c99f96e0589e34e03 Mon Sep 17 00:00:00 2001 From: TheMeinerLP Date: Sun, 8 Oct 2023 19:44:24 +0200 Subject: [PATCH] Add 1 tick delay on removal,improve prefix and fix messages --- .../service/RedstoneClockService.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/net/onelitefeather/antiredstoneclockremastered/service/RedstoneClockService.java b/src/main/java/net/onelitefeather/antiredstoneclockremastered/service/RedstoneClockService.java index b1036f5..1543915 100644 --- a/src/main/java/net/onelitefeather/antiredstoneclockremastered/service/RedstoneClockService.java +++ b/src/main/java/net/onelitefeather/antiredstoneclockremastered/service/RedstoneClockService.java @@ -23,7 +23,7 @@ public final class RedstoneClockService { - private final static TagResolver.Single PREFIX = Placeholder.component("prefix", MiniMessage.miniMessage().deserialize("AntiRedstoneClock")); + private final static TagResolver.Single PREFIX = Placeholder.component("prefix", MiniMessage.miniMessage().deserialize("[AntiRedstoneClock]")); private final @NotNull AntiRedstoneClockRemastered antiRedstoneClockRemastered; private final int endTimeDelay; @@ -140,12 +140,12 @@ private void destroyRedstoneClock(@NotNull Location location, @NotNull RedstoneC if (!clock.isDetected()) { clock.setDetected(true); if (this.notifyConsole) { - this.antiRedstoneClockRemastered.getLogger().log(Level.WARNING, "Redstone Clock detected at: X,Y,Z({},{},{})", new Object[]{location.getBlockX(), location.getBlockY(), location.getBlockZ()}); + this.antiRedstoneClockRemastered.getLogger().log(Level.WARNING, "Redstone Clock detected at: X,Y,Z({0},{1},{2})", new Object[]{location.getBlockX(), location.getBlockY(), location.getBlockZ()}); } if (this.notifyAdmins) { for (Player player : Bukkit.getOnlinePlayers()) { if (player.isOp() || player.hasPermission(Constants.PERMISSION_NOTIFY)) { - player.sendMessage(MiniMessage.miniMessage().deserialize(" Redstone Clock detected at: X,Y,Z(,,)", + player.sendMessage(MiniMessage.miniMessage().deserialize(" '>Redstone Clock detected at: X,Y,Z(,,)", Placeholder.parsed("x", String.valueOf(location.getBlockX())), Placeholder.parsed("y", String.valueOf(location.getBlockY())), Placeholder.parsed("z", String.valueOf(location.getBlockZ())), @@ -162,11 +162,11 @@ private void breakBlock(@NotNull Location location) { Block block = location.getBlock(); if (this.dropItems) { var drops = block.getDrops(); - drops.forEach(itemStack -> { - block.getWorld().dropItem(location, itemStack); - }); + drops.forEach(itemStack -> block.getWorld().dropItem(location, itemStack)); } - block.setType(Material.AIR, false); + Runnable removeTask = () -> block.setType(Material.AIR, true); + Bukkit.getScheduler().runTaskLater(antiRedstoneClockRemastered, removeTask, 1); + } public void addRedstoneClockTest(@NotNull Location location) {