RedstoneTester #202
@ -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<Player, RedstoneTester> 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<Player, RedstoneTester> 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");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -39,7 +39,6 @@ public class TPSUtils {
|
||||
private static long nanoDOffset = 0;
|
||||
|
||||
private static long ticksSinceServerStart = 0;
|
||||
@SuppressWarnings("java:S4276")
|
||||
public static final Supplier<Long> currentTick = () -> ticksSinceServerStart;
|
||||
YoyoNow markierte diese Unterhaltung als gelöst
|
||||
|
||||
YoyoNow markierte diese Unterhaltung als gelöst
Chaoscaot
hat
STATIC FINAL IST IM UPPERCASE STATIC FINAL IST IM UPPERCASE
YoyoNow
hat
Nein an der Stelle werde ich es getrosst ignorieren, weil es so einfacher zu benutzen ist! Nein an der Stelle werde ich es getrosst ignorieren, weil es so einfacher zu benutzen ist!
|
||||
public static void init() {
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren
Etwas unnötig, meine ich