From 6b44f1265950a4a312e516e8fc0f4a68278465da Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 20 Mar 2021 13:09:25 +0100 Subject: [PATCH] Fix pr stuff --- .../bausystem/world/RedstoneListener.java | 73 ++++++++++--------- .../de/steamwar/bausystem/world/TPSUtils.java | 1 - 2 files changed, 37 insertions(+), 37 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/world/RedstoneListener.java b/BauSystem_Main/src/de/steamwar/bausystem/world/RedstoneListener.java index a988510..7179592 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/world/RedstoneListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/world/RedstoneListener.java @@ -45,43 +45,8 @@ import java.util.Map; public class RedstoneListener implements Listener { - private static class RedstoneTester { - - private final Player player; - private Location loc1 = null; - private Location loc2 = null; - - private long lastTick = 0; - private Long tick = null; - - public RedstoneTester(Player player) { - this.player = player; - } - - private void activate(Location location) { - if (loc1 == null || loc2 == null) { - tick = null; - return; - } - if (loc1.equals(location)) { - if (TPSUtils.currentTick.get() - lastTick > 100) { - tick = null; - } - lastTick = TPSUtils.currentTick.get(); - if (tick == null) { - tick = TPSUtils.currentTick.get(); - } - return; - } - if (tick != null && loc2.equals(location)) { - player.sendMessage(BauSystem.PREFIX + "Differenz§8: §e" + (TPSUtils.currentTick.get() - tick) + "§8 - §7in GameTicks"); - } - } - - } - - private Map playerMap = new HashMap<>(); public static final ItemStack WAND = new SWItem(Material.BLAZE_ROD, "§eRedstonetester", Arrays.asList("§eLinksklick Block §8- §7Setzt die 1. Position", "§eRechtsklick Block §8- §7Setzt die 2. Position", "§eShift-Rechtsklick Luft §8- §7Zurücksetzten"), false, null).getItemStack(); + private static Map playerMap = new HashMap<>(); private boolean permissionCheck(Player player) { if (Welt.noPermission(player, Permission.build)) { @@ -171,4 +136,40 @@ public class RedstoneListener implements Listener { redstoneTester.activate(e.getBlock().getLocation()); }); } + + private static class RedstoneTester { + + private final Player player; + private Location loc1 = null; + private Location loc2 = null; + + private long lastTick = 0; + private Long tick = null; + + public RedstoneTester(Player player) { + this.player = player; + } + + private void activate(Location location) { + if (loc1 == null || loc2 == null) { + tick = null; + return; + } + if (loc1.equals(location)) { + if (TPSUtils.currentTick.get() - lastTick > 100) { + tick = null; + } + lastTick = TPSUtils.currentTick.get(); + if (tick == null) { + tick = TPSUtils.currentTick.get(); + } + return; + } + if (tick != null && loc2.equals(location)) { + player.sendMessage(BauSystem.PREFIX + "Differenz§8: §e" + (TPSUtils.currentTick.get() - tick) + "§8 - §7in GameTicks"); + } + } + + } + } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/world/TPSUtils.java b/BauSystem_Main/src/de/steamwar/bausystem/world/TPSUtils.java index 6915dcf..6ec2518 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/world/TPSUtils.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/world/TPSUtils.java @@ -39,7 +39,6 @@ public class TPSUtils { private static long nanoDOffset = 0; private static long ticksSinceServerStart = 0; - @SuppressWarnings("java:S4276") public static final Supplier currentTick = () -> ticksSinceServerStart; public static void init() {