forked from Limework/RediSkript
Compare commits
120 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| bae2d970bb | |||
| 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 |
@@ -1,32 +0,0 @@
|
||||
# This workflow will build a Java project with Maven
|
||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
|
||||
|
||||
name: RediSkript Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up JDK 11
|
||||
uses: actions/setup-java@v2
|
||||
with:
|
||||
java-version: '8'
|
||||
distribution: 'adopt'
|
||||
- name: Build with Maven
|
||||
run: mvn -B package --file pom.xml
|
||||
- name: Download a Build Artifact
|
||||
uses: actions/upload-artifact@v2.2.3
|
||||
with:
|
||||
# Artifact name
|
||||
name: RediSkript_JAR
|
||||
# Destination path
|
||||
path: target/*.jar
|
||||
@@ -5,4 +5,3 @@ out
|
||||
compile
|
||||
*.iml
|
||||
|
||||
*.iml
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
[](https://github.com/Limework/RediSkript/actions/workflows/maven.yml)
|
||||
|
||||
RediSkript allows you to communicate between your servers with use of Redis, it's very fast and easy to use.
|
||||
|
||||
Skript: https://github.com/SkriptLang/Skript
|
||||
@@ -30,8 +28,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 +39,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 +49,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/).
|
||||
|
||||

|
||||
|
||||
@@ -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 {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||
<output url="file://$MODULE_DIR$/target/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.destroystokyo.paper:paper-api:1.15-R0.1-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.ow2.asm:asm:7.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.ow2.asm:asm-commons:7.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.ow2.asm:asm-tree:7.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.ow2.asm:asm-analysis:7.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.google.code.gson:gson:2.8.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jetbrains:annotations:19.0.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: redis.clients:jedis:3.4.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.SkriptLang:Skript:2.5.3" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.destroystokyo.paper:paper-api:1.16.4-R0.1-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.findbugs:jsr305:1.3.9" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: junit:junit:4.10" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.ow2.asm:asm:8.0.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.ow2.asm:asm-commons:8.0.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.ow2.asm:asm-tree:8.0.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.ow2.asm:asm-analysis:8.0.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.eclipse.jdt:org.eclipse.jdt.annotation:1.1.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.findbugs:findbugs:3.0.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.jcip:jcip-annotations:1.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.findbugs:bcel-findbugs:6.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.findbugs:jFormatString:2.0.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: dom4j:dom4j:1.6.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: xml-apis:xml-apis:1.0.b2" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.ow2.asm:asm-debug-all:5.0.2" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.apple:AppleJavaExtensions:1.4" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: jaxen:jaxen:1.1.6" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldguard:worldguard-legacy:7.0.0-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit:bukkit:1.13-R0.1-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldedit:worldedit-bukkit:7.0.0-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldedit:worldedit-core:7.0.0-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldedit.worldedit-libs:core:7.0.0-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: de.schlichtherle:truezip:6.8.3" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: rhino:js:1.7R2" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldedit.worldedit-libs:bukkit:7.0.0-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.logging.log4j:log4j-slf4j-impl:2.8.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.logging.log4j:log4j-api:2.8.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldguard:worldguard-core:7.0.0-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.intake:intake:4.2-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q:squirrelid:0.2.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.flywaydb:flyway-core:3.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.khelekore:prtree:1.5.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q:commandbook:2.3" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bstats:bstats-bukkit:1.4" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.marcelo-mason:PreciousStones:24e3d4bf67b7240ae36b32be10e99d4091938c5c" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: ant-contrib:ant-contrib:1.0b3" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.milkbowl.vault:Vault:1.7.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: io.papermc:paperlib:1.0.5" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-lang:commons-lang:2.6" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:guava:21.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.gson:gson:2.8.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-chat:1.16-R0.4" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.yaml:snakeyaml:1.27" level="project" />
|
||||
<orderEntry type="library" name="Maven: redis.clients:jedis:3.5.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.30" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.json:json:20201115" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.cryptomator:siv-mode:1.4.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.commons:commons-pool2:2.6.2" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -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,25 +27,93 @@
|
||||
<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>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<configuration>
|
||||
<outputDirectory>${project.basedir}/compile</outputDirectory>
|
||||
</configuration>
|
||||
</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>
|
||||
<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>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.json</groupId>
|
||||
<artifactId>json</artifactId>
|
||||
<version>20210307</version>
|
||||
<version>20201115</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.cryptomator</groupId>
|
||||
<artifactId>siv-mode</artifactId>
|
||||
<version>1.4.4</version>
|
||||
<version>1.4.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-pool2 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-pool2</artifactId>
|
||||
<version>2.6.2</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
-9
@@ -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");
|
||||
}
|
||||
|
||||
}
|
||||
+7
-6
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
+23
-100
@@ -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;
|
||||
}
|
||||
//
|
||||
}
|
||||
+1
-1
@@ -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);
|
||||
@@ -0,0 +1,46 @@
|
||||
package net.limework.rediskript.skript.elements;
|
||||
|
||||
import ch.njol.skript.lang.Expression;
|
||||
import ch.njol.skript.lang.SkriptParser;
|
||||
import ch.njol.skript.lang.util.SimpleExpression;
|
||||
import ch.njol.util.Kleenean;
|
||||
import org.bukkit.event.Event;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
import redis.clients.jedis.Jedis;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public class ExprJedis extends SimpleExpression<Jedis> {
|
||||
|
||||
static {
|
||||
|
||||
}
|
||||
|
||||
private Jedis jedis;
|
||||
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
protected Jedis[] get(Event event) {
|
||||
return new Jedis[]{jedis};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingle() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends Jedis> getReturnType() {
|
||||
return Jedis.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(@Nullable Event event, boolean b) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean init(Expression<?>[] expressions, int i, Kleenean kleenean, SkriptParser.ParseResult parseResult) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -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;
|
||||
@@ -0,0 +1,33 @@
|
||||
package net.limework.rediskript.skript.elements;
|
||||
|
||||
import ch.njol.skript.classes.ClassInfo;
|
||||
import ch.njol.skript.classes.Parser;
|
||||
import ch.njol.skript.registrations.Classes;
|
||||
import redis.clients.jedis.Jedis;
|
||||
|
||||
public class Types {
|
||||
static {
|
||||
Classes.registerClass(
|
||||
new ClassInfo<>(Jedis.class, "jedis")
|
||||
.user("JedisInstances?")
|
||||
.parser(new Parser<Jedis>() {
|
||||
@Override
|
||||
public String toString(Jedis t, int i) {
|
||||
return t.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toVariableNameString(Jedis t) {
|
||||
return t.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVariableNamePattern() {
|
||||
return "jedis:+";
|
||||
}
|
||||
}));
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user