Update RedstoneListener core feature
Add plugin.yml redstonetester -> rt
Dieser Commit ist enthalten in:
Ursprung
6d8faea32e
Commit
4faede4abf
@ -59,32 +59,30 @@ public class RedstoneListener implements Listener {
|
||||
private Location loc1 = null;
|
||||
private Location loc2 = null;
|
||||
|
||||
private Location activated = null;
|
||||
private long tick = 0;
|
||||
private long lastTick = 0;
|
||||
private Long tick = null;
|
||||
|
||||
public RedstoneTester(Player player) {
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
private void activate(Location location) {
|
||||
if (loc1 != null && loc1.equals(location)) {
|
||||
if (activated != null && !activated.equals(location)) {
|
||||
player.sendMessage(BauSystem.PREFIX + "Aktivierungsdifferenz§8: §e" + (currentTick - tick));
|
||||
player.sendMessage(BauSystem.PREFIX + "Reihenfolge§8: §7" + locationToString(activated) + " §8->§7 " + locationToString(location));
|
||||
activated = null;
|
||||
return;
|
||||
if (loc1 == null || loc2 == null) {
|
||||
tick = null;
|
||||
return;
|
||||
}
|
||||
if (loc1.equals(location)) {
|
||||
if (currentTick - lastTick > 100) {
|
||||
tick = null;
|
||||
}
|
||||
activated = loc1;
|
||||
tick = currentTick;
|
||||
} else if (loc2 != null && loc2.equals(location)) {
|
||||
if (activated != null && !activated.equals(location)) {
|
||||
player.sendMessage(BauSystem.PREFIX + "Aktivierungsdifferenz§8: §e" + (currentTick - tick));
|
||||
player.sendMessage(BauSystem.PREFIX + "Reihenfolge§8: §7" + locationToString(activated) + " §8->§7 " + locationToString(location));
|
||||
activated = null;
|
||||
return;
|
||||
lastTick = currentTick;
|
||||
if (tick == null) {
|
||||
tick = currentTick;
|
||||
}
|
||||
activated = loc2;
|
||||
tick = currentTick;
|
||||
return;
|
||||
}
|
||||
if (tick != null && loc2.equals(location)) {
|
||||
player.sendMessage(BauSystem.PREFIX + "Differenz§8: §e" + (currentTick - tick) + "§8 - §7in GameTicks");
|
||||
}
|
||||
}
|
||||
|
||||
@ -107,12 +105,12 @@ public class RedstoneListener implements Listener {
|
||||
player.sendMessage(BauSystem.PREFIX + "Positionen gelöscht§8.");
|
||||
}
|
||||
break;
|
||||
case RIGHT_CLICK_BLOCK:
|
||||
case LEFT_CLICK_BLOCK:
|
||||
if (!validBlock(event.getPlayer(), block.getBlockData())) return;
|
||||
playerMap.computeIfAbsent(event.getPlayer(), RedstoneTester::new).loc1 = block.getLocation();
|
||||
sendLocation(event.getPlayer(), "POS1", block.getLocation());
|
||||
break;
|
||||
case LEFT_CLICK_BLOCK:
|
||||
case RIGHT_CLICK_BLOCK:
|
||||
if (!validBlock(event.getPlayer(), block.getBlockData())) return;
|
||||
playerMap.computeIfAbsent(event.getPlayer(), RedstoneTester::new).loc2 = block.getLocation();
|
||||
sendLocation(event.getPlayer(), "POS2", block.getLocation());
|
||||
|
@ -40,3 +40,4 @@ commands:
|
||||
aliases: sim
|
||||
gui:
|
||||
redstonetester:
|
||||
aliases: rt
|
In neuem Issue referenzieren
Einen Benutzer sperren