Prevent instantiating utility classes
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
ccf69a2903
commit
980cf5eef3
@ -22,6 +22,10 @@ import java.util.concurrent.ScheduledExecutorService;
|
||||
public class Cache
|
||||
{
|
||||
|
||||
private Cache() {
|
||||
throw new IllegalStateException("Utility class");
|
||||
}
|
||||
|
||||
|
||||
// todo: make this compatible with the message listener's regex
|
||||
private static final String BOT_PREFIX = "hideko";
|
||||
|
@ -6,6 +6,10 @@ import java.util.LinkedList;
|
||||
|
||||
public class Alias
|
||||
{
|
||||
private Alias() {
|
||||
throw new IllegalStateException("Utility class");
|
||||
}
|
||||
|
||||
public static String generateNiceAliases(MessageCommand command)
|
||||
{
|
||||
LinkedList<String> aliases = command.getCommandLabels();
|
||||
|
@ -13,6 +13,10 @@ import java.util.List;
|
||||
|
||||
public class BotInfo
|
||||
{
|
||||
private BotInfo() {
|
||||
throw new IllegalStateException("Utility class");
|
||||
}
|
||||
|
||||
public static MessageEmbed generateEmbed(List<String> commandLabels)
|
||||
{
|
||||
EmbedBuilder embedBuilder = new EmbedBuilder();
|
||||
|
@ -14,6 +14,9 @@ import java.util.List;
|
||||
|
||||
public class ClearChat
|
||||
{
|
||||
private ClearChat() {
|
||||
throw new IllegalStateException("Utility class");
|
||||
}
|
||||
|
||||
public static String getLabel() {
|
||||
return "clear";
|
||||
|
@ -14,6 +14,9 @@ import java.util.List;
|
||||
public class CoinFlip
|
||||
{
|
||||
|
||||
private CoinFlip() {
|
||||
throw new IllegalStateException("Utility class");
|
||||
}
|
||||
|
||||
public static Button getReflipButton() {
|
||||
return Button.primary("coinflip_reflip", "Flip again")
|
||||
|
@ -14,6 +14,11 @@ import java.util.UUID;
|
||||
|
||||
public class DiceRoll
|
||||
{
|
||||
|
||||
private DiceRoll() {
|
||||
throw new IllegalStateException("Utility class");
|
||||
}
|
||||
|
||||
public static MessageResponse buildResponse(User author, String[] args)
|
||||
{
|
||||
LinkedHashMap<Dice, Integer> dicesToRoll = new LinkedHashMap<>();
|
||||
|
@ -10,6 +10,10 @@ import wtf.beatrice.hidekobot.HidekoBot;
|
||||
public class Invite
|
||||
{
|
||||
|
||||
private Invite() {
|
||||
throw new IllegalStateException("Utility class");
|
||||
}
|
||||
|
||||
public static MessageEmbed generateEmbed()
|
||||
{
|
||||
EmbedBuilder embedBuilder = new EmbedBuilder();
|
||||
|
@ -10,6 +10,11 @@ import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class LoveCalculator
|
||||
{
|
||||
|
||||
private LoveCalculator() {
|
||||
throw new IllegalStateException("Utility class");
|
||||
}
|
||||
|
||||
public static MessageEmbed buildEmbedAndCacheResult(User author, User user1, User user2)
|
||||
{
|
||||
String userId1 = user1.getId();
|
||||
|
@ -14,6 +14,10 @@ import java.util.List;
|
||||
public class MagicBall
|
||||
{
|
||||
|
||||
private MagicBall() {
|
||||
throw new IllegalStateException("Utility class");
|
||||
}
|
||||
|
||||
public static LinkedList<String> getLabels()
|
||||
{
|
||||
return new LinkedList<>(Arrays.asList("8ball", "8b", "eightball", "magicball"));
|
||||
|
@ -8,6 +8,11 @@ import wtf.beatrice.hidekobot.objects.MessageResponse;
|
||||
|
||||
public class ProfileImage
|
||||
{
|
||||
|
||||
private ProfileImage() {
|
||||
throw new IllegalStateException("Utility class");
|
||||
}
|
||||
|
||||
public static int parseResolution(int resolution)
|
||||
{
|
||||
int[] acceptedSizes = Cache.getSupportedAvatarResolutions();
|
||||
|
@ -5,6 +5,10 @@ import net.dv8tion.jda.api.Permission;
|
||||
public class Say
|
||||
{
|
||||
|
||||
private Say() {
|
||||
throw new IllegalStateException("Utility class");
|
||||
}
|
||||
|
||||
public static Permission getPermission() {
|
||||
return Permission.MESSAGE_MANAGE;
|
||||
}
|
||||
|
@ -35,6 +35,11 @@ import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class Trivia
|
||||
{
|
||||
|
||||
private Trivia() {
|
||||
throw new IllegalStateException("Utility class");
|
||||
}
|
||||
|
||||
private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(Trivia.class);
|
||||
private static final String TRIVIA_API_LINK = "https://opentdb.com/api.php?amount=10&type=multiple&category=";
|
||||
private static final String TRIVIA_API_CATEGORIES_LINK = "https://opentdb.com/api_category.php";
|
||||
|
@ -25,6 +25,10 @@ import java.util.List;
|
||||
public class UrbanDictionary
|
||||
{
|
||||
|
||||
private UrbanDictionary() {
|
||||
throw new IllegalStateException("Utility class");
|
||||
}
|
||||
|
||||
public static LinkedList<String> getCommandLabels()
|
||||
{ return new LinkedList<>(Arrays.asList("urban", "urbandictionary", "ud")); }
|
||||
|
||||
|
@ -27,6 +27,10 @@ import java.util.concurrent.TimeUnit;
|
||||
public class UserPunishment
|
||||
{
|
||||
|
||||
private UserPunishment() {
|
||||
throw new IllegalStateException("Utility class");
|
||||
}
|
||||
|
||||
private static final Duration maxTimeoutDuration = Duration.of(28, ChronoUnit.DAYS);
|
||||
private static final Duration minTimeoutDuration = Duration.of(30, ChronoUnit.SECONDS);
|
||||
|
||||
|
@ -27,6 +27,10 @@ public class CommandUtil
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(CommandUtil.class);
|
||||
|
||||
private CommandUtil() {
|
||||
throw new IllegalStateException("Utility class");
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to delete a message when a user clicks the "delete" button attached to that message.
|
||||
* This will check in the database if that user ran the command originally.
|
||||
|
@ -12,6 +12,9 @@ import java.util.Arrays;
|
||||
public class FormatUtil
|
||||
{
|
||||
|
||||
private FormatUtil() {
|
||||
throw new IllegalStateException("Utility class");
|
||||
}
|
||||
|
||||
// cosmetic string to print on startup.
|
||||
private static final String LOGO = """
|
||||
|
@ -10,6 +10,10 @@ import java.util.Random;
|
||||
public class RandomUtil
|
||||
{
|
||||
|
||||
private RandomUtil() {
|
||||
throw new IllegalStateException("Utility class");
|
||||
}
|
||||
|
||||
// the Random instance that we should always use when looking for an RNG based thing.
|
||||
// the seed is updated periodically, if the random.org integration is enabled.
|
||||
private static Random randomInstance = new SecureRandom();
|
||||
|
@ -10,6 +10,10 @@ import java.util.List;
|
||||
public class SerializationUtil
|
||||
{
|
||||
|
||||
private SerializationUtil() {
|
||||
throw new IllegalStateException("Utility class");
|
||||
}
|
||||
|
||||
public static <T> String serializeBase64(List<T> dataList) {
|
||||
|
||||
try (ByteArrayOutputStream bo = new ByteArrayOutputStream();
|
||||
|
Loading…
Reference in New Issue
Block a user