Skip to content

Commit

Permalink
Add 1 tick delay on removal,improve prefix and fix messages
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMeinerLP committed Oct 8, 2023
1 parent 6d7c3b3 commit 0941eeb
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

public final class RedstoneClockService {

private final static TagResolver.Single PREFIX = Placeholder.component("prefix", MiniMessage.miniMessage().deserialize("<gradient:red:white>AntiRedstoneClock</gradient>"));
private final static TagResolver.Single PREFIX = Placeholder.component("prefix", MiniMessage.miniMessage().deserialize("<gradient:red:white>[AntiRedstoneClock]</gradient>"));

private final @NotNull AntiRedstoneClockRemastered antiRedstoneClockRemastered;
private final int endTimeDelay;
Expand Down Expand Up @@ -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("<prefix> Redstone Clock detected at: X,Y,Z(<x>,<y>,<z>)",
player.sendMessage(MiniMessage.miniMessage().deserialize("<prefix> <gold><click:run_command:'/tp <x> <y> <z>'>Redstone Clock detected at: X,Y,Z(<x>,<y>,<z>)</click>",
Placeholder.parsed("x", String.valueOf(location.getBlockX())),
Placeholder.parsed("y", String.valueOf(location.getBlockY())),
Placeholder.parsed("z", String.valueOf(location.getBlockZ())),
Expand All @@ -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) {
Expand Down

0 comments on commit 0941eeb

Please sign in to comment.