forked from ChomeNS/chomens-bot-java
end command fix + mess with clamp and nbs
seems real
This commit is contained in:
parent
e739e07a32
commit
99a773a116
4 changed files with 10 additions and 13 deletions
|
@ -30,7 +30,7 @@ public class Bot {
|
|||
|
||||
@Getter private String username;
|
||||
|
||||
@Getter private Session session;
|
||||
@Getter public Session session;
|
||||
|
||||
@Getter private ScheduledExecutorService executor = Executors.newScheduledThreadPool(100);
|
||||
|
||||
|
@ -92,13 +92,13 @@ public class Bot {
|
|||
}
|
||||
|
||||
public void reconnect () {
|
||||
if (session != null) session.disconnect("Disconnect");
|
||||
|
||||
if (_username == null) username = RandomStringUtils.randomAlphabetic(8);
|
||||
else username = _username;
|
||||
|
||||
Session session = new TcpClientSession(host, port, new MinecraftProtocol(username), null);
|
||||
|
||||
this.session = session;
|
||||
|
||||
session.addListener(new SessionAdapter() {
|
||||
// same stuff over and over yup
|
||||
|
||||
|
@ -156,8 +156,6 @@ public class Bot {
|
|||
}
|
||||
});
|
||||
|
||||
this.session = session;
|
||||
|
||||
session.connect();
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ public class EndCommand implements Command {
|
|||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||
final Bot bot = context.bot();
|
||||
|
||||
bot.reconnect();
|
||||
bot.session().disconnect("End command");
|
||||
|
||||
return Component.text("success");
|
||||
}
|
||||
|
|
|
@ -168,9 +168,10 @@ public class NBSConverter {
|
|||
// key += customInstrument.pitch;
|
||||
}
|
||||
|
||||
if (key < 33 || key > 57) {
|
||||
continue;
|
||||
}
|
||||
// when the imposter is sus!!1!
|
||||
// if (key < 33 || key > 57) {
|
||||
// continue;
|
||||
// }
|
||||
|
||||
byte layerVolume = 100;
|
||||
if (nbsLayers.size() > note.layer) {
|
||||
|
|
|
@ -8,12 +8,10 @@ public class NumberUtilities {
|
|||
}
|
||||
|
||||
public static float clamp (float value, float min, float max) {
|
||||
if (value < min) return min;
|
||||
return Math.min(value, max);
|
||||
return Math.max(Math.min(value, max), min);
|
||||
}
|
||||
|
||||
public static double clamp (double value, double min, double max) {
|
||||
if (value < min) return min;
|
||||
return Math.min(value, max);
|
||||
return Math.max(Math.min(value, max), min);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue