124 Commits

Author SHA1 Message Date
mohammed jasem alaajel 8d813a10dc Merge branch 'master' of https://github.com/Limework/RediSkript 2021-05-16 03:17:33 +04:00
mohammed jasem alaajel e4d506af07 fixed maven build problem 2021-05-16 03:17:20 +04:00
mohammed jasem alaajel 92b458f755 Update README.md 2021-05-16 03:05:37 +04:00
mohammed jasem alaajel df8c9a8f2c Create maven.yml 2021-05-16 03:02:53 +04:00
mohammed jasem alaajel bfbfd231ea removed compile file
Note: you can find the jar inside target folder now.
2021-05-16 02:59:54 +04:00
Govindass 141357b353 make encryption even more informative 2021-02-12 13:03:29 +02:00
Govindass c89e4f1310 Make encryption config more informative & some other things 2021-02-12 12:59:28 +02:00
Govindass 8cda727799 Update config.yml 2021-02-12 12:51:00 +02:00
Govindass ee5a9459bf Update config to be more informative 2021-02-12 12:48:39 +02:00
Govindass b482e0fa7a update siv-mode 2021-02-09 11:55:21 +02:00
Govindass d23956460f 1.3.3 2021-01-26 12:22:53 +02:00
Govindass 470104fc93 Fix set operation on {var::*} 2021-01-26 11:54:49 +02:00
Govindass 0f3ab74d98 Various fixes and improvements 2021-01-26 10:51:31 +02:00
Govindass 358aa66566 Merge branch 'master' of https://github.com/Limework/RediSkript 2020-12-28 10:55:51 +02:00
Govindass 8eb200f614 bump Jedis version from 3.4.0 to 3.4.1 (has important fixes I think) 2020-12-28 10:55:47 +02:00
mohammed jasem alaajel 6ea36c2f37 Update README.md 2020-12-26 16:28:13 +04:00
mohammed jasem alaajel ce3a7e3dcd added reloadconfig to redisreload 2020-12-26 15:09:25 +04:00
mohammed jasem alaajel b0d29ea97d added debug check when error sending message 2020-12-26 15:07:12 +04:00
mohammed jasem alaajel 5692b5d9e4 fixed typo in logs sending.. 2020-12-26 14:47:00 +04:00
mohammed jasem alaajel e5d9d17a23 Merge pull request #11 from Limework/patch-1
new ConnectionController!
2020-12-26 14:04:18 +04:00
mohammed jasem alaajel a96f9b3201 Update RedisController.java 2020-12-26 14:03:27 +04:00
mohammed jasem alaajel bfb8ebc862 Fixed bug where connection manager is keep reconnecting when connection reconnect after failure 2020-12-25 23:27:06 +04:00
mohammed jasem alaajel 029222a068 added replacement for system prinltn messages 2020-12-25 21:43:20 +04:00
mohammed jasem alaajel a2b58798f9 new ConnectionController! 2020-12-23 21:04:23 +04:00
mohammed jasem alaajel 3920b0e844 Update README.md 2020-12-16 14:55:43 +04:00
mohammed jasem alaajel 8d0c324323 Update README.md 2020-12-16 14:55:19 +04:00
Govindass 6b46545813 Merge branch 'master' of https://github.com/Limework/RediSkript 2020-12-15 15:02:30 +02:00
mohammed jasem alaajel 230c2cbb25 cleaned idea / removed typo in groupID 2020-12-14 17:47:17 +04:00
Govindas cd77d558de Update README.md 2020-12-14 15:21:20 +02:00
mohammed jasem alaajel 7716bc9cf5 noticed something weird in releases section that maven was 1 version late!!!!! 2020-12-14 17:19:21 +04:00
mohammed jasem alaajel 49c12da743 fixed maven not compiling correctly 2020-12-14 16:20:17 +04:00
mohammed jasem alaajel faf6a7d76d bumped redis version aswell 2020-12-14 15:13:41 +04:00
mohammed jasem alaajel 370af7bc23 bumped skript + spigot api version 2020-12-14 13:55:01 +04:00
mohammed jasem alaajel 61c6aa03dc Merge pull request #7 from Limework/add-license-1
Create LICENSE
2020-12-03 16:56:10 +04:00
mohammed jasem alaajel b80fcc00dc Create LICENSE 2020-12-03 16:55:42 +04:00
Govindass c6900e352f Reload redis in a separate thread to not lag the main thread 2020-12-03 13:21:16 +02:00
Govindass 2d5d281fe4 Finally fixed connection leak in /reloadredis !!! 2020-12-03 13:07:27 +02:00
Govindass 5699b9445f Improve code quality 2020-12-03 11:55:45 +02:00
Govindass 053bb04918 Remove unnecessary EventHandler 2020-12-03 11:13:03 +02:00
Govindas 2140cd67ff Update README.md 2020-11-28 10:14:19 +02:00
Govindas e9ae0bd50b Update README.md 2020-11-28 10:12:11 +02:00
Govindass 6ea120a85a Optimizations 2020-11-28 10:02:14 +02:00
Govindass 01525e4d63 Merge branch 'master' of https://github.com/Limework/RediSkript 2020-11-26 17:05:11 +02:00
Govindass c63495e201 Some more work on variables (Still very unfinished) 2020-11-26 17:05:07 +02:00
Govindas 265dbfa84d Remove to-do list from readme (refer to issues) 2020-11-25 17:07:30 +02:00
Govindass 6f600cc96e Add cross-server variable editing (I'll make it use {} instead of strings later) 2020-11-25 17:01:11 +02:00
Govindass 1b151dfbbe Allow sending multiple redis messages in one go 2020-11-25 13:53:52 +02:00
Govindass afdb0c3e59 Fix rare error on disable 2020-11-25 13:18:23 +02:00
Govindass ca64ec19db Fix wrong prefix coloring in command 2020-11-12 12:36:12 +02:00
Govindass c0bd63e3cd test 2020-11-03 12:23:00 +02:00
Govindass 705ce16f5d Fix wrong class name & Fully fix sending messages while disabled 2020-11-03 11:29:06 +02:00
Govindass 5a4943bd9d so I found that this threadpool was actually needed, oops
due to it not having threadpool, froze my server at one point
2020-11-02 14:14:38 +02:00
Govindass 211a45ee52 Remove Skript plugin check, as it doesn't load without it anyway 2020-11-02 12:09:18 +02:00
Govindass 1e85072e34 Oops forgot one more console message 2020-10-31 17:12:13 +02:00
Govindass a60cae72e3 Improve console messages 2020-10-31 16:48:42 +02:00
Govindass d4461f09c8 some refactoring, make classes more well-sorted 2020-10-29 10:01:36 +02:00
Govindass dd6b9b6ee6 use HIGHEST priority on disable, so "on script unload" can still work 2020-10-29 09:47:18 +02:00
Govindass 2ee28a5450 Update jarRepositories.xml 2020-10-28 12:20:27 +02:00
Govindass 26b9e0e1d8 Merge branch 'master' of https://github.com/Limework/RediSkript 2020-10-28 12:15:30 +02:00
Govindass 933b85b2d5 try fix maven 2 2020-10-28 12:15:27 +02:00
Govindass 824cf3664c try fix maven 2020-10-28 12:08:44 +02:00
Govindas d02cac7c5d Update README.md 2020-10-28 11:55:00 +02:00
Govindass a520ba6496 Update pom.xml 2020-10-28 11:53:44 +02:00
Govindass 4d265cbf61 Improve debug (thanks ShaneBee) 2020-10-27 09:06:36 +02:00
Govindass 7849efd866 Little questionable improvements (shouldn't hurt anything anyway) 2020-10-24 17:59:48 +03:00
Govindass f80d9b36e7 Make on redis message a synchronous event for thread-safety 2020-10-24 15:19:10 +03:00
Govindass 0c20becfa1 Merge branch 'master' of https://github.com/Limework/RediSkript 2020-10-24 14:33:12 +03:00
Govindass 089fdfd1f3 Update pom.xml 2020-10-24 14:32:55 +03:00
Govindas c4426a692e Update README.md 2020-10-24 14:32:48 +03:00
Govindass ed3ea7b2c7 Remove unneeded threadpool (testing has shown for it to be unneeded) 2020-10-24 13:29:49 +03:00
Govindass 2b00f0908e change useSSL to useTLS, because redis itself refers to it as TLS 2020-10-24 12:35:35 +03:00
Govindass f6c4bbcdce Revert "fixed reload but not tested"
This reverts commit a08ecd93b7.
2020-10-24 12:32:40 +03:00
Govindass ba48fdc564 Revert "Update RedisManager.java"
This reverts commit 6c5d580b16.
2020-10-24 12:32:36 +03:00
Govindass ce47af29f4 Revert "Update RedisManager.java"
This reverts commit b93624bc49.
2020-10-24 12:32:24 +03:00
mohammed jasem alaajel b93624bc49 Update RedisManager.java 2020-10-23 21:01:57 +04:00
mohammed jasem alaajel 6c5d580b16 Update RedisManager.java 2020-10-23 20:45:53 +04:00
mohammed jasem alaajel a08ecd93b7 fixed reload but not tested 2020-10-23 20:37:43 +04:00
Govindass c720433c60 Re-word redis reload command information 2020-10-23 17:50:04 +03:00
Govindass 12ce69d68f Fix critical redis server shutdown bug 2020-10-23 17:48:22 +03:00
Govindass efab085c47 Better 1.8 support & cleanup 2020-10-23 17:21:32 +03:00
Govindass 31db51fce6 Undo synchronous event, broke 1.8 servers completely 2020-10-23 16:55:04 +03:00
Govindass 776ebc9780 add redis message date expression & improve quality of existing expressions & make event guaranteedly synchronous 2020-10-23 16:49:25 +03:00
Govindass 1ef35dfb60 New /reloadredis fully restarts the plugin with reloaded configuration & some code improvements 2020-10-23 14:34:30 +03:00
Govindass 2049616f64 Make json errors easier to debug 2020-10-22 17:44:45 +03:00
Govindass 97aa663bfd Reduce jar size by removing unneeded dependencies 2020-10-22 17:28:00 +03:00
Govindass 4afd5a2dbc Merge branch 'master' of https://github.com/Limework/RediSkript 2020-10-22 14:19:36 +03:00
Govindass 92d89ec76d Remove debug message & Hotfix 2020-10-22 14:19:29 +03:00
Govindas 0ca8712a1a Update README.md 2020-10-22 13:31:38 +03:00
Govindass 216b2635b3 Further fixes & refactoring for release 2020-10-22 13:30:41 +03:00
Govindass df8608802d Fix encryption disabling & some refactoring 2020-10-22 12:32:08 +03:00
Govindass 157e2b08c7 Remove unneeded code 2020-10-18 17:07:37 +03:00
mohammed jasem alaajel 5f4600546e small fix to make sure the connect was killed 2020-07-30 09:35:50 +04:00
mohammed jasem alaajel f4ab43bcb8 added protection to kill current working sub 2020-07-28 10:53:42 +04:00
mohammed jasem alaajel 542884dfe9 added /reloadredis command 2020-07-28 10:44:00 +04:00
ham1255 2e80b57a53 Fixed mongodb url from config is wrong 2020-07-08 12:37:10 +04:00
ham1255 4141bcdfb1 added mongodb, bumped versoin 2020-07-07 18:49:19 +04:00
ham1255 9b24e49f43 new changes. 2020-07-06 22:38:54 +04:00
ham1255 35af0d3b0a Skript counts as softdepend as it make the plugin usable without skript 2020-06-30 12:44:49 +04:00
ham1255 52a2fb4c22 abstract class for guis making for making stuff easier 2020-06-30 12:42:27 +04:00
ham1255 24dafb436d moved some stuff and fixed wrong usage 2020-06-30 11:45:14 +04:00
ham1255 fc1cb590d2 forgot one line xd 2020-06-28 18:41:22 +04:00
ham1255 d9c323bc25 not tested But rewritten the Plugin 2020-06-28 18:40:53 +04:00
ham1255 7a51aef643 Update .gitignore 2020-06-28 16:45:02 +04:00
ham1255 bda20daa4b Delete SkLimework.iml 2020-06-28 16:41:47 +04:00
ham1255 9dca6cfc85 renamed project 2020-06-28 16:39:21 +04:00
ham1255 4c59ab26a4 Merge branch 'master' of https://github.com/Limework/SkLimework 2020-06-26 17:03:14 +04:00
ham1255 39fcccefeb fixed conflict and removed hard coded channels 2020-06-26 17:02:39 +04:00
Govindass 4893d53c74 fix channel syntax conflict with Vixio 2020-06-26 15:58:30 +03:00
ham1255 37edb0d497 added maven to since it will get rewritten soon. 2020-06-22 13:48:44 +04:00
ham1255 39e9536e8f New Reconnector hopefuly works 2020-06-14 17:43:46 +04:00
Govindass 3dffba07df Highly improve encryption security 2020-06-08 16:53:23 +03:00
Govindass 691b47c558 attempt to use SIV 2020-06-08 11:16:16 +03:00
ham1255 fc72c698f4 Fixed loop doesn;'t exist on server shutdown 2020-06-05 13:28:26 +04:00
Govindass 4f79fc29b7 Remove awaitTermination as it was preventing shutdown sometimes 2020-05-30 10:11:43 +03:00
Govindass 13502b818d Finish AES encryption 2020-05-27 16:22:05 +03:00
Govindass e740e2642e Fix forgotten digest 2020-05-27 15:10:26 +03:00
Govindass acdd2c2fdc Add AES-128 encryption 2020-05-27 14:43:16 +03:00
ham1255 46978fc170 ,. 2020-05-18 01:57:36 +04:00
ham1255 8b4af2450c Fixed not reconnecting on redis 4* or higher 2020-05-12 14:35:30 +04:00
ham1255 e634985b87 Added Reconnection for channels sub 2020-05-10 23:10:45 +04:00
ham1255 d82f7f4bd8 Check if error will occure when redis fails 2020-05-10 21:44:10 +04:00
ham1255 2ca77d1007 added ignore 2020-05-10 10:53:54 +04:00
ham1255 670ebd92bf added code 2020-05-10 10:52:06 +04:00
mohammed jassim alajel a4dfcac567 Create README.md 2020-05-10 10:39:19 +04:00
20 changed files with 126 additions and 310 deletions
+1 -1
View File
@@ -29,4 +29,4 @@ jobs:
# Artifact name
name: RediSkript_JAR
# Destination path
path: target/*.jar
path: target/Red*
+11 -33
View File
@@ -30,8 +30,6 @@ set variables "test::1", "test::2", "test::3" in channel "global" to 100
#then use this in any server that listens to "global" redis channel and was online when the above line was executed:
send "%{test::*}%" #outputs 100, 100 and 100
add 100 to variables "test::1" and "test::2" in channel "global"
remove 10 from variable "test::1" in channel "global"
delete variables "test::*" in channel "global"
set variable "test::%uuid of player%" in channel "playerdata" to tool of player
@@ -43,7 +41,7 @@ Syntax:
variable[s] %strings% in [redis] [channel] %string%
```
There is only one command: **/reloadredis** it fully reloads the configuration, you can reload IP, password, channels and everything else.
There is only one command: /reloadredis it fully reloads the configuration, you can reload IP, password, channels and everything else.
You only need to have matching configuration in every server for communication and a Redis server to connect to. I recommend using VPS for hosting redis server, I personally use VPS from humbleservers.com.
@@ -53,49 +51,29 @@ Redis:
#a secure password that cannot be cracked, please change it!
#it is also recommended to firewall your redis server with iptables so it can only be accessed by specific IP addresses
Password: "yHy0d2zdBlRmaSPj3CiBwEv5V3XxBTLTrCsGW7ntBnzhfxPxXJS6Q1aTtR6DSfAtCZr2VxWnsungXHTcF94a4bsWEpGAvjL9XMU"
#hostname of your redis server, you can use free redis hosting (search for it online) if you do not have the ability to host your own redis server
#redis server is very lightweight, takes under 30 MB of RAM usually
Host: "127.0.0.1"
#must be 2 or higher, if you set to lower, the addon will automatically use 2 as a minimum
#do not edit MaxConnections if you do not know what you're doing
#it is only useful to increase this number to account for PING between distant servers and when you are sending a lot of messages constantly
MaxConnections: 2
#the default Redis port
Port: 6379
#time out in milliseconds, how long it should take before it decides that it is unable to connect when sending a message
#9000 = 9 seconds
TimeOut: 9000
#90000 = 90 seconds
TimeOut: 90000
#also known as SSL, only use this if you're running Redis 6.0.6 or higher, older versions will not work correctly
#it encrypts your traffic and makes data exchange between distant servers secure
#it encrypts your traffic and makes data exchange between distant servers completely secure
useTLS: false
#EncryptMessages may be useful if you cannot use TLS due to use of older version of Redis or if you're paranoid about privacy and want to double encrypt your messages
#however this will not encrypt the initial authentication password, only the messages sent (use TLS for initial authentication password encryption)
#the encryption configuration must be the same across all servers in order to communicate
#use 16 characters long key for AES-128 encryption
#32 characters long key for AES-256 encryption (recommended)
#the AES implementation used in RediSkript uses SIV mode, which makes the same key resistant to cracking for a big count of messages without the need of changing the key very often
#may be useful if you cannot use TLS due to use of older version of Redis
#however this will not encrypt the initial authentication password, only the messages sent
#it uses AES-128 SIV encryption which is secure enough for this
EncryptMessages: true
#EncryptionKey and MacKey must be different
EncryptionKey: "32CHARACTERS KEY"
MacKey: "32CHARACTERS KEY"
EncryptionKey: "16CHARACTERS KEY"
MacKey: "16CHARACTERS KEY"
#the channels from which this server can receive messages
#you can always send messages to all channels!
#you can add as many channels as you wish!
#ideal setup is having one global channel and having one channel that represents server name, so you know who to send messages to
#then a few other utility channels up to your needs
Channels:
- "global"
- "servername"
- "Channel1"
- "Channel2"
- "Channel3"
```
## YourKit
YourKit supports open source projects with innovative and intelligent tools for monitoring and profiling Java and .NET applications. YourKit is the creator of [YourKit Java Profiler](https://www.yourkit.com/java/profiler/), [YourKit .NET Profiler](https://www.yourkit.com/.net/profiler/) and [YourKit YouMonitor](https://www.yourkit.com/youmonitor/).
![YourKit](https://www.yourkit.com/images/yklogo.png)
-88
View File
@@ -1,88 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>RediSkript</artifactId>
<groupId>net.limework</groupId>
<version>1.3.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>RediSkript-bukkit</artifactId>
<repositories>
<repository>
<id>papermc</id>
<url>https://papermc.io/repo/repository/maven-public/</url>
</repository>
</repositories>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.3</version>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</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>
<dependencies>
<dependency>
<groupId>com.github.SkriptLang</groupId>
<artifactId>Skript</artifactId>
<version>2.6.1</version>
<type>jar</type>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.16.5-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>3.8.0</version>
</dependency>
<dependency>
<groupId>net.limework</groupId>
<artifactId>RediSkript-core</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>
-25
View File
@@ -1,25 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>RediSkript</artifactId>
<groupId>net.limework</groupId>
<version>1.3.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>RediSkript-core</artifactId>
<dependencies>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>3.8.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
@@ -1,11 +0,0 @@
package net.limework.rediskript;
import redis.clients.jedis.BinaryJedisPubSub;
public abstract class Subscriber extends BinaryJedisPubSub implements Runnable {
}
+67 -19
View File
@@ -6,25 +6,16 @@
<groupId>net.limework</groupId>
<artifactId>RediSkript</artifactId>
<version>1.3.5</version>
<modules>
<module>RediSkript-core</module>
<module>RediSkript-bukkit</module>
</modules>
<packaging>pom</packaging>
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<repository>
<id>commons-pool2</id>
<url>https://mvnrepository.com/artifact/org.apache.commons/commons-pool2</url>
</repository>
</repositories>
<version>1.3.3</version>
<packaging>jar</packaging>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -36,19 +27,76 @@
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.3</version>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/org/spigotmc/spigot-api/</url>
</repository>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<repository>
<id>commons-pool2</id>
<url>https://mvnrepository.com/artifact/org.apache.commons/commons-pool2</url>
</repository>
<repository>
<id>PaperMC</id>
<url>https://repo.destroystokyo.com/repository/maven-public/</url>
</repository>
<repository>
<id>sk89q</id>
<url>http://maven.sk89q.com/repo</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.github.SkriptLang</groupId>
<artifactId>Skript</artifactId>
<version>2.5.3</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.16.5-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>3.5.1</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20210307</version>
<version>20201115</version>
</dependency>
<dependency>
<groupId>org.cryptomator</groupId>
<artifactId>siv-mode</artifactId>
<version>1.4.4</version>
<version>1.4.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-pool2 -->
<dependency>
@@ -10,7 +10,6 @@ import net.limework.rediskript.commands.CommandReloadRedis;
import net.limework.rediskript.events.RedisMessageEvent;
import net.limework.rediskript.managers.RedisController;
import net.limework.rediskript.skript.elements.*;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.plugin.java.JavaPlugin;
@@ -90,12 +89,4 @@ public class RediSkript extends JavaPlugin {
public RedisController getRC() {
return redisController;
}
//Developer note: This is use for skript-reflect! and also for plugin use for static stuff -> skript effects classes
//DO NOT USE THIS IN NON STATIC CLASSES
public static RediSkript getAPI(){
//this safer than making static.
return (RediSkript) Bukkit.getServer().getPluginManager().getPlugin("RediSkript");
}
}
@@ -1,5 +1,6 @@
package net.limework.rediskript.data;
import org.bukkit.configuration.Configuration;
import org.cryptomator.siv.SivMode;
import org.cryptomator.siv.UnauthenticCiphertextException;
@@ -8,17 +9,17 @@ import java.nio.charset.StandardCharsets;
public class Encryption {
private final boolean encryptionEnabled;
private boolean encryptionEnabled;
private String encryptionKey;
private String macKey;
private final SivMode AES_SIV = new SivMode();
public Encryption(boolean encryptionEnabled, String encryptionKey, String macKey){
this.encryptionEnabled = encryptionEnabled;
if (this.encryptionEnabled) {
public Encryption(Configuration config){
encryptionEnabled = config.getBoolean("Redis.EncryptMessages");
if (encryptionEnabled) {
// AES encryption
this.encryptionKey = encryptionKey;
this.macKey = macKey;
encryptionKey = config.getString("Redis.EncryptionKey");
macKey = config.getString("Redis.MacKey");
}
}
@@ -19,7 +19,6 @@ import java.nio.charset.StandardCharsets;
import java.util.Base64;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.logging.Level;
public class RedisController extends BinaryJedisPubSub implements Runnable {
@@ -28,8 +27,6 @@ public class RedisController extends BinaryJedisPubSub implements Runnable {
private final JedisPool jedisPool;
//this seems useless unless tls is OFF!
// class author is govindas :/
private final Encryption encryption;
private byte[][] channelsInByte;
@@ -59,9 +56,7 @@ public class RedisController extends BinaryJedisPubSub implements Runnable {
config.getInt("Redis.TimeOut"),
config.getString("Redis.Password"),
config.getBoolean("Redis.useTLS"));
encryption = new Encryption(config.getBoolean("Redis.EncryptMessages"),
config.getString("Redis.EncryptionKey"),
config.getString("Redis.MacKey"));
encryption = new Encryption(config);
setupChannels(config);
isConnectionBroken = new AtomicBoolean(true);
isConnecting = new AtomicBoolean(false);
@@ -135,117 +130,51 @@ public class RedisController extends BinaryJedisPubSub implements Runnable {
//Transfer variables between servers
JSONArray varNames = j.getJSONArray("Names");
JSONArray variableNames = j.getJSONArray("Names");
Object inputValue;
String changeValue = null;
JSONArray varValues = null;
JSONArray variableValues = null;
if (!j.isNull("Values")) {
varValues = j.getJSONArray("Values");
variableValues = j.getJSONArray("Values");
}
for (int i = 0; i < varNames.length(); i++) {
String varName = varNames.get(i).toString();
for (int i = 0; i < variableNames.length(); i++) {
if (j.isNull("Values")) {
//only check for SET here, because null has to be ignored in all other cases
// only check for SET here, because null has to be ignored in all other cases
if (j.getString("Operation").equals("SET")) {
Variables.setVariable(varName, null, null, false);
Variables.setVariable(variableNames.get(i).toString(), null, null, false);
}
} else {
if (!varValues.isNull(i)) {
changeValue = varValues.get(i).toString();
if (!variableValues.isNull(i)) {
changeValue = variableValues.get(i).toString();
}
String[] inputs = changeValue.split("\\^", 2);
inputValue = Classes.deserialize(inputs[0], Base64.getDecoder().decode(inputs[1]));
switch (j.getString("Operation")) {
case "ADD":
if (varName.charAt(varName.length() - 1) == '*') {
plugin.getLogger().log(Level.WARNING, "Adding to {::*} variables in RediSkript is not supported. Variable name: " + varName);
continue;
}
Object variable = Variables.getVariable(varName, null, false);
if (variable == null) {
Variables.setVariable(varName, inputValue, null, false);
} else if (variable instanceof Long) {
if (inputValue instanceof Long) {
Variables.setVariable(varName, (Long) variable + (Long) inputValue, null, false);
} else if (inputValue instanceof Double) {
// convert Long variable to Double
variable = Double.valueOf((Long) variable);
Variables.setVariable(varName, (Double) variable + (Double) inputValue, null, false);
} else {
// Not supported input type
plugin.getLogger().log(Level.WARNING, "Unsupported add action of data type (" + inputValue.getClass().getName() + ") on variable: " + varName);
continue;
}
} else if (variable instanceof Double) {
if (inputValue instanceof Double) {
Variables.setVariable(varName, (Double) variable + (Double) inputValue, null, false);
} else if (inputValue instanceof Long) {
Variables.setVariable(varName, (Double) variable + ((Long) inputValue).doubleValue(), null, false);
} else {
// Not supported input type
plugin.getLogger().log(Level.WARNING, "Unsupported add action of data type (" + inputValue.getClass().getName() + ") on variable: " + varName);
continue;
}
} else {
// Not supported input type
plugin.getLogger().log(Level.WARNING, "Unsupported variable type in add action (" + variable.getClass().getName() + ") on variable: " + varName);
continue;
}
break;
//I will add this once someone tells me how to remove from Skript variable
//because using SET operation has issues with inconvertible types (Double and Long)
//variable = (Variable) Variables.getVariable(variableNames.get(i).toString(), null, false);
// variable.change(null, (Object[]) inputValue, Changer.ChangeMode.REMOVE);
case "REMOVE":
if (varName.charAt(varName.length() - 1) == '*') {
plugin.getLogger().log(Level.WARNING, "Removing from {::*} variables in RediSkript is not supported. Variable name: " + varName);
continue;
}
variable = Variables.getVariable(varName, null, false);
if (variable == null) {
if (inputValue instanceof Long) {
Variables.setVariable(varName, -(Long) inputValue, null, false);
} else if (inputValue instanceof Double) {
Variables.setVariable(varName, -(Double) inputValue, null, false);
} else {
// Not supported input type
plugin.getLogger().log(Level.WARNING, "Unsupported remove action of data type (" + inputValue.getClass().getName() + ") on variable: " + varName);
continue;
}
} else if (variable instanceof Long) {
if (inputValue instanceof Long) {
Variables.setVariable(varName, (Long) variable - (Long) inputValue, null, false);
} else if (inputValue instanceof Double) {
// convert Long variable to Double
variable = Double.valueOf((Long) variable);
Variables.setVariable(varName, (Double) variable - (Double) inputValue, null, false);
} else {
// Not supported input type
plugin.getLogger().log(Level.WARNING, "Unsupported remove action of data type (" + inputValue.getClass().getName() + ") on variable: " + varName);
continue;
}
} else if (variable instanceof Double) {
if (inputValue instanceof Double) {
Variables.setVariable(varName, (Double) variable - (Double) inputValue, null, false);
} else if (inputValue instanceof Long) {
Variables.setVariable(varName, (Double) variable - ((Long) inputValue).doubleValue(), null, false);
}
} else {
// Not supported input type
plugin.getLogger().log(Level.WARNING, "Unsupported variable type in remove action (" + variable.getClass().getName() + ") on variable: " + varName);
continue;
}
//I will add this once someone tells me how to remove from Skript variable
//because using SET operation has issues with inconvertible types (Double and Long)
//variable = (Variable) Variables.getVariable(variableNames.get(i).toString(), null, false);
// variable.change(null, (Object[]) inputValue, Changer.ChangeMode.REMOVE);
break;
case "SET":
String variableName = variableNames.get(i).toString();
//this is needed, because setting a {variable::*} causes weird behavior, like
//1st set operation is no data, 2nd has data, etc.
//if you set it to null before action, it works correctly
if (varName.charAt(varName.length() - 1) == '*') {
Variables.setVariable(varName, null, null, false);
if (variableName.charAt(variableName.length()-1) == '*') {
Variables.setVariable(variableName, null, null, false);
}
Variables.setVariable(varNames.get(i).toString(), inputValue, null, false);
break;
Variables.setVariable(variableNames.get(i).toString(), inputValue, null, false);
}
}
@@ -326,10 +255,4 @@ public class RedisController extends BinaryJedisPubSub implements Runnable {
public Boolean isRedisConnectionOffline() {
return isConnectionBroken.get();
}
// for skript reflect :)
public JedisPool getJedisPool() {
return jedisPool;
}
//
}
@@ -23,7 +23,7 @@ public class EffSendMessage extends Effect {
@Override
protected void execute(Event event) {
RediSkript plugin = RediSkript.getAPI();
RediSkript plugin = (RediSkript) Bukkit.getPluginManager().getPlugin("RediSkript");
String[] message = this.message.getAll(event);
String channel = this.channel.getSingle(event);
@@ -73,7 +73,7 @@ public class ExprVariableInChannel extends SimpleExpression<Object> {
@Override
public Class<?>[] acceptChange(Changer.ChangeMode mode) {
//if (mode == Changer.ChangeMode.DELETE || mode == Changer.ChangeMode.SET || mode == Changer.ChangeMode.ADD || mode == Changer.ChangeMode.REMOVE)
if (mode == Changer.ChangeMode.DELETE || mode == Changer.ChangeMode.SET || mode == Changer.ChangeMode.ADD || mode == Changer.ChangeMode.REMOVE)
if (mode == Changer.ChangeMode.DELETE || mode == Changer.ChangeMode.SET)
return CollectionUtils.array(Object.class);
return null;
@@ -23,13 +23,13 @@ Redis:
#the encryption configuration must be the same across all servers in order to communicate
#use 16 characters long key for AES-128 encryption
#32 characters long key for AES-256 encryption (recommended)
#32 characters long key for AES-256 encryption
#AES-128 is faster, but less secure (but it is not crackable by today's technology as of 2020, may be crackable by quantum computers)
#the AES implementation used in RediSkript uses SIV mode, which makes the same key resistant to cracking for a big count of messages without the need of changing the key very often
EncryptMessages: true
#EncryptionKey and MacKey must be different
EncryptionKey: "32CHARACTERS KEY"
MacKey: "32CHARACTERS KEY"
EncryptionKey: "16CHARACTERS KEY"
MacKey: "16CHARACTERS KEY"
#the channels from which this server can receive messages
@@ -1,5 +1,5 @@
main: net.limework.rediskript.RediSkript
name: RediSkript
name: ${project.name}
version: ${project.version}
authors: [Govindas, ham1255, DaemonicKing, limework.net]
api-version: 1.13
@@ -7,4 +7,3 @@ depend: [Skript]
commands:
reloadredis:
description: "Reload redis configuration & restart the connection."
permission: reload.redis