Compare commits
124 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8d813a10dc | |||
| e4d506af07 | |||
| 92b458f755 | |||
| df8c9a8f2c | |||
| bfbfd231ea | |||
| 141357b353 | |||
| c89e4f1310 | |||
| 8cda727799 | |||
| ee5a9459bf | |||
| b482e0fa7a | |||
| d23956460f | |||
| 470104fc93 | |||
| 0f3ab74d98 | |||
| 358aa66566 | |||
| 8eb200f614 | |||
| 6ea36c2f37 | |||
| ce3a7e3dcd | |||
| b0d29ea97d | |||
| 5692b5d9e4 | |||
| e5d9d17a23 | |||
| a96f9b3201 | |||
| bfb8ebc862 | |||
| 029222a068 | |||
| a2b58798f9 | |||
| 3920b0e844 | |||
| 8d0c324323 | |||
| 6b46545813 | |||
| 230c2cbb25 | |||
| cd77d558de | |||
| 7716bc9cf5 | |||
| 49c12da743 | |||
| faf6a7d76d | |||
| 370af7bc23 | |||
| 61c6aa03dc | |||
| b80fcc00dc | |||
| c6900e352f | |||
| 2d5d281fe4 | |||
| 5699b9445f | |||
| 053bb04918 | |||
| 2140cd67ff | |||
| e9ae0bd50b | |||
| 6ea120a85a | |||
| 01525e4d63 | |||
| c63495e201 | |||
| 265dbfa84d | |||
| 6f600cc96e | |||
| 1b151dfbbe | |||
| afdb0c3e59 | |||
| ca64ec19db | |||
| c0bd63e3cd | |||
| 705ce16f5d | |||
| 5a4943bd9d | |||
| 211a45ee52 | |||
| 1e85072e34 | |||
| a60cae72e3 | |||
| d4461f09c8 | |||
| dd6b9b6ee6 | |||
| 2ee28a5450 | |||
| 26b9e0e1d8 | |||
| 933b85b2d5 | |||
| 824cf3664c | |||
| d02cac7c5d | |||
| a520ba6496 | |||
| 4d265cbf61 | |||
| 7849efd866 | |||
| f80d9b36e7 | |||
| 0c20becfa1 | |||
| 089fdfd1f3 | |||
| c4426a692e | |||
| ed3ea7b2c7 | |||
| 2b00f0908e | |||
| f6c4bbcdce | |||
| ba48fdc564 | |||
| ce47af29f4 | |||
| b93624bc49 | |||
| 6c5d580b16 | |||
| a08ecd93b7 | |||
| c720433c60 | |||
| 12ce69d68f | |||
| efab085c47 | |||
| 31db51fce6 | |||
| 776ebc9780 | |||
| 1ef35dfb60 | |||
| 2049616f64 | |||
| 97aa663bfd | |||
| 4afd5a2dbc | |||
| 92d89ec76d | |||
| 0ca8712a1a | |||
| 216b2635b3 | |||
| df8608802d | |||
| 157e2b08c7 | |||
| 5f4600546e | |||
| f4ab43bcb8 | |||
| 542884dfe9 | |||
| 2e80b57a53 | |||
| 4141bcdfb1 | |||
| 9b24e49f43 | |||
| 35af0d3b0a | |||
| 52a2fb4c22 | |||
| 24dafb436d | |||
| fc1cb590d2 | |||
| d9c323bc25 | |||
| 7a51aef643 | |||
| bda20daa4b | |||
| 9dca6cfc85 | |||
| 4c59ab26a4 | |||
| 39fcccefeb | |||
| 4893d53c74 | |||
| 37edb0d497 | |||
| 39e9536e8f | |||
| 3dffba07df | |||
| 691b47c558 | |||
| fc72c698f4 | |||
| 4f79fc29b7 | |||
| 13502b818d | |||
| e740e2642e | |||
| acdd2c2fdc | |||
| 46978fc170 | |||
| 8b4af2450c | |||
| e634985b87 | |||
| d82f7f4bd8 | |||
| 2ca77d1007 | |||
| 670ebd92bf | |||
| a4dfcac567 |
@@ -29,4 +29,4 @@ jobs:
|
|||||||
# Artifact name
|
# Artifact name
|
||||||
name: RediSkript_JAR
|
name: RediSkript_JAR
|
||||||
# Destination path
|
# Destination path
|
||||||
path: target/*.jar
|
path: target/Red*
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ Redis Message:
|
|||||||
on redis message:
|
on redis message:
|
||||||
if redis channel is "world":
|
if redis channel is "world":
|
||||||
broadcast "%redis message% %redis channel% %redis message date%"
|
broadcast "%redis message% %redis channel% %redis message date%"
|
||||||
|
|
||||||
command /sendredis <text> <text>:
|
command /sendredis <text> <text>:
|
||||||
usage: /sendredis <message> <channel>
|
usage: /sendredis <message> <channel>
|
||||||
trigger:
|
trigger:
|
||||||
@@ -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:
|
#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
|
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"
|
delete variables "test::*" in channel "global"
|
||||||
|
|
||||||
set variable "test::%uuid of player%" in channel "playerdata" to tool of player
|
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%
|
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.
|
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!
|
#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
|
#it is also recommended to firewall your redis server with iptables so it can only be accessed by specific IP addresses
|
||||||
Password: "yHy0d2zdBlRmaSPj3CiBwEv5V3XxBTLTrCsGW7ntBnzhfxPxXJS6Q1aTtR6DSfAtCZr2VxWnsungXHTcF94a4bsWEpGAvjL9XMU"
|
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"
|
Host: "127.0.0.1"
|
||||||
#must be 2 or higher, if you set to lower, the addon will automatically use 2 as a minimum
|
#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
|
MaxConnections: 2
|
||||||
#the default Redis port
|
#the default Redis port
|
||||||
Port: 6379
|
Port: 6379
|
||||||
#time out in milliseconds, how long it should take before it decides that it is unable to connect when sending a message
|
#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
|
#90000 = 90 seconds
|
||||||
TimeOut: 9000
|
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
|
#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
|
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
|
#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 (use TLS for initial authentication password encryption)
|
#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
|
||||||
#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
|
|
||||||
EncryptMessages: true
|
EncryptMessages: true
|
||||||
#EncryptionKey and MacKey must be different
|
EncryptionKey: "16CHARACTERS KEY"
|
||||||
EncryptionKey: "32CHARACTERS KEY"
|
MacKey: "16CHARACTERS KEY"
|
||||||
MacKey: "32CHARACTERS KEY"
|
|
||||||
|
|
||||||
|
|
||||||
#the channels from which this server can receive messages
|
#the channels from which this server can receive messages
|
||||||
#you can always send messages to all channels!
|
#you can always send messages to all channels!
|
||||||
#you can add as many channels as you wish!
|
#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:
|
Channels:
|
||||||
- "global"
|
- "Channel1"
|
||||||
- "servername"
|
- "Channel2"
|
||||||
- "Channel3"
|
- "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/).
|
|
||||||
|
|
||||||

|
|
||||||
|
|||||||
@@ -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>
|
|
||||||
@@ -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 {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -6,14 +6,51 @@
|
|||||||
|
|
||||||
<groupId>net.limework</groupId>
|
<groupId>net.limework</groupId>
|
||||||
<artifactId>RediSkript</artifactId>
|
<artifactId>RediSkript</artifactId>
|
||||||
<version>1.3.5</version>
|
<version>1.3.3</version>
|
||||||
<modules>
|
<packaging>jar</packaging>
|
||||||
<module>RediSkript-core</module>
|
|
||||||
<module>RediSkript-bukkit</module>
|
<build>
|
||||||
</modules>
|
<resources>
|
||||||
<packaging>pom</packaging>
|
<resource>
|
||||||
|
<directory>src/main/resources</directory>
|
||||||
|
<filtering>true</filtering>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.6.1</version>
|
||||||
|
<configuration>
|
||||||
|
<source>1.8</source>
|
||||||
|
<target>1.8</target>
|
||||||
|
<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>
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>spigot-repo</id>
|
||||||
|
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/org/spigotmc/spigot-api/</url>
|
||||||
|
</repository>
|
||||||
<repository>
|
<repository>
|
||||||
<id>jitpack.io</id>
|
<id>jitpack.io</id>
|
||||||
<url>https://jitpack.io</url>
|
<url>https://jitpack.io</url>
|
||||||
@@ -22,33 +59,44 @@
|
|||||||
<id>commons-pool2</id>
|
<id>commons-pool2</id>
|
||||||
<url>https://mvnrepository.com/artifact/org.apache.commons/commons-pool2</url>
|
<url>https://mvnrepository.com/artifact/org.apache.commons/commons-pool2</url>
|
||||||
</repository>
|
</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>
|
</repositories>
|
||||||
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<version>3.6.1</version>
|
|
||||||
<configuration>
|
|
||||||
<source>1.8</source>
|
|
||||||
<target>1.8</target>
|
|
||||||
<encoding>UTF-8</encoding>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
|
|
||||||
<dependencies>
|
<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>
|
<dependency>
|
||||||
<groupId>org.json</groupId>
|
<groupId>org.json</groupId>
|
||||||
<artifactId>json</artifactId>
|
<artifactId>json</artifactId>
|
||||||
<version>20210307</version>
|
<version>20201115</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.cryptomator</groupId>
|
<groupId>org.cryptomator</groupId>
|
||||||
<artifactId>siv-mode</artifactId>
|
<artifactId>siv-mode</artifactId>
|
||||||
<version>1.4.4</version>
|
<version>1.4.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-pool2 -->
|
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-pool2 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -57,4 +105,4 @@
|
|||||||
<version>2.6.2</version>
|
<version>2.6.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
-9
@@ -10,7 +10,6 @@ import net.limework.rediskript.commands.CommandReloadRedis;
|
|||||||
import net.limework.rediskript.events.RedisMessageEvent;
|
import net.limework.rediskript.events.RedisMessageEvent;
|
||||||
import net.limework.rediskript.managers.RedisController;
|
import net.limework.rediskript.managers.RedisController;
|
||||||
import net.limework.rediskript.skript.elements.*;
|
import net.limework.rediskript.skript.elements.*;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
@@ -90,12 +89,4 @@ public class RediSkript extends JavaPlugin {
|
|||||||
public RedisController getRC() {
|
public RedisController getRC() {
|
||||||
return redisController;
|
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");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
+7
-6
@@ -1,5 +1,6 @@
|
|||||||
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;
|
||||||
|
|
||||||
@@ -8,17 +9,17 @@ import java.nio.charset.StandardCharsets;
|
|||||||
|
|
||||||
public class Encryption {
|
public class Encryption {
|
||||||
|
|
||||||
private final boolean encryptionEnabled;
|
private 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(boolean encryptionEnabled, String encryptionKey, String macKey){
|
public Encryption(Configuration config){
|
||||||
this.encryptionEnabled = encryptionEnabled;
|
encryptionEnabled = config.getBoolean("Redis.EncryptMessages");
|
||||||
if (this.encryptionEnabled) {
|
if (encryptionEnabled) {
|
||||||
// AES encryption
|
// AES encryption
|
||||||
this.encryptionKey = encryptionKey;
|
encryptionKey = config.getString("Redis.EncryptionKey");
|
||||||
this.macKey = macKey;
|
macKey = config.getString("Redis.MacKey");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
+26
-103
@@ -19,7 +19,6 @@ import java.nio.charset.StandardCharsets;
|
|||||||
import java.util.Base64;
|
import java.util.Base64;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
public class RedisController extends BinaryJedisPubSub implements Runnable {
|
public class RedisController extends BinaryJedisPubSub implements Runnable {
|
||||||
|
|
||||||
@@ -28,8 +27,6 @@ public class RedisController extends BinaryJedisPubSub implements Runnable {
|
|||||||
private final JedisPool jedisPool;
|
private final JedisPool jedisPool;
|
||||||
|
|
||||||
//this seems useless unless tls is OFF!
|
//this seems useless unless tls is OFF!
|
||||||
|
|
||||||
// class author is govindas :/
|
|
||||||
private final Encryption encryption;
|
private final Encryption encryption;
|
||||||
|
|
||||||
private byte[][] channelsInByte;
|
private byte[][] channelsInByte;
|
||||||
@@ -59,9 +56,7 @@ 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.getBoolean("Redis.EncryptMessages"),
|
encryption = new Encryption(config);
|
||||||
config.getString("Redis.EncryptionKey"),
|
|
||||||
config.getString("Redis.MacKey"));
|
|
||||||
setupChannels(config);
|
setupChannels(config);
|
||||||
isConnectionBroken = new AtomicBoolean(true);
|
isConnectionBroken = new AtomicBoolean(true);
|
||||||
isConnecting = new AtomicBoolean(false);
|
isConnecting = new AtomicBoolean(false);
|
||||||
@@ -135,117 +130,51 @@ public class RedisController extends BinaryJedisPubSub implements Runnable {
|
|||||||
|
|
||||||
//Transfer variables between servers
|
//Transfer variables between servers
|
||||||
|
|
||||||
JSONArray varNames = j.getJSONArray("Names");
|
JSONArray variableNames = j.getJSONArray("Names");
|
||||||
Object inputValue;
|
Object inputValue;
|
||||||
String changeValue = null;
|
String changeValue = null;
|
||||||
JSONArray varValues = null;
|
JSONArray variableValues = null;
|
||||||
if (!j.isNull("Values")) {
|
if (!j.isNull("Values")) {
|
||||||
varValues = j.getJSONArray("Values");
|
variableValues = j.getJSONArray("Values");
|
||||||
}
|
}
|
||||||
for (int i = 0; i < varNames.length(); i++) {
|
for (int i = 0; i < variableNames.length(); i++) {
|
||||||
String varName = varNames.get(i).toString();
|
|
||||||
if (j.isNull("Values")) {
|
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")) {
|
if (j.getString("Operation").equals("SET")) {
|
||||||
Variables.setVariable(varName, null, null, false);
|
Variables.setVariable(variableNames.get(i).toString(), null, null, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (!varValues.isNull(i)) {
|
if (!variableValues.isNull(i)) {
|
||||||
changeValue = varValues.get(i).toString();
|
changeValue = variableValues.get(i).toString();
|
||||||
}
|
}
|
||||||
String[] inputs = changeValue.split("\\^", 2);
|
String[] inputs = changeValue.split("\\^", 2);
|
||||||
inputValue = Classes.deserialize(inputs[0], Base64.getDecoder().decode(inputs[1]));
|
inputValue = Classes.deserialize(inputs[0], Base64.getDecoder().decode(inputs[1]));
|
||||||
switch (j.getString("Operation")) {
|
switch (j.getString("Operation")) {
|
||||||
case "ADD":
|
case "ADD":
|
||||||
if (varName.charAt(varName.length() - 1) == '*') {
|
//I will add this once someone tells me how to remove from Skript variable
|
||||||
plugin.getLogger().log(Level.WARNING, "Adding to {::*} variables in RediSkript is not supported. Variable name: " + varName);
|
//because using SET operation has issues with inconvertible types (Double and Long)
|
||||||
continue;
|
//variable = (Variable) Variables.getVariable(variableNames.get(i).toString(), null, false);
|
||||||
}
|
// variable.change(null, (Object[]) inputValue, Changer.ChangeMode.REMOVE);
|
||||||
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;
|
|
||||||
case "REMOVE":
|
case "REMOVE":
|
||||||
if (varName.charAt(varName.length() - 1) == '*') {
|
//I will add this once someone tells me how to remove from Skript variable
|
||||||
plugin.getLogger().log(Level.WARNING, "Removing from {::*} variables in RediSkript is not supported. Variable name: " + varName);
|
//because using SET operation has issues with inconvertible types (Double and Long)
|
||||||
continue;
|
//variable = (Variable) Variables.getVariable(variableNames.get(i).toString(), null, false);
|
||||||
}
|
// variable.change(null, (Object[]) inputValue, Changer.ChangeMode.REMOVE);
|
||||||
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;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case "SET":
|
case "SET":
|
||||||
|
String variableName = variableNames.get(i).toString();
|
||||||
|
|
||||||
//this is needed, because setting a {variable::*} causes weird behavior, like
|
//this is needed, because setting a {variable::*} causes weird behavior, like
|
||||||
//1st set operation is no data, 2nd has data, etc.
|
//1st set operation is no data, 2nd has data, etc.
|
||||||
//if you set it to null before action, it works correctly
|
//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() {
|
public Boolean isRedisConnectionOffline() {
|
||||||
return isConnectionBroken.get();
|
return isConnectionBroken.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
// for skript reflect :)
|
|
||||||
public JedisPool getJedisPool() {
|
|
||||||
return jedisPool;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
}
|
}
|
||||||
+1
-1
@@ -23,7 +23,7 @@ public class EffSendMessage extends Effect {
|
|||||||
@Override
|
@Override
|
||||||
protected void execute(Event event) {
|
protected void execute(Event event) {
|
||||||
|
|
||||||
RediSkript plugin = RediSkript.getAPI();
|
RediSkript plugin = (RediSkript) Bukkit.getPluginManager().getPlugin("RediSkript");
|
||||||
|
|
||||||
String[] message = this.message.getAll(event);
|
String[] message = this.message.getAll(event);
|
||||||
String channel = this.channel.getSingle(event);
|
String channel = this.channel.getSingle(event);
|
||||||
+1
-1
@@ -73,7 +73,7 @@ public class ExprVariableInChannel extends SimpleExpression<Object> {
|
|||||||
@Override
|
@Override
|
||||||
public Class<?>[] acceptChange(Changer.ChangeMode mode) {
|
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 || mode == Changer.ChangeMode.ADD || mode == Changer.ChangeMode.REMOVE)
|
if (mode == Changer.ChangeMode.DELETE || mode == Changer.ChangeMode.SET)
|
||||||
return CollectionUtils.array(Object.class);
|
return CollectionUtils.array(Object.class);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@@ -23,13 +23,13 @@ Redis:
|
|||||||
#the encryption configuration must be the same across all servers in order to communicate
|
#the encryption configuration must be the same across all servers in order to communicate
|
||||||
|
|
||||||
#use 16 characters long key for AES-128 encryption
|
#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)
|
#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
|
#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
|
EncryptMessages: true
|
||||||
#EncryptionKey and MacKey must be different
|
#EncryptionKey and MacKey must be different
|
||||||
EncryptionKey: "32CHARACTERS KEY"
|
EncryptionKey: "16CHARACTERS KEY"
|
||||||
MacKey: "32CHARACTERS KEY"
|
MacKey: "16CHARACTERS KEY"
|
||||||
|
|
||||||
|
|
||||||
#the channels from which this server can receive messages
|
#the channels from which this server can receive messages
|
||||||
@@ -41,4 +41,4 @@ Redis:
|
|||||||
Channels:
|
Channels:
|
||||||
- "global"
|
- "global"
|
||||||
- "servername"
|
- "servername"
|
||||||
- "Channel3"
|
- "Channel3"
|
||||||
@@ -1,10 +1,9 @@
|
|||||||
main: net.limework.rediskript.RediSkript
|
main: net.limework.rediskript.RediSkript
|
||||||
name: RediSkript
|
name: ${project.name}
|
||||||
version: ${project.version}
|
version: ${project.version}
|
||||||
authors: [Govindas, ham1255, DaemonicKing, limework.net]
|
authors: [Govindas, ham1255, DaemonicKing, limework.net]
|
||||||
api-version: 1.13
|
api-version: 1.13
|
||||||
depend: [Skript]
|
depend: [Skript]
|
||||||
commands:
|
commands:
|
||||||
reloadredis:
|
reloadredis:
|
||||||
description: "Reload redis configuration & restart the connection."
|
description: "Reload redis configuration & restart the connection."
|
||||||
permission: reload.redis
|
|
||||||
Reference in New Issue
Block a user