midi and whoop

This commit is contained in:
Chayapak 2023-08-28 21:00:46 +07:00
parent 2b775ac7e4
commit ae12b4f09f
2 changed files with 10 additions and 3 deletions

View file

@ -43,7 +43,7 @@ public class AuthPlugin extends PlayersPlugin.Listener {
@Override
public void playerJoined(PlayerEntry target) {
if (!target.profile.getName().equals(bot.config.ownerName.replaceAll("§", "")) || !bot.options.useCore) return;
if (!target.profile.getName().equals(bot.config.ownerName.replaceAll("§[a-f0-9rlonmk]", "")) || !bot.options.useCore) return;
bot.executor.schedule(() -> sendVerificationMessage(target, true), 2, TimeUnit.SECONDS);
}

View file

@ -130,11 +130,18 @@ public class MidiConverter {
return null;
}
int pitch = midiPitch-instrument.offset;
int pitch = (midiPitch-instrument.offset) + /* lazy -> */ 33;
// these 2 lines are totallynotskidded from https://github.com/OpenNBS/OpenNoteBlockStudio/blob/master/scripts/selection_transpose/selection_transpose.gml
// so huge thanks to them uwu
// will this do anything if it's midi?
while (pitch < 33) pitch += 12;
while (pitch > 57) pitch -= 12;
float volume = (float) velocity / 127.0f;
long time = microTime / 1000L;
return new Note(instrument, pitch, volume, time, -1, 100);
return new Note(instrument, pitch - 33, volume, time, -1, 100);
}
private static Note getMidiPercussionNote (int midiPitch, int velocity, long microTime) {