diff --git a/pom.xml b/pom.xml
index 5de353c..afe8af3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -85,10 +85,6 @@
org.springframework.boot
spring-boot-starter-websocket
-
- org.springframework.boot
- spring-boot-starter-data-redis
-
@@ -114,10 +110,6 @@
httpclient5
5.3.1
-
- redis.clients
- jedis
-
diff --git a/src/main/java/cc/fascinated/bat/BatApplication.java b/src/main/java/cc/fascinated/bat/BatApplication.java
index 4bf936a..8782999 100644
--- a/src/main/java/cc/fascinated/bat/BatApplication.java
+++ b/src/main/java/cc/fascinated/bat/BatApplication.java
@@ -7,7 +7,6 @@ import lombok.SneakyThrows;
import lombok.extern.log4j.Log4j2;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.cache.annotation.EnableCaching;
import org.springframework.scheduling.annotation.EnableScheduling;
import java.io.File;
@@ -15,7 +14,7 @@ import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import java.util.Objects;
-@EnableCaching @EnableScheduling
+@EnableScheduling
@SpringBootApplication
@Log4j2(topic = "Ember")
public class BatApplication {
diff --git a/src/main/java/cc/fascinated/bat/common/Profile.java b/src/main/java/cc/fascinated/bat/common/Profile.java
index 42e089b..37bcdc9 100644
--- a/src/main/java/cc/fascinated/bat/common/Profile.java
+++ b/src/main/java/cc/fascinated/bat/common/Profile.java
@@ -4,12 +4,14 @@ import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
+import java.io.Serializable;
+
/**
* @author Fascinated (fascinated7)
*/
@AllArgsConstructor
@Getter @Setter
-public abstract class Profile {
+public abstract class Profile implements Serializable {
/**
* The key of the profile.
*/
diff --git a/src/main/java/cc/fascinated/bat/common/ProfileHolder.java b/src/main/java/cc/fascinated/bat/common/ProfileHolder.java
index 6a38aef..5a9a191 100644
--- a/src/main/java/cc/fascinated/bat/common/ProfileHolder.java
+++ b/src/main/java/cc/fascinated/bat/common/ProfileHolder.java
@@ -2,6 +2,7 @@ package cc.fascinated.bat.common;
import lombok.Getter;
+import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
@@ -9,7 +10,7 @@ import java.util.Map;
* @author Fascinated (fascinated7)
*/
@Getter
-public class ProfileHolder {
+public class ProfileHolder implements Serializable {
/**
* The profiles for the holder
*/
diff --git a/src/main/java/cc/fascinated/bat/features/autorole/profile/AutoRoleProfile.java b/src/main/java/cc/fascinated/bat/features/autorole/profile/AutoRoleProfile.java
index 508d767..57db1cf 100644
--- a/src/main/java/cc/fascinated/bat/features/autorole/profile/AutoRoleProfile.java
+++ b/src/main/java/cc/fascinated/bat/features/autorole/profile/AutoRoleProfile.java
@@ -6,6 +6,7 @@ import lombok.Getter;
import lombok.Setter;
import net.dv8tion.jda.api.entities.Role;
+import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
@@ -13,7 +14,7 @@ import java.util.List;
* @author Fascinated (fascinated7)
*/
@Setter @Getter
-public class AutoRoleProfile extends Profile {
+public class AutoRoleProfile extends Profile implements Serializable {
private static final int DEFAULT_MAX_ROLES = 10;
/**
diff --git a/src/main/java/cc/fascinated/bat/features/birthday/profile/BirthdayProfile.java b/src/main/java/cc/fascinated/bat/features/birthday/profile/BirthdayProfile.java
index 3e64aa6..7044511 100644
--- a/src/main/java/cc/fascinated/bat/features/birthday/profile/BirthdayProfile.java
+++ b/src/main/java/cc/fascinated/bat/features/birthday/profile/BirthdayProfile.java
@@ -9,6 +9,7 @@ import net.dv8tion.jda.api.entities.Member;
import net.dv8tion.jda.api.entities.User;
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
+import java.io.Serializable;
import java.util.*;
/**
@@ -16,7 +17,7 @@ import java.util.*;
*/
@Getter
@Setter
-public class BirthdayProfile extends Profile {
+public class BirthdayProfile extends Profile implements Serializable {
private static final String DEFAULT_MESSAGE = "Happy Birthday {user} :tada: :birthday: You are now {age} years old!";
/**
diff --git a/src/main/java/cc/fascinated/bat/features/scoresaber/profile/GuildNumberOneScoreFeedProfile.java b/src/main/java/cc/fascinated/bat/features/scoresaber/profile/GuildNumberOneScoreFeedProfile.java
index 873dfc3..e3e3f32 100644
--- a/src/main/java/cc/fascinated/bat/features/scoresaber/profile/GuildNumberOneScoreFeedProfile.java
+++ b/src/main/java/cc/fascinated/bat/features/scoresaber/profile/GuildNumberOneScoreFeedProfile.java
@@ -6,11 +6,13 @@ import lombok.Getter;
import lombok.Setter;
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
+import java.io.Serializable;
+
/**
* @author Fascinated (fascinated7)
*/
@Getter @Setter
-public class GuildNumberOneScoreFeedProfile extends Profile {
+public class GuildNumberOneScoreFeedProfile extends Profile implements Serializable {
/**
* The channel ID of the score feed
*/
diff --git a/src/main/java/cc/fascinated/bat/features/scoresaber/profile/GuildUserScoreFeedProfile.java b/src/main/java/cc/fascinated/bat/features/scoresaber/profile/GuildUserScoreFeedProfile.java
index e68b2de..4887e4f 100644
--- a/src/main/java/cc/fascinated/bat/features/scoresaber/profile/GuildUserScoreFeedProfile.java
+++ b/src/main/java/cc/fascinated/bat/features/scoresaber/profile/GuildUserScoreFeedProfile.java
@@ -6,6 +6,7 @@ import lombok.Getter;
import lombok.Setter;
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
+import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
@@ -13,7 +14,7 @@ import java.util.List;
* @author Fascinated (fascinated7)
*/
@Getter @Setter
-public class GuildUserScoreFeedProfile extends Profile {
+public class GuildUserScoreFeedProfile extends Profile implements Serializable {
/**
* The channel ID of the score feed
*/
diff --git a/src/main/java/cc/fascinated/bat/features/scoresaber/profile/UserScoreSaberProfile.java b/src/main/java/cc/fascinated/bat/features/scoresaber/profile/UserScoreSaberProfile.java
index 1a4fa04..57ca77f 100644
--- a/src/main/java/cc/fascinated/bat/features/scoresaber/profile/UserScoreSaberProfile.java
+++ b/src/main/java/cc/fascinated/bat/features/scoresaber/profile/UserScoreSaberProfile.java
@@ -4,11 +4,13 @@ import cc.fascinated.bat.common.Profile;
import lombok.Getter;
import lombok.Setter;
+import java.io.Serializable;
+
/**
* @author Fascinated (fascinated7)
*/
@Setter @Getter
-public class UserScoreSaberProfile extends Profile {
+public class UserScoreSaberProfile extends Profile implements Serializable {
/**
* The Account ID of the ScoreSaber profile
*/
diff --git a/src/main/java/cc/fascinated/bat/service/CommandService.java b/src/main/java/cc/fascinated/bat/service/CommandService.java
index 606e602..bc40395 100644
--- a/src/main/java/cc/fascinated/bat/service/CommandService.java
+++ b/src/main/java/cc/fascinated/bat/service/CommandService.java
@@ -26,7 +26,8 @@ import java.util.Map;
/**
* @author Fascinated (fascinated7)
*/
-@Service @Log4j2
+@Service
+@Log4j2
@DependsOn("discordService")
public class CommandService extends ListenerAdapter {
/**
@@ -139,8 +140,10 @@ public class CommandService extends ListenerAdapter {
}
if (!missingPermissions.isEmpty()) {
event.replyEmbeds(EmbedUtils.errorEmbed()
- .setDescription("You are missing the following permissions to execute this command: " + missingPermissions)
- .build()).queue();
+ .setDescription("You are missing the following permissions to execute this command: " + missingPermissions)
+ .build())
+ .setEphemeral(true)
+ .queue();
return;
}
}
@@ -150,8 +153,9 @@ public class CommandService extends ListenerAdapter {
log.error("An error occurred while executing command \"{}\"", commandName, ex);
event.replyEmbeds(EmbedUtils.successEmbed()
- .setDescription("An error occurred while executing the command\n\n" + ex.getLocalizedMessage())
- .build()).queue();
+ .setDescription("An error occurred while executing the command\n\n" + ex.getLocalizedMessage())
+ .build())
+ .queue();
}
}
}
diff --git a/src/main/java/cc/fascinated/bat/service/GuildService.java b/src/main/java/cc/fascinated/bat/service/GuildService.java
index 65e9106..c31d9f5 100644
--- a/src/main/java/cc/fascinated/bat/service/GuildService.java
+++ b/src/main/java/cc/fascinated/bat/service/GuildService.java
@@ -7,8 +7,6 @@ import lombok.extern.log4j.Log4j2;
import net.dv8tion.jda.api.events.guild.GuildJoinEvent;
import net.dv8tion.jda.api.hooks.ListenerAdapter;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.cache.annotation.CachePut;
-import org.springframework.cache.annotation.Cacheable;
import org.springframework.context.annotation.DependsOn;
import org.springframework.stereotype.Service;
@@ -38,7 +36,6 @@ public class GuildService extends ListenerAdapter {
* @param id The ID of the guild
* @return The guild
*/
- @Cacheable(cacheNames = {"guilds"}, key = "#id")
public BatGuild getGuild(@NonNull String id) {
long start = System.currentTimeMillis();
Optional optionalGuild = guildRepository.findById(id);
@@ -55,7 +52,6 @@ public class GuildService extends ListenerAdapter {
*
* @param guild The guild to save
*/
- @CachePut(cacheNames = {"guilds"}, key = "#guild.id")
public void saveGuild(@NonNull BatGuild guild) {
guildRepository.save(guild);
}
diff --git a/src/main/java/cc/fascinated/bat/service/ScoreSaberService.java b/src/main/java/cc/fascinated/bat/service/ScoreSaberService.java
index c99494d..a976d4d 100644
--- a/src/main/java/cc/fascinated/bat/service/ScoreSaberService.java
+++ b/src/main/java/cc/fascinated/bat/service/ScoreSaberService.java
@@ -13,7 +13,6 @@ import lombok.NonNull;
import lombok.SneakyThrows;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.web.socket.CloseStatus;
import org.springframework.web.socket.TextMessage;
@@ -44,7 +43,6 @@ public class ScoreSaberService extends TextWebSocketHandler {
* @throws ResourceNotFoundException If the account is not found.
* @throws cc.fascinated.bat.exception.RateLimitException If the ScoreSaber rate limit is reached.
*/
- @Cacheable(cacheNames = "scoreSaberAccounts", key = "#id")
public ScoreSaberAccountToken getAccount(String id) {
ScoreSaberAccountToken account = WebRequest.getAsEntity(String.format(GET_PLAYER_ENDPOINT, id), ScoreSaberAccountToken.class);
if (account == null) { // Check if the account doesn't exist.
diff --git a/src/main/java/cc/fascinated/bat/service/UserService.java b/src/main/java/cc/fascinated/bat/service/UserService.java
index e2980fc..aaec511 100644
--- a/src/main/java/cc/fascinated/bat/service/UserService.java
+++ b/src/main/java/cc/fascinated/bat/service/UserService.java
@@ -5,8 +5,6 @@ import cc.fascinated.bat.repository.UserRepository;
import lombok.NonNull;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.cache.annotation.CachePut;
-import org.springframework.cache.annotation.Cacheable;
import org.springframework.context.annotation.DependsOn;
import org.springframework.stereotype.Service;
@@ -34,7 +32,6 @@ public class UserService {
* @param id The ID of the user
* @return The user
*/
- @Cacheable(cacheNames = {"users"}, key = "#id")
public BatUser getUser(@NonNull String id) {
long start = System.currentTimeMillis();
Optional optionalUser = userRepository.findById(id);
@@ -51,7 +48,6 @@ public class UserService {
*
* @param user The user to save
*/
- @CachePut(cacheNames = {"users"}, key = "#user.id")
public void saveUser(@NonNull BatUser user) {
userRepository.save(user);
}