Skip to content

Commit

Permalink
Feat: ItemContainer больше не дудосит лог ошибками & улучшена реализа…
Browse files Browse the repository at this point in the history
…ция команды tps
  • Loading branch information
Reider745 committed Sep 2, 2024
1 parent decf61d commit d6f4555
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
18 changes: 10 additions & 8 deletions src/main/java/com/reider745/commands/TpsCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,27 @@ public boolean execute(CommandSender commandSender, String s, String[] strings)
long innerCoreSum = 0;
for(long time : innerCoreTimes)
if(time != 0) {
innerCoreSum += Math.min(20, 1000 / time);
innerCoreSum += time;
aboba1++;
}

long nukkitSum = 0;
for(long time : nukkitTimes)
if(time != 0) {
nukkitSum += Math.min(20, 1000 / time);
nukkitSum += time;
aboba2++;
}

if(innerCoreSum != 0)
commandSender.sendMessage("Inner core tps: " + (innerCoreSum / aboba1));
else
if(innerCoreSum != 0) {
final float avgTime = innerCoreSum / aboba1;
commandSender.sendMessage("Inner core tps: " + Math.min(20, 1000 / avgTime) + ", ms: "+avgTime);
}else
commandSender.sendMessage("Inner core tps: 20.0");

if(nukkitSum != 0)
commandSender.sendMessage("Nukkit tps: " + (nukkitSum / aboba2));
else
if(nukkitSum != 0) {
final float avgTime = nukkitSum / aboba1;
commandSender.sendMessage("Nukkit tps: " + Math.min(20, 1000 / avgTime) + ", ms: "+avgTime);
}else
commandSender.sendMessage("Nukkit tps: 20.0");
}catch (Exception e){
commandSender.sendMessage("Not enough information");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ public void sendChanges() {
networkEntity.send("bindings", new JSONObject(dirtyBindingsMap));
dirtyBindingsMap.clear();
}catch (Exception e){
Logger.error(dirtyBindingsMap.toString(), e);
//Logger.error(dirtyBindingsMap.toString(), e);
}
}
}
Expand Down

0 comments on commit d6f4555

Please sign in to comment.