integer division, i love it so much

This commit is contained in:
nora 2021-05-06 19:24:09 +02:00
parent dffc5c1aa4
commit 322432ca37
8 changed files with 4 additions and 11 deletions

View file

@ -5,8 +5,6 @@
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />

View file

@ -44,7 +44,6 @@ public class TriviaApproval extends ReactionAdapter {
if (event.getUser() != null) {
if (event.getUser().getIdLong() == Config.NILS_ID) {
String emote = event.getReaction().getReactionEmote().getName();
System.out.println(ConsoleColors.BLUE + "[TriviaApproval 47] Received Emote " + emote + ConsoleColors.RESET);
if (emote.equals(APPROVE_EMOTE)) {
event.getTextChannel().sendMessage("Question approved.").queue();
System.out.println(ConsoleColors.BLUE + "[TriviaApproval 50] Question Approved: " + question.getQuestion() + ConsoleColors.RESET);

View file

@ -133,8 +133,6 @@ public class TriviaCommand extends Command {
answers[3] = "0";
new TriviaApproval(event, new TriviaQuestion(answers));
} else {
System.out.println(ConsoleColors.BLUE_BOLD + "[TriviaCommand.AddSection 139] Received Next Message. status: " + status + ConsoleColors.RESET);
answers[status] = event.getMessage().getContentRaw();
if (status >= 3) {
try {

View file

@ -12,6 +12,7 @@ import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.*;
import java.net.URL;
import java.util.Arrays;
import java.util.List;
public class EmoteAddCommand extends Command {
@ -114,8 +115,8 @@ public class EmoteAddCommand extends Command {
private byte[] resizeImage(byte[] bytes, String format, int size) throws IOException {
reply("Image size too big (" + bytes.length / 1000 + "kB). Resizing image...");
Image image = ImageIO.read(new ByteArrayInputStream(bytes));
int ratio = image.getHeight(null) / image.getWidth(null);
image = image.getScaledInstance(size, size * ratio, Image.SCALE_SMOOTH);
double ratio = (double)image.getHeight(null) / (double)image.getWidth(null);
image = image.getScaledInstance(size, (int) (size * ratio), Image.SCALE_SMOOTH);
ByteArrayOutputStream out = new ByteArrayOutputStream();
BufferedImage bufferedImg = new BufferedImage(image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_INT_ARGB);

View file

@ -24,7 +24,7 @@ import java.util.Scanner;
public class Main {
public static void main(String[] args) throws LoginException {
Config.init(1);
Config.init(0);
JDABuilder builder = JDABuilder.createDefault(Config.TOKEN);
builder.setCompression(Compression.ZLIB);
builder.setActivity(Activity.watching("over Gon"));

View file

@ -48,7 +48,6 @@ public class CommandHandler {
if (event.getMessage().getContentRaw().toLowerCase().startsWith(Config.PREFIX)) {
String[] split = parser.splitOffCommandName(event.getMessage().getContentRaw());
String command = split[0];
System.out.println(ConsoleColors.GREEN + "[CHandler 35] cmd: '" + command + "'" + " args: '" + split[1] + "'" + ConsoleColors.RESET);
if (commands.containsKey(command)) {
commands.get(command).onMessageReceived(event, split[1]);
} else if (hiddenCommands.containsKey(command)) {

View file

@ -9,7 +9,6 @@ public class CommandListener extends ListenerAdapter {
@Override
public void onMessageReceived(@NotNull MessageReceivedEvent event) {
if (!event.getAuthor().isBot()) {
System.out.println(ConsoleColors.CYAN + "[CListener 13] Received message." + ConsoleColors.RESET);
CommandHandler.call(event);
}
}

View file

@ -18,7 +18,6 @@ public class ReactionEventManager {
}
public static void onReactionAdd(MessageReactionAddEvent event){
System.out.println(ConsoleColors.PURPLE + "[ReactionEventManager 21] Reaction added: " + event.getReactionEmote() + ConsoleColors.RESET);
long message = event.getMessageIdLong();
ReactionListener listener = currentReactions.get(message);
if (listener != null) {