moved some classes + now plugin compiles with new changes

Moved some classes to Core module Like encryption so it can be used on another modules aka bungee
This commit is contained in:
mohammed jasem alaajel 2021-05-17 02:06:53 +04:00
parent 2b9e00fd39
commit b5d08de1de
7 changed files with 45 additions and 18 deletions

View File

@ -29,4 +29,4 @@ jobs:
# Artifact name # Artifact name
name: RediSkript_JAR name: RediSkript_JAR
# Destination path # Destination path
path: target/Red* path: target/*.jar

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>RediSkript</artifactId> <artifactId>RediSkript</artifactId>
<groupId>net.limework</groupId> <groupId>net.limework</groupId>
<version>1.3.3</version> <version>1.4.0-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@ -70,6 +70,14 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<outputDirectory>../target</outputDirectory>
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>
@ -92,6 +100,11 @@
<artifactId>jedis</artifactId> <artifactId>jedis</artifactId>
<version>3.5.1</version> <version>3.5.1</version>
</dependency> </dependency>
<dependency>
<groupId>net.limework</groupId>
<artifactId>RediSkript-core</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -56,7 +56,9 @@ public class RedisController extends BinaryJedisPubSub implements Runnable {
config.getInt("Redis.TimeOut"), config.getInt("Redis.TimeOut"),
config.getString("Redis.Password"), config.getString("Redis.Password"),
config.getBoolean("Redis.useTLS")); config.getBoolean("Redis.useTLS"));
encryption = new Encryption(config); encryption = new Encryption(config.getBoolean("Redis.EncryptMessages"),
config.getString("Redis.EncryptionKe"),
config.getString("Redis.MacKey"));
setupChannels(config); setupChannels(config);
isConnectionBroken = new AtomicBoolean(true); isConnectionBroken = new AtomicBoolean(true);
isConnecting = new AtomicBoolean(false); isConnecting = new AtomicBoolean(false);

View File

@ -5,14 +5,21 @@
<parent> <parent>
<artifactId>RediSkript</artifactId> <artifactId>RediSkript</artifactId>
<groupId>net.limework</groupId> <groupId>net.limework</groupId>
<version>1.3.3</version> <version>1.4.0-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>RediSkript-core</artifactId> <artifactId>RediSkript-core</artifactId>
<dependencies>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>3.5.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project> </project>

View File

@ -0,0 +1,11 @@
package net.limework.rediskript;
import redis.clients.jedis.BinaryJedisPubSub;
public abstract class Subscriber extends BinaryJedisPubSub implements Runnable {
}

View File

@ -1,6 +1,5 @@
package net.limework.rediskript.data; package net.limework.rediskript.data;
import org.bukkit.configuration.Configuration;
import org.cryptomator.siv.SivMode; import org.cryptomator.siv.SivMode;
import org.cryptomator.siv.UnauthenticCiphertextException; import org.cryptomator.siv.UnauthenticCiphertextException;
@ -9,17 +8,17 @@ import java.nio.charset.StandardCharsets;
public class Encryption { public class Encryption {
private boolean encryptionEnabled; private final boolean encryptionEnabled;
private String encryptionKey; private String encryptionKey;
private String macKey; private String macKey;
private final SivMode AES_SIV = new SivMode(); private final SivMode AES_SIV = new SivMode();
public Encryption(Configuration config){ public Encryption(boolean encryptionEnabled, String encryptionKey, String macKey){
encryptionEnabled = config.getBoolean("Redis.EncryptMessages"); this.encryptionEnabled = encryptionEnabled;
if (encryptionEnabled) { if (this.encryptionEnabled) {
// AES encryption // AES encryption
encryptionKey = config.getString("Redis.EncryptionKey"); this.encryptionKey = encryptionKey;
macKey = config.getString("Redis.MacKey"); this.macKey = encryptionKey;
} }
} }

View File

@ -6,7 +6,7 @@
<groupId>net.limework</groupId> <groupId>net.limework</groupId>
<artifactId>RediSkript</artifactId> <artifactId>RediSkript</artifactId>
<version>1.3.3</version> <version>1.4.0-SNAPSHOT</version>
<modules> <modules>
<module>RediSkript-core</module> <module>RediSkript-core</module>
<module>RediSkript-bukkit</module> <module>RediSkript-bukkit</module>
@ -53,11 +53,6 @@
<dependencies> <dependencies>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>3.5.1</version>
</dependency>
<dependency> <dependency>
<groupId>org.json</groupId> <groupId>org.json</groupId>
<artifactId>json</artifactId> <artifactId>json</artifactId>