Made system commands case insensitive and reworked /dabr mechanism

This commit is contained in:
delvh
2020-08-01 21:40:20 +02:00
parent 56bb00cd32
commit c3dfedc642
2 changed files with 21 additions and 5 deletions

View File

@ -10,9 +10,11 @@ import java.io.IOException;
import java.nio.file.Files;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Arrays;
import java.util.Random;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Collectors;
import javafx.animation.RotateTransition;
import javafx.application.Platform;
@ -423,9 +425,21 @@ public final class ChatScene implements Restorable {
* @since Envoy Client v0.1-beta
*/
private void doABarrelRoll(int rotations, double animationTime) {
// contains all Node objects in ChatScene in alphabetical order
final var rotatableNodes = new Node[] { attachmentButton, attachmentView, contactLabel, infoLabel, messageList, messageTextArea, postButton,
remainingChars, rotateButton, scene, settingsButton, chatList, voiceButton };
// Limiting the rotations and duration
rotations = Math.min(rotations, 100000);
rotations = Math.max(rotations, 1);
animationTime = Math.min(animationTime, 150);
animationTime = Math.max(animationTime, 0.25);
// contains all Node objects in ChatScene
final var rotatableNodes = Arrays.stream(ChatScene.class.getDeclaredFields()).map(field -> {
try {
return field.get(this);
} catch (IllegalArgumentException | IllegalAccessException e1) {
// In this case, this option can never be executed
return null;
}
}).filter(Node.class::isInstance).map(Node.class::cast).collect(Collectors.toList());
for (final var node : rotatableNodes) {
// Sets the animation duration to {animationTime}
final var rotateTransition = new RotateTransition(Duration.seconds(animationTime), node);