optimize imports

This commit is contained in:
nora 2022-09-05 17:58:56 +02:00
parent a730644a51
commit e68d589075
8 changed files with 15 additions and 19 deletions

View file

@ -6,7 +6,9 @@ import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.entities.Message; import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.MessageEmbed; import net.dv8tion.jda.api.entities.MessageEmbed;
import java.util.*; import java.util.Random;
import java.util.Timer;
import java.util.TimerTask;
public class FightCommand extends Command { public class FightCommand extends Command {
@ -30,14 +32,14 @@ public class FightCommand extends Command {
static class Fight { static class Fight {
private static String[] abilities = {"Little Flower", "Jajanken", "Lightning", "punch", "Chapter 7 Bankruptcy", "Ripper Cyclotron", "Rising Sun", private static final String[] abilities = {"Little Flower", "Jajanken", "Lightning", "punch", "Chapter 7 Bankruptcy", "Ripper Cyclotron", "Rising Sun",
"100-Type Guanyin Bodhisattva"}; "100-Type Guanyin Bodhisattva"};
private Message fightMessage; private final Message fightMessage;
private Fighter fighter1; private final Fighter fighter1;
private Fighter fighter2; private final Fighter fighter2;
private Fighter currentFighter; private final Fighter currentFighter;
Random random = new Random(); Random random = new Random();
public Fight(Message fightMessage, String fighter1, String fighter2) { public Fight(Message fightMessage, String fighter1, String fighter2) {

View file

@ -6,7 +6,6 @@ import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.entities.Member; import net.dv8tion.jda.api.entities.Member;
import java.util.List; import java.util.List;
import java.util.Objects;
public class HugCommand extends Command { public class HugCommand extends Command {

View file

@ -3,7 +3,6 @@ package com.github.nilstrieb.commands.fun.trivia;
import com.github.nilstrieb.cofig.Config; import com.github.nilstrieb.cofig.Config;
import com.github.nilstrieb.core.command.Command; import com.github.nilstrieb.core.command.Command;
import com.github.nilstrieb.core.sections.Section; import com.github.nilstrieb.core.sections.Section;
import com.github.nilstrieb.util.ConsoleColors;
import com.github.nilstrieb.util.trivia.TriviaQuestion; import com.github.nilstrieb.util.trivia.TriviaQuestion;
import com.github.nilstrieb.util.trivia.TriviaQuestionData; import com.github.nilstrieb.util.trivia.TriviaQuestionData;
import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.EmbedBuilder;

View file

@ -10,11 +10,12 @@ import net.dv8tion.jda.api.entities.Message;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
import java.awt.*; import java.awt.*;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.*; import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL; import java.net.URL;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
public class EmoteAddCommand extends Command { public class EmoteAddCommand extends Command {
@ -116,7 +117,7 @@ public class EmoteAddCommand extends Command {
private byte[] resizeImage(byte[] bytes, String format, int size) throws IOException { private byte[] resizeImage(byte[] bytes, String format, int size) throws IOException {
reply("Image size too big (" + bytes.length / 1000 + "kB). Resizing image..."); reply("Image size too big (" + bytes.length / 1000 + "kB). Resizing image...");
Image image = ImageIO.read(new ByteArrayInputStream(bytes)); Image image = ImageIO.read(new ByteArrayInputStream(bytes));
double ratio = (double)image.getHeight(null) / (double)image.getWidth(null); double ratio = (double) image.getHeight(null) / (double) image.getWidth(null);
image = image.getScaledInstance(size, (int) (size * ratio), Image.SCALE_SMOOTH); image = image.getScaledInstance(size, (int) (size * ratio), Image.SCALE_SMOOTH);
ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayOutputStream out = new ByteArrayOutputStream();

View file

@ -1,12 +1,12 @@
package com.github.nilstrieb.core.command; package com.github.nilstrieb.core.command;
import com.github.nilstrieb.cofig.Config; import com.github.nilstrieb.cofig.Config;
import com.github.nilstrieb.util.ConsoleColors;
import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.entities.MessageEmbed; import net.dv8tion.jda.api.entities.MessageEmbed;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent; import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
import java.util.*; import java.util.HashMap;
import java.util.Map;
/** /**
* The CommandHandler handles everything about the commands * The CommandHandler handles everything about the commands

View file

@ -1,6 +1,5 @@
package com.github.nilstrieb.core.command; package com.github.nilstrieb.core.command;
import com.github.nilstrieb.util.ConsoleColors;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent; import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
import net.dv8tion.jda.api.hooks.ListenerAdapter; import net.dv8tion.jda.api.hooks.ListenerAdapter;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

View file

@ -4,8 +4,6 @@ import com.github.nilstrieb.core.util.MultiPageEmbed;
import net.dv8tion.jda.api.entities.MessageEmbed; import net.dv8tion.jda.api.entities.MessageEmbed;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent; import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
/** /**

View file

@ -6,8 +6,6 @@ import net.dv8tion.jda.api.entities.MessageEmbed;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent; import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
import net.dv8tion.jda.api.events.message.react.MessageReactionAddEvent; import net.dv8tion.jda.api.events.message.react.MessageReactionAddEvent;
import java.util.Objects;
/** /**
* This class sends a message to the channel in the event that contains multiple pages that can be navigated using reactinos * This class sends a message to the channel in the event that contains multiple pages that can be navigated using reactinos
*/ */