Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
Ursprung
17d869203d
Commit
0895757971
@ -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 §e{1} §7TNT §e{2} §7Blöcke/TNT
|
||||
BLOCK_COUNTER_MESSAGE = §e{0} §7Blöcke Schaden §e{1} §7TNT §e{2} §7Blöcke/TNT §e{3} §7Blöcke/s
|
||||
BLOCK_COUNTER_ENABLE = §7BlockCounter angemacht
|
||||
BLOCK_COUNTER_DISABLE = §7BlockCounter ausgemacht
|
||||
|
||||
|
@ -40,6 +40,7 @@ public class BlockCount {
|
||||
private Region region;
|
||||
private int count = 0;
|
||||
private int tntCount = 0;
|
||||
private final long tick = TPSUtils.currentTick.get();
|
||||
|
||||
private long lastUpdate = TPSUtils.currentTick.get();
|
||||
|
||||
@ -50,13 +51,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 < 40) {
|
||||
if (TPSUtils.currentTick.get() - blockCount.lastUpdate < 60) {
|
||||
continue;
|
||||
}
|
||||
toRemove.add(region);
|
||||
|
||||
if (count > 10) {
|
||||
RegionUtils.message(blockCount.region, player -> BlockCounter.getMessage(player, blockCount.count, blockCount.tntCount, (double) blockCount.count / blockCount.tntCount));
|
||||
RegionUtils.message(blockCount.region, player -> BlockCounter.getMessage(player, blockCount.count, blockCount.tntCount, blockCount.tick, blockCount.lastUpdate));
|
||||
}
|
||||
}
|
||||
toRemove.forEach(BlockCounter.blockCountMap::remove);
|
||||
|
@ -48,9 +48,11 @@ public class BlockCounter {
|
||||
Config.getInstance().get(p).put("blockCounter", false);
|
||||
}
|
||||
|
||||
public String getMessage(Player player, int count, int tntCount, double countPerTNT) {
|
||||
public String getMessage(Player player, int count, int tntCount, long tick, long lastTick) {
|
||||
double countPerTNT = (double) count / tntCount;
|
||||
double countPerTick = (double) count / Math.max((lastTick - tick), 1);
|
||||
if (isActive(player)) {
|
||||
return BauSystem.MESSAGE.parsePrefixed("BLOCK_COUNTER_MESSAGE", player, count, tntCount, (int) (countPerTNT * 10) / 10.0);
|
||||
return BauSystem.MESSAGE.parsePrefixed("BLOCK_COUNTER_MESSAGE", player, count, tntCount, (int) (countPerTNT * 10) / 10.0, (int) (countPerTick * 10) / 200.0);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren