From b09dd121fc6d7abdc872e7bed177ae1f25ffc4aa Mon Sep 17 00:00:00 2001
From: mohammed jasem alaajel <34905970+ham1255@users.noreply.github.com>
Date: Mon, 17 May 2021 02:10:02 +0400
Subject: [PATCH] Proxy addition phase 1
---
.github/workflows/maven.yml | 2 +-
RediSkript-bukkit/pom.xml | 110 ++++++++++++++++++
.../src}/main/java/META-INF/MANIFEST.MF | 0
.../net/limework/rediskript/RediSkript.java | 0
.../commands/CommandReloadRedis.java | 0
.../rediskript/events/RedisMessageEvent.java | 0
.../rediskript/managers/RedisController.java | 4 +-
.../skript/elements/EffSendMessage.java | 0
.../rediskript/skript/elements/EvtRedis.java | 0
.../skript/elements/ExprChannel.java | 0
.../skript/elements/ExprMessage.java | 0
.../skript/elements/ExprMessageDate.java | 0
.../elements/ExprVariableInChannel.java | 0
.../src}/main/resources/config.yml | 0
.../src}/main/resources/plugin.yml | 0
RediSkript-core/pom.xml | 25 ++++
.../net/limework/rediskript/Subscriber.java | 11 ++
.../limework/rediskript/data/Encryption.java | 13 +--
pom.xml | 49 ++------
19 files changed, 163 insertions(+), 51 deletions(-)
create mode 100644 RediSkript-bukkit/pom.xml
rename {src => RediSkript-bukkit/src}/main/java/META-INF/MANIFEST.MF (100%)
rename {src => RediSkript-bukkit/src}/main/java/net/limework/rediskript/RediSkript.java (100%)
rename {src => RediSkript-bukkit/src}/main/java/net/limework/rediskript/commands/CommandReloadRedis.java (100%)
rename {src => RediSkript-bukkit/src}/main/java/net/limework/rediskript/events/RedisMessageEvent.java (100%)
rename {src => RediSkript-bukkit/src}/main/java/net/limework/rediskript/managers/RedisController.java (98%)
rename {src => RediSkript-bukkit/src}/main/java/net/limework/rediskript/skript/elements/EffSendMessage.java (100%)
rename {src => RediSkript-bukkit/src}/main/java/net/limework/rediskript/skript/elements/EvtRedis.java (100%)
rename {src => RediSkript-bukkit/src}/main/java/net/limework/rediskript/skript/elements/ExprChannel.java (100%)
rename {src => RediSkript-bukkit/src}/main/java/net/limework/rediskript/skript/elements/ExprMessage.java (100%)
rename {src => RediSkript-bukkit/src}/main/java/net/limework/rediskript/skript/elements/ExprMessageDate.java (100%)
rename {src => RediSkript-bukkit/src}/main/java/net/limework/rediskript/skript/elements/ExprVariableInChannel.java (100%)
rename {src => RediSkript-bukkit/src}/main/resources/config.yml (100%)
rename {src => RediSkript-bukkit/src}/main/resources/plugin.yml (100%)
create mode 100644 RediSkript-core/pom.xml
create mode 100644 RediSkript-core/src/main/java/net/limework/rediskript/Subscriber.java
rename {src => 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
new file mode 100644
index 0000000..4e5f4c6
--- /dev/null
+++ b/RediSkript-bukkit/pom.xml
@@ -0,0 +1,110 @@
+
+
+
+ RediSkript
+ net.limework
+ 1.4.0-SNAPSHOT
+
+ 4.0.0
+
+ RediSkript-bukkit
+
+
+
+ spigot-repo
+ https://hub.spigotmc.org/nexus/content/repositories/snapshots/org/spigotmc/spigot-api/
+
+
+ jitpack.io
+ https://jitpack.io
+
+
+ commons-pool2
+ https://mvnrepository.com/artifact/org.apache.commons/commons-pool2
+
+
+ PaperMC
+ https://repo.destroystokyo.com/repository/maven-public/
+
+
+ sk89q
+ http://maven.sk89q.com/repo
+
+
+
+
+
+
+
+
+ src/main/resources
+ true
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.6.1
+
+
+ 1.8
+ UTF-8
+
+
+
+ org.apache.maven.plugins
+ maven-shade-plugin
+ 3.2.3
+
+ false
+
+
+
+ package
+
+ shade
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+ 3.2.0
+
+ ../target
+
+
+
+
+
+
+
+ com.github.SkriptLang
+ Skript
+ 2.5.3
+ jar
+ provided
+
+
+ org.spigotmc
+ spigot-api
+ 1.16.5-R0.1-SNAPSHOT
+ provided
+
+
+ redis.clients
+ jedis
+ 3.5.1
+
+
+ net.limework
+ RediSkript-core
+ ${project.version}
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/META-INF/MANIFEST.MF b/RediSkript-bukkit/src/main/java/META-INF/MANIFEST.MF
similarity index 100%
rename from src/main/java/META-INF/MANIFEST.MF
rename to RediSkript-bukkit/src/main/java/META-INF/MANIFEST.MF
diff --git a/src/main/java/net/limework/rediskript/RediSkript.java b/RediSkript-bukkit/src/main/java/net/limework/rediskript/RediSkript.java
similarity index 100%
rename from src/main/java/net/limework/rediskript/RediSkript.java
rename to RediSkript-bukkit/src/main/java/net/limework/rediskript/RediSkript.java
diff --git a/src/main/java/net/limework/rediskript/commands/CommandReloadRedis.java b/RediSkript-bukkit/src/main/java/net/limework/rediskript/commands/CommandReloadRedis.java
similarity index 100%
rename from src/main/java/net/limework/rediskript/commands/CommandReloadRedis.java
rename to RediSkript-bukkit/src/main/java/net/limework/rediskript/commands/CommandReloadRedis.java
diff --git a/src/main/java/net/limework/rediskript/events/RedisMessageEvent.java b/RediSkript-bukkit/src/main/java/net/limework/rediskript/events/RedisMessageEvent.java
similarity index 100%
rename from src/main/java/net/limework/rediskript/events/RedisMessageEvent.java
rename to RediSkript-bukkit/src/main/java/net/limework/rediskript/events/RedisMessageEvent.java
diff --git a/src/main/java/net/limework/rediskript/managers/RedisController.java b/RediSkript-bukkit/src/main/java/net/limework/rediskript/managers/RedisController.java
similarity index 98%
rename from src/main/java/net/limework/rediskript/managers/RedisController.java
rename to RediSkript-bukkit/src/main/java/net/limework/rediskript/managers/RedisController.java
index ca20044..9dc20ff 100644
--- a/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/src/main/java/net/limework/rediskript/skript/elements/EffSendMessage.java b/RediSkript-bukkit/src/main/java/net/limework/rediskript/skript/elements/EffSendMessage.java
similarity index 100%
rename from src/main/java/net/limework/rediskript/skript/elements/EffSendMessage.java
rename to RediSkript-bukkit/src/main/java/net/limework/rediskript/skript/elements/EffSendMessage.java
diff --git a/src/main/java/net/limework/rediskript/skript/elements/EvtRedis.java b/RediSkript-bukkit/src/main/java/net/limework/rediskript/skript/elements/EvtRedis.java
similarity index 100%
rename from src/main/java/net/limework/rediskript/skript/elements/EvtRedis.java
rename to RediSkript-bukkit/src/main/java/net/limework/rediskript/skript/elements/EvtRedis.java
diff --git a/src/main/java/net/limework/rediskript/skript/elements/ExprChannel.java b/RediSkript-bukkit/src/main/java/net/limework/rediskript/skript/elements/ExprChannel.java
similarity index 100%
rename from src/main/java/net/limework/rediskript/skript/elements/ExprChannel.java
rename to RediSkript-bukkit/src/main/java/net/limework/rediskript/skript/elements/ExprChannel.java
diff --git a/src/main/java/net/limework/rediskript/skript/elements/ExprMessage.java b/RediSkript-bukkit/src/main/java/net/limework/rediskript/skript/elements/ExprMessage.java
similarity index 100%
rename from src/main/java/net/limework/rediskript/skript/elements/ExprMessage.java
rename to RediSkript-bukkit/src/main/java/net/limework/rediskript/skript/elements/ExprMessage.java
diff --git a/src/main/java/net/limework/rediskript/skript/elements/ExprMessageDate.java b/RediSkript-bukkit/src/main/java/net/limework/rediskript/skript/elements/ExprMessageDate.java
similarity index 100%
rename from src/main/java/net/limework/rediskript/skript/elements/ExprMessageDate.java
rename to RediSkript-bukkit/src/main/java/net/limework/rediskript/skript/elements/ExprMessageDate.java
diff --git a/src/main/java/net/limework/rediskript/skript/elements/ExprVariableInChannel.java b/RediSkript-bukkit/src/main/java/net/limework/rediskript/skript/elements/ExprVariableInChannel.java
similarity index 100%
rename from src/main/java/net/limework/rediskript/skript/elements/ExprVariableInChannel.java
rename to RediSkript-bukkit/src/main/java/net/limework/rediskript/skript/elements/ExprVariableInChannel.java
diff --git a/src/main/resources/config.yml b/RediSkript-bukkit/src/main/resources/config.yml
similarity index 100%
rename from src/main/resources/config.yml
rename to RediSkript-bukkit/src/main/resources/config.yml
diff --git a/src/main/resources/plugin.yml b/RediSkript-bukkit/src/main/resources/plugin.yml
similarity index 100%
rename from src/main/resources/plugin.yml
rename to RediSkript-bukkit/src/main/resources/plugin.yml
diff --git a/RediSkript-core/pom.xml b/RediSkript-core/pom.xml
new file mode 100644
index 0000000..5afa440
--- /dev/null
+++ b/RediSkript-core/pom.xml
@@ -0,0 +1,25 @@
+
+
+
+ RediSkript
+ net.limework
+ 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/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 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/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 e107c46..4e46db9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,8 +6,12 @@
net.limework
RediSkript
- 1.3.3
- jar
+ 1.4.0-SNAPSHOT
+
+ RediSkript-core
+ RediSkript-bukkit
+
+ pom
@@ -46,48 +50,9 @@
-
-
- spigot-repo
- https://hub.spigotmc.org/nexus/content/repositories/snapshots/org/spigotmc/spigot-api/
-
-
- jitpack.io
- https://jitpack.io
-
-
- commons-pool2
- https://mvnrepository.com/artifact/org.apache.commons/commons-pool2
-
-
- PaperMC
- https://repo.destroystokyo.com/repository/maven-public/
-
-
- sk89q
- http://maven.sk89q.com/repo
-
-
+
-
- com.github.SkriptLang
- Skript
- 2.5.3
- jar
- provided
-
-
- org.spigotmc
- spigot-api
- 1.16.5-R0.1-SNAPSHOT
- provided
-
-
- redis.clients
- jedis
- 3.5.1
-
org.json
json