This commit is contained in:
Chayapak 2023-06-12 20:23:38 +07:00
parent 91d418ea8c
commit 96d30713d4
2 changed files with 23 additions and 8 deletions

View file

@ -188,7 +188,10 @@ public class CommandHandlerPlugin {
private int getLongestUsageIndex(List<String> usages) {
int longestIndex = 0;
int maxLength = 0;
for (int i = 0; i < usages.size(); i++) {
final int usagesSize = usages.size();
for (int i = 0; i < usagesSize; i++) {
String[] args = usages.get(i).split("\\s+");
if (args.length > maxLength) {
longestIndex = i;
@ -201,7 +204,10 @@ public class CommandHandlerPlugin {
private int getShortestUsageIndex(List<String> usages) {
int shortestIndex = 0;
int minLength = Integer.MAX_VALUE;
for (int i = 0; i < usages.size(); i++) {
final int usagesSize = usages.size();
for (int i = 0; i < usagesSize; i++) {
String[] args = usages.get(i).split("\\s+");
if (args.length < minLength) {
shortestIndex = i;
@ -213,7 +219,10 @@ public class CommandHandlerPlugin {
private int getMinimumArgs(String usage, boolean inGame, TrustLevel trustLevel) {
int count = 0;
for (int i = 0; i < usage.length(); i++) {
final int usageLength = usage.length();
for (int i = 0; i < usageLength; i++) {
if (usage.charAt(i) == '<') {
count++;
}
@ -225,7 +234,10 @@ public class CommandHandlerPlugin {
private int getMaximumArgs(String usage, boolean inGame, TrustLevel trustLevel) {
int count = 0;
for (int i = 0; i < usage.length(); i++) {
final int usageLength = usage.length();
for (int i = 0; i < usageLength; i++) {
if (usage.charAt(i) == '<' || usage.charAt(i) == '[') {
count++;
}

View file

@ -38,7 +38,9 @@ public class MidiConverter {
ArrayList<MidiEvent> tempoEvents = new ArrayList<>();
for (Track track : sequence.getTracks()) {
for (int i = 0; i < track.size(); i++) {
final int trackSize = track.size();
for (int i = 0; i < trackSize; i++) {
MidiEvent event = track.get(i);
MidiMessage message = event.getMessage();
if (message instanceof MetaMessage mm) {
@ -52,14 +54,15 @@ public class MidiConverter {
tempoEvents.sort(Comparator.comparingLong(MidiEvent::getTick));
for (Track track : sequence.getTracks()) {
long microTime = 0;
int[] ids = new int[16];
int mpq = 500000;
int tempoEventIdx = 0;
long prevTick = 0;
for (int i = 0; i < track.size(); i++) {
final int trackSize = track.size();
for (int i = 0; i < trackSize; i++) {
MidiEvent event = track.get(i);
MidiMessage message = event.getMessage();