forked from 2009Scape/Server
[gui] Fix tps display
This commit is contained in:
parent
6af0e71693
commit
8fa4c7fbef
3 changed files with 5 additions and 9 deletions
|
|
@ -3,13 +3,10 @@ package org.crandor.gui.tab;
|
|||
|
||||
import org.crandor.gui.ConsoleTab;
|
||||
import org.crandor.gui.component.PlayerViewer;
|
||||
import org.crandor.net.Constants;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.BevelBorder;
|
||||
import javax.swing.border.SoftBevelBorder;
|
||||
import javax.swing.event.ListSelectionEvent;
|
||||
import javax.swing.event.ListSelectionListener;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.File;
|
||||
|
|
@ -150,7 +147,6 @@ public class PlayerTab extends ConsoleTab {
|
|||
System.out.println("Player directory was null!");
|
||||
return;
|
||||
}
|
||||
System.out.println(getPlayerNames().toString());
|
||||
for (File file : Objects.requireNonNull(f.listFiles())) {
|
||||
String fileName = file.getName();
|
||||
if (!fileName.contains(".save")) continue;
|
||||
|
|
|
|||
|
|
@ -439,7 +439,7 @@ public class StatisticsTab extends ConsoleTab {
|
|||
int space = (y / 2 - 10) / 4;
|
||||
g.setFont(new Font(null, Font.PLAIN, 9));
|
||||
for (int i = 0; i < 5; i++) {
|
||||
g.setColor(Color.GRAY);
|
||||
g.setColor(i == 0 ? Color.BLACK : Color.GRAY);
|
||||
g.drawLine(x, (int) zero.getY() - (space * i), c.getWidth() - 5, (int) zero.getY() - (space * i));
|
||||
g.drawLine(x, (int) zero.getY() + (space * i), c.getWidth() - 5, (int) zero.getY() + (space * i));
|
||||
g.setColor(Color.BLACK);
|
||||
|
|
@ -460,18 +460,17 @@ public class StatisticsTab extends ConsoleTab {
|
|||
int toPoint = index == 0 ? 0 : performanceQueue[index - 1];
|
||||
int toX = (count - i - 1) * statisticsZoom;
|
||||
int toY = (int) (-toPoint / (600D / (space * 4)));
|
||||
System.out.println(fromY + " -> " + toY);
|
||||
if (fromY < 0) {
|
||||
g.setColor(Color.RED);
|
||||
}
|
||||
g.drawLine((int) (zero.getX() + fromX), (int) (zero.getY() + fromY),
|
||||
(int) (zero.getX() + toX), (int) (zero.getY() + toY));
|
||||
if (fromY < 0) {
|
||||
if (fromY >= 0) {
|
||||
g.setColor(Color.GREEN);
|
||||
}
|
||||
}
|
||||
g.setColor(Color.BLACK);
|
||||
//Draw horizontal line.
|
||||
g.drawLine(x - 4, (int) zero.getY(), c.getWidth() - 2, (int) zero.getY());
|
||||
//Draw vertical line.
|
||||
g.drawLine(x, y + 4, x, 1);
|
||||
Point p = ((StatisticsTab) c).statisticMousePoint;
|
||||
|
|
|
|||
|
|
@ -78,7 +78,8 @@ public final class MajorUpdateWorker implements Runnable {
|
|||
* @throws InterruptedException When the thread is interrupted.
|
||||
*/
|
||||
private void sleep() throws InterruptedException {
|
||||
StatisticsTab.reportPerformance((int) ((System.currentTimeMillis() - start) - 600));
|
||||
// How many ticks off we are
|
||||
StatisticsTab.reportPerformance((int) (System.currentTimeMillis() - start));
|
||||
long duration = 600 - ((System.currentTimeMillis() - start) % 600);
|
||||
if (duration > 0) {
|
||||
Thread.sleep(duration);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue