SteamWar/BauSystem2.0
Archiviert
12
0

Update BlockCounter
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2021-12-01 20:26:56 +01:00
Ursprung 46ae6afe3b
Commit 75f11561b7
3 geänderte Dateien mit 7 neuen und 5 gelöschten Zeilen

Datei anzeigen

@ -514,7 +514,7 @@ SMART_PLACE_DISABLE = §cSmartPlace deaktiviert
BLOCK_COUNTER_HELP_TOGGLE = §8/§eblockcounter §8- §7Wechsel zwischen an und aus
BLOCK_COUNTER_HELP_ENABLE = §8/§eblockcounter enable §8- §7Schalte den BlockCounter an
BLOCK_COUNTER_HELP_DISABLE = §8/§eblockcounter disable §8- §7Schalte den BlockCounter aus
BLOCK_COUNTER_MESSAGE = §e{0} §7Blöcke Schaden am Testblock
BLOCK_COUNTER_MESSAGE = §e{0} §7Blöcke Schaden §e{1} §7TNT §e{2} §7Blöcke/TNT
BLOCK_COUNTER_ENABLE = §7BlockCounter angemacht
BLOCK_COUNTER_DISABLE = §7BlockCounter ausgemacht

Datei anzeigen

@ -39,6 +39,7 @@ public class BlockCount {
private Region region;
private int count = 0;
private int tntCount = 0;
private long lastUpdate = TPSUtils.currentTick.get();
@ -49,13 +50,13 @@ public class BlockCount {
bukkitTask = Bukkit.getScheduler().runTaskTimer(BauSystem.getInstance(), () -> {
Set<Region> toRemove = new HashSet<>();
for (BlockCount blockCount : BlockCounter.blockCountMap.values()) {
if (TPSUtils.currentTick.get() - blockCount.lastUpdate < 20) {
if (TPSUtils.currentTick.get() - blockCount.lastUpdate < 40) {
continue;
}
toRemove.add(region);
if (count > 10) {
RegionUtils.message(blockCount.region, player -> BlockCounter.getMessage(player, blockCount.count));
RegionUtils.message(blockCount.region, player -> BlockCounter.getMessage(player, blockCount.count, blockCount.tntCount, (double) blockCount.count / blockCount.tntCount));
}
}
toRemove.forEach(BlockCounter.blockCountMap::remove);
@ -69,6 +70,7 @@ public class BlockCount {
public void update(List<Block> blocks) {
count += blocks.size();
tntCount++;
lastUpdate = TPSUtils.currentTick.get();
}
}

Datei anzeigen

@ -48,9 +48,9 @@ public class BlockCounter {
Config.getInstance().get(p).put("blockCounter", false);
}
public String getMessage(Player player, int count) {
public String getMessage(Player player, int count, int tntCount, double countPerTNT) {
if (isActive(player)) {
return BauSystem.MESSAGE.parse("BLOCK_COUNTER_MESSAGE", player, count);
return BauSystem.MESSAGE.parse("BLOCK_COUNTER_MESSAGE", player, count, tntCount, (int) (countPerTNT * 10) / 10.0);
}
return null;
}