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
name: RediSkript_JAR
# Destination path
path: target/Red*
path: target/*.jar

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>RediSkript</artifactId>
<groupId>net.limework</groupId>
<version>1.3.3</version>
<version>1.4.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@ -70,6 +70,14 @@
</execution>
</executions>
</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>
</build>
@ -92,6 +100,11 @@
<artifactId>jedis</artifactId>
<version>3.5.1</version>
</dependency>
<dependency>
<groupId>net.limework</groupId>
<artifactId>RediSkript-core</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>

View File

@ -56,7 +56,9 @@ public class RedisController extends BinaryJedisPubSub implements Runnable {
config.getInt("Redis.TimeOut"),
config.getString("Redis.Password"),
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);
isConnectionBroken = new AtomicBoolean(true);
isConnecting = new AtomicBoolean(false);

View File

@ -5,14 +5,21 @@
<parent>
<artifactId>RediSkript</artifactId>
<groupId>net.limework</groupId>
<version>1.3.3</version>
<version>1.4.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>RediSkript-core</artifactId>
<dependencies>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>3.5.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
</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;
import org.bukkit.configuration.Configuration;
import org.cryptomator.siv.SivMode;
import org.cryptomator.siv.UnauthenticCiphertextException;
@ -9,17 +8,17 @@ import java.nio.charset.StandardCharsets;
public class Encryption {
private boolean encryptionEnabled;
private final boolean encryptionEnabled;
private String encryptionKey;
private String macKey;
private final SivMode AES_SIV = new SivMode();
public Encryption(Configuration config){
encryptionEnabled = config.getBoolean("Redis.EncryptMessages");
if (encryptionEnabled) {
public Encryption(boolean encryptionEnabled, String encryptionKey, String macKey){
this.encryptionEnabled = encryptionEnabled;
if (this.encryptionEnabled) {
// AES encryption
encryptionKey = config.getString("Redis.EncryptionKey");
macKey = config.getString("Redis.MacKey");
this.encryptionKey = encryptionKey;
this.macKey = encryptionKey;
}
}

View File

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