From b5d08de1de7dc887325ccd3467c54ebb8c864bc7 Mon Sep 17 00:00:00 2001
From: mohammed jasem alaajel <34905970+ham1255@users.noreply.github.com>
Date: Mon, 17 May 2021 02:06:53 +0400
Subject: [PATCH] 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
---
.github/workflows/maven.yml | 2 +-
RediSkript-bukkit/pom.xml | 15 ++++++++++++++-
.../rediskript/managers/RedisController.java | 4 +++-
RediSkript-core/pom.xml | 11 +++++++++--
.../java/net/limework/rediskript/Subscriber.java | 11 +++++++++++
.../net/limework/rediskript/data/Encryption.java | 13 ++++++-------
pom.xml | 7 +------
7 files changed, 45 insertions(+), 18 deletions(-)
create mode 100644 RediSkript-core/src/main/java/net/limework/rediskript/Subscriber.java
rename {RediSkript-bukkit => RediSkript-core}/src/main/java/net/limework/rediskript/data/Encryption.java (73%)
diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index bd27e14..59ed6be 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -29,4 +29,4 @@ jobs:
# Artifact name
name: RediSkript_JAR
# Destination path
- path: target/Red*
+ path: target/*.jar
diff --git a/RediSkript-bukkit/pom.xml b/RediSkript-bukkit/pom.xml
index 4dcfd46..4e5f4c6 100644
--- a/RediSkript-bukkit/pom.xml
+++ b/RediSkript-bukkit/pom.xml
@@ -5,7 +5,7 @@
RediSkript
net.limework
- 1.3.3
+ 1.4.0-SNAPSHOT
4.0.0
@@ -70,6 +70,14 @@
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+ 3.2.0
+
+ ../target
+
+
@@ -92,6 +100,11 @@
jedis
3.5.1
+
+ net.limework
+ RediSkript-core
+ ${project.version}
+
\ No newline at end of file
diff --git a/RediSkript-bukkit/src/main/java/net/limework/rediskript/managers/RedisController.java b/RediSkript-bukkit/src/main/java/net/limework/rediskript/managers/RedisController.java
index ca20044..9dc20ff 100644
--- a/RediSkript-bukkit/src/main/java/net/limework/rediskript/managers/RedisController.java
+++ b/RediSkript-bukkit/src/main/java/net/limework/rediskript/managers/RedisController.java
@@ -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);
diff --git a/RediSkript-core/pom.xml b/RediSkript-core/pom.xml
index b5b0db9..5afa440 100644
--- a/RediSkript-core/pom.xml
+++ b/RediSkript-core/pom.xml
@@ -5,14 +5,21 @@
RediSkript
net.limework
- 1.3.3
+ 1.4.0-SNAPSHOT
4.0.0
RediSkript-core
-
+
+
+ redis.clients
+ jedis
+ 3.5.1
+ provided
+
+
\ No newline at end of file
diff --git a/RediSkript-core/src/main/java/net/limework/rediskript/Subscriber.java b/RediSkript-core/src/main/java/net/limework/rediskript/Subscriber.java
new file mode 100644
index 0000000..d92ba6f
--- /dev/null
+++ b/RediSkript-core/src/main/java/net/limework/rediskript/Subscriber.java
@@ -0,0 +1,11 @@
+package net.limework.rediskript;
+
+
+import redis.clients.jedis.BinaryJedisPubSub;
+
+public abstract class Subscriber extends BinaryJedisPubSub implements Runnable {
+
+
+
+}
+
diff --git a/RediSkript-bukkit/src/main/java/net/limework/rediskript/data/Encryption.java b/RediSkript-core/src/main/java/net/limework/rediskript/data/Encryption.java
similarity index 73%
rename from RediSkript-bukkit/src/main/java/net/limework/rediskript/data/Encryption.java
rename to RediSkript-core/src/main/java/net/limework/rediskript/data/Encryption.java
index c044fd6..fea9488 100644
--- a/RediSkript-bukkit/src/main/java/net/limework/rediskript/data/Encryption.java
+++ b/RediSkript-core/src/main/java/net/limework/rediskript/data/Encryption.java
@@ -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;
}
}
diff --git a/pom.xml b/pom.xml
index 5977013..4e46db9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
net.limework
RediSkript
- 1.3.3
+ 1.4.0-SNAPSHOT
RediSkript-core
RediSkript-bukkit
@@ -53,11 +53,6 @@
-
- redis.clients
- jedis
- 3.5.1
-
org.json
json